]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mpegaudio.c
remove non portable get/put_be64_double()
[ffmpeg] / libavcodec / mpegaudio.c
index e8bf6f1d216b0307d02301a1ba8037c0c29645c4..190aa1590ce3d8277b5a775e0a788c503dae6780 100644 (file)
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+/**
+ * @file mpegaudio.c
+ * The simplest mpeg audio layer 2 encoder.
+ */
 #include "avcodec.h"
+#include "bitstream.h"
 #include "mpegaudio.h"
 
 /* currently, cannot change these constants (need to modify
@@ -81,8 +88,10 @@ static int MPA_encode_init(AVCodecContext *avctx)
             break;
         }
     }
-    if (i == 3)
+    if (i == 3){
+        av_log(avctx, AV_LOG_ERROR, "Sampling rate %d is not allowed in mp2\n", freq);
         return -1;
+    }
     s->freq_index = i;
 
     /* encoding bitrate & frequency */
@@ -90,8 +99,10 @@ static int MPA_encode_init(AVCodecContext *avctx)
         if (mpa_bitrate_tab[s->lsf][1][i] == bitrate) 
             break;
     }
-    if (i == 15)
+    if (i == 15){
+        av_log(avctx, AV_LOG_ERROR, "bitrate %d is not allowed in mp2\n", bitrate);
         return -1;
+    }
     s->bitrate_index = i;
 
     /* compute total header size & pad bit */
@@ -111,7 +122,7 @@ static int MPA_encode_init(AVCodecContext *avctx)
     s->alloc_table = alloc_tables[table];
 
 #ifdef DEBUG
-    printf("%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n", 
+    av_log(avctx, AV_LOG_DEBUG, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n", 
            bitrate, freq, s->frame_size, table, s->frame_frac_incr);
 #endif
 
@@ -456,7 +467,8 @@ static void compute_scale_factors(unsigned char scale_code[SBLIMIT],
             sf[1] = sf[2] = sf[0];
             break;
         default:
-            av_abort();
+            assert(0); //cant happen
+            code = 0;           /* kill warning */
         }
         
 #if 0
@@ -759,7 +771,7 @@ static int MPA_encode_frame(AVCodecContext *avctx,
     }
     compute_bit_allocation(s, smr, bit_alloc, &padding);
 
-    init_put_bits(&s->pb, frame, MPA_MAX_CODED_FRAME_SIZE, NULL, NULL);
+    init_put_bits(&s->pb, frame, MPA_MAX_CODED_FRAME_SIZE);
 
     encode_frame(s, bit_alloc, padding);
     
@@ -773,6 +785,7 @@ static int MPA_encode_close(AVCodecContext *avctx)
     return 0;
 }
 
+#ifdef CONFIG_MP2_ENCODER
 AVCodec mp2_encoder = {
     "mp2",
     CODEC_TYPE_AUDIO,
@@ -783,5 +796,6 @@ AVCodec mp2_encoder = {
     MPA_encode_close,
     NULL,
 };
+#endif // CONFIG_MP2_ENCODER
 
 #undef FIX