Dirac - A Video Codec

Created by the British Broadcasting Corporation.


Classes | Typedefs | Functions

dirac_parser.h File Reference

C interface to Dirac decoder. More...

#include <libdirac_common/dirac_types.h>
#include <libdirac_decoder/decoder_types.h>
Include dependency graph for dirac_parser.h:

Go to the source code of this file.

Classes

Typedefs

Functions


Detailed Description

A set of 'C' functions that define the public interface to the Dirac decoder. Refer to the the reference decoder source code, decoder/decmain.cpp for an example of how to use the "C" interface. The pseudocode below gives a brief description of the "C" interface usage.

 #include <libdirac_decoder/dirac_parser.h>\n
 Initialise the decoder

 dirac_decoder_t *decoder_handle = dirac_decoder_init();
 do
 {
     dirac_decoder_state_t state = dirac_parse (decoder_handle);
     switch (state)
     {
     case STATE_BUFFER:
         read more data.
         Pass data to the decoder.
         dirac_buffer (decoder_handle, data_start, data_end)
         break;

     case STATE_SEQUENCE:
         handle start of sequence.
         The decoder returns the sequence parameters in the 
         seq_params member of the decoder handle.
         Allocate space for the frame data buffers and pass 
         this to the decoder.
         dirac_set_buf (decoder_handle, buf, NULL);
         break;

     case STATE_SEQUENCE_END:
         Deallocate frame data buffers
         break;

     case STATE_PICTURE_AVAIL:
         Handle picture data.
         The decoder sets the fbuf member in the decoder 
         handle to the frame decoded.
         break;

     case STATE_INVALID:
         Unrecoverable error. Stop all processing
         break;
     }
 } while (data available && decoder state != STATE_INVALID
 
 Free the decoder resources
 dirac_decoder_close(decoder_handle)
 

Typedef Documentation


Function Documentation

DllExport void dirac_buffer ( dirac_decoder_t decoder,
unsigned char *  start,
unsigned char *  end 
)

Copy data into internal buffer

Parameters:
decoderDecoder object
startStart of data
endEnd of data
DllExport void dirac_decoder_close ( dirac_decoder_t decoder)

Release the decoder resources

Parameters:
decoderDecoder object
DllExport dirac_decoder_t* dirac_decoder_init ( int  verbose)

Decoder Init Initialise the decoder.

Parameters:
verboseboolean flag to set verbose output
Returns:
decoder handle
DllExport dirac_decoder_state_t dirac_parse ( dirac_decoder_t decoder)

Parses the data in the input buffer. This function returns the following values.
STATE_BUFFER: Not enough data in internal buffer to process
STATE_SEQUENCE: Start of sequence detected. The seq_params member in the decoder object is set to the details of the next sequence to be processed.
STATE_PICTURE_START: Start of picture detected. The frame_params member of the decoder object is set to the details of the next frame to be processed.
STATE_PICTURE_AVAIL: Decoded picture available. The frame_aprams member of the decoder object is set the the details of the decoded frame available. The fbuf member of the decoder object has the luma and chroma data of the decompressed frame.
STATE_SEQUENCE_END: End of sequence detected.
STATE_INVALID: Invalid stream. Stop further processing.

Parameters:
decoderDecoder object
Returns:
Decoder state
DllExport void dirac_set_buf ( dirac_decoder_t decoder,
unsigned char *  buf[3],
void *  id 
)

Set the output buffer into which the decoder copies the decoded data

Parameters:
decoderDecoder object
bufArray of char buffers to hold luma and chroma data
idUser data

© 2004 British Broadcasting Corporation. Dirac code licensed under the Mozilla Public License (MPL) Version 1.1.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.