]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mpegaudioenc.c
Use a variable instead of a repeated calculation when decoding AVUI.
[ffmpeg] / libavcodec / mpegaudioenc.c
index 1f9516d2e9ed62a27dd686ea94204a710acb1cc8..4dc050f3e8e4109ac104205c8c6d9f50eef3e288 100644 (file)
@@ -751,10 +751,8 @@ static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     }
     compute_bit_allocation(s, smr, bit_alloc, &padding);
 
-    if ((ret = ff_alloc_packet(avpkt, MPA_MAX_CODED_FRAME_SIZE))) {
-        av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+    if ((ret = ff_alloc_packet2(avctx, avpkt, MPA_MAX_CODED_FRAME_SIZE)))
         return ret;
-    }
 
     init_put_bits(&s->pb, avpkt->data, avpkt->size);
 
@@ -782,15 +780,18 @@ static const AVCodecDefault mp2_defaults[] = {
 };
 
 AVCodec ff_mp2_encoder = {
-    .name           = "mp2",
-    .type           = AVMEDIA_TYPE_AUDIO,
-    .id             = CODEC_ID_MP2,
-    .priv_data_size = sizeof(MpegAudioContext),
-    .init           = MPA_encode_init,
-    .encode2        = MPA_encode_frame,
-    .close          = MPA_encode_close,
-    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
-    .supported_samplerates= (const int[]){44100, 48000,  32000, 22050, 24000, 16000, 0},
-    .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
-    .defaults       = mp2_defaults,
+    .name                  = "mp2",
+    .type                  = AVMEDIA_TYPE_AUDIO,
+    .id                    = CODEC_ID_MP2,
+    .priv_data_size        = sizeof(MpegAudioContext),
+    .init                  = MPA_encode_init,
+    .encode2               = MPA_encode_frame,
+    .close                 = MPA_encode_close,
+    .sample_fmts           = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+                                                            AV_SAMPLE_FMT_NONE },
+    .supported_samplerates = (const int[]){
+        44100, 48000,  32000, 22050, 24000, 16000, 0
+    },
+    .long_name             = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
+    .defaults              = mp2_defaults,
 };