The Media Kit: BMediaBufferDecoder

The Media Kit Table of Contents | The Media Kit Index

# BMediaBufferDecoder

Derived from: BMediaDecoder

Declared in: be/media/MediaDecoder.h

Library: libmedia.so

###### Summary

The BMediaBufferDecoder class can be used to decode media data from a memory buffer. It implements the `BMediaDecoder::GetNextChunk()` function to fetch data from the memory buffer, and adds a new `DecodeBuffer()` function that decodes data from one buffer into another.

## Hook Functions

`GetNextChunk()`

## Constructor and Destructor

### BMediaBufferDecoder()

`BMediaBufferDecoder()`
`BMediaBufferDecoder(const media_format *`inFormat, const void *info = NULL, size_t infoSize = 0`)`

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.

### ~BMediaBufferDecoder()

`virtual``~BMediaBufferDecoder() `

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

## Member Functions

### DecodeBuffer()

`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 CODES

- `B_OK`. No error.

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

### GetNextChunk()

`protected:`

`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()`.

### InitCheck()

`status_t` `InitCheck(void``)` 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 CODES

- `B_OK`. The constructor was successful.

- `SetTo()` errors.

The Media Kit Table of Contents | The Media Kit Index

The Be Book,
...in lovely HTML...
for BeOS Release 5.

Copyright © 2000 Be, Inc. All rights reserved..