GrlCaps: Grilo Reference Manual

## GrlCaps

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

## Functions

GrlCaps * | grl_caps_new ()
GList * | grl_caps_get_key_filter ()
GList * | grl_caps_get_key_range_filter ()
GrlTypeFilter | grl_caps_get_type_filter ()
gboolean | grl_caps_is_key_filter ()
gboolean | grl_caps_is_key_range_filter ()
void | grl_caps_set_key_filter ()
void | grl_caps_set_key_range_filter ()
void | grl_caps_set_type_filter ()
gboolean | grl_caps_test_option ()

## Types and Values

| GrlCaps
| GrlCapsClass
enum | GrlTypeFilter

## Object Hierarchy

        GObject
        ╰── GrlCaps

## Includes

    #include <grilo.h>

## 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_source_get_caps (GRL_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.

## Functions

### 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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

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` .

#### Parameters

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` .

#### Parameters

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);

#### Parameters

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);

#### Parameters

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.

#### Parameters

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` .

#### Parameters

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

## Types and Values

### GrlCaps

    typedef struct _GrlCaps GrlCaps;

### GrlCapsClass

    typedef struct {
      GObjectClass parent;
    } GrlCapsClass;

Grilo Capabilities class.

#### Members

GObjectClass `parent`; | the parent class structure |

### enum GrlTypeFilter

Type of media to allow.

#### Members

GRL_TYPE_FILTER_NONE | allow no content (only containers) |
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 |

## See Also

GrlOperationOptions, `grl_source_get_caps()`