[FFmpeg-devel] [PATCH V1 4/4] lavf/mov: support dvcC/dvvC box for Dolby Vision

Jan Ekström jeebjp at gmail.com
Mon Mar 30 17:55:54 EEST 2020


On Mon, Mar 30, 2020 at 12:20 PM Jun Zhao <mypopydev at gmail.com> wrote:
>
> From: vacingfang <vacingfang at tencent.com>
>
> support dvcC/dvcC box from spec Dolby Vision Streams Within the
> ISO Base MediaFile Format Version 2.1.2
> (https://www.dolby.com/in/en/technologies/dolby-vision/dolby-vision\
> -bitstreams-within-the-iso-base-media-file-format-v2.1.2.pdf)
>
> And export the Dolby Vision profile/level with metadata.
>
> Signed-off-by: vacingfang <vacingfang at tencent.com>
> ---
>  libavformat/mov.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index f280f36..76d90a7 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -6766,6 +6766,37 @@ static int mov_read_dmlp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>      return 0;
>  }
>
> +static int mov_read_dvcc_dvvc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> +{
> +    AVStream *st;
> +    uint8_t version_major, version_minor, profile, level;
> +    char str_buf[32];
> +    uint16_t tmp;
> +
> +    if (c->fc->nb_streams < 1)
> +        return 0;
> +    st = c->fc->streams[c->fc->nb_streams-1];
> +
> +    if ((uint64_t)atom.size > (1<<30) || atom.size < 4)
> +        return AVERROR_INVALIDDATA;
> +
> +    version_major = avio_r8(pb);
> +    version_minor = avio_r8(pb);
> +
> +    tmp = avio_rb16(pb);
> +    profile = (tmp >> 9) & 0x7f;    // 7bits
> +    level   = (tmp >> 3) & 0x3f;    // 6 bits
> +    av_log(c, AV_LOG_DEBUG, "dolby vision stream, version: %d.%d, profile: %d, level: %d\n",
> +            version_major, version_minor, profile, level);
> +
> +    snprintf(str_buf, sizeof(str_buf), "%d", profile);
> +    av_dict_set(&st->metadata, "dovi_profile", str_buf, 0);
> +    snprintf(str_buf, sizeof(str_buf), "%d", level);
> +    av_dict_set(&st->metadata, "dovi_level", str_buf, 0);
> +

Hi,

I would really prefer a piece of side data here. Means that the
structure would be defined, and you wouldn't need to do string <-> int
switches around (as well as the possibility of just passing this along
so that the muxer on the other side could then re-create the
DOVIConfigurationBox in case writing it gets implemented.

Best regards,
Jan


More information about the ffmpeg-devel mailing list