## RTP Specific types

RTP Specific types

## Synopsis

    #include <farstream/fs-rtp.h>

                        FsRtpHeaderExtension;
    FsRtpHeaderExtension * fs_rtp_header_extension_new      (guint id,
                                                             FsStreamDirection direction,
                                                             const gchar *uri);
    FsRtpHeaderExtension * fs_rtp_header_extension_copy     (FsRtpHeaderExtension *extension);
    void                fs_rtp_header_extension_destroy     (FsRtpHeaderExtension *extension);
    gboolean            fs_rtp_header_extension_are_equal   (FsRtpHeaderExtension *extension1,
                                                             FsRtpHeaderExtension *extension2);
    GList *             fs_rtp_header_extension_list_copy   (GList *extensions);
    void                fs_rtp_header_extension_list_destroy
                                                            (GList *extensions);
    GList *             fs_rtp_header_extension_list_from_keyfile
                                                            (const gchar *filename,
                                                             FsMediaType media_type,
                                                             GError **error);
    #define             FS_RTP_HEADER_EXTENSION_FORMAT
    #define             FS_RTP_HEADER_EXTENSION_ARGS        (hdrext)

## Description

## Details

### FsRtpHeaderExtension

    typedef struct {
      guint id;
      FsStreamDirection direction;
      gchar *uri;
    } FsRtpHeaderExtension;

Defines a RTP header extension with its negotiated identifier, direction and URI. They should only be created with `fs_rtp_header_extension_new()`.

guint `id`; | The identifier of the RTP header extension
FsStreamDirection `direction`; | the direction in which this extension can be used
gchar *`uri`; | The URI that defines this extension

### fs_rtp_header_extension_new ()

    FsRtpHeaderExtension * fs_rtp_header_extension_new      (guint id,
                                                             FsStreamDirection direction,
                                                             const gchar *uri);

Creates a new FsRtpHeaderExtension

`id` : | The identifier of the RTP header extension
`direction` : | the direction in which this extension can be used
`uri` : | The URI that defines this extension
Returns : | a new FsRtpHeaderExtension

### fs_rtp_header_extension_copy ()

    FsRtpHeaderExtension * fs_rtp_header_extension_copy     (FsRtpHeaderExtension *extension);

Copies a FsRtpHeaderExtension

`extension` : | The RTP header extension definition to copy
Returns : | a new FsRtpHeaderExtension

### fs_rtp_header_extension_destroy ()

    void                fs_rtp_header_extension_destroy     (FsRtpHeaderExtension *extension);

Frees the passed FsRtpHeaderExtension

`extension` : | A RTP header extension to free

### fs_rtp_header_extension_are_equal ()

    gboolean            fs_rtp_header_extension_are_equal   (FsRtpHeaderExtension *extension1,
                                                             FsRtpHeaderExtension *extension2);

Compares two FsRtpHeaderExtension structures

`extension1` : | The first FsRtpHeaderExtension
`extension2` : | The second FsRtpHeaderExtension
Returns : | `TRUE` if they are identical, `FALSE` otherwise

### fs_rtp_header_extension_list_copy ()

    GList *             fs_rtp_header_extension_list_copy   (GList *extensions);

Does a deep copy of a GList of FsRtpHeaderExtension

`extensions` : | a GList of FsRtpHeaderExtension. [element-type FsRtpHeaderExtension][transfer none]
Returns : | a new GList of FsRtpHeaderExtension. [element-type FsRtpHeaderExtension][transfer full]

### fs_rtp_header_extension_list_destroy ()

    void                fs_rtp_header_extension_list_destroy
                                                            (GList *extensions);

Frees the passed GList of FsRtpHeaderExtension

`extensions` : | a GList of FsRtpHeaderExtension

### fs_rtp_header_extension_list_from_keyfile ()

    GList *             fs_rtp_header_extension_list_from_keyfile
                                                            (const gchar *filename,
                                                             FsMediaType media_type,
                                                             GError **error);

Reads the content of a GKeyFile of the following format into a GList of FsRtpHeaderExtension structures.

The groups have a format "rtp-hdrext:audio:XXX" or "rtp-hdrext:video:XXX" where XXX is a unique string (per media type).

The valid keys are:

- id: a int between in the 1-255 and 4096-4351 ranges
- uri: a URI describing the RTP Header Extension
- direction (optional): To only send or receive a RTP Header Extension, possible values are "send", "receive", "none" or "both". Defaults to "both"

Example:

    1
    2
    3
    4
    5
    6
    7
    8

    [rtp-hdrext:audio:a]
    id=1
    uri=urn:ietf:params:rtp-hdrext:toffset

    [rtp-hdrext:audio:abc]
    id=3
    uri=urn:ietf:params:rtp-hdrext:ntp-64
    direction=receive

`filename` : | Name of the GKeyFile to read the RTP Header Extensions from
`media_type` : | The media type for which to get header extensions
`error` : | location of a GError, or NULL if no error occured
Returns : | a GList of FsRtpHeaderExtension that must be freed with `fs_rtp_header_extension_list_destroy()`. [element-type FsRtpHeaderExtension][transfer full]

### FS_RTP_HEADER_EXTENSION_FORMAT

    #define FS_RTP_HEADER_EXTENSION_FORMAT "%d: (%s) %s"

A format that can be used in printf like format strings to format a FsRtpHeaderExtension

### FS_RTP_HEADER_EXTENSION_ARGS()

    #define             FS_RTP_HEADER_EXTENSION_ARGS(hdrext)

Formats the codec in args for FS_RTP_HEADER_EXTENSION_ARGS

`hdrext` : | a FsRtpHeaderExtension