mirror of https://git.ffmpeg.org/ffmpeg.git
qdm2: decode directly to the user-provided AVFrame
This commit is contained in:
parent
1b9b6d6e5e
commit
e01e1a4673
|
@ -130,8 +130,6 @@ typedef struct {
|
|||
* 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
|
||||
|
@ -1841,9 +1839,6 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
|
|||
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
|
||||
avcodec_get_frame_defaults(&s->frame);
|
||||
avctx->coded_frame = &s->frame;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1921,6 +1916,7 @@ static int qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out)
|
|||
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;
|
||||
|
@ -1933,12 +1929,12 @@ static int qdm2_decode_frame(AVCodecContext *avctx, void *data,
|
|||
return -1;
|
||||
|
||||
/* get output buffer */
|
||||
s->frame.nb_samples = 16 * s->frame_size;
|
||||
if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
|
||||
frame->nb_samples = 16 * s->frame_size;
|
||||
if ((ret = ff_get_buffer(avctx, frame)) < 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)
|
||||
|
@ -1947,7 +1943,6 @@ static int qdm2_decode_frame(AVCodecContext *avctx, void *data,
|
|||
}
|
||||
|
||||
*got_frame_ptr = 1;
|
||||
*(AVFrame *)data = s->frame;
|
||||
|
||||
return s->checksum_size;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue