X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fdpcm.c;h=5ab2331601df571f4d0550c865caadbce1a0973f;hb=67bc1ba5d75953d136bfa02ce6c0a27e9fd9dac3;hp=fb1c7ce6f20fef43ef807175831b75859b9ecb3d;hpb=0fd1ddf15545a7bac1e8d2622d070fdf4bad95d8;p=ffmpeg diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index fb1c7ce6f20..5ab2331601d 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -40,10 +40,10 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" #include "bytestream.h" +#include "internal.h" #include "mathops.h" typedef struct DPCMContext { - AVFrame frame; int16_t roq_square_array[256]; int sample[2]; ///< previous sample (for SOL_DPCM) const int8_t *sol_table; ///< delta table for SOL_DPCM @@ -162,9 +162,6 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx) else avctx->sample_fmt = AV_SAMPLE_FMT_S16; - avcodec_get_frame_defaults(&s->frame); - avctx->coded_frame = &s->frame; - return 0; } @@ -174,6 +171,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, { int buf_size = avpkt->size; DPCMContext *s = avctx->priv_data; + AVFrame *frame = data; int out = 0, ret; int predictor[2]; int ch = 0; @@ -209,12 +207,12 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, } /* get output buffer */ - s->frame.nb_samples = out / avctx->channels; - if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { + frame->nb_samples = out / avctx->channels; + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } - output_samples = (int16_t *)s->frame.data[0]; + output_samples = (int16_t *)frame->data[0]; samples_end = output_samples + out; switch(avctx->codec->id) { @@ -294,7 +292,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, } case AV_CODEC_ID_SOL_DPCM: if (avctx->codec_tag != 3) { - uint8_t *output_samples_u8 = s->frame.data[0], + uint8_t *output_samples_u8 = frame->data[0], *samples_end_u8 = output_samples_u8 + out; while (output_samples_u8 < samples_end_u8) { int n = bytestream2_get_byteu(&gb); @@ -321,8 +319,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, break; } - *got_frame_ptr = 1; - *(AVFrame *)data = s->frame; + *got_frame_ptr = 1; return avpkt->size; } @@ -330,13 +327,13 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, #define DPCM_DECODER(id_, name_, long_name_) \ AVCodec ff_ ## name_ ## _decoder = { \ .name = #name_, \ + .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ .type = AVMEDIA_TYPE_AUDIO, \ .id = id_, \ .priv_data_size = sizeof(DPCMContext), \ .init = dpcm_decode_init, \ .decode = dpcm_decode_frame, \ .capabilities = CODEC_CAP_DR1, \ - .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ } DPCM_DECODER(AV_CODEC_ID_INTERPLAY_DPCM, interplay_dpcm, "DPCM Interplay");