]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libvo-amrwbenc.c
mpegts: Add support for Sections in PMT
[ffmpeg] / libavcodec / libvo-amrwbenc.c
index d3db5f847adbcaccc477427dcac9d28dc74de9f0..f39317e1de515210db6c536a0925ff353dc57308 100644 (file)
 
 #include "avcodec.h"
 #include "libavutil/avstring.h"
+#include "libavutil/opt.h"
 
 typedef struct AMRWBContext {
+    AVClass *av_class;
     void  *state;
     int    mode;
     int    last_bitrate;
     int    allow_dtx;
 } AMRWBContext;
 
+static const AVOption options[] = {
+    { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRWBContext, allow_dtx), AV_OPT_TYPE_INT, { 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+    { NULL }
+};
+
+static const AVClass class = {
+    "libvo_amrwbenc", av_default_item_name, options, LIBAVUTIL_VERSION_INT
+};
+
 static int get_wb_bitrate_mode(int bitrate, void *log_ctx)
 {
     /* make the correspondance between bitrate and mode */
@@ -78,7 +89,6 @@ static av_cold int amr_wb_encode_init(AVCodecContext *avctx)
     avctx->coded_frame = avcodec_alloc_frame();
 
     s->state     = E_IF_init();
-    s->allow_dtx = 0;
 
     return 0;
 }
@@ -108,16 +118,16 @@ static int amr_wb_encode_frame(AVCodecContext *avctx,
 }
 
 AVCodec ff_libvo_amrwbenc_encoder = {
-    "libvo_amrwbenc",
-    CODEC_TYPE_AUDIO,
-    CODEC_ID_AMR_WB,
-    sizeof(AMRWBContext),
-    amr_wb_encode_init,
-    amr_wb_encode_frame,
-    amr_wb_encode_close,
-    NULL,
+    .name           = "libvo_amrwbenc",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_AMR_WB,
+    .priv_data_size = sizeof(AMRWBContext),
+    .init           = amr_wb_encode_init,
+    .encode         = amr_wb_encode_frame,
+    .close          = amr_wb_encode_close,
     .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn Adaptive Multi-Rate "
                                       "(AMR) Wide-Band"),
+    .priv_class = &class,
 };