diff options
author | James Almer <jamrial@gmail.com> | 2013-07-11 20:40:17 -0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-10-23 16:13:23 +0200 |
commit | c994b42830cb6c3152b4d383d7c26affc1a2321b (patch) | |
tree | d0f65d6a28a17f7144c8901374a38ffdef74c384 /libavformat | |
parent | 83922cccb20738426225680f29593e1c71e41ae1 (diff) | |
download | ffmpeg-c994b42830cb6c3152b4d383d7c26affc1a2321b.tar.gz |
lavf/adtsenc: Add support for APE tags
Should fix ticket #2269
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/Makefile | 2 | ||||
-rw-r--r-- | libavformat/adtsenc.c | 30 |
2 files changed, 31 insertions, 1 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile index a899da9c7a..ff92a4c57b 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -64,7 +64,7 @@ OBJS-$(CONFIG_ADF_DEMUXER) += bintext.o sauce.o OBJS-$(CONFIG_ADP_DEMUXER) += adp.o OBJS-$(CONFIG_ADX_DEMUXER) += adxdec.o OBJS-$(CONFIG_ADX_MUXER) += rawenc.o -OBJS-$(CONFIG_ADTS_MUXER) += adtsenc.o +OBJS-$(CONFIG_ADTS_MUXER) += adtsenc.o apetag.o OBJS-$(CONFIG_AEA_DEMUXER) += aea.o pcm.o OBJS-$(CONFIG_AFC_DEMUXER) += afc.o OBJS-$(CONFIG_AIFF_DEMUXER) += aiffdec.o pcm.o isom.o \ diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 60d7b07879..f25f966129 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -24,16 +24,20 @@ #include "libavcodec/put_bits.h" #include "libavcodec/avcodec.h" #include "libavcodec/mpeg4audio.h" +#include "libavutil/opt.h" #include "avformat.h" +#include "apetag.h" #define ADTS_HEADER_SIZE 7 typedef struct { + AVClass *class; int write_adts; int objecttype; int sample_rate_index; int channel_conf; int pce_size; + int apetag; uint8_t pce_data[MAX_PCE_SIZE]; } ADTSContext; @@ -162,6 +166,30 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; } +static int adts_write_trailer(AVFormatContext *s) +{ + ADTSContext *adts = s->priv_data; + + if (adts->apetag) + ff_ape_write_tag(s); + + return 0; +} + +#define ENC AV_OPT_FLAG_ENCODING_PARAM +#define OFFSET(obj) offsetof(ADTSContext, obj) +static const AVOption options[] = { + { "write_apetag", "Enable APE tag writing", OFFSET(apetag), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, ENC}, + { NULL }, +}; + +static const AVClass adts_muxer_class = { + .class_name = "ADTS muxer", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + AVOutputFormat ff_adts_muxer = { .name = "adts", .long_name = NULL_IF_CONFIG_SMALL("ADTS AAC (Advanced Audio Coding)"), @@ -172,4 +200,6 @@ AVOutputFormat ff_adts_muxer = { .video_codec = AV_CODEC_ID_NONE, .write_header = adts_write_header, .write_packet = adts_write_packet, + .write_trailer = adts_write_trailer, + .priv_class = &adts_muxer_class, }; |