[FFmpeg-devel] [PATCH]Write total number of tracks to m4a
Carl Eugen Hoyos
cehoyos at ag.or.at
Thu Aug 1 00:29:58 CEST 2013
Hi!
Attached patch fixes ticket #2157 for me.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 42ec3f2..1b3cebb 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2022,6 +2022,12 @@ static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov,
AVDictionaryEntry *t = av_dict_get(s->metadata, "track", NULL, 0);
int size = 0, track = t ? atoi(t->value) : 0;
if (track) {
+ int i = 1, tracks = 0;
+ while (t->value[i])
+ if (t->value[i++] == '/') {
+ tracks = atoi(&t->value[i]);
+ break;
+ }
avio_wb32(pb, 32); /* size */
ffio_wfourcc(pb, "trkn");
avio_wb32(pb, 24); /* size */
@@ -2030,7 +2036,7 @@ static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov,
avio_wb32(pb, 0);
avio_wb16(pb, 0); // empty
avio_wb16(pb, track); // track number
- avio_wb16(pb, 0); // total track number
+ avio_wb16(pb, tracks); // total track number
avio_wb16(pb, 0); // empty
size = 32;
}
More information about the ffmpeg-devel
mailing list