GrlCaps

GrlCaps — Describes the capabilities of a source for a given operation.

Synopsis

#include <grilo.h>

                    GrlCaps;
                    GrlCapsClass;
enum                GrlTypeFilter;
GrlCaps *           grl_caps_new                        (void);
GList *             grl_caps_get_key_filter             (GrlCaps *caps);
GList *             grl_caps_get_key_range_filter       (GrlCaps *caps);
GrlTypeFilter       grl_caps_get_type_filter            (GrlCaps *caps);
gboolean            grl_caps_is_key_filter              (GrlCaps *caps,
                                                         GrlKeyID key);
gboolean            grl_caps_is_key_range_filter        (GrlCaps *caps,
                                                         GrlKeyID key);
void                grl_caps_set_key_filter             (GrlCaps *caps,
                                                         GList *keys);
void                grl_caps_set_key_range_filter       (GrlCaps *caps,
                                                         GList *keys);
void                grl_caps_set_type_filter            (GrlCaps *caps,
                                                         GrlTypeFilter filter);
gboolean            grl_caps_test_option                (GrlCaps *caps,
                                                         const gchar *key,
                                                         const GValue *value);

Object Hierarchy

  GObject
   +----GrlCaps

Description

A GrlCaps instance is here to help you know if a given set of operation options is supported for a given operation.

Here is an example of how this would be used.

1
2
3
4
5
6
7
GrlCaps *caps = grl_metadata_source_get_caps (GRL_METADATA_SOURCE (my_source),
                                                 GRL_OP_SEARCH);
   GrlOperationOptions *supported_options;
   if (grl_operation_options_obey_caps (my_options, caps, &supported_options, NULL))
     grl_media_source_search (my_source, "blah", interesting_keys, my_options, ...);
   else // only use a subset of the options we wanted to pass
     grl_media_source_search (my_source, "blah", interesting_keys, supported_options, ...);

A GrlCaps can also be passed to grl_operation_options_new(). The created GrlOperationOptions instance would then check any change against its caps.

Details

GrlCaps

typedef struct _GrlCaps GrlCaps;

GrlCapsClass

typedef struct {
  GObjectClass parent;
} GrlCapsClass;

Grilo Capabilities class.

GObjectClass parent;

the parent class structure


enum GrlTypeFilter

typedef enum {
  GRL_TYPE_FILTER_NONE = 0,
  GRL_TYPE_FILTER_AUDIO = (1 << 0),
  GRL_TYPE_FILTER_VIDEO = (1 << 1),
  GRL_TYPE_FILTER_IMAGE = (1 << 2),
  GRL_TYPE_FILTER_ALL = (GRL_TYPE_FILTER_AUDIO | GRL_TYPE_FILTER_VIDEO | GRL_TYPE_FILTER_IMAGE)
} GrlTypeFilter;

Type of media to allow.

GRL_TYPE_FILTER_NONE

allow no content (only GrlMediaBox)

GRL_TYPE_FILTER_AUDIO

allow audio content

GRL_TYPE_FILTER_VIDEO

allow video content

GRL_TYPE_FILTER_IMAGE

allow image content

GRL_TYPE_FILTER_ALL

allow any type of content


grl_caps_new ()

GrlCaps *           grl_caps_new                        (void);

Creates a new caps object.

Returns :

a new caps object.

Since 0.2.0


grl_caps_get_key_filter ()

GList *             grl_caps_get_key_filter             (GrlCaps *caps);

caps :

a GrlCaps instance

Returns :

.

[transfer none][element-type GrlKeyID]

Since 0.2.0


grl_caps_get_key_range_filter ()

GList *             grl_caps_get_key_range_filter       (GrlCaps *caps);

caps :

a GrlCaps instance

Returns :

.

[transfer none][element-type GrlKeyID]

Since 0.2.0


grl_caps_get_type_filter ()

GrlTypeFilter       grl_caps_get_type_filter            (GrlCaps *caps);

caps :

a GrlCaps instance

Returns :

the supported GrlTypeFilter

Since 0.2.0


grl_caps_is_key_filter ()

gboolean            grl_caps_is_key_filter              (GrlCaps *caps,
                                                         GrlKeyID key);

Checks if key is supported for filtering in caps .

caps :

a GrlCaps instance

key :

a GrlKeyID

Returns :

TRUE if key can be used for filtering

Since 0.2.0


grl_caps_is_key_range_filter ()

gboolean            grl_caps_is_key_range_filter        (GrlCaps *caps,
                                                         GrlKeyID key);

Checks if key is supported for filtering by range in caps .

caps :

a grlCaps instance

key :

a GrlKeyID

Returns :

TRUE if key can be used for filtering

Since 0.2.0


grl_caps_set_key_filter ()

void                grl_caps_set_key_filter             (GrlCaps *caps,
                                                         GList *keys);

caps :

a GrlCaps instance

keys :

.

[transfer none][element-type GrlKeyID]

Since 0.2.0


grl_caps_set_key_range_filter ()

void                grl_caps_set_key_range_filter       (GrlCaps *caps,
                                                         GList *keys);

caps :

a GrlCaps instance

keys :

.

[transfer none][element-type GrlKeyID]

Since 0.2.0


grl_caps_set_type_filter ()

void                grl_caps_set_type_filter            (GrlCaps *caps,
                                                         GrlTypeFilter filter);

Sets the supported filter capability.

caps :

a GrlCaps instance

filter :

a GrlTypeFilter

Since 0.2.0


grl_caps_test_option ()

gboolean            grl_caps_test_option                (GrlCaps *caps,
                                                         const gchar *key,
                                                         const GValue *value);

Checks whether (key , value ) are authorized by caps .

caps :

a GrlCaps instance

key :

a key to test

value :

the value corresponding to key to test against caps

Returns :

TRUE if (key , value ) obey to caps , FALSE otherwise.

Since 0.2.0

See Also

GrlOperationOptions, grl_metadata_source_get_caps()