FarsightCodec

FarsightCodec — A descriptor of a codec

Synopsis




                    FarsightCodec;
                    FarsightCodecParameter;
                    FarsightCodecPreference;
enum                FarsightMediaType;
void                farsight_codec_init                 (FarsightCodec *codec,
                                                         int id,
                                                         const char *encoding_name,
                                                         FarsightMediaType media_type,
                                                         guint clock_rate);
void                farsight_codec_destroy              (FarsightCodec *codec);
FarsightCodec*      farsight_codec_copy                 (FarsightCodec *codec);
void                farsight_codec_list_destroy         (GList *codec_list);
GList*              farsight_codec_list_copy            (const GList *codec_list);
GList*              farsight_codec_list_from_keyfile    (const gchar *filename);
gchar*              farsight_codec_to_string            (FarsightCodec *codec);
const gchar*        farsight_media_type_to_string       (FarsightMediaType media_type);

Description

Details

FarsightCodec

typedef struct {
  gint id;
  char *encoding_name;
  FarsightMediaType media_type;
  guint clock_rate;
  guint channels;
  GList *optional_params;
} FarsightCodec;

gint id; numeric identifier for encoding, eg. PT for SDP
char *encoding_name; the name of the codec
FarsightMediaType 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

FarsightCodecParameter

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

Used to store arbitary parameters for a codec

gchar *name; paramter name.
gchar *value; parameter value.

FarsightCodecPreference

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

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

enum FarsightMediaType

typedef enum
{
  FARSIGHT_MEDIA_TYPE_AUDIO,
  FARSIGHT_MEDIA_TYPE_VIDEO,
  FARSIGHT_MEDIA_TYPE_LAST = FARSIGHT_MEDIA_TYPE_VIDEO
} FarsightMediaType;

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

FARSIGHT_MEDIA_TYPE_AUDIO A media type that encodes audio.
FARSIGHT_MEDIA_TYPE_VIDEO A media type that encodes video.
FARSIGHT_MEDIA_TYPE_LAST

farsight_codec_init ()

void                farsight_codec_init                 (FarsightCodec *codec,
                                                         int id,
                                                         const char *encoding_name,
                                                         FarsightMediaType media_type,
                                                         guint clock_rate);

Initialises a FarsightCodec structure

codec : FarsightCodec structure to initialise
id : codec identifier, if RTP this should be based on IETF RTP payload types
encoding_name : Name of media type this encodes
media_type : FarsightMediaType for type of codec
clock_rate : The clock rate this codec encodes at, if applicable

farsight_codec_destroy ()

void                farsight_codec_destroy              (FarsightCodec *codec);

Deletes a FarsightCodec structure and all its data

codec : FarsightCodec structure to free

farsight_codec_copy ()

FarsightCodec*      farsight_codec_copy                 (FarsightCodec *codec);

Copies a FarsightCodec structure.

codec : codec to copy
Returns : a copy of the codec

farsight_codec_list_destroy ()

void                farsight_codec_list_destroy         (GList *codec_list);

Deletes a list of FarsightCodec structures and the list itself

codec_list : a GList of FarsightCodec to delete

farsight_codec_list_copy ()

GList*              farsight_codec_list_copy            (const GList *codec_list);

Copies a list of FarsightCodec structures.

codec_list : a GList of FarsightCodec to copy
Returns : The new list.

farsight_codec_list_from_keyfile ()

GList*              farsight_codec_list_from_keyfile    (const gchar *filename);

Reads the content of a GKeyFile of the following format into a GList of FarsightCodec 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
Returns : The read GList of FarsightCodec or NULL if an error appended

farsight_codec_to_string ()

gchar*              farsight_codec_to_string            (FarsightCodec *codec);

Returns a newly-allocated string representing the codec

codec : A farsight codec
Returns : the newly-allocated string

farsight_media_type_to_string ()

const gchar*        farsight_media_type_to_string       (FarsightMediaType media_type);

media_type :
Returns :