X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Froqaudioenc.c;h=402eb78be58ae52c1687fa2a728508503a2fba25;hb=9a738c27dceb4b975784b23213a46f5cb560d1c2;hp=609beffb4b4bf754286a22cd12661624464638d2;hpb=32173df3d226cffd6413d57aa7e8630a6f12b871;p=ffmpeg diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c index 609beffb4b4..402eb78be58 100644 --- a/libavcodec/roqaudioenc.c +++ b/libavcodec/roqaudioenc.c @@ -21,10 +21,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavutil/intmath.h" #include "avcodec.h" #include "bytestream.h" #include "internal.h" +#include "mathops.h" #define ROQ_FRAME_SIZE 735 #define ROQ_HEADER_SIZE 8 @@ -46,9 +46,6 @@ static av_cold int roq_dpcm_encode_close(AVCodecContext *avctx) { ROQDPCMContext *context = avctx->priv_data; -#if FF_API_OLD_ENCODE_AUDIO - av_freep(&avctx->coded_frame); -#endif av_freep(&context->frame_buffer); return 0; @@ -81,14 +78,6 @@ static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx) context->lastSample[0] = context->lastSample[1] = 0; -#if FF_API_OLD_ENCODE_AUDIO - avctx->coded_frame= avcodec_alloc_frame(); - if (!avctx->coded_frame) { - ret = AVERROR(ENOMEM); - goto error; - } -#endif - return 0; error: roq_dpcm_encode_close(avctx); @@ -158,15 +147,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; @@ -204,13 +194,14 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, AVCodec ff_roq_dpcm_encoder = { .name = "roq_dpcm", + .long_name = NULL_IF_CONFIG_SMALL("id RoQ DPCM"), .type = AVMEDIA_TYPE_AUDIO, - .id = CODEC_ID_ROQ_DPCM, + .id = AV_CODEC_ID_ROQ_DPCM, .priv_data_size = sizeof(ROQDPCMContext), .init = roq_dpcm_encode_init, .encode2 = roq_dpcm_encode_frame, .close = roq_dpcm_encode_close, .capabilities = CODEC_CAP_DELAY, - .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, - .long_name = NULL_IF_CONFIG_SMALL("id RoQ DPCM"), + .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, + AV_SAMPLE_FMT_NONE }, };