Go to the documentation of this file.
33 #include <mpeghdec/mpeghdecoder.h>
42 #define MAX_LOST_FRAMES 2
44 #define PER_CHANNEL_OUTBUF_SIZE (3072 * (MAX_LOST_FRAMES + 1))
60 mpeghdecoder_destroy(
s->decoder);
72 #define CH_LAYOUT_7POINT2POINT3 AV_CH_LAYOUT_5POINT1POINT2 | AV_CH_SIDE_SURROUND_LEFT | \
73 AV_CH_SIDE_SURROUND_RIGHT | AV_CH_TOP_BACK_CENTER | \
75 #define CH_LAYOUT_5POINT1POINT6 AV_CH_LAYOUT_5POINT1POINT4_BACK | \
76 AV_CH_TOP_FRONT_CENTER | AV_CH_TOP_CENTER
77 #define CH_LAYOUT_7POINT1POINT6 AV_CH_LAYOUT_7POINT1POINT4_BACK | \
78 AV_CH_TOP_FRONT_CENTER | AV_CH_TOP_CENTER
79 static const uint64_t channel_layout_masks[] = {
93 if (channel_layout_masks[
i]) {
125 s->decoder_buffer =
av_malloc_array(
s->decoder_buffer_size,
sizeof(*
s->decoder_buffer));
126 if (!
s->decoder_buffer)
130 s->decoder = mpeghdecoder_init(cicp);
131 if (
s->decoder ==
NULL) {
137 if (mpeghdecoder_setMhaConfig(
s->decoder, avctx->
extradata,
148 int *got_frame_ptr,
AVPacket *avpkt)
152 MPEGH_DECODER_ERROR err;
153 MPEGH_DECODER_OUTPUT_INFO out_info;
161 if ((err = mpeghdecoder_processTimescale(
s->decoder, avpkt->
data,
170 err = mpeghdecoder_flushAndGet(
s->decoder);
172 if (err != MPEGH_DEC_OK && err != MPEGH_DEC_FEED_DATA)
174 "mpeghdecoder_flushAndGet() failed: %d\n", err);
177 err = mpeghdecoder_getSamples(
s->decoder,
s->decoder_buffer,
178 s->decoder_buffer_size,
180 if (err == MPEGH_DEC_FEED_DATA) {
189 frame->nb_samples = out_info.numSamplesPerChannel;
191 frame->pts = out_info.ticks;
192 frame->time_base.num = 1;
193 frame->time_base.den = out_info.sampleRate;
198 memcpy(
frame->extended_data[0],
s->decoder_buffer,
200 sizeof(*
s->decoder_buffer) );
208 MPEGH_DECODER_ERROR err;
211 err = mpeghdecoder_flush(
s->decoder);
213 if (err != MPEGH_DEC_OK && err != MPEGH_DEC_FEED_DATA)
218 .
p.
name =
"libmpeghdec",
230 .p.wrapper_name =
"libmpeghdec",
#define AV_CH_LAYOUT_6POINT1
#define AV_LOG_WARNING
Something somehow does not look correct.
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int sample_rate
samples per second
#define AV_CH_LAYOUT_MONO
static av_cold int channel_layout_to_cicp(const AVChannelLayout *layout)
This structure describes decoded (raw) audio or video data.
int decoder_buffer_size
in samples
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
int nb_channels
Number of channels in this layout.
static int mpegh3dadec_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
@ AV_CODEC_ID_MPEGH_3D_AUDIO
AVCodec p
The public AVCodec.
AVChannelLayout ch_layout
Audio channel layout.
#define AV_CH_LAYOUT_5POINT1POINT4_BACK
#define AV_CH_LAYOUT_STEREO
#define CH_LAYOUT_5POINT1POINT6
#define AV_CH_LAYOUT_7POINT1POINT4_BACK
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
HANDLE_MPEGH_DECODER_CONTEXT decoder
#define AV_CH_LAYOUT_22POINT2
#define FF_CODEC_DECODE_CB(func)
int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
#define CODEC_LONG_NAME(str)
static av_cold int mpegh3dadec_close(AVCodecContext *avctx)
const FFCodec ff_libmpeghdec_decoder
#define AV_CH_LAYOUT_5POINT1
static av_cold int mpegh3dadec_init(AVCodecContext *avctx)
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
An AVChannelLayout holds information about the channel layout of audio data.
enum AVSampleFormat sample_fmt
audio sample format
#define AVERROR_EXTERNAL
Generic error in an external library.
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
#define AV_CH_LAYOUT_5POINT0
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
#define av_malloc_array(a, b)
#define AV_CH_LAYOUT_7POINT1
#define AV_CH_LAYOUT_7POINT1_WIDE
const char * name
Name of the codec implementation.
#define CH_LAYOUT_7POINT2POINT3
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define AV_CH_LAYOUT_SURROUND
main external API structure.
#define CH_LAYOUT_7POINT1POINT6
#define AV_CH_LAYOUT_5POINT1POINT2
static av_cold void mpegh3dadec_flush(AVCodecContext *avctx)
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
This structure stores compressed data.
#define AV_CH_LAYOUT_4POINT0
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
@ AV_SAMPLE_FMT_S32
signed 32 bits
#define PER_CHANNEL_OUTBUF_SIZE