22 #include <vo-amrwbenc/enc_if.h>
48 static const int rates[] = { 6600, 8850, 12650, 14250, 15850, 18250,
49 19850, 23050, 23850 };
50 int i, best = -1, min_diff = 0;
53 for (i = 0; i < 9; i++) {
54 if (rates[i] == bitrate)
56 if (best < 0 || abs(rates[i] - bitrate) < min_diff) {
58 min_diff = abs(rates[i] - bitrate);
62 snprintf(log_buf,
sizeof(log_buf),
"bitrate not supported: use one of ");
63 for (i = 0; i < 9; i++)
64 av_strlcatf(log_buf,
sizeof(log_buf),
"%.2fk, ", rates[i] / 1000.
f);
65 av_strlcatf(log_buf,
sizeof(log_buf),
"using %.2fk", rates[best] / 1000.
f);
91 s->
state = E_IF_init();
106 unsigned char *frame,
107 int buf_size,
void *
data)
121 .
name =
"libvo_amrwbenc",
131 .priv_class = &
class,
#define AV_OPT_FLAG_AUDIO_PARAM
AVFrame * coded_frame
the picture in the bitstream
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
struct AMRWBContext AMRWBContext
static const AVOption options[]
static int init(AVCodecParserContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
AVFrame * avcodec_alloc_frame(void)
Allocate an AVFrame and set its fields to default values.
static int get_wb_bitrate_mode(int bitrate, void *log_ctx)
int bit_rate
the average bitrate
int frame_size
Samples per packet, initialized when calling 'init'.
int sample_rate
samples per second
main external API structure.
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Describe the class of an AVClass context structure.
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
static int amr_wb_encode_frame(AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data)
AVSampleFormat
all in native-endian format
static int amr_wb_encode_close(AVCodecContext *avctx)
static av_cold int amr_wb_encode_init(AVCodecContext *avctx)
int channels
number of audio channels
AVCodec ff_libvo_amrwbenc_encoder