GrlMediaSource

GrlMediaSource — Abstract class for media providers

Synopsis

#include <grilo.h>

enum                GrlMediaSourceChangeType;
struct              GrlMediaSource;
void                (*GrlMediaSourceResultCb)           (GrlMediaSource *source,
                                                         guint operation_id,
                                                         GrlMedia *media,
                                                         guint remaining,
                                                         gpointer user_data,
                                                         const GError *error);
void                (*GrlMediaSourceMetadataCb)         (GrlMediaSource *source,
                                                         guint operation_id,
                                                         GrlMedia *media,
                                                         gpointer user_data,
                                                         const GError *error);
void                (*GrlMediaSourceStoreCb)            (GrlMediaSource *source,
                                                         GrlMediaBox *parent,
                                                         GrlMedia *media,
                                                         gpointer user_data,
                                                         const GError *error);
void                (*GrlMediaSourceRemoveCb)           (GrlMediaSource *source,
                                                         GrlMedia *media,
                                                         gpointer user_data,
                                                         const GError *error);
                    GrlMediaSourceBrowseSpec;
                    GrlMediaSourceSearchSpec;
                    GrlMediaSourceQuerySpec;
                    GrlMediaSourceMetadataSpec;
                    GrlMediaSourceStoreSpec;
                    GrlMediaSourceRemoveSpec;
                    GrlMediaSourceMediaFromUriSpec;
struct              GrlMediaSourceClass;
guint               grl_media_source_browse             (GrlMediaSource *source,
                                                         GrlMedia *container,
                                                         const GList *keys,
                                                         guint skip,
                                                         guint count,
                                                         GrlMetadataResolutionFlags flags,
                                                         GrlMediaSourceResultCb callback,
                                                         gpointer user_data);
GList *             grl_media_source_browse_sync        (GrlMediaSource *source,
                                                         GrlMedia *container,
                                                         const GList *keys,
                                                         guint skip,
                                                         guint count,
                                                         GrlMetadataResolutionFlags flags,
                                                         GError **error);
guint               grl_media_source_search             (GrlMediaSource *source,
                                                         const gchar *text,
                                                         const GList *keys,
                                                         guint skip,
                                                         guint count,
                                                         GrlMetadataResolutionFlags flags,
                                                         GrlMediaSourceResultCb callback,
                                                         gpointer user_data);
GList *             grl_media_source_search_sync        (GrlMediaSource *source,
                                                         const gchar *text,
                                                         const GList *keys,
                                                         guint skip,
                                                         guint count,
                                                         GrlMetadataResolutionFlags flags,
                                                         GError **error);
guint               grl_media_source_query              (GrlMediaSource *source,
                                                         const gchar *query,
                                                         const GList *keys,
                                                         guint skip,
                                                         guint count,
                                                         GrlMetadataResolutionFlags flags,
                                                         GrlMediaSourceResultCb callback,
                                                         gpointer user_data);
GList *             grl_media_source_query_sync         (GrlMediaSource *source,
                                                         const gchar *query,
                                                         const GList *keys,
                                                         guint skip,
                                                         guint count,
                                                         GrlMetadataResolutionFlags flags,
                                                         GError **error);
guint               grl_media_source_metadata           (GrlMediaSource *source,
                                                         GrlMedia *media,
                                                         const GList *keys,
                                                         GrlMetadataResolutionFlags flags,
                                                         GrlMediaSourceMetadataCb callback,
                                                         gpointer user_data);
GrlMedia *          grl_media_source_metadata_sync      (GrlMediaSource *source,
                                                         GrlMedia *media,
                                                         const GList *keys,
                                                         GrlMetadataResolutionFlags flags,
                                                         GError **error);
void                grl_media_source_store              (GrlMediaSource *source,
                                                         GrlMediaBox *parent,
                                                         GrlMedia *media,
                                                         GrlMediaSourceStoreCb callback,
                                                         gpointer user_data);
void                grl_media_source_store_sync         (GrlMediaSource *source,
                                                         GrlMediaBox *parent,
                                                         GrlMedia *media,
                                                         GError **error);
void                grl_media_source_remove             (GrlMediaSource *source,
                                                         GrlMedia *media,
                                                         GrlMediaSourceRemoveCb callback,
                                                         gpointer user_data);
void                grl_media_source_remove_sync        (GrlMediaSource *source,
                                                         GrlMedia *media,
                                                         GError **error);
void                grl_media_source_set_auto_split_threshold
                                                        (GrlMediaSource *source,
                                                         guint threshold);
guint               grl_media_source_get_auto_split_threshold
                                                        (GrlMediaSource *source);
gboolean            grl_media_source_test_media_from_uri
                                                        (GrlMediaSource *source,
                                                         const gchar *uri);
guint               grl_media_source_get_media_from_uri (GrlMediaSource *source,
                                                         const gchar *uri,
                                                         const GList *keys,
                                                         GrlMetadataResolutionFlags flags,
                                                         GrlMediaSourceMetadataCb callback,
                                                         gpointer user_data);
GrlMedia *          grl_media_source_get_media_from_uri_sync
                                                        (GrlMediaSource *source,
                                                         const gchar *uri,
                                                         const GList *keys,
                                                         GrlMetadataResolutionFlags flags,
                                                         GError **error);
gboolean            grl_media_source_notify_change_start
                                                        (GrlMediaSource *source,
                                                         GError **error);
gboolean            grl_media_source_notify_change_stop (GrlMediaSource *source,
                                                         GError **error);
void                grl_media_source_notify_change_list (GrlMediaSource *source,
                                                         GPtrArray *changed_medias,
                                                         GrlMediaSourceChangeType change_type,
                                                         gboolean location_unknown);
void                grl_media_source_notify_change      (GrlMediaSource *source,
                                                         GrlMedia *media,
                                                         GrlMediaSourceChangeType change_type,
                                                         gboolean location_unknown);

Object Hierarchy

  GObject
   +----GrlMediaPlugin
         +----GrlMetadataSource
               +----GrlMediaSource

Properties

  "auto-split-threshold"     guint                 : Read / Write

Signals

  "content-changed"                                : Action

Description

GrlMediaSource is the abstract base class needed to construct a source of media data.

The media sources fetch media data descriptors and store them in data transfer objects represented as GrlMedia.

There are several methods to retrieve the media, such as searching a text expression, crafting a specific query, etc. And most of those methods are asynchronous.

Examples of media sources are GrlYoutubeSource, GrlJamendoSource, etc.

Details

enum GrlMediaSourceChangeType

typedef enum {
  GRL_CONTENT_CHANGED,
  GRL_CONTENT_ADDED,
  GRL_CONTENT_REMOVED
} GrlMediaSourceChangeType;

Specifies which kind of change has happened in the plugin

GRL_CONTENT_CHANGED

content has changed. It is used when any property of GrlMedia has changed, or in case of GrlMediaBox, if several children have been added and removed.

GRL_CONTENT_ADDED

new content has been added.

GRL_CONTENT_REMOVED

content has been removed

struct GrlMediaSource

struct GrlMediaSource;

GrlMediaSourceResultCb ()

void                (*GrlMediaSourceResultCb)           (GrlMediaSource *source,
                                                         guint operation_id,
                                                         GrlMedia *media,
                                                         guint remaining,
                                                         gpointer user_data,
                                                         const GError *error);

Prototype for the callback passed to the media sources' methods

source :

a media source

operation_id :

operation identifier

media :

a data transfer object. [transfer full]

remaining :

the number of remaining GrlMedia to process, or GRL_SOURCE_REMAINING_UNKNOWN if it is unknown

user_data :

user data passed to the used method

error :

possible GError generated at processing. [type uint]

GrlMediaSourceMetadataCb ()

void                (*GrlMediaSourceMetadataCb)         (GrlMediaSource *source,
                                                         guint operation_id,
                                                         GrlMedia *media,
                                                         gpointer user_data,
                                                         const GError *error);

Prototype for the callback passed to grl_media_source_metadata()

source :

a media source

operation_id :

operation identifier

media :

a data transfer object. [transfer full]

user_data :

user data passed to grl_media_source_metadata()

error :

possible GError generated at processing. [type uint]

GrlMediaSourceStoreCb ()

void                (*GrlMediaSourceStoreCb)            (GrlMediaSource *source,
                                                         GrlMediaBox *parent,
                                                         GrlMedia *media,
                                                         gpointer user_data,
                                                         const GError *error);

Prototype for the callback passed to grl_media_source_store()

source :

a media source

parent :

The GrlMediaBox who parents the media

media :

a data transfer object. [transfer full]

user_data :

user data passed to grl_media_source_store()

error :

possible GError generated at processing. [type uint]

GrlMediaSourceRemoveCb ()

void                (*GrlMediaSourceRemoveCb)           (GrlMediaSource *source,
                                                         GrlMedia *media,
                                                         gpointer user_data,
                                                         const GError *error);

Prototype for the callback passed to grl_media_source_remove()

source :

a media source

media :

a data transfer object. [transfer full]

user_data :

user data passed to grl_media_source_remove()

error :

possible GError generated at processing. [type uint]

GrlMediaSourceBrowseSpec

typedef struct {
  GrlMediaSource *source;
  guint browse_id;
  GrlMedia *container;
  GList *keys;
  guint skip;
  guint count;
  GrlMetadataResolutionFlags flags;
  GrlMediaSourceResultCb callback;
  gpointer user_data;
} GrlMediaSourceBrowseSpec;

Data transport structure used internally by the plugins which support browse vmethod.

GrlMediaSource *source;

a media source

guint browse_id;

operation identifier

GrlMedia *container;

a container of data transfer objects

GList *keys;

the GList of GrlKeyIDs to request

guint skip;

the number if elements to skip in the browse operation

guint count;

the number of elements to retrieve in the browse operation

GrlMetadataResolutionFlags flags;

the resolution mode

GrlMediaSourceResultCb callback;

the user defined callback

gpointer user_data;

the user data to pass in the callback

GrlMediaSourceSearchSpec

typedef struct {
  GrlMediaSource *source;
  guint search_id;
  gchar *text;
  GList *keys;
  guint skip;
  guint count;
  GrlMetadataResolutionFlags flags;
  GrlMediaSourceResultCb callback;
  gpointer user_data;
} GrlMediaSourceSearchSpec;

Data transport structure used internally by the plugins which support search vmethod.

GrlMediaSource *source;

a media source

guint search_id;

operation identifier

gchar *text;

the text to search

GList *keys;

the GList of GrlKeyIDs to request

guint skip;

the number if elements to skip in the browse operation

guint count;

the number of elements to retrieve in the browse operation

GrlMetadataResolutionFlags flags;

the resolution mode

GrlMediaSourceResultCb callback;

the user defined callback

gpointer user_data;

the user data to pass in the callback

GrlMediaSourceQuerySpec

typedef struct {
  GrlMediaSource *source;
  guint query_id;
  gchar *query;
  GList *keys;
  guint skip;
  guint count;
  GrlMetadataResolutionFlags flags;
  GrlMediaSourceResultCb callback;
  gpointer user_data;
} GrlMediaSourceQuerySpec;

Data transport structure used internally by the plugins which support query vmethod.

GrlMediaSource *source;

a media source

guint query_id;

operation identifier

gchar *query;

the query to process

GList *keys;

the GList of GrlKeyIDs to request

guint skip;

the number if elements to skip in the browse operation

guint count;

the number of elements to retrieve in the browse operation

GrlMetadataResolutionFlags flags;

the resolution mode

GrlMediaSourceResultCb callback;

the user defined callback

gpointer user_data;

the user data to pass in the callback

GrlMediaSourceMetadataSpec

typedef struct {
  GrlMediaSource *source;
  guint metadata_id;
  GrlMedia *media;
  GList *keys;
  GrlMetadataResolutionFlags flags;
  GrlMediaSourceMetadataCb callback;
  gpointer user_data;
} GrlMediaSourceMetadataSpec;

Data transport structure used internally by the plugins which support metadata vmethod.

GrlMediaSource *source;

a media source

guint metadata_id;

operation identifier

GrlMedia *media;

a data transfer object

GList *keys;

the GList of GrlKeyIDs to request

GrlMetadataResolutionFlags flags;

the resolution mode

GrlMediaSourceMetadataCb callback;

the user defined callback

gpointer user_data;

the user data to pass in the callback

GrlMediaSourceStoreSpec

typedef struct {
  GrlMediaSource *source;
  GrlMediaBox *parent;
  GrlMedia *media;
  GrlMediaSourceStoreCb callback;
  gpointer user_data;
} GrlMediaSourceStoreSpec;

Data transport structure used internally by the plugins which support store vmethod.

GrlMediaSource *source;

a media source

GrlMediaBox *parent;

a parent to store the data transfer objects

GrlMedia *media;

a data transfer object

GrlMediaSourceStoreCb callback;

the user defined callback

gpointer user_data;

the user data to pass in the callback

GrlMediaSourceRemoveSpec

typedef struct {
  GrlMediaSource *source;
  gchar *media_id;
  GrlMedia *media;
  GrlMediaSourceRemoveCb callback;
  gpointer user_data;
} GrlMediaSourceRemoveSpec;

Data transport structure used internally by the plugins which support store vmethod.

GrlMediaSource *source;

a media source

gchar *media_id;

media identifier to remove

GrlMedia *media;

a data transfer object

GrlMediaSourceRemoveCb callback;

the user defined callback

gpointer user_data;

the user data to pass in the callback

GrlMediaSourceMediaFromUriSpec

typedef struct {
  GrlMediaSource *source;
  guint media_from_uri_id;
  gchar *uri;
  GList *keys;
  GrlMetadataResolutionFlags flags;
  GrlMediaSourceMetadataCb callback;
  gpointer user_data;
} GrlMediaSourceMediaFromUriSpec;

Data transport structure used internally by the plugins which support media_from_uri vmethod.

GrlMediaSource *source;

a media source

guint media_from_uri_id;

operation identifier

gchar *uri;

A URI that can be used to identify a media resource

GList *keys;

Metadata keys to resolve

GrlMetadataResolutionFlags flags;

Operation flags

GrlMediaSourceMetadataCb callback;

the user defined callback

gpointer user_data;

the user data to pass in the callback

struct GrlMediaSourceClass

struct GrlMediaSourceClass {
  GrlMetadataSourceClass parent_class;

  void (*browse) (GrlMediaSource *source, GrlMediaSourceBrowseSpec *bs);

  void (*search) (GrlMediaSource *source, GrlMediaSourceSearchSpec *ss);

  void (*query) (GrlMediaSource *source, GrlMediaSourceQuerySpec *qs);

  void (*cancel) (GrlMediaSource *source, guint operation_id);

  void (*metadata) (GrlMediaSource *source, GrlMediaSourceMetadataSpec *ms);

  void (*store) (GrlMediaSource *source, GrlMediaSourceStoreSpec *ss);

  void (*remove) (GrlMediaSource *source, GrlMediaSourceRemoveSpec *ss);

  gboolean (*test_media_from_uri) (GrlMediaSource *source,
				   const gchar *uri);

  void (*media_from_uri) (GrlMediaSource *source,
			  GrlMediaSourceMediaFromUriSpec *mfss);

  gboolean (*notify_change_start) (GrlMediaSource *source,
                                    GError **error);

  gboolean (*notify_change_stop) (GrlMediaSource *source,
                                  GError **error);
};

Grilo MediaSource class. Override the vmethods to implement the source functionality.

GrlMetadataSourceClass parent_class;

the parent class structure

browse ()

browse through a list of media

search ()

search for media

query ()

query for a specific media

cancel ()

cancel the current operation

metadata ()

request for specific metadata

store ()

store a media in a container

remove ()

remove a media from a container

test_media_from_uri ()

tests if this source can create GrlMedia instances from a given URI.

media_from_uri ()

Creates a GrlMedia instance representing the media exposed by a certain URI.

notify_change_start ()

start emitting signals about changes in content

notify_change_stop ()

stop emitting signals about changes in content

grl_media_source_browse ()

guint               grl_media_source_browse             (GrlMediaSource *source,
                                                         GrlMedia *container,
                                                         const GList *keys,
                                                         guint skip,
                                                         guint count,
                                                         GrlMetadataResolutionFlags flags,
                                                         GrlMediaSourceResultCb callback,
                                                         gpointer user_data);

Browse from skip, a count number of media elements through an available list.

This method is asynchronous.

source :

a media source

container :

a container of data transfer objects. [allow-none]

keys :

the GList of GrlKeyIDs to request. [element-type GObject.ParamSpec]

skip :

the number if elements to skip in the browse operation

count :

the number of elements to retrieve in the browse operation

flags :

the resolution mode

callback :

the user defined callback. [scope notified]

user_data :

the user data to pass in the callback

Returns :

the operation identifier

Since 0.1.4


grl_media_source_browse_sync ()

GList *             grl_media_source_browse_sync        (GrlMediaSource *source,
                                                         GrlMedia *container,
                                                         const GList *keys,
                                                         guint skip,
                                                         guint count,
                                                         GrlMetadataResolutionFlags flags,
                                                         GError **error);

Browse from skip, a count number of media elements through an available list.

This method is synchronous.

source :

a media source

container :

a container of data transfer objects. [allow-none]

keys :

the GList of GrlKeyIDs to request. [element-type GObject.ParamSpec]

skip :

the number if elements to skip in the browse operation

count :

the number of elements to retrieve in the browse operation

flags :

the resolution mode

error :

a GError, or NULL

Returns :

a GList with GrlMedia elements. After use g_object_unref() every element and g_list_free() the list. [element-type Grl.Media][transfer full]

Since 0.1.6


grl_media_source_search ()

guint               grl_media_source_search             (GrlMediaSource *source,
                                                         const gchar *text,
                                                         const GList *keys,
                                                         guint skip,
                                                         guint count,
                                                         GrlMetadataResolutionFlags flags,
                                                         GrlMediaSourceResultCb callback,
                                                         gpointer user_data);

Search for the text string in a media source for data identified with that string.

If text is NULL then no text filter will be applied, and thus, no media items from source will be filtered. If source does not support NULL-text search operations it should notiy the client by setting GRL_CORE_ERROR_SEARCH_NULL_UNSUPPORTED in callback's error parameter.

This method is asynchronous.

source :

a media source

text :

the text to search

keys :

the GList of GrlKeyIDs to request. [element-type GObject.ParamSpec]

skip :

the number if elements to skip in the search operation

count :

the number of elements to retrieve in the search operation

flags :

the resolution mode

callback :

the user defined callback. [scope notified]

user_data :

the user data to pass in the callback

Returns :

the operation identifier

Since 0.1.1


grl_media_source_search_sync ()

GList *             grl_media_source_search_sync        (GrlMediaSource *source,
                                                         const gchar *text,
                                                         const GList *keys,
                                                         guint skip,
                                                         guint count,
                                                         GrlMetadataResolutionFlags flags,
                                                         GError **error);

Search for the text string in a media source for data identified with that string.

If text is NULL then no text filter will be applied, and thus, no media items from source will be filtered. If source does not support NULL-text search operations it should notiy the client by setting GRL_CORE_ERROR_SEARCH_NULL_UNSUPPORTED in the error parameter.

This method is synchronous.

source :

a media source

text :

the text to search

keys :

the GList of GrlKeyIDs to request. [element-type GObject.ParamSpec]

skip :

the number if elements to skip in the search operation

count :

the number of elements to retrieve in the search operation

flags :

the resolution mode

error :

a GError, or NULL

Returns :

a GList with GrlMedia elements. After use g_object_unref() every element and g_list_free() the list. [element-type Grl.Media][transfer full]

Since 0.1.6


grl_media_source_query ()

guint               grl_media_source_query              (GrlMediaSource *source,
                                                         const gchar *query,
                                                         const GList *keys,
                                                         guint skip,
                                                         guint count,
                                                         GrlMetadataResolutionFlags flags,
                                                         GrlMediaSourceResultCb callback,
                                                         gpointer user_data);

Execute a specialized query (specific for each provider) on a media repository.

It is different from grl_media_source_search() semantically, because the query implies a carefully crafted string, rather than a simple string to search.

This method is asynchronous.

source :

a media source

query :

the query to process

keys :

the GList of GrlKeyIDs to request. [element-type GObject.ParamSpec]

skip :

the number if elements to skip in the query operation

count :

the number of elements to retrieve in the query operation

flags :

the resolution mode

callback :

the user defined callback. [scope notified]

user_data :

the user data to pass in the callback

Returns :

the operation identifier

Since 0.1.1


grl_media_source_query_sync ()

GList *             grl_media_source_query_sync         (GrlMediaSource *source,
                                                         const gchar *query,
                                                         const GList *keys,
                                                         guint skip,
                                                         guint count,
                                                         GrlMetadataResolutionFlags flags,
                                                         GError **error);

Execute a specialized query (specific for each provider) on a media repository.

This method is synchronous.

source :

a media source

query :

the query to process

keys :

the GList of GrlKeyIDs to request. [element-type GObject.ParamSpec]

skip :

the number if elements to skip in the query operation

count :

the number of elements to retrieve in the query operation

flags :

the resolution mode

error :

a GError, or NULL

Returns :

a GList with GrlMedia elements. After use g_object_unref() every element and g_list_free() the list. [element-type Grl.Media][transfer full]

Since 0.1.6


grl_media_source_metadata ()

guint               grl_media_source_metadata           (GrlMediaSource *source,
                                                         GrlMedia *media,
                                                         const GList *keys,
                                                         GrlMetadataResolutionFlags flags,
                                                         GrlMediaSourceMetadataCb callback,
                                                         gpointer user_data);

This method is intended to fetch the requested keys of metadata of a given media to the media source.

This method is asynchronous.

source :

a media source

media :

a data transfer object. [allow-none]

keys :

the GList of GrlKeyIDs to request. [element-type GObject.ParamSpec]

flags :

the resolution mode

callback :

the user defined callback. [scope notified]

user_data :

the user data to pass in the callback

Returns :

the operation identifier

Since 0.1.6


grl_media_source_metadata_sync ()

GrlMedia *          grl_media_source_metadata_sync      (GrlMediaSource *source,
                                                         GrlMedia *media,
                                                         const GList *keys,
                                                         GrlMetadataResolutionFlags flags,
                                                         GError **error);

This method is intended to fetch the requested keys of metadata of a given media to the media source.

This method is synchronous.

source :

a media source

media :

a data transfer object. [allow-none]

keys :

the GList of GrlKeyIDs to request. [element-type GObject.ParamSpec]

flags :

the resolution mode

error :

a GError, or NULL

Returns :

a filled GrlMedia. [transfer full]

Since 0.1.6


grl_media_source_store ()

void                grl_media_source_store              (GrlMediaSource *source,
                                                         GrlMediaBox *parent,
                                                         GrlMedia *media,
                                                         GrlMediaSourceStoreCb callback,
                                                         gpointer user_data);

Store the media into the parent container

This method is asynchronous.

source :

a media source

parent :

a parent to store the data transfer objects. [allow-none]

media :

a data transfer object

callback :

the user defined callback. [scope notified]

user_data :

the user data to pass in the callback

Since 0.1.4


grl_media_source_store_sync ()

void                grl_media_source_store_sync         (GrlMediaSource *source,
                                                         GrlMediaBox *parent,
                                                         GrlMedia *media,
                                                         GError **error);

Store the media into the parent container.

This method is synchronous.

source :

a media source

parent :

a GrlMediaBox to store the data transfer objects. [allow-none]

media :

a GrlMedia data transfer object

error :

a GError, or NULL

Since 0.1.6


grl_media_source_remove ()

void                grl_media_source_remove             (GrlMediaSource *source,
                                                         GrlMedia *media,
                                                         GrlMediaSourceRemoveCb callback,
                                                         gpointer user_data);

Remove a media from the source repository.

This method is asynchronous.

source :

a media source

media :

a data transfer object

callback :

the user defined callback. [scope notified]

user_data :

the user data to pass in the callback

Since 0.1.4


grl_media_source_remove_sync ()

void                grl_media_source_remove_sync        (GrlMediaSource *source,
                                                         GrlMedia *media,
                                                         GError **error);

Remove a media from the source repository.

This method is synchronous.

source :

a media source

media :

a data transfer object

error :

a GError, or NULL

Since 0.1.6


grl_media_source_set_auto_split_threshold ()

void                grl_media_source_set_auto_split_threshold
                                                        (GrlMediaSource *source,
                                                         guint threshold);

TBD

source :

a media source

threshold :

the threshold to request

Since 0.1.1


grl_media_source_get_auto_split_threshold ()

guint               grl_media_source_get_auto_split_threshold
                                                        (GrlMediaSource *source);

TBD

source :

a media source

Returns :

the assigned threshold

Since 0.1.1


grl_media_source_test_media_from_uri ()

gboolean            grl_media_source_test_media_from_uri
                                                        (GrlMediaSource *source,
                                                         const gchar *uri);

Tests whether source can instantiate a GrlMedia object representing the media resource exposed at uri.

source :

a media source

uri :

A URI that can be used to identify a media resource

Returns :

TRUE if it can, FALSE otherwise. This method is synchronous.

Since 0.1.7


grl_media_source_get_media_from_uri ()

guint               grl_media_source_get_media_from_uri (GrlMediaSource *source,
                                                         const gchar *uri,
                                                         const GList *keys,
                                                         GrlMetadataResolutionFlags flags,
                                                         GrlMediaSourceMetadataCb callback,
                                                         gpointer user_data);

Creates an instance of GrlMedia representing the media resource exposed at uri.

It is recommended to call grl_media_source_test_media_from_uri() before invoking this to check whether the target source can theoretically do the resolution.

This method is asynchronous.

source :

a media source

uri :

A URI that can be used to identify a media resource

keys :

A list of keys to resolve. [element-type GrlKeyID]

flags :

the resolution mode

callback :

the user defined callback. [scope notified]

user_data :

the user data to pass in the callback

Returns :

the operation identifier

Since 0.1.14


grl_media_source_get_media_from_uri_sync ()

GrlMedia *          grl_media_source_get_media_from_uri_sync
                                                        (GrlMediaSource *source,
                                                         const gchar *uri,
                                                         const GList *keys,
                                                         GrlMetadataResolutionFlags flags,
                                                         GError **error);

Creates an instance of GrlMedia representing the media resource exposed at uri.

It is recommended to call grl_media_source_test_media_from_uri() before invoking this to check whether the target source can theoretically do the resolution.

This method is synchronous.

source :

a media source

uri :

A URI that can be used to identify a media resource

keys :

A list of keys to resolve. [element-type GrlKeyID]

flags :

the resolution mode

error :

a GError, or NULL

Returns :

a filled GrlMedia. [transfer full]

Since 0.1.8


grl_media_source_notify_change_start ()

gboolean            grl_media_source_notify_change_start
                                                        (GrlMediaSource *source,
                                                         GError **error);

Starts emitting ::content-changed signals when source discovers changes in the content. This instructs source to setup the machinery needed to be aware of changes in the content.

source :

a media source

error :

a GError, or NULL

Returns :

TRUE if initialization has succeed.

Since 0.1.9


grl_media_source_notify_change_stop ()

gboolean            grl_media_source_notify_change_stop (GrlMediaSource *source,
                                                         GError **error);

This will drop emission of ::content-changed signals from source. When this is done source should stop the machinery required for it to track changes in the content.

source :

a media source

error :

a GError, or NULL

Returns :

TRUE if stop has succeed.

Since 0.1.9


grl_media_source_notify_change_list ()

void                grl_media_source_notify_change_list (GrlMediaSource *source,
                                                         GPtrArray *changed_medias,
                                                         GrlMediaSourceChangeType change_type,
                                                         gboolean location_unknown);

Emits "content-changed" signal to notify subscribers that a change ocurred in source.

The function will take ownership of changed medias and it should not be manipulated in any way by the caller after invoking this function. If that is needed, the caller must ref the array in advance.

See GrlMediaSource::content-changed signal.

Note

This function is intended to be used only by plugins.

source :

a media source

changed_medias :

: the list of medias that have changed. [element-type Grl.Media][transfer full]

change_type :

the type of change

location_unknown :

if change has happpened in media or any descendant

Since 0.1.14


grl_media_source_notify_change ()

void                grl_media_source_notify_change      (GrlMediaSource *source,
                                                         GrlMedia *media,
                                                         GrlMediaSourceChangeType change_type,
                                                         gboolean location_unknown);

Emits "content-changed" signal to notify subscribers that a change ocurred in source.

See #grl_media_source_notify_change_list() function.

Note

This function is intended to be used only by plugins.

source :

a media source

media :

the media which has changed, or NULL to use the root box. [allow-none]

change_type :

the type of change

location_unknown :

if change has happened in media or any descendant

Since 0.1.9

Property Details

The "auto-split-threshold" property

  "auto-split-threshold"     guint                 : Read / Write

Transparently split queries with count requests bigger than a certain threshold into smaller queries.

Default value: 0

Signal Details

The "content-changed" signal

void                user_function                      (GrlMediaSource          *source,
                                                        GPtrArray               *changed_medias,
                                                        GrlMediaSourceChangeType change_type,
                                                        gboolean                 location_unknown,
                                                        gpointer                 user_data)             : Action

Signals that the content in the source has changed. changed_medias is the list of elements that have changed. Usually these medias are of type GrlMediaBox, meaning that the content of that box has changed.

If location_unknown is TRUE it means the source cannot establish where the change happened: could be either in the box, in any child, or in any other descendant of the box in the hierarchy.

Both change_type and location_unknown are applied to all elements in the list.

For the cases where the source can only signal that a change happened, but not where, it would use a list with the the root box (NULL id) and set location_unknown as TRUE.

source :

source that has changed

changed_medias :

a GPtrArray with the medias that changed or a common ancestor of them of type GrlMediaBox.

change_type :

the kind of change that ocurred

location_unknown :

TRUE if the change happened in media itself or in one of its direct children (when media is a GrlMediaBox). FALSE otherwise

user_data :

user data set when the signal handler was connected.

Since 0.1.9

See Also

GrlMediaPlugin, GrlMetadataSource, GrlMedia