]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libamr.c
Generic metadata API.
[ffmpeg] / libavcodec / libamr.c
index 2a7702a64dccd1935cbc123a7ac6615e32cf600d..79ca57ff37dee7c18aa780268bcfa89b7b0b32f5 100644 (file)
@@ -81,9 +81,9 @@
 #include <amrnb/interf_enc.h>
 #endif
 
-static const char *nb_bitrate_unsupported =
+static const char nb_bitrate_unsupported[] =
     "bitrate not supported: use one of 4.75k, 5.15k, 5.9k, 6.7k, 7.4k, 7.95k, 10.2k or 12.2k\n";
-static const char *wb_bitrate_unsupported =
+static const char wb_bitrate_unsupported[] =
     "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, 18.25k, 19.85k, 23.05k, or 23.85k\n";
 
 /* Common code for fixed and float version*/
@@ -112,7 +112,7 @@ static int getBitrateMode(int bitrate)
     {
         if(rates[i].rate==bitrate)
         {
-            return(rates[i].mode);
+            return rates[i].mode;
         }
     }
     /* no bitrate matching, return an error */
@@ -134,6 +134,7 @@ static void amr_decode_fix_avctx(AVCodecContext * avctx)
     }
 
     avctx->frame_size = 160 * is_amr_wb;
+    avctx->sample_fmt = SAMPLE_FMT_S16;
 }
 
 #ifdef CONFIG_LIBAMR_NB_FIXED
@@ -244,10 +245,10 @@ static int amr_nb_decode_close(AVCodecContext * avctx)
 
 static int amr_nb_decode_frame(AVCodecContext * avctx,
             void *data, int *data_size,
-            uint8_t * buf, int buf_size)
+            const uint8_t * buf, int buf_size)
 {
     AMRContext *s = avctx->priv_data;
-    uint8_t*amrData=buf;
+    const uint8_t*amrData=buf;
     int offset=0;
     UWord8 toc, q, ft;
     Word16 serial[SERIAL_FRAMESIZE];   /* coded bits */
@@ -440,10 +441,10 @@ static int amr_nb_encode_close(AVCodecContext * avctx)
 
 static int amr_nb_decode_frame(AVCodecContext * avctx,
             void *data, int *data_size,
-            uint8_t * buf, int buf_size)
+            const uint8_t * buf, int buf_size)
 {
     AMRContext *s = avctx->priv_data;
-    uint8_t*amrData=buf;
+    const uint8_t*amrData=buf;
     static const uint8_t block_size[16]={ 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 };
     enum Mode dec_mode;
     int packet_size;
@@ -503,7 +504,7 @@ AVCodec libamr_nb_decoder =
     NULL,
     amr_nb_decode_close,
     amr_nb_decode_frame,
-    .long_name = "libamr-nb Adaptive Multi-Rate (AMR) Narrow-Band",
+    .long_name = NULL_IF_CONFIG_SMALL("libamr-nb Adaptive Multi-Rate (AMR) Narrow-Band"),
 };
 
 AVCodec libamr_nb_encoder =
@@ -516,7 +517,8 @@ AVCodec libamr_nb_encoder =
     amr_nb_encode_frame,
     amr_nb_encode_close,
     NULL,
-    .long_name = "libamr-nb Adaptive Multi-Rate (AMR) Narrow-Band",
+    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .long_name = NULL_IF_CONFIG_SMALL("libamr-nb Adaptive Multi-Rate (AMR) Narrow-Band"),
 };
 
 #endif
@@ -559,7 +561,7 @@ static int getWBBitrateMode(int bitrate)
     {
         if(rates[i].rate==bitrate)
         {
-            return(rates[i].mode);
+            return rates[i].mode;
         }
     }
     /* no bitrate matching, return an error */
@@ -652,10 +654,10 @@ static int amr_wb_decode_init(AVCodecContext * avctx)
 
 static int amr_wb_decode_frame(AVCodecContext * avctx,
             void *data, int *data_size,
-            uint8_t * buf, int buf_size)
+            const uint8_t * buf, int buf_size)
 {
     AMRWBContext *s = avctx->priv_data;
-    uint8_t*amrData=buf;
+    const uint8_t*amrData=buf;
     int mode;
     int packet_size;
     static const uint8_t block_size[16] = {18, 23, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1};
@@ -697,7 +699,7 @@ AVCodec libamr_wb_decoder =
     NULL,
     amr_wb_decode_close,
     amr_wb_decode_frame,
-    .long_name = "libamr-wb Adaptive Multi-Rate (AMR) Wide-Band",
+    .long_name = NULL_IF_CONFIG_SMALL("libamr-wb Adaptive Multi-Rate (AMR) Wide-Band"),
 };
 
 AVCodec libamr_wb_encoder =
@@ -710,7 +712,8 @@ AVCodec libamr_wb_encoder =
     amr_wb_encode_frame,
     amr_wb_encode_close,
     NULL,
-    .long_name = "libamr-wb Adaptive Multi-Rate (AMR) Wide-Band",
+    .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+    .long_name = NULL_IF_CONFIG_SMALL("libamr-wb Adaptive Multi-Rate (AMR) Wide-Band"),
 };
 
 #endif //CONFIG_LIBAMR_WB