## GstProtection

GstProtection — Functions and classes to support encrypted streams.

## Functions

GstProtectionMeta * | gst_buffer_add_protection_meta ()
#define | gst_buffer_get_protection_meta()
const gchar * | gst_protection_select_system ()
gchar ** | gst_protection_filter_systems_by_available_decryptors ()

## Types and Values

struct | GstProtectionMeta
#define | GST_PROTECTION_SYSTEM_ID_CAPS_FIELD
#define | GST_PROTECTION_UNSPECIFIED_SYSTEM_ID

## Includes

    #include <gst/gst.h>

## Description

The GstProtectionMeta class enables the information needed to decrypt a GstBuffer to be attached to that buffer.

Typically, a demuxer element would attach GstProtectionMeta objects to the buffers that it pushes downstream. The demuxer would parse the protection information for a video/audio frame from its input data and use this information to populate the GstStructure `info` field, which is then encapsulated in a GstProtectionMeta object and attached to the corresponding output buffer using the `gst_buffer_add_protection_meta()` function. The information in this attached GstProtectionMeta would be used by a downstream decrypter element to recover the original unencrypted frame.

## Functions

### gst_buffer_add_protection_meta ()

    GstProtectionMeta *
    gst_buffer_add_protection_meta (GstBuffer *buffer,
                                    GstStructure *info);

Attaches protection metadata to a GstBuffer.

#### Parameters

buffer | GstBuffer holding an encrypted sample, to which protection metadata should be added. |
info | a GstStructure holding cryptographic information relating to the sample contained in `buffer` . This function takes ownership of `info` . | [transfer full]

#### Returns

a pointer to the added GstProtectionMeta if successful; `NULL` if unsuccessful.

[transfer none]

Since: 1.6

### gst_buffer_get_protection_meta()

    #define             gst_buffer_get_protection_meta(b)

### gst_protection_select_system ()

    const gchar *
    gst_protection_select_system (const gchar **system_identifiers);

Iterates the supplied list of UUIDs and checks the GstRegistry for an element that supports one of the supplied UUIDs. If more than one element matches, the system ID of the highest ranked element is selected.

#### Parameters

system_identifiers | A null terminated array of strings that contains the UUID values of each protection system that is to be checked. | [transfer none][array zero-terminated=1]

#### Returns

One of the strings from `system_identifiers` that indicates the highest ranked element that implements the protection system indicated by that system ID, or `NULL` if no element has been found.

[transfer none][nullable]

Since: 1.6

### gst_protection_filter_systems_by_available_decryptors ()

    gchar **
    gst_protection_filter_systems_by_available_decryptors
                                   (const gchar **system_identifiers);

Iterates the supplied list of UUIDs and checks the GstRegistry for all the decryptors supporting one of the supplied UUIDs.

#### Parameters

system_identifiers | A null terminated array of strings that contains the UUID values of each protection system that is to be checked. | [transfer none][array zero-terminated=1]

#### Returns

A null terminated array containing all the `system_identifiers` supported by the set of available decryptors, or `NULL` if no matches were found.

[transfer full][array zero-terminated=1][nullable]

Since: 1.14

## Types and Values

### struct GstProtectionMeta

    struct GstProtectionMeta {
      GstMeta meta;

      GstStructure *info;
    };

Metadata type that holds information about a sample from a protection-protected track, including the information needed to decrypt it (if it is encrypted).

#### Members

GstMeta `meta`; | the parent GstMeta. |
GstStructure *`info`; | the cryptographic information needed to decrypt the sample. |

Since: 1.6

### GST_PROTECTION_SYSTEM_ID_CAPS_FIELD

    #define GST_PROTECTION_SYSTEM_ID_CAPS_FIELD "protection-system"

The field name in a GstCaps that is used to signal the UUID of the protection system.

Since: 1.6

### GST_PROTECTION_UNSPECIFIED_SYSTEM_ID

    #define GST_PROTECTION_UNSPECIFIED_SYSTEM_ID "unspecified-system-id"

The protection system value of the unspecified UUID. In some cases the system protection ID is not present in the contents or in their metadata, as encrypted WebM. This define is used to set the value of the "system_id" field in GstProtectionEvent, with this value, the application will use an external information to choose which protection system to use.

Example: The matroskademux uses this value in the case of encrypted WebM, the application will choose the appropriate protection system based on the information received through EME API.

Since: 1.16