22#include <vo-amrwbenc/enc_if.h>
33#define MAX_PACKET_SIZE (1 + (477 + 7) / 8)
49 .class_name =
"libvo_amrwbenc",
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++) {
72 snprintf(log_buf,
sizeof(log_buf),
"bitrate not supported: use one of ");
73 for (
i = 0;
i < 9;
i++)
101 s->state = E_IF_init();
118 const int16_t *samples = (
const int16_t *)
frame->data[0];
124 if (
s->last_bitrate != avctx->
bit_rate) {
128 size = E_IF_encode(
s->state,
s->mode, samples, avpkt->
data,
s->allow_dtx);
143 .p.name =
"libvo_amrwbenc",
144 CODEC_LONG_NAME(
"Android VisualOn AMR-WB (Adaptive Multi-Rate Wide-Band)"),
150 .p.wrapper_name =
"libvo_amrwbenc",
const FFCodec ff_libvo_amrwbenc_encoder
Libavcodec external API header.
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
#define i(width, name, range_min, range_max)
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define CODEC_SAMPLEFMTS(...)
#define FF_COMPLIANCE_UNOFFICIAL
Allow unofficial extensions.
int(* init)(AVBSFContext *ctx)
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and allocate data.
static av_always_inline int64_t ff_samples_to_time_base(const AVCodecContext *avctx, int64_t samples)
Rescale from sample rate to AVCodecContext.time_base.
#define AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_SAMPLE_FMT_S16
signed 16 bits
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define LIBAVUTIL_VERSION_INT
common internal API header
static int get_wb_bitrate_mode(int bitrate, void *log_ctx)
static const AVClass amrwb_class
static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
static av_cold int amr_wb_encode_init(AVCodecContext *avctx)
static int amr_wb_encode_close(AVCodecContext *avctx)
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
int64_t bit_rate
the average bitrate
int initial_padding
Audio only.
int sample_rate
samples per second
int frame_size
Number of samples per channel in an audio frame.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...