[PATCH] lavf/adtsenc: Add support for APE tags
Should fix ticket #2269 Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/adtsenc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 60d7b07..7118105 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpeg4audio.h" #include "avformat.h" +#include "apetag.h" #define ADTS_HEADER_SIZE 7 @@ -162,6 +163,13 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; } +static int adts_write_trailer(AVFormatContext *s) +{ + ff_ape_write_tag(s); + + return 0; +} + AVOutputFormat ff_adts_muxer = { .name = "adts", .long_name = NULL_IF_CONFIG_SMALL("ADTS AAC (Advanced Audio Coding)"), @@ -172,4 +180,5 @@ 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, }; -- 1.8.1.5
On 7/11/13, James Almer <jamrial@gmail.com> wrote:
Should fix ticket #2269
Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/adtsenc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 60d7b07..7118105 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpeg4audio.h" #include "avformat.h" +#include "apetag.h"
#define ADTS_HEADER_SIZE 7
@@ -162,6 +163,13 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; }
+static int adts_write_trailer(AVFormatContext *s) +{ + ff_ape_write_tag(s); + + return 0; +} + AVOutputFormat ff_adts_muxer = { .name = "adts", .long_name = NULL_IF_CONFIG_SMALL("ADTS AAC (Advanced Audio Coding)"), @@ -172,4 +180,5 @@ 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, }; -- 1.8.1.5
Missing Makefile change.
Should fix ticket #2269 Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/Makefile | 2 +- libavformat/adtsenc.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 3c4a3c8..2d246bf 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -60,7 +60,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 60d7b07..7118105 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpeg4audio.h" #include "avformat.h" +#include "apetag.h" #define ADTS_HEADER_SIZE 7 @@ -162,6 +163,13 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; } +static int adts_write_trailer(AVFormatContext *s) +{ + ff_ape_write_tag(s); + + return 0; +} + AVOutputFormat ff_adts_muxer = { .name = "adts", .long_name = NULL_IF_CONFIG_SMALL("ADTS AAC (Advanced Audio Coding)"), @@ -172,4 +180,5 @@ 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, }; -- 1.8.1.5
On Thu, Jul 11, 2013 at 11:08 AM, James Almer <jamrial@gmail.com> wrote:
Should fix ticket #2269
Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/adtsenc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 60d7b07..7118105 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpeg4audio.h" #include "avformat.h" +#include "apetag.h"
#define ADTS_HEADER_SIZE 7
@@ -162,6 +163,13 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; }
+static int adts_write_trailer(AVFormatContext *s) +{ + ff_ape_write_tag(s);
I think this should be an option of the adts muxer as not all the adts decoder will know what to do with this and some will crash. and if some people use libav as a library and want to create adts chunk (HLS) they may be calling trailer at the end of each chunk and this will be adding the ape metadata. What do you all think?
+ + return 0; +} + AVOutputFormat ff_adts_muxer = { .name = "adts", .long_name = NULL_IF_CONFIG_SMALL("ADTS AAC (Advanced Audio Coding)"), @@ -172,4 +180,5 @@ 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, }; -- 1.8.1.5
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
On 7/11/13, Thierry Foucu <tfoucu@gmail.com> wrote:
On Thu, Jul 11, 2013 at 11:08 AM, James Almer <jamrial@gmail.com> wrote:
Should fix ticket #2269
Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/adtsenc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 60d7b07..7118105 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpeg4audio.h" #include "avformat.h" +#include "apetag.h"
#define ADTS_HEADER_SIZE 7
@@ -162,6 +163,13 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; }
+static int adts_write_trailer(AVFormatContext *s) +{ + ff_ape_write_tag(s);
I think this should be an option of the adts muxer as not all the adts decoder will know what to do with this and some will crash. and if some people use libav as a library and want to create adts chunk (HLS) they may be calling trailer at the end of each chunk and this will be adding the ape metadata.
What do you all think?
You sure this code is used for HLS?
+ + return 0; +} + AVOutputFormat ff_adts_muxer = { .name = "adts", .long_name = NULL_IF_CONFIG_SMALL("ADTS AAC (Advanced Audio Coding)"), @@ -172,4 +180,5 @@ 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, }; -- 1.8.1.5
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
On Thu, Jul 11, 2013 at 1:16 PM, Paul B Mahol <onemda@gmail.com> wrote:
On 7/11/13, Thierry Foucu <tfoucu@gmail.com> wrote:
On Thu, Jul 11, 2013 at 11:08 AM, James Almer <jamrial@gmail.com> wrote:
Should fix ticket #2269
Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/adtsenc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 60d7b07..7118105 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpeg4audio.h" #include "avformat.h" +#include "apetag.h"
#define ADTS_HEADER_SIZE 7
@@ -162,6 +163,13 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; }
+static int adts_write_trailer(AVFormatContext *s) +{ + ff_ape_write_tag(s);
I think this should be an option of the adts muxer as not all the adts decoder will know what to do with this and some will crash. and if some people use libav as a library and want to create adts chunk (HLS) they may be calling trailer at the end of each chunk and this will be adding the ape metadata.
What do you all think?
You sure this code is used for HLS?
in HLS, audio only could be ADTS audio. And apple is using the size of the chunk and the duration of it to compute its bitrate. So, we should not have extra metadata for each chunk.
+ + return 0; +} + AVOutputFormat ff_adts_muxer = { .name = "adts", .long_name = NULL_IF_CONFIG_SMALL("ADTS AAC (Advanced Audio Coding)"), @@ -172,4 +180,5 @@ 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, }; -- 1.8.1.5
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
On 7/12/13, Thierry Foucu <tfoucu@gmail.com> wrote:
On Thu, Jul 11, 2013 at 1:16 PM, Paul B Mahol <onemda@gmail.com> wrote:
On 7/11/13, Thierry Foucu <tfoucu@gmail.com> wrote:
On Thu, Jul 11, 2013 at 11:08 AM, James Almer <jamrial@gmail.com> wrote:
Should fix ticket #2269
Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/adtsenc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 60d7b07..7118105 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpeg4audio.h" #include "avformat.h" +#include "apetag.h"
#define ADTS_HEADER_SIZE 7
@@ -162,6 +163,13 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; }
+static int adts_write_trailer(AVFormatContext *s) +{ + ff_ape_write_tag(s);
I think this should be an option of the adts muxer as not all the adts decoder will know what to do with this and some will crash. and if some people use libav as a library and want to create adts chunk (HLS) they may be calling trailer at the end of each chunk and this will be adding the ape metadata.
What do you all think?
You sure this code is used for HLS?
in HLS, audio only could be ADTS audio. And apple is using the size of the chunk and the duration of it to compute its bitrate. So, we should not have extra metadata for each chunk.
Yes, but: is this code used by HLS? and metadata is not set after each chunk, just at end.
+ + return 0; +} + AVOutputFormat ff_adts_muxer = { .name = "adts", .long_name = NULL_IF_CONFIG_SMALL("ADTS AAC (Advanced Audio Coding)"), @@ -172,4 +180,5 @@ 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, }; -- 1.8.1.5
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
On 12/07/13 8:27 AM, Paul B Mahol wrote:
On 7/12/13, Thierry Foucu <tfoucu@gmail.com> wrote:
On Thu, Jul 11, 2013 at 1:16 PM, Paul B Mahol <onemda@gmail.com> wrote:
On 7/11/13, Thierry Foucu <tfoucu@gmail.com> wrote:
On Thu, Jul 11, 2013 at 11:08 AM, James Almer <jamrial@gmail.com> wrote:
Should fix ticket #2269
Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/adtsenc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 60d7b07..7118105 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpeg4audio.h" #include "avformat.h" +#include "apetag.h"
#define ADTS_HEADER_SIZE 7
@@ -162,6 +163,13 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; }
+static int adts_write_trailer(AVFormatContext *s) +{ + ff_ape_write_tag(s);
I think this should be an option of the adts muxer as not all the adts decoder will know what to do with this and some will crash. and if some people use libav as a library and want to create adts chunk (HLS) they may be calling trailer at the end of each chunk and this will be adding the ape metadata.
What do you all think?
You sure this code is used for HLS?
in HLS, audio only could be ADTS audio. And apple is using the size of the chunk and the duration of it to compute its bitrate. So, we should not have extra metadata for each chunk.
Yes, but: is this code used by HLS? and metadata is not set after each chunk, just at end.
Ping. What version is preferred in the end? Forced, or enabled with an AVOption? If the latter, I'd prefer the AVOption to be "write_apetag" instead of "apetag" as i originally named it in alternative patch i submitted. That way it will be consistent with similar AVOptions from other muxers.
On Wed, Oct 23, 2013 at 03:13:23AM -0300, James Almer wrote:
On 12/07/13 8:27 AM, Paul B Mahol wrote:
On 7/12/13, Thierry Foucu <tfoucu@gmail.com> wrote:
On Thu, Jul 11, 2013 at 1:16 PM, Paul B Mahol <onemda@gmail.com> wrote:
On 7/11/13, Thierry Foucu <tfoucu@gmail.com> wrote:
On Thu, Jul 11, 2013 at 11:08 AM, James Almer <jamrial@gmail.com> wrote:
Should fix ticket #2269
Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/adtsenc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 60d7b07..7118105 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpeg4audio.h" #include "avformat.h" +#include "apetag.h"
#define ADTS_HEADER_SIZE 7
@@ -162,6 +163,13 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; }
+static int adts_write_trailer(AVFormatContext *s) +{ + ff_ape_write_tag(s);
I think this should be an option of the adts muxer as not all the adts decoder will know what to do with this and some will crash. and if some people use libav as a library and want to create adts chunk (HLS) they may be calling trailer at the end of each chunk and this will be adding the ape metadata.
What do you all think?
You sure this code is used for HLS?
in HLS, audio only could be ADTS audio. And apple is using the size of the chunk and the duration of it to compute its bitrate. So, we should not have extra metadata for each chunk.
Yes, but: is this code used by HLS? and metadata is not set after each chunk, just at end.
Ping.
What version is preferred in the end? Forced, or enabled with an AVOption?
either is fine with me, what is not fine is none thus
If the latter, I'd prefer the AVOption to be "write_apetag" instead of "apetag"
applied that then
as i originally named it in alternative patch i submitted. That way it will be consistent with similar AVOptions from other muxers.
Thanks -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB DNS cache poisoning attacks, popular search engine, Google internet authority dont be evil, please
On 11/07/13 5:00 PM, Thierry Foucu wrote:
On Thu, Jul 11, 2013 at 11:08 AM, James Almer <jamrial@gmail.com> wrote:
Should fix ticket #2269
Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/adtsenc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 60d7b07..7118105 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/mpeg4audio.h" #include "avformat.h" +#include "apetag.h"
#define ADTS_HEADER_SIZE 7
@@ -162,6 +163,13 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; }
+static int adts_write_trailer(AVFormatContext *s) +{ + ff_ape_write_tag(s);
I think this should be an option of the adts muxer as not all the adts decoder will know what to do with this and some will crash. and if some people use libav as a library and want to create adts chunk (HLS) they may be calling trailer at the end of each chunk and this will be adding the ape metadata.
What do you all think?
I just checked and foobar2000 for example can't read any kind of tags stored on these files, be it APE or id3v1. It didn't crash, though. So yeah, i guess that it would be wise to make it optional. I'll send an updated patch in a minute, and then whichever version is preferred can be committed. Regards.
Should fix ticket #2269 Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/Makefile | 2 +- libavformat/adtsenc.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 3c4a3c8..2d246bf 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -60,7 +60,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 60d7b07..94fb494 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[] = { + { "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, }; -- 1.8.1.5
On Thu, Jul 11, 2013 at 4:40 PM, James Almer <jamrial@gmail.com> wrote:
Should fix ticket #2269
Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/Makefile | 2 +- libavformat/adtsenc.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/libavformat/Makefile b/libavformat/Makefile index 3c4a3c8..2d246bf 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -60,7 +60,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 60d7b07..94fb494 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[] = { + { "apetag", "Enable APE tag writing", OFFSET(apetag), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, ENC}, + { NULL }, +}; +
Thanks for adding an option.
+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, }; -- 1.8.1.5
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
participants (4)
-
James Almer -
Michael Niedermayer -
Paul B Mahol -
Thierry Foucu