]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavcodec/mpegaudioenc.c
frsh: Export information about the last RTP contract and VRES
[frescor/ffmpeg.git] / libavcodec / mpegaudioenc.c
index 69d5243db8d96de2f38a4bd4a7b57d026ee7aa80..de3081e2bf584371d50d7813113060a44807103e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * The simplest mpeg audio layer 2 encoder
- * Copyright (c) 2000, 2001 Fabrice Bellard.
+ * Copyright (c) 2000, 2001 Fabrice Bellard
  *
  * This file is part of FFmpeg.
  *
  */
 
 /**
- * @file mpegaudio.c
+ * @file libavcodec/mpegaudio.c
  * The simplest mpeg audio layer 2 encoder.
  */
 
 #include "avcodec.h"
-#include "bitstream.h"
+#include "put_bits.h"
+
+#undef  CONFIG_MPEGAUDIO_HP
+#define CONFIG_MPEGAUDIO_HP 0
 #include "mpegaudio.h"
 
 /* currently, cannot change these constants (need to modify
@@ -387,7 +390,7 @@ static void compute_scale_factors(unsigned char scale_code[SBLIMIT],
                     vmax = v;
             }
             /* compute the scale factor index using log 2 computations */
-            if (vmax > 0) {
+            if (vmax > 1) {
                 n = av_log2(vmax);
                 /* n is the position of the MSB of vmax. now
                    use at most 2 compares to find the index */
@@ -540,7 +543,7 @@ static void compute_bit_allocation(MpegAudioContext *s,
         /* look for the subband with the largest signal to mask ratio */
         max_sb = -1;
         max_ch = -1;
-        max_smr = 0x80000000;
+        max_smr = INT_MIN;
         for(ch=0;ch<s->nb_channels;ch++) {
             for(i=0;i<s->sblimit;i++) {
                 if (smr[ch][i] > max_smr && subband_status[ch][i] != SB_NOMORE) {
@@ -778,7 +781,7 @@ static int MPA_encode_frame(AVCodecContext *avctx,
     encode_frame(s, bit_alloc, padding);
 
     s->nb_samples += MPA_FRAME_SIZE;
-    return pbBufPtr(&s->pb) - s->pb.buf;
+    return put_bits_ptr(&s->pb) - s->pb.buf;
 }
 
 static av_cold int MPA_encode_close(AVCodecContext *avctx)
@@ -796,7 +799,8 @@ AVCodec mp2_encoder = {
     MPA_encode_frame,
     MPA_encode_close,
     NULL,
-    .long_name = "MP2 (MPEG audio layer 2)",
+    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
 };
 
 #undef FIX