Revision 651b276e

View differences:

libavcodec/libopencore-amr.c
21 21

  
22 22
#include "avcodec.h"
23 23
#include "libavutil/avstring.h"
24
#include "libavutil/opt.h"
24 25

  
25 26
static void amr_decode_fix_avctx(AVCodecContext *avctx)
26 27
{
......
77 78
}
78 79

  
79 80
typedef struct AMRContext {
81
    AVClass *av_class;
80 82
    int   frame_count;
81 83
    void *dec_state;
82 84
    void *enc_state;
83 85
    int   enc_bitrate;
84 86
    int   enc_mode;
87
    int   enc_dtx;
85 88
} AMRContext;
86 89

  
90
static const AVOption options[] = {
91
    { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRContext, enc_dtx), FF_OPT_TYPE_INT, 0, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
92
    { NULL }
93
};
94

  
95
static const AVClass class = {
96
    "libopencore_amrnb", av_default_item_name, options, LIBAVUTIL_VERSION_INT
97
};
98

  
87 99
static av_cold int amr_nb_decode_init(AVCodecContext *avctx)
88 100
{
89 101
    AMRContext *s  = avctx->priv_data;
......
176 188
    avctx->frame_size  = 160;
177 189
    avctx->coded_frame = avcodec_alloc_frame();
178 190

  
179
    s->enc_state = Encoder_Interface_init(0);
191
    s->enc_state = Encoder_Interface_init(s->enc_dtx);
180 192
    if (!s->enc_state) {
181 193
        av_log(avctx, AV_LOG_ERROR, "Encoder_Interface_init error\n");
182 194
        return -1;
......
228 240
    NULL,
229 241
    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
230 242
    .long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Narrow-Band"),
243
    .priv_class = &class,
231 244
};
232 245

  
233 246
#endif
libavcodec/libvo-amrwbenc.c
23 23

  
24 24
#include "avcodec.h"
25 25
#include "libavutil/avstring.h"
26
#include "libavutil/opt.h"
26 27

  
27 28
typedef struct AMRWBContext {
29
    AVClass *av_class;
28 30
    void  *state;
29 31
    int    mode;
30 32
    int    last_bitrate;
31 33
    int    allow_dtx;
32 34
} AMRWBContext;
33 35

  
36
static const AVOption options[] = {
37
    { "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 },
38
    { NULL }
39
};
40

  
41
static const AVClass class = {
42
    "libvo_amrwbenc", av_default_item_name, options, LIBAVUTIL_VERSION_INT
43
};
44

  
34 45
static int get_wb_bitrate_mode(int bitrate, void *log_ctx)
35 46
{
36 47
    /* make the correspondance between bitrate and mode */
......
78 89
    avctx->coded_frame = avcodec_alloc_frame();
79 90

  
80 91
    s->state     = E_IF_init();
81
    s->allow_dtx = 0;
82 92

  
83 93
    return 0;
84 94
}
......
119 129
    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
120 130
    .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn Adaptive Multi-Rate "
121 131
                                      "(AMR) Wide-Band"),
132
    .priv_class = &class,
122 133
};
123 134

  

Also available in: Unified diff