C interface to Dirac decoder.
More...
#include <libdirac_common/dirac_types.h>
#include <libdirac_decoder/decoder_types.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:
-
| decoder | Decoder object |
| start | Start of data |
| end | End of data |
Release the decoder resources
- Parameters:
-
Decoder Init Initialise the decoder.
- Parameters:
-
| verbose | boolean flag to set verbose output |
- Returns:
- decoder handle
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:
-
- 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:
-
| decoder | Decoder object |
| buf | Array of char buffers to hold luma and chroma data |
| id | User data |