Main Page   Modules   Compound List   File List   Compound Members   File Members  

XLV Codec API


Modules

Codec encodings
Codec mode
Codec types
Codec flags

Compounds

struct  _XLV_CodecFrame
 Frame descriptor. More...

struct  _XLV_CodecQuality
struct  _XLV_CodecQueryRealtime
struct  _XLV_CodecRTBuffer
struct  _XLV_CodecSpec
 Main structure for XLV Codec API: Format specification. More...


Defines

#define XLV_CODEC_SET_SPEC   301
#define XLV_CODEC_DROP_FRAME   302
#define XLV_CODEC_GET_INPUT   303
#define XLV_CODEC_SET_INPUT   304
#define XLV_CODEC_GET_OUTPUT   305
 Retrieve the format of the output data of the codec. More...

#define XLV_CODEC_SET_DATA   306
 Specify the format of the input data of a codec. More...

#define XLV_DECODER_GET_FRAME   307
 Get a decoded frame from the decoder. More...

#define XLV_DECODER_PUSH_FRAME   308
#define XLV_CODER_GET_FRAME   309
#define XLV_CODER_PUSH_FRAME   310
#define XLV_CODEC_CHECK_WATERMARK   311
#define XLV_CODEC_SET_MODE   312
#define XLV_CODEC_GET_OUTSIZE   313
#define XLV_CODEC_GET_INSIZE   314
#define XLV_CODEC_LOW_WATERMARK   0
#define XLV_CODEC_HIGH_WATERMARK   1
#define XLV_CODEC_RT_BASE_CMD   350
#define XLV_CODEC_RT_ENABLE   (XLV_CODEC_RT_BASE_CMD+1)
#define XLV_CODEC_RT_QUERY_POOL   (XLV_CODEC_RT_BASE_CMD+2)

Typedefs

typedef XLV_Stream XLV_ICodec
 XLV_ICodec object. This is an alias for XLV_Stream.

typedef _XLV_CodecSpec XLV_CodecSpec
 Main structure for XLV Codec API: Format specification. More...

typedef _XLV_CodecFrame XLV_CodecFrame
 Frame descriptor. More...

typedef _XLV_CodecQuality XLV_CodecQuality
typedef _XLV_CodecRTBuffer XLV_CodecRTBuffer
typedef _XLV_CodecQueryRealtime XLV_CodecQueryRealtime

Functions

XLV_ICodecxlv_decoder_open (XLV_Session *session, const guint8 *name, guint32 raw_format)
 open a new decoding stream of type "name". More...

XLV_ICodecxlv_coder_open (XLV_Session *session, const guint8 *name, XLV_CodecSpec *input_format)
 open a new coding stream of type "name". More...

XLV_ICodecxlv_decoder_build_adaptor (XLV_Session *session, XLV_ICodec *codec, guint32 raw_format)
XLV_ICodecxlv_coder_build_adaptor (XLV_Session *session, XLV_ICodec *codec, XLV_CodecSpec *input_format, XLV_CodecSpec *req_format)
guint32 xlv_codec_support (XLV_ICodec *codec)
 Returns the preferred output format of the codec in the current mode. More...

void xlv_codec_release (XLV_ICodec *codec)
 Closes and releases the "codec" object.

guint32 xlv_codec_get_outsize (XLV_ICodec *codec)
 Returns the size of the output buffer of the codec.

gboolean xlv_codec_set_spec (XLV_ICodec *codec, XLV_CodecSpec *spec)
gboolean xlv_codec_need_data (XLV_ICodec *codec)
gboolean xlv_codec_drop_frame (XLV_ICodec *codec)
gboolean xlv_codec_get_output (XLV_ICodec *codec, XLV_CodecSpec *output)
gboolean xlv_codec_get_input (XLV_ICodec *codec, XLV_CodecSpec *input)
gboolean xlv_codec_get_new_output (XLV_ICodec *codec, XLV_CodecSpec *output)
gboolean xlv_decoder_get_frame (XLV_ICodec *codec, XLV_CodecFrame *frame)
gboolean xlv_coder_put_frame (XLV_ICodec *codec, XLV_CodecFrame *frame)
gint xlv_decoder_push_data (XLV_ICodec *codec, gpointer data, guint32 len)
gint xlv_coder_get_data (XLV_ICodec *codec, gpointer data, guint32 *len)
void xlv_codec_set_parameters (XLV_ICodec *codec, gpointer data)
XLV_CodecSpecxlv_codecspec_dup (XLV_CodecSpec *spec)
 Duplicate a XLV_CodecSpec structure.

XLV_CodecSpecxlv_codecspec_new ()
 Build an empty XLV_CodecSpec structure.

void xlv_codecspec_release (XLV_CodecSpec *spec)
 Free a XLV_CodecSpec structure.


Define Documentation

#define XLV_CODEC_GET_INPUT   303
 

This call is mainly useful for encoding mode. In decoding mode, it should return already known values by other means. It returns through its parameter a fourcc code showing its preferred input encoding. (May be called before XLV_CODEC_SET_INPUT. See XLV_CODEC_GET_OUTPUT for call protocol.

#define XLV_CODEC_GET_OUTPUT   305
 

Retrieve the format of the output data of the codec.

This function returns through its parameters all informations needed to render or to save the output data generated by the codec. Mainly, you should first call it with XLV_CODEC_QUERY_ENCODING to retrieve some information about the size of the structure, allocate it and then call it again with XLV_CODEC_ZERO_ENCODING. Then the structure is really filled.

#include <xlv/xlv_codec.h>

void get_output(XLV_ICodec *codec)
{
        XLV_CodecSpec spec;

        memset(&spec, 0, sizeof(spec));
        spec.m_fourcc = XLV_CODEC_QUERY_ENCODING;
        
        /* Ask the codec to fill some entries */
        XLV_IOCTL(codec, XLV_CODEC_GET_OUTPUT, &spec);

        /* Ok, now allocate the structure */
        spec.m_codec_data.data = g_malloc(spec.m_codec_data_len);
        spec.m_fourcc = XLV_CODEC_ZERO_ENCODING;

        /* And call it again */
        XLV_IOCTL(codec, XLV_CODEC_GET_OUTPUT, &spec);
}

But if you know approximatively the size of the structure you can allocate it and call directly XLV_CODEC_GET_OUTPUT with the parameter. But it is advised to always follow the specified protocol.

#define XLV_CODEC_SET_DATA   306
 

Specify the format of the input data of a codec.

This function is usually called just after you specified the mode of the codec (See XLV_CODEC_SET_MODE). The format of the parameter depends on the type of codec. If it is a video codec, you must use XLV_VideoData. If it is an audio codec, it is XLV_PCMData. In any cases, you must be sure to have set correctly the field m_valid_entries.

#define XLV_CODEC_SET_INPUT   304
 

This call is only available in encoding mode. It takes as a parameter a XLV_CodecSpec structure. You should have call it after XLV_CODEC_SET_MODE. After this call, the coder must be ready to accept data if it returns TRUE. If it returns FALSE, the coder returns in the structure the format it is capable to encode.

#define XLV_CODEC_SET_MODE   312
 

Specify the codec mode: by default the codec is in DECODE mode.

See also:
Codec mode

#define XLV_CODEC_SET_SPEC   301
 

ENCODE mode only, this specifies the specification of the output stream This structure may be modified to tell which format is the clothest of the requested format.

#define XLV_DECODER_GET_FRAME   307
 

Get a decoded frame from the decoder.

This call takes a XLV_CodecFrame for parameter. You need to have preallocated the output buffer. To know the required size, see XLV_CODEC_GET_OUTSIZE.


Typedef Documentation

typedef struct _XLV_CodecFrame XLV_CodecFrame
 

Frame descriptor.

This structure give a short description of a single image.

typedef struct _XLV_CodecSpec XLV_CodecSpec
 

Main structure for XLV Codec API: Format specification.

This structure may be considered as one of the most important of XLV Codec API because it informs the user and the codec about the format they will use to exchange data.


Function Documentation

guint32 xlv_codec_support XLV_ICodec   codec
 

Returns the preferred output format of the codec in the current mode.

Parameters:
codec  a valid XLV_ICodec object.

XLV_ICodec* xlv_coder_open XLV_Session *    session,
const guint8 *    name,
XLV_CodecSpec   input_format
 

open a new coding stream of type "name".

Parameters:
session  a valid XLV_Session object.
name  the name of the codec to be opened.
raw_forwat  if different from 0, it is the format you want to get from the codec.
Returns:
if different from NULL, a valid new codec object.
This function opens the codec in encoding mode and then try to see if it is possible for him to encode natively a format 'input_format'. If it is not possible, it automatically creates a new adaptor and then adapt the input of the coder so the input format will be 'input_format'.

#include <xlv/xlv_session.h>
#include <xlv/xlv_codec.h>

XLV_Session *g_session;

void open_decoder()
{
        XLV_ICodec *coder;
        XLV_CodecSpec format;

        format.m_fourcc = XLV_CODEC_RGB32_ENCODING;
        format.m_pluginid = NULL;
        format.m_codec_data_len = sizeof (XLV_VideoData);
        format.m_codec_data.data = g_malloc (sizeof (XLV_VideoData));
        
        format.m_codec_data.video->m_valid_entries = XLV_CODEC_ISIZE_VALID;
        format.m_codec_data.video->m_fourcc_encoding = XLV_CODEC_RGB32_ENCODING;
        format.m_codec_data.video->m_width = 320;
        format.m_codec_data.video->m_height = 240;

        /* This command will open the OpenDivx decoder and we want to have
         * a RGB (32 bits per pixel) image. This is impossible natively, so
         * it creates a VIDCNV object which will translate RGB32 into YV12
         */
        coder = xlv_coder_open(g_session, "DIVX", &format);

        /* ... */

        /* You only have to release "coder". The underlying codec (here DIVX),
         * will be also freed
         */
        xlv_codec_release (coder);
}

XLV_ICodec* xlv_decoder_open XLV_Session *    session,
const guint8 *    name,
guint32    raw_format
 

open a new decoding stream of type "name".

Parameters:
session  a valid XLV_Session object.
name  the name of the codec to be opened.
raw_forwat  if different from 0, it is the format you want to get from the codec.
Returns:
if different from NULL, a valid new codec object.
This function opens the codec in decoding mode and then try to see if it is possible for him to output 'raw_format'. If it is not possible, it automatically creates a new adaptor and then adapt the output so the output format will be 'raw_format'.

#include <xlv/xlv_session.h>
#include <xlv/xlv_codec.h>

XLV_Session *g_session;

void open_decoder()
{
        XLV_ICodec *decoder;

        /* This command will open the OpenDivx decoder and we want to have
         * a RGB (32 bits per pixel) image. This is impossible natively, so
         * it creates a VIDCNV object which will translate YV12 into RGB32
         */
        decoder = xlv_decoder_open(g_session, "DIVX", XLV_CODEC_RGB32_ENCODING);

        /* ... */

        /* You only have to release "decoder". The underlying codec (here DIVX),
         * will be also freed
         */
        xlv_codec_release (decoder);
}


Generated on Mon Jul 1 19:39:09 2002 for XLV by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002