X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Froqaudioenc.c;h=f687f5cd9d9294737a84b2136679eba9d381143f;hb=b4bb9593834460bbbe0e70823f2c503cb01ad052;hp=f97d5d6e0ce1d59f4ef427a419dc1bafa090166c;hpb=b2bed9325dbd6be0da1d91ffed3f513c40274fd2;p=ffmpeg diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c index f97d5d6e0ce..f687f5cd9d9 100644 --- a/libavcodec/roqaudioenc.c +++ b/libavcodec/roqaudioenc.c @@ -32,8 +32,7 @@ #define MAX_DPCM (127*127) -typedef struct -{ +typedef struct ROQDPCMContext { short lastSample[2]; int input_frames; int buffered_samples; @@ -147,15 +146,16 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, context->input_frames++; return 0; } - in = context->frame_buffer; } + if (context->input_frames < 8) + in = context->frame_buffer; if (stereo) { context->lastSample[0] &= 0xFF00; context->lastSample[1] &= 0xFF00; } - if (context->input_frames == 7 || !in) + if (context->input_frames == 7) data_size = avctx->channels * context->buffered_samples; else data_size = avctx->channels * avctx->frame_size; @@ -200,7 +200,7 @@ AVCodec ff_roq_dpcm_encoder = { .init = roq_dpcm_encode_init, .encode2 = roq_dpcm_encode_frame, .close = roq_dpcm_encode_close, - .capabilities = CODEC_CAP_DELAY, + .capabilities = AV_CODEC_CAP_DELAY, .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, };