Derived From:
Mix-in Classes:
Declared In:media/MediaBufferEncoder.h
Allocation:Constructor only
Class Overview

Constructor and Destructor


BMediaBufferDecoder(); BMediaBufferDecoder(const media_format* inFormat,
                    const void* info = NULL,
                    size_t infoSize = 0);
BMediaBufferDecoder(const media_codec_info* mci);

The constructor sets up the BMediaBufferDecoder. If you use the empty form of the constructor, you'll have to call SetTo() to establish the format to be decoded before calling Decode().

The second form accepts a media_format structure, inFormat, that indicates the type of media data that will be input into the decoder. info, if specified, will be filled out with text information about the node; you must specify a buffer infoSize bytes long.

The third form of the constructor accepts a media_codec_info structure, mci, that determines which codec should be used.


If you use either the media_format or media_codec_info form of the constructor, you must call InitCheck() to ensure that construction was successful before using any other functions in this class.


virtual ~BMediaBufferDecoder();

Releases the decoder add-on being used by the BMediaBufferDecoder.

Member Functions


status_t DecodeBuffer(const void* inputBuffer,
                      size_t inputSize,
                      void* outBuffer,
                      int64* outFrameCount,
                      media_header* outMH,
                      media_decode_info* info);

Decodes a chunk of media data from the input buffer inputBuffer into the output buffer specified by outBuffer. The input buffer contains inputSize bytes of media data. On return, outFrameCount is set to indicate how many frames of data were decoded, and outMH is the header for the decoded buffer.

The media_decode_info structure info is used on input to specify decoding parameters.

Return CodeDescription


No error.

Other errors.

The decoder's Decode() function can return errors.


status_t GetNextChunk(const void** chunkData,
                      size_t* chunkLen,
                      media_header* mh) = 0;

Implementation detail. This function is implemented to fetch memory from the input buffer specified by the call to DecodeBuffer().


status_t InitCheck() const;

Returns a status_t value indicating whether or not construction was successful. You must call this function after construction before calling any other BMediaBufferDecoder functions.

Return CodeDescription


The constructor was successful.

Other errors.

See BMediaDecoder's SetTo() function.

Creative Commons License
Legal Notice
This work is licensed under a Creative Commons Attribution-Non commercial-No Derivative Works 3.0 License.