diff options
Diffstat (limited to 'libavcodec/wmaenc.c')
-rw-r--r-- | libavcodec/wmaenc.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c index 35dac73149..7fb84794f5 100644 --- a/libavcodec/wmaenc.c +++ b/libavcodec/wmaenc.c @@ -2,26 +2,27 @@ * WMA compatible encoder * Copyright (c) 2007 Michael Niedermayer * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" #include "internal.h" #include "wma.h" +#include "libavutil/avassert.h" #undef NDEBUG #include <assert.h> @@ -370,10 +371,8 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt, } } - if ((ret = ff_alloc_packet(avpkt, 2 * MAX_CODED_SUPERFRAME_SIZE))) { - av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n"); + if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * MAX_CODED_SUPERFRAME_SIZE))) return ret; - } #if 1 total_gain= 128; @@ -400,16 +399,15 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt, } #endif - if ((i = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain)) >= 0) { - av_log(avctx, AV_LOG_ERROR, "required frame size too large. please " - "use a higher bit rate.\n"); - return AVERROR(EINVAL); - } - assert((put_bits_count(&s->pb) & 7) == 0); - while (i++) + encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain); + av_assert0((put_bits_count(&s->pb) & 7) == 0); + i= s->block_align - (put_bits_count(&s->pb)+7)/8; + av_assert0(i>=0); + while(i--) put_bits(&s->pb, 8, 'N'); flush_put_bits(&s->pb); + av_assert0(put_bits_ptr(&s->pb) - s->pb.buf == s->block_align); if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); @@ -419,6 +417,7 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt, return 0; } +#if CONFIG_WMAV1_ENCODER AVCodec ff_wmav1_encoder = { .name = "wmav1", .type = AVMEDIA_TYPE_AUDIO, @@ -431,7 +430,8 @@ AVCodec ff_wmav1_encoder = { AV_SAMPLE_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"), }; - +#endif +#if CONFIG_WMAV2_ENCODER AVCodec ff_wmav2_encoder = { .name = "wmav2", .type = AVMEDIA_TYPE_AUDIO, @@ -444,3 +444,4 @@ AVCodec ff_wmav2_encoder = { AV_SAMPLE_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"), }; +#endif |