63 avctx->
delay = 512 - 32 + 1;
65 s->
glopts = twolame_init();
81 twolame_set_VBR(s->
glopts, TRUE);
82 twolame_set_VBR_level(s->
glopts,
85 "VBR in MP2 is a hack, use another codec that supports it.\n");
90 ret = twolame_init_params(s->
glopts);
100 const AVFrame *frame,
int *got_packet_ptr)
111 ret = twolame_encode_buffer_float32_interleaved(s->
glopts,
112 (
const float *)frame->
data[0],
118 ret = twolame_encode_buffer_float32(s->
glopts,
119 (
const float *)frame->
data[0],
120 (
const float *)frame->
data[1],
125 ret = twolame_encode_buffer_interleaved(s->
glopts,
126 (
const short int *)frame->
data[0],
131 ret = twolame_encode_buffer(s->
glopts,
132 (
const short int *)frame->
data[0],
133 (
const short int *)frame->
data[1],
139 "Unsupported sample format %d.\n", avctx->
sample_fmt);
167 #define OFFSET(x) offsetof(TWOLAMEContext, x)
168 #define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
170 {
"mode",
"Mpeg Mode",
OFFSET(mode),
AV_OPT_TYPE_INT, { .i64 = TWOLAME_AUTO_MODE }, TWOLAME_AUTO_MODE, TWOLAME_MONO,
AE,
"mode"},
178 {
"error_protection",
"enable CRC error protection",
OFFSET(error_protection),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
AE},
181 {
"verbosity",
"set library optput level (0-10)",
OFFSET(verbosity),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 10,
AE},
198 16000, 22050, 24000, 32000, 44100, 48000, 0
202 .
name =
"libtwolame",
212 .priv_class = &twolame_class,
220 .channel_layouts = (
const uint64_t[]) {
#define MPA_MAX_CODED_FRAME_SIZE
This structure describes decoded (raw) audio or video data.
static av_cold int twolame_encode_init(AVCodecContext *avctx)
#define AV_LOG_WARNING
Something somehow does not look correct.
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
#define AV_CH_LAYOUT_STEREO
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
AVCodec ff_libtwolame_encoder
static const AVCodecDefault twolame_defaults[]
enum AVSampleFormat sample_fmt
audio sample format
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static const int twolame_samplerates[]
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const AVCodecDefault defaults[]
#define CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define CODEC_FLAG_QSCALE
Use fixed qscale.
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static const AVOption options[]
int bit_rate
the average bitrate
int ff_alloc_packet(AVPacket *avpkt, int size)
Check AVPacket size and/or allocate data.
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)
#define AVERROR_BUG
Bug detected, please report the issue.
Describe the class of an AVClass context structure.
static const AVClass twolame_class
int global_quality
Global quality for codecs which cannot change it per frame.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
common internal and external API header
static int twolame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
static av_cold int twolame_encode_close(AVCodecContext *avctx)
mpeg audio declarations for both encoder and decoder.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
static av_cold int init(AVCodecParserContext *s)
int channels
number of audio channels
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
static av_always_inline int64_t ff_samples_to_time_base(AVCodecContext *avctx, int64_t samples)
Rescale from sample rate to AVCodecContext.time_base.
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.