[FFmpeg-devel] [PATCH] mov: extract stsd vendor field in metadata. Also updates fate ref for rgb24-mkv and fate-mov-zombie as the output will contain the new metadata field.

Michael Niedermayer michael at niedermayer.cc
Sat Nov 12 02:57:22 EET 2016


On Fri, Nov 11, 2016 at 04:14:37PM -0800, Zhenni Huang wrote:
> ---
>  libavformat/mov.c         | 19 +++++++++++++++++--
>  tests/ref/fate/mov-zombie |  2 +-
>  tests/ref/fate/rgb24-mkv  |  4 ++--
>  3 files changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 9ec7d03..b547832 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -1835,6 +1835,8 @@ static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb,
>      uint8_t codec_name[32];
>      int64_t stsd_start;
>      unsigned int len;
> +    int video_vendor_id = 0;
> +    char video_vendor_id_buffer[5];
>  
>      /* The first 16 bytes of the video sample description are already
>       * read in ff_mov_read_stsd_entries() */
> @@ -1842,7 +1844,13 @@ static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb,
>  
>      avio_rb16(pb); /* version */
>      avio_rb16(pb); /* revision level */
> -    avio_rb32(pb); /* vendor */
> +
> +    /* set video_vendor_id */
> +    video_vendor_id = avio_rl32(pb); /* vendor */
> +    memset(video_vendor_id_buffer, 0, 5);
> +    memcpy(video_vendor_id_buffer, (char*)&video_vendor_id, 4);
> +    av_dict_set(&st->metadata, "vendor_id", video_vendor_id_buffer, 0);
> +
>      avio_rb32(pb); /* temporal quality */
>      avio_rb32(pb); /* spatial quality */
>  
> @@ -1891,9 +1899,16 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb,
>      int bits_per_sample, flags;
>      uint16_t version = avio_rb16(pb);
>      AVDictionaryEntry *compatible_brands = av_dict_get(c->fc->metadata, "compatible_brands", NULL, AV_DICT_MATCH_CASE);
> +    int audio_vendor_id = 0;
> +    char audio_vendor_id_buffer[5];
>  
>      avio_rb16(pb); /* revision level */
> -    avio_rb32(pb); /* vendor */
> +
> +    /* set audio_vendor_id */
> +    audio_vendor_id = avio_rl32(pb); /* vendor */
> +    memset(audio_vendor_id_buffer, 0, 5);

> +    memcpy(audio_vendor_id_buffer, (char*)&audio_vendor_id, 4);

this wont work on big endian
the intermediate int should not be used


> +    av_dict_set(&st->metadata, "vendor_id", audio_vendor_id_buffer, 0);
>  
>      st->codecpar->channels              = avio_rb16(pb); /* channel count */
>      st->codecpar->bits_per_coded_sample = avio_rb16(pb); /* sample size */

this results in many empty vendor_id values
for example:
      handler_name    : VideoHandler
      vendor_id       :
      handler_name    : SoundHandler
      vendor_id       :


The meta data should only be set if there is a non empty vendor

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161112/c7ecd600/attachment.sig>


More information about the ffmpeg-devel mailing list