Main Page   Modules   Data Structures   Data Fields   Related Pages  

Codec


Data Structures

struct  rte_codec_info

Typedefs

typedef struct rte_codec rte_codec

Enumerations

enum  rte_stream_type {
  RTE_STREAM_VIDEO = 1,
  RTE_STREAM_AUDIO,
  RTE_STREAM_RAW_VBI,
  RTE_STREAM_SLICED_VBI,
  RTE_STREAM_MAX = 15
}

Functions

rte_codec_inforte_codec_info_enum (rte_context *context, unsigned int index)
rte_codec_inforte_codec_info_by_keyword (rte_context *context, const char *keyword)
rte_codec_inforte_codec_info_by_codec (rte_codec *codec)
rte_codecrte_set_codec (rte_context *context, const char *keyword, unsigned int stream_index, void *user_data)
void rte_codec_delete (rte_codec *codec)
void* rte_codec_user_data (rte_codec *codec)
rte_option_inforte_codec_option_info_enum (rte_codec *codec, unsigned int index)
rte_option_inforte_codec_option_info_by_keyword (rte_codec *codec, const char *keyword)
rte_bool rte_codec_option_get (rte_codec *codec, const char *keyword, rte_option_value *value)
rte_bool rte_codec_option_set (rte_codec *codec, const char *keyword,...)
char* rte_codec_option_print (rte_codec *codec, const char *keyword,...)
rte_bool rte_codec_option_menu_get (rte_codec *codec, const char *keyword, int *entry)
rte_bool rte_codec_option_menu_set (rte_codec *codec, const char *keyword, int entry)
rte_bool rte_codec_options_reset (rte_codec *codec)

Typedef Documentation

typedef struct rte_codec rte_codec
 

Opaque rte_codec object. You can allocate an rte_codec with rte_set_codec().


Enumeration Type Documentation

enum rte_stream_type
 

Basic type of the data processed by a codec.


Function Documentation

rte_codec_info* rte_codec_info_enum ( rte_context * context,
unsigned int index )
 

Parameters:
context   Initialized rte_context as returned by rte_context_new().
index   Index into the codec table.

Enumerates elementary stream codecs available for the selected context (backend/file format/mux format). You should start at index 0, incrementing.

Returns:
Static pointer, data not to be freed, to a rte_codec_info structure. NULL if the context is invalid or the index is out of bounds.

rte_codec_info* rte_codec_info_by_keyword ( rte_context * context,
const char * keyword )
 

Parameters:
context   Initialized rte_context as returned by rte_context_new().
keyword   Codec identifier as in rte_codec_info, rte_set_codec() or rte_get_codec().

Similar to rte_codec_enum(), but this function attempts to find a codec by keyword.

Returns:
Static pointer to a rte_codec_info structure, NULL if the context is invalid or the named codec has not been found.

rte_codec_info* rte_codec_info_by_codec ( rte_codec * codec )
 

Parameters:
codec   Pointer to a rte_codec returned by rte_get_codec() or rte_set_codec().

Returns the codec info for the given codec.

Returns:
Static pointer to a rte_codec_info structure, NULL if the codec is NULL.

rte_codec * rte_set_codec ( rte_context * context,
const char * keyword,
unsigned int stream_index,
void * user_data )
 

Parameters:
context   Initialized rte_context as returned by rte_context_new().
keyword   Codec identifier as in rte_codec_info.
stream_index   Elementary stream number.
user_data   Pointer stored in the codec, can be retrieved with rte_codec_user_data().

Allocates a codec instance and assigns it to encode some track of the context, the audio, video, ... (depending on the codec type) elementary stream number stream_index.

The stream number refers for example to one of the 16 video or 32 audio streams in a MPEG-1 program stream. The required and permitted number of elementary streams of each type is listed in rte_context_info. Naturally a context needs at least one elementary stream.

The first and default stream has index number 0. When you already selected a codec for this stream type and index it will be replaced. All properties of the new codec instance are reset to their defaults.

Possible mp1e backend initialization (error checks omitted):

 context = rte_context_new ("mp1e_mpeg1_ps", NULL, NULL);  // MPEG-1 Program stream

 rte_set_codec (context, "mp1e_mpeg1_video", 0, NULL);     // MPEG-1 Video (first elementary)
 rte_set_codec (context, "mp1e_mpeg2_layer2", 0, NULL);    // MPEG-2 Audio (first elementary)
 rte_set_codec (context, "mp1e_mpeg1_layer2", 1, NULL);    // MPEG-1 Audio (second elementary)

As a special service you can set codec options by appending to the keyword like this:

 rte_set_codec (context, 0, "mp1e_mpeg2_layer_2; bit_rate=128000, comment="example");

Returns:
Static pointer, data not to be freed, to an opaque rte_codec object. On error NULL is returned, which may be caused by invalid parameters, an unknown codec_keyword, a stream type of the codec not suitable for the context or an invalid option string. See also rte_errstr().

void rte_codec_delete ( rte_codec * codec )
 

Parameters:
codec   Pointer to a rte_codec returned by rte_get_codec() or rte_set_codec().

Removes the codec from the rte_context it has been assigned to and deletes the codec.

void* rte_codec_user_data ( rte_codec * codec )
 

Parameters:
codec   Pointer to a rte_codec returned by rte_get_codec() or rte_set_codec().

Retrieves the pointer stored in the user data field of the codec.

Returns:
User pointer.

rte_option_info* rte_codec_option_info_enum ( rte_codec * codec,
unsigned int index )
 

Parameters:
codec   Pointer to a rte_codec returned by rte_get_codec() or rte_set_codec().
index   Index into the option table.

Enumerates the options available for the given codec. You should start at index 0, incrementing by one.

Returns:
Static pointer, data not to be freed, to a rte_option_info structure. NULL if the index is out of bounds.

rte_option_info* rte_codec_option_info_by_keyword ( rte_codec * codec,
const char * keyword )
 

Parameters:
codec   Pointer to a rte_codec returned by rte_get_codec() or rte_set_codec().
keyword   Keyword identifying the option as in rte_option_info.

Similar to rte_codec_option_info_enum() but this function tries to find the option info by keyword.

Returns:
Static pointer to a rte_option_info structure, NULL if the keyword was not found.

rte_bool rte_codec_option_get ( rte_codec * codec,
const char * keyword,
rte_option_value * value )
 

Parameters:
codec   Pointer to a rte_codec returned by rte_get_codec() or rte_set_codec().
keyword   Keyword identifying the option as in rte_option_info.
value   A place to store the option value.

This function queries the current value of the option. When the option is a string, you must free() value.str when not longer needed.

Returns:
TRUE on success, otherwise value remained unchanged.

rte_bool rte_codec_option_set ( rte_codec * codec,
const char * keyword,
... )
 

Parameters:
codec   Pointer to a rte_codec returned by rte_get_codec() or rte_set_codec().
keyword   Keyword identifying the option as in rte_option_info.
Varargs   New value to set.

Sets the value of the option. Make sure you are casting the value to the correct type (int, double, char *).

Typical usage is:

 rte_codec_option_set (codec, "frame_rate", (double) 3.141592);

Note setting an option invalidates prior input stream parameter negotiation with rte_parameters_set(), so you should initialize the codec options first.

Returns:
TRUE on success.

char* rte_codec_option_print ( rte_codec * codec,
const char * keyword,
... )
 

Parameters:
codec   Pointer to a rte_codec returned by rte_get_codec() or rte_set_codec().
keyword   Keyword identifying the option as in rte_option_info.
Varargs   Option value.

Return a string representation of the option value. When for example the option is a memory size, a value of 2048 may result in a string "2 KB". Make sure you are casting the value to the correct type (int, double, char *). You must free() the returned string when no longer needed.

Returns:
String pointer or NULL on failure.

rte_bool rte_codec_option_menu_get ( rte_codec * codec,
const char * keyword,
int * entry )
 

Parameters:
codec   Pointer to a rte_codec returned by rte_get_codec() or rte_set_codec().
keyword   Keyword identifying the option as in rte_option_info.
entry   A place to store the current menu entry.

Similar to rte_codec_option_get() this function queries the current value of the named option, but returns this value as number of the corresponding menu entry. Naturally this must be an option with menu or the function will fail.

Returns:
TRUE on success, otherwise value remained unchanged.

rte_bool rte_codec_option_menu_set ( rte_codec * codec,
const char * keyword,
int entry )
 

Parameters:
codec   Pointer to a rte_codec returned by rte_get_codec() or rte_set_codec().
keyword   Keyword identifying the option as in rte_option_info.
entry   Menu entry to be selected.

Similar to rte_codec_option_set() this function sets the value of the named option, however it does so by number of the corresponding menu entry. Naturally this must be an option with menu, or the function will fail.

Note setting an option invalidates prior sample parameter negotiation with rte_parameters_set(), so you should initialize the codec options first.

Returns:
TRUE on success, otherwise the option is not changed.

rte_bool rte_codec_options_reset ( rte_codec * codec )
 

Parameters:
codec   Pointer to a rte_codec returned by rte_get_codec() or rte_set_codec().

Resets all options of the codec to their respective default, that is the value they have after calling rte_set_codec().

Returns:
TRUE on success, on failure not all options may be reset.


Generated at Wed Mar 22 23:35:36 2006 for RTE Library by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001