Browse code

avformat/adtsenc: Optionally enable ID3 in ADTS.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Dale Curtis authored on 2014/07/22 04:05:08
Showing 1 changed files
... ...
@@ -27,6 +27,7 @@
27 27
 #include "libavutil/opt.h"
28 28
 #include "avformat.h"
29 29
 #include "apetag.h"
30
+#include "id3v2.h"
30 31
 
31 32
 #define ADTS_HEADER_SIZE 7
32 33
 
... ...
@@ -38,6 +39,7 @@ typedef struct {
38 38
     int channel_conf;
39 39
     int pce_size;
40 40
     int apetag;
41
+    int id3v2tag;
41 42
     uint8_t pce_data[MAX_PCE_SIZE];
42 43
 } ADTSContext;
43 44
 
... ...
@@ -97,6 +99,8 @@ static int adts_write_header(AVFormatContext *s)
97 97
     ADTSContext *adts = s->priv_data;
98 98
     AVCodecContext *avc = s->streams[0]->codec;
99 99
 
100
+    if (adts->id3v2tag)
101
+        ff_id3v2_write_simple(s, 4, ID3v2_DEFAULT_MAGIC);
100 102
     if (avc->extradata_size > 0 &&
101 103
             adts_decode_extradata(s, adts, avc->extradata, avc->extradata_size) < 0)
102 104
         return -1;
... ...
@@ -179,6 +183,7 @@ static int adts_write_trailer(AVFormatContext *s)
179 179
 #define ENC AV_OPT_FLAG_ENCODING_PARAM
180 180
 #define OFFSET(obj) offsetof(ADTSContext, obj)
181 181
 static const AVOption options[] = {
182
+    { "write_id3v2", "Enable ID3v2 tag writing", OFFSET(id3v2tag), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, ENC},
182 183
     { "write_apetag", "Enable APE tag writing", OFFSET(apetag), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, ENC},
183 184
     { NULL },
184 185
 };