On Mon, Mar 30, 2020 at 11:53 AM Jun Zhao <mypopy...@gmail.com> wrote: > > From: vacingfang <vacingf...@tencent.com> > > support DOVIVideo Stream Descriptor from Dolby Vision Streams > Within the MPEG-2 Transport Stream Format V1.2 > > From the spec: https://www.dolby.com/us/en/technologies/\ > dolby-vision/dolby-vision-bitstreams-in-mpeg-2-transport-\ > stream-multiplex-v1.2.pdf. > > export the Dolby Vision profile/level with metadata. > > Signed-off-by: vacingfang <vacingf...@tencent.com> > --- > libavformat/mpegts.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > index 7f56bac..e035605 100644 > --- a/libavformat/mpegts.c > +++ b/libavformat/mpegts.c > @@ -2135,6 +2135,27 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, > AVStream *st, int stream_type > st->request_probe = 0; > } > break; > + case 0xb0: /* dolby vision video stream descriptor*/ > + { > + int version_major, version_minor, profile, level; > + char str_buf[32]; > + if (desc_end - *pp < 4) // 8 + 8 + 7 + 6 + 1 + 1 + 1 > + return AVERROR_INVALIDDATA; > + > + version_major = get8(pp, desc_end); > + version_minor = get8(pp, desc_end); > + profile = get16(pp, desc_end); > + level = (profile >> 3) & 0x3f; // 6 bits > + profile = (profile >> 9) & 0x7f; // 7 bits > + av_log(fc, 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);
Ditto for the side data point. Not only would it enable to not have the whole string<->int conversions out of the way, but also you would gain the information if the stream has RPUs, or if it's EL/BL etc. Best regards, Jan _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".