FsCodec

FsCodec — Structure representing a media codec

Synopsis




enum                FsMediaType;
const gchar*        fs_media_type_to_string             (FsMediaType media_type);
                    FsCodec;
                    FsCodecParameter;
                    FsCodecPreference;
#define             FS_CODEC_ID_ANY
#define             FS_CODEC_ID_DISABLE
FsCodec*            fs_codec_new                        (int id,
                                                         const char *encoding_name,
                                                         FsMediaType media_type,
                                                         guint clock_rate);
void                fs_codec_destroy                    (FsCodec *codec);
FsCodec*            fs_codec_copy                       (const FsCodec *codec);
void                fs_codec_list_destroy               (GList *codec_list);
GList*              fs_codec_list_copy                  (const GList *codec_list);
GList*              fs_codec_list_from_keyfile          (const gchar *filename,
                                                         GError **error);
gchar*              fs_codec_to_string                  (const FsCodec *codec);
gboolean            fs_codec_are_equal                  (const FsCodec *codec1,
                                                         const FsCodec *codec2);
GstCaps*            fs_codec_to_gst_caps                (const FsCodec *codec);

Description

An FsCodec is a way to exchange codec information between the client and Farsight. The information specified in this structure is usually representative of the codec information exchanged in the signaling.

Details

enum FsMediaType

typedef enum
{
  FS_MEDIA_TYPE_AUDIO,
  FS_MEDIA_TYPE_VIDEO,
  FS_MEDIA_TYPE_APPLICATION,
  FS_MEDIA_TYPE_LAST = FS_MEDIA_TYPE_APPLICATION
} FsMediaType;

Enum used to signify the media type of a codec or stream.

FS_MEDIA_TYPE_AUDIO

A media type that encodes audio.

FS_MEDIA_TYPE_VIDEO

A media type that encodes video.

FS_MEDIA_TYPE_APPLICATION

A media type that ???

FS_MEDIA_TYPE_LAST

Largest valid FsMediaType

fs_media_type_to_string ()

const gchar*        fs_media_type_to_string             (FsMediaType media_type);

Gives a user-printable string representing the media type

media_type :

A media type

Returns :

a static string representing the media type

FsCodec

typedef struct {
  /* TODO Should this be made into a GstStructure? */
  gint id;
  char *encoding_name;
  FsMediaType media_type;
  guint clock_rate;
  guint channels;
  GList *optional_params;
} FsCodec;

This structure reprensents one codec that can be offered or received

gint id;

numeric identifier for encoding, eg. PT for SDP

char *encoding_name;

the name of the codec

FsMediaType media_type;

type of media this codec is for

guint clock_rate;

clock rate of this stream

guint channels;

Number of channels codec should decode

GList *optional_params;

key pairs of param name to param data

FsCodecParameter

typedef struct {
    gchar *name;
    gchar *value;
} FsCodecParameter;

Used to store arbitary parameters for a codec

gchar *name;

paramter name.

gchar *value;

parameter value.

FsCodecPreference

typedef struct {
    gchar *encoding_name;
    gint clock_rate;
} FsCodecPreference;

Used to give a preferece for what type of codec to use.

gchar *encoding_name;

name of encoding preferred

gint clock_rate;

rate of codec preffered

FS_CODEC_ID_ANY

#define FS_CODEC_ID_ANY            (-1)

If the id of a FsCodec is FS_CODEC_ID_ANY, then it will be replaced with a dynamic payload type at runtime


FS_CODEC_ID_DISABLE

#define FS_CODEC_ID_DISABLE        (-2)

If the id of a FsCodec is FS_CODEC_ID_DISABLE, then this codec will not be used


fs_codec_new ()

FsCodec*            fs_codec_new                        (int id,
                                                         const char *encoding_name,
                                                         FsMediaType media_type,
                                                         guint clock_rate);

Allocates and initializes a FsCodec structure

id :

codec identifier, if RTP this should be based on IETF RTP payload types

encoding_name :

Name of media type this encodes

media_type :

FsMediaType for type of codec

clock_rate :

The clock rate this codec encodes at, if applicable

Returns :

A newly allocated FsCodec

fs_codec_destroy ()

void                fs_codec_destroy                    (FsCodec *codec);

Deletes a FsCodec structure and all its data

codec :

FsCodec structure to free

fs_codec_copy ()

FsCodec*            fs_codec_copy                       (const FsCodec *codec);

Copies a FsCodec structure.

codec :

codec to copy

Returns :

a copy of the codec

fs_codec_list_destroy ()

void                fs_codec_list_destroy               (GList *codec_list);

Deletes a list of FsCodec structures and the list itself

codec_list :

a GList of FsCodec to delete

fs_codec_list_copy ()

GList*              fs_codec_list_copy                  (const GList *codec_list);

Copies a list of FsCodec structures.

codec_list :

a GList of FsCodec to copy

Returns :

The new list.

fs_codec_list_from_keyfile ()

GList*              fs_codec_list_from_keyfile          (const gchar *filename,
                                                         GError **error);

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

Example:

[audio/codec1]
clock-rate=8000

[audio/codec1:1]
clock-rate=16000

[audio/codec2]
one_param=QCIF
another_param=WOW

filename :

Name of the GKeyFile to read the codecs parameters from

error :

location of a GError, or NULL if no error occured

Returns :

The GList of FsCodec or NULL if the keyfile was empty or an error occured.

fs_codec_to_string ()

gchar*              fs_codec_to_string                  (const FsCodec *codec);

Returns a newly-allocated string representing the codec

codec :

A farsight codec

Returns :

the newly-allocated string

fs_codec_are_equal ()

gboolean            fs_codec_are_equal                  (const FsCodec *codec1,
                                                         const FsCodec *codec2);

Compare two codecs, it will declare two codecs to be identical even if their optional parameters are in a different order.

codec1 :

First codec

codec2 :

Second codec

Returns :

TRUE of the codecs are identical, FALSE otherwise

fs_codec_to_gst_caps ()

GstCaps*            fs_codec_to_gst_caps                (const FsCodec *codec);

This function converts a FsCodec to a fixed GstCaps with media type application/x-rtp.

codec :

A FsCodec to be converted

Returns :

A newly-allocated GstCaps