From: gt-sdi <gt...@straylightdigital.com> Extract poster_time and time_scale from quicktime mdhd atom and add to metadata for output by ffprobe.
Signed-off-by: gt-sdi <gt...@straylightdigital.com> --- libavformat/mov.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 767833e..b49592b 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -850,9 +850,28 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } +static void mov_metadata_time_scale(AVDictionary **metadata, int time) +{ + char buffer[32]; + if (time) { + snprintf(buffer, sizeof(buffer), "%i", time); + av_dict_set(metadata, "time_scale", buffer, 0); + } +} + +static void mov_metadata_poster_time(AVDictionary **metadata, int64_t time) +{ + char buffer[32]; + if (time) { + snprintf(buffer, sizeof(buffer), "%" PRId64, time); + av_dict_set(metadata, "poster_time", buffer, 0); + } +} + static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int64_t creation_time; + int64_t poster_time; int version = avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ @@ -864,8 +883,9 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb32(pb); /* modification time */ } mov_metadata_creation_time(&c->fc->metadata, creation_time); - c->time_scale = avio_rb32(pb); /* time scale */ + c->time_scale = avio_rb32(pb); /* time scale */ + mov_metadata_time_scale(&c->fc->metadata, c->time_scale); av_dlog(c->fc, "time scale = %i\n", c->time_scale); c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ @@ -883,7 +903,10 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb32(pb); /* preview time */ avio_rb32(pb); /* preview duration */ - avio_rb32(pb); /* poster time */ + + poster_time = avio_rb32(pb); /* poster time */ + mov_metadata_poster_time(&c->fc->metadata, poster_time); + avio_rb32(pb); /* selection time */ avio_rb32(pb); /* selection duration */ avio_rb32(pb); /* current time */ -- 2.0.4 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel