mpeghdec
FraunhoferIISMPEG-HDecoderLibrary
Classes | Typedefs | Enumerations | Functions
mpeghdecoder.h File Reference

MPEG-H 3DA decoder library interface header file. More...

#include <stdint.h>
#include <stdbool.h>
#include "mpeghexport.h"

Go to the source code of this file.

Classes

struct  MPEGH_DECODER_OUTPUT_INFO
 This structure gives information about the currently decoded audio data. All fields are read-only. More...
 

Typedefs

typedef struct MPEGH_DECODER_CONTEXT * HANDLE_MPEGH_DECODER_CONTEXT
 
typedef struct MPEGH_DECODER_OUTPUT_INFO MPEGH_DECODER_OUTPUT_INFO
 This structure gives information about the currently decoded audio data. All fields are read-only.
 

Enumerations

enum  MPEGH_DECODER_ERROR {
  MPEGH_DEC_OK, MPEGH_DEC_FEED_DATA, MPEGH_DEC_NULLPTR_ERROR, MPEGH_DEC_OUT_OF_MEMORY,
  MPEGH_DEC_BUFFER_ERROR, MPEGH_DEC_PROCESS_ERROR, MPEGH_DEC_UNSUPPORTED_PARAM, MPEGH_DEC_NEEDS_RESTART
}
 MPEG-H decoder error codes. More...
 
enum  MPEGH_DECODER_PARAMETER {
  MPEGH_DEC_PARAM_TARGET_REFERENCE_LEVEL, MPEGH_DEC_PARAM_EFFECT_TYPE, MPEGH_DEC_PARAM_BOOST_FACTOR, MPEGH_DEC_PARAM_ATTENUATION_FACTOR,
  MPEGH_DEC_PARAM_ALBUM_MODE
}
 Options for handling of Dynamic Range Control (DRC) parameters. More...
 

Functions

MPEGHDEC_EXPORT HANDLE_MPEGH_DECODER_CONTEXT mpeghdecoder_init (int32_t cicpSetup)
 Open an MPEG-H decoder instance. More...
 
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_setMhaConfig (HANDLE_MPEGH_DECODER_CONTEXT hCtx, const uint8_t *config, uint32_t configSize)
 Explicitly configure the decoder by passing the MHA config contained in a binary buffer. This is required for MPEG-H MHA format bitstreams which have no in-band config. More...
 
MPEGHDEC_EXPORT void mpeghdecoder_destroy (HANDLE_MPEGH_DECODER_CONTEXT hCtx)
 De-allocate all resources of an MPEG-H decoder instance. More...
 
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_process (HANDLE_MPEGH_DECODER_CONTEXT hCtx, const uint8_t *inData, uint32_t inLength, uint64_t timestamp)
 Fill MPEG-H decoder's internal input buffer with bitstream data from the external input buffer and adds the corresponding timestamp to a timestamp queue. Furthermore, it decodes as many frames as possible and pushes the decoded samples into a samples queue. The decoded PCM samples can then be obtained by calling the mpeghdecoder_getSamples() function. More...
 
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_processTimescale (HANDLE_MPEGH_DECODER_CONTEXT hCtx, const uint8_t *inData, uint32_t inLength, uint64_t timestamp, uint32_t timescale)
 Fill MPEG-H decoder's internal input buffer with bitstream data from the external input buffer and adds the corresponding timestamp to a timestamp queue. Furthermore, it decodes as many frames as possible and pushes the decoded samples into a samples queue. The decoded PCM samples can then be obtained by calling the mpeghdecoder_getSamples() function. More...
 
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_getSamples (HANDLE_MPEGH_DECODER_CONTEXT hCtx, int32_t *outData, uint32_t outLength, MPEGH_DECODER_OUTPUT_INFO *outInfo)
 Get a decoded audio frame. More...
 
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_flushAndGet (HANDLE_MPEGH_DECODER_CONTEXT hCtx)
 Flush the decoder and push the flushed PCM samples into a samples queue. The decoded PCM samples can then be obtained by calling the mpeghdecoder_getSamples() function. This function should only be used to trigger the output of all pending samples in the EOF/EOS case. More...
 
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_flush (HANDLE_MPEGH_DECODER_CONTEXT hCtx)
 Flush the decoder and discard all pending samples in the samples queue. This function should be used in case of seeking operations. More...
 
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_setParam (HANDLE_MPEGH_DECODER_CONTEXT hCtx, MPEGH_DECODER_PARAMETER param, int value)
 Set decoder parameter. More...
 

Detailed Description

MPEG-H 3DA decoder library interface header file.

Definition in file mpeghdecoder.h.

Typedef Documentation

typedef struct MPEGH_DECODER_CONTEXT* HANDLE_MPEGH_DECODER_CONTEXT

Pointer to a MPEG-H decoder instance.

Definition at line 165 of file mpeghdecoder.h.

Enumeration Type Documentation

MPEG-H decoder error codes.

Enumerator
MPEGH_DEC_OK 

No error occured.

MPEGH_DEC_FEED_DATA 

No more output samples are available. Feed more input data.

MPEGH_DEC_NULLPTR_ERROR 

A NULL pointer was provided as a function parameter.

MPEGH_DEC_OUT_OF_MEMORY 

Heap returned NULL pointer.

MPEGH_DEC_BUFFER_ERROR 

The current input data could not be filled because the buffer is full or the size of a provided output buffer is too small.

MPEGH_DEC_PROCESS_ERROR 

The provided input data could not be processed.

MPEGH_DEC_UNSUPPORTED_PARAM 

An unsupported parameter was provided as a function parameter.

MPEGH_DEC_NEEDS_RESTART 

A restart of the decoder is necessary due to a change of the output configuration (samplerate, number of channels).

Definition at line 103 of file mpeghdecoder.h.

Options for handling of Dynamic Range Control (DRC) parameters.

Enumerator
MPEGH_DEC_PARAM_TARGET_REFERENCE_LEVEL 

MPEG-D DRC: Target reference level / decoder target loudness.
Defines the level below full-scale (quantized in steps of 0.25 LU) to which the output audio signal will be normalized to by the DRC module.
The parameter controls loudness normalization for MPEG-D DRC. The valid values range from 40 (-10 LKFS) to 127 (-31.75 LKFS).
Example values:
124 (-31 LKFS) for audio/video receivers (AVR) or other devices allowing audio playback with high dynamic range,
96 (-24 LKFS) for TV sets or equivalent devices (default),
64 (-16 LKFS) for mobile devices where the dynamic range of audio playback is restricted.

MPEGH_DEC_PARAM_EFFECT_TYPE 

MPEG-D DRC: Request a DRC effect type for selection of a DRC set.
Supported indices are:
-1: DRC off. Completely disables MPEG-D DRC.
0: None (default). Disables MPEG-D DRC, but automatically enables DRC if necessary to prevent clipping.
1: Late night
2: Noisy environment
3: Limited playback range
4: Low playback level
5: Dialog enhancement
6: General compression. Used for generally enabling MPEG-D DRC without particular request.

MPEGH_DEC_PARAM_BOOST_FACTOR 

MPEG-D DRC: Scaling factor for boosting gain values.
Defines how the boosting DRC gains (conveyed in the bitstream) will be applied to the decoded signal. The valid values range from 0 (don't apply boost gains) to 127 (fully apply boost gains). Default value is 127.

MPEGH_DEC_PARAM_ATTENUATION_FACTOR 

MPEG-D DRC: Scaling factor for attenuating gain values.
Same as MPEGH_DEC_PARAM_BOOST_FACTOR but for attenuating DRC gains.

MPEGH_DEC_PARAM_ALBUM_MODE 

MPEG-D DRC: Enable album mode.
0: Disabled (default),
1: Enabled.
Disabled album mode leads to application of gain sequences for fading in and out, if provided in the bitstream.
Enabled album mode makes use of dedicated album loudness information, if provided in the bitstream.

Definition at line 120 of file mpeghdecoder.h.

Function Documentation

MPEGHDEC_EXPORT void mpeghdecoder_destroy ( HANDLE_MPEGH_DECODER_CONTEXT  hCtx)

De-allocate all resources of an MPEG-H decoder instance.

Parameters
[in]hCtxMPEG-H decoder handle.
Returns
void.
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_flush ( HANDLE_MPEGH_DECODER_CONTEXT  hCtx)

Flush the decoder and discard all pending samples in the samples queue. This function should be used in case of seeking operations.

Parameters
[in]hCtxMPEG-H decoder handle.
Returns
Error code.
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_flushAndGet ( HANDLE_MPEGH_DECODER_CONTEXT  hCtx)

Flush the decoder and push the flushed PCM samples into a samples queue. The decoded PCM samples can then be obtained by calling the mpeghdecoder_getSamples() function. This function should only be used to trigger the output of all pending samples in the EOF/EOS case.

Parameters
[in]hCtxMPEG-H decoder handle.
Returns
Error code.
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_getSamples ( HANDLE_MPEGH_DECODER_CONTEXT  hCtx,
int32_t *  outData,
uint32_t  outLength,
MPEGH_DECODER_OUTPUT_INFO outInfo 
)

Get a decoded audio frame.

Parameters
[in]hCtxMPEG-H decoder handle.
[out]outDataPointer to external output buffer where the decoded PCM samples will be stored into. Needs space to hold up to 3072 samples per rendered output channel.
[in]outLengthSize of external output buffer in samples. Needs space to hold up to 3072 samples per rendered output channel. The amount of valid bytes after invocation, can be otained from the outInfo.
[out]outInfoPointer to an OUTPUT_INFO structure holding information about the current output frame.
Returns
Error code.
MPEGHDEC_EXPORT HANDLE_MPEGH_DECODER_CONTEXT mpeghdecoder_init ( int32_t  cicpSetup)

Open an MPEG-H decoder instance.

Parameters
[in]cicpSetupThe CICP index of the desired target layout.
Returns
MPEG-H decoder handle.
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_process ( HANDLE_MPEGH_DECODER_CONTEXT  hCtx,
const uint8_t *  inData,
uint32_t  inLength,
uint64_t  timestamp 
)

Fill MPEG-H decoder's internal input buffer with bitstream data from the external input buffer and adds the corresponding timestamp to a timestamp queue. Furthermore, it decodes as many frames as possible and pushes the decoded samples into a samples queue. The decoded PCM samples can then be obtained by calling the mpeghdecoder_getSamples() function.

Parameters
[in]hCtxMPEG-H decoder handle.
[in]inDataPointer to external input buffer.
[in]inLengthSize of external input buffer.
[in]timestampPresentation timestamp of the external input buffer (in nano seconds).
Returns
Error code.
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_processTimescale ( HANDLE_MPEGH_DECODER_CONTEXT  hCtx,
const uint8_t *  inData,
uint32_t  inLength,
uint64_t  timestamp,
uint32_t  timescale 
)

Fill MPEG-H decoder's internal input buffer with bitstream data from the external input buffer and adds the corresponding timestamp to a timestamp queue. Furthermore, it decodes as many frames as possible and pushes the decoded samples into a samples queue. The decoded PCM samples can then be obtained by calling the mpeghdecoder_getSamples() function.

Parameters
[in]hCtxMPEG-H decoder handle.
[in]inDataPointer to external input buffer.
[in]inLengthSize of external input buffer.
[in]timestampPresentation timestamp of the external input buffer (in ticks of timescale).
[in]timescaleTimescale of the presentation timestamp.
Returns
Error code.
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_setMhaConfig ( HANDLE_MPEGH_DECODER_CONTEXT  hCtx,
const uint8_t *  config,
uint32_t  configSize 
)

Explicitly configure the decoder by passing the MHA config contained in a binary buffer. This is required for MPEG-H MHA format bitstreams which have no in-band config.

Parameters
[in]hCtxMPEG-H decoder handle.
[in]configPointer to an unsigned char buffer containing the MHA configuration buffer.
[in]configSizeLength of the configuration buffer in bytes.
Returns
Error code.
MPEGHDEC_EXPORT MPEGH_DECODER_ERROR mpeghdecoder_setParam ( HANDLE_MPEGH_DECODER_CONTEXT  hCtx,
MPEGH_DECODER_PARAMETER  param,
int  value 
)

Set decoder parameter.

Parameters
[in]hCtxMPEG-H decoder handle.
[in]paramParameter to be set.
[in]valueParameter value.
Returns
Error code.