22 #include <vo-amrwbenc/enc_if.h> 33 #define MAX_PACKET_SIZE (1 + (477 + 7) / 8) 58 static const int rates[] = { 6600, 8850, 12650, 14250, 15850, 18250,
59 19850, 23050, 23850 };
60 int i, best = -1, min_diff = 0;
63 for (i = 0; i < 9; i++) {
64 if (rates[i] == bitrate)
66 if (best < 0 ||
abs(rates[i] - bitrate) < min_diff) {
68 min_diff =
abs(rates[i] - bitrate);
72 snprintf(log_buf,
sizeof(log_buf),
"bitrate not supported: use one of ");
73 for (i = 0; i < 9; i++)
74 av_strlcatf(log_buf,
sizeof(log_buf),
"%.2fk, ", rates[i] / 1000.
f);
75 av_strlcatf(log_buf,
sizeof(log_buf),
"using %.2fk", rates[best] / 1000.
f);
101 s->
state = E_IF_init();
118 const int16_t *
samples = (
const int16_t *)frame->
data[0];
143 .
name =
"libvo_amrwbenc",
145 "(Adaptive Multi-Rate Wide-Band)"),
155 .wrapper_name =
"libvo_amrwbenc",
AMRWBFrame frame
AMRWB parameters decoded from bitstream.
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
const char * av_default_item_name(void *ptr)
Return the context name.
static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
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,...)
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[]
Filter the word “frame” indicates either a video frame or a group of audio samples
static av_always_inline int64_t ff_samples_to_time_base(AVCodecContext *avctx, int64_t samples)
Rescale from sample rate to AVCodecContext.time_base.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
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.