65 s->
glopts = twolame_init();
86 twolame_set_VBR_level(s->
glopts,
89 "VBR in MP2 is a hack, use another codec that supports it.\n");
94 ret = twolame_init_params(s->
glopts);
115 ret = twolame_encode_buffer_float32_interleaved(s->
glopts,
116 (
const float *)frame->
data[0],
122 ret = twolame_encode_buffer_float32(s->
glopts,
123 (
const float *)frame->
data[0],
124 (
const float *)frame->
data[1],
129 ret = twolame_encode_buffer_interleaved(s->
glopts,
130 (
const short int *)frame->
data[0],
135 ret = twolame_encode_buffer(s->
glopts,
136 (
const short int *)frame->
data[0],
137 (
const short int *)frame->
data[1],
143 "Unsupported sample format %d.\n", avctx->
sample_fmt);
171 #define OFFSET(x) offsetof(TWOLAMEContext, x)
172 #define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
182 {
"error_protection",
"enable CRC error protection",
OFFSET(error_protection),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
AE},
185 {
"verbosity",
"set library optput level (0-10)",
OFFSET(verbosity),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 10,
AE},
202 16000, 22050, 24000, 32000, 44100, 48000, 0
206 .
name =
"libtwolame",
216 .priv_class = &twolame_class,
224 .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.
int64_t bit_rate
the average bitrate
#define LIBAVUTIL_VERSION_INT
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
static av_cold int init(AVCodecContext *avctx)
#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...
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
AVCodec ff_libtwolame_encoder
static const AVCodecDefault twolame_defaults[]
enum AVSampleFormat sample_fmt
audio sample format
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static const int twolame_samplerates[]
#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.
int flags
AV_CODEC_FLAG_*.
const char * name
Name of the codec implementation.
static const AVOption options[]
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
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.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Describe the class of an AVClass context structure.
static const AVClass twolame_class
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
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.
int channels
number of audio channels
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
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.
static const AVCodecDefault defaults[]
#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.