Hi On Thu, Aug 14, 2014 at 01:24:37PM -0600, Graham Torn wrote: > From: gt-sdi <[email protected]> > > Extract poster_time and time_scale from quicktime mdhd atom > and add to metadata for output by ffprobe. > > Signed-off-by: gt-sdi <[email protected]> > --- > 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); > + } > +}
see av_dict_set_int()
> +
> 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 */
when transcoding this can end up being stored in the destination
file. considering that could even be a mov file, this seems
sub optimal
note see, "duration" and "encoder" on other similar metadata that is
not just unconditionally copied
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
