[FFmpeg-devel] [PATCH] mov: extract stsd vendor field in metadata.

Moritz Barsnick barsnick at gmx.net
Wed Nov 9 00:15:42 EET 2016


On Mon, Nov 07, 2016 at 16:30:02 -0800, Zhenni Huang wrote:
> -    avio_rb32(pb); /* vendor */
> +    video_vendor_id = avio_rb32(pb); /* vendor */
>      avio_rb32(pb); /* temporal quality */
>      avio_rb32(pb); /* spatial quality */
>  
> +    /* set video_vendor_id */
> +    video_vendor_id_buffer[0] = (video_vendor_id >> 24) & 0xff;
> +    video_vendor_id_buffer[1] = (video_vendor_id >> 16) & 0xff;
> +    video_vendor_id_buffer[2] = (video_vendor_id >>  8) & 0xff;
> +    video_vendor_id_buffer[3] = (video_vendor_id >>  0) & 0xff;
> +    video_vendor_id_buffer[4] = 0;
> +    av_dict_set(&st->metadata, "vendor_id", video_vendor_id_buffer, 0);

Wouldn't you avoid shifting the bytes around if you did an avio_rl32()
in the first place, i.e.

video_vendor_id = avio_rl32(pb);

Then you could just initialize the buffer to 0 and memcopy the id over.
Or am I missing something?

(If not: Others tend to complain about useless masks and useless shifts
of 0. I personally think they're okay for readability.)

Moritz


More information about the ffmpeg-devel mailing list