22 #include <vo-amrwbenc/enc_if.h>
33 #define MAX_PACKET_SIZE (1 + (477 + 7) / 8)
55 static const int rates[] = { 6600, 8850, 12650, 14250, 15850, 18250,
56 19850, 23050, 23850 };
57 int i, best = -1, min_diff = 0;
60 for (i = 0; i < 9; i++) {
61 if (rates[i] == bitrate)
63 if (best < 0 || abs(rates[i] - bitrate) < min_diff) {
65 min_diff = abs(rates[i] - bitrate);
69 snprintf(log_buf,
sizeof(log_buf),
"bitrate not supported: use one of ");
70 for (i = 0; i < 9; i++)
71 av_strlcatf(log_buf,
sizeof(log_buf),
"%.2fk, ", rates[i] / 1000.f);
72 av_strlcatf(log_buf,
sizeof(log_buf),
"using %.2fk", rates[best] / 1000.f);
98 s->
state = E_IF_init();
115 const int16_t *samples = (
const int16_t *)frame->
data[0];
140 .
name =
"libvo_amrwbenc",
142 "(Adaptive Multi-Rate Wide-Band)"),
This structure describes decoded (raw) audio or video data.
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t bit_rate
the average bitrate
#define LIBAVUTIL_VERSION_INT
Memory handling functions.
static av_cold int init(AVCodecContext *avctx)
#define AV_OPT_FLAG_AUDIO_PARAM
static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
static const AVClass amrwb_class
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
#define FF_COMPLIANCE_UNOFFICIAL
Allow unofficial extensions.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int initial_padding
Audio only.
const char * name
Name of the codec implementation.
common internal API header
static int get_wb_bitrate_mode(int bitrate, void *log_ctx)
int frame_size
Number of samples per channel in an audio frame.
Libavcodec external API header.
AVSampleFormat
Audio sample formats.
int sample_rate
samples per second
main external API structure.
Describe the class of an AVClass context structure.
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static const AVOption options[]
common internal api header.
static int amr_wb_encode_close(AVCodecContext *avctx)
static av_cold int amr_wb_encode_init(AVCodecContext *avctx)
int channels
number of audio channels
static enum AVSampleFormat sample_fmts[]
static av_always_inline int64_t ff_samples_to_time_base(AVCodecContext *avctx, int64_t samples)
Rescale from sample rate to AVCodecContext.time_base.
This structure stores compressed data.
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
AVCodec ff_libvo_amrwbenc_encoder
#define AV_NOPTS_VALUE
Undefined timestamp value.