[FFmpeg-devel] Fwd: [PATCH] libavformat: Add poster_time and time_scale to quicktime metadata output

Graham Torn graham.torn at gmail.com
Mon Aug 18 23:11:05 CEST 2014


I'm wondering if this patch request got missed? ... or if I neglected something when submitting? ... Any feedback appreciated.

Cheers
GT


Graham Torn
graham.torn at gmail.com



Begin forwarded message:

> From: Graham Torn <graham.torn at gmail.com>
> Subject: [PATCH] libavformat: Add poster_time and time_scale to quicktime metadata output
> Date: August 14, 2014 at 13:24:37 MDT
> To: ffmpeg-devel at ffmpeg.org
> Cc: gt-sdi <gtorn at straylightdigital.com>
> 
> From: gt-sdi <gtorn at 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 <gtorn at 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
> 



More information about the ffmpeg-devel mailing list