#include <stdio.h>
#define BITSTREAM_READER_LE
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "get_bits.h"
-#include "dsputil.h"
+#include "internal.h"
#include "rdft.h"
#include "mpegaudiodsp.h"
#include "mpegaudio.h"
* QDM2 decoder context
*/
typedef struct {
- AVFrame frame;
-
/// Parameters from codec header, do not change during playback
int nb_channels; ///< number of channels
int channels; ///< number of channels
for (i = 0; packet_bytes > 0; i++) {
int j;
+ if (i >= FF_ARRAY_ELEMS(q->sub_packet_list_A)) {
+ SAMPLES_NEEDED_2("too many packet bytes");
+ return;
+ }
+
q->sub_packet_list_A[i].next = NULL;
if (i > 0) {
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
- avcodec_get_frame_defaults(&s->frame);
- avctx->coded_frame = &s->frame;
-
return 0;
}
static int qdm2_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
+ AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
QDM2Context *s = avctx->priv_data;
return -1;
/* get output buffer */
- s->frame.nb_samples = 16 * s->frame_size;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ frame->nb_samples = 16 * s->frame_size;
+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- out = (int16_t *)s->frame.data[0];
+ out = (int16_t *)frame->data[0];
for (i = 0; i < 16; i++) {
if (qdm2_decode(s, buf, out) < 0)
out += s->channels * s->frame_size;
}
- *got_frame_ptr = 1;
- *(AVFrame *)data = s->frame;
+ *got_frame_ptr = 1;
return s->checksum_size;
}