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();
112 const AVFrame *frame,
int *got_packet_ptr)
115 const int16_t *samples = (
const int16_t *)frame->
data[0];
142 .
name =
"libvo_amrwbenc",
144 "(Adaptive Multi-Rate Wide-Band)"),
153 .priv_class = &
class,
This structure describes decoded (raw) audio or video data.
#define AV_LOG_WARNING
Something somehow does not look correct.
memory handling functions
#define AV_OPT_FLAG_AUDIO_PARAM
static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static const AVOption options[]
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
#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. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
common internal API header
static int get_wb_bitrate_mode(int bitrate, void *log_ctx)
int bit_rate
the average bitrate
int ff_alloc_packet(AVPacket *avpkt, int size)
Check AVPacket size and/or allocate data.
if(ac->has_optimized_func)
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.
static void close(AVCodecParserContext *s)
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.
common internal api header.
static int amr_wb_encode_close(AVCodecContext *avctx)
static av_cold int init(AVCodecParserContext *s)
static av_cold int amr_wb_encode_init(AVCodecContext *avctx)
int channels
number of audio channels
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.
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.