diff options
author | Martin Storsjö <martin@martin.st> | 2011-04-13 21:47:12 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2011-04-14 00:31:39 +0300 |
commit | 651b276ef7ad8d89e89bfc94a4232ab6c36f3a8a (patch) | |
tree | 85f9373af0018e4184a6817dfc73dac516a28a6b /libavcodec/libvo-amrwbenc.c | |
parent | 3dd82afc748df0f1c49b76e1cd4ea6e35b1001a5 (diff) | |
download | ffmpeg-651b276ef7ad8d89e89bfc94a4232ab6c36f3a8a.tar.gz |
libopencore-amr, libvo-amrwbenc: Allow enabling DTX via private AVOptions
DTX, discontinuous transmission, allows emitting frames with
comfort noise when no voice is detected in the input audio.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/libvo-amrwbenc.c')
-rw-r--r-- | libavcodec/libvo-amrwbenc.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c index d3db5f847a..d8a6099561 100644 --- a/libavcodec/libvo-amrwbenc.c +++ b/libavcodec/libvo-amrwbenc.c @@ -23,14 +23,25 @@ #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), FF_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; } @@ -119,5 +129,6 @@ AVCodec ff_libvo_amrwbenc_encoder = { .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, }; |