29 #include "libavutil/opt.h"
61 s->
glopts = twolame_init();
65 twolame_set_verbosity(s->
glopts, 0);
84 if ((ret = twolame_init_params(s->
glopts)))
105 ret = twolame_encode_buffer_float32_interleaved(s->
glopts,
111 ret = twolame_encode_buffer_float32(s->
glopts,
117 ret = twolame_encode_buffer_interleaved(s->
glopts,
123 ret = twolame_encode_buffer(s->
glopts,
154 #define OFFSET(x) offsetof(TWOLAMEContext, x)
155 #define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
160 {
"joint_stereo", NULL, 0,
AV_OPT_TYPE_CONST, { .i64 = TWOLAME_JOINT_STEREO }, 0, 0,
AE,
"mode" },
161 {
"dual_channel", NULL, 0,
AV_OPT_TYPE_CONST, { .i64 = TWOLAME_DUAL_CHANNEL }, 0, 0,
AE,
"mode" },
165 {
"error_protection",
"enable CRC error protection",
OFFSET(error_protection),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
AE},
179 .
name =
"libtwolame",
196 .supported_samplerates = (
const int[]){ 16000, 22050, 24000, 32000, 44100, 48000, 0 },
#define MPA_MAX_CODED_FRAME_SIZE
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and/or allocate data.
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.
#define LIBAVUTIL_VERSION_INT
static av_cold int init(AVCodecContext *avctx)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
#define AV_CH_LAYOUT_STEREO
AVCodec ff_libtwolame_encoder
const char * av_default_item_name(void *ctx)
Return the context name.
enum AVSampleFormat sample_fmt
audio sample format
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
const char * name
Name of the codec implementation.
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
const OptionDef options[]
#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.
Libavcodec external API header.
int bit_rate
the average bitrate
static const AVClass libtwolame_class
int frame_size
Number of samples per channel in an audio frame.
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.
int global_quality
Global quality for codecs which cannot change it per frame.
common internal 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.
int channels
number of audio channels
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.
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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.