From c9b900050518359483eef2917a26d79e6d6fe223 Mon Sep 17 00:00:00 2001 From: shuanglong.wang Date: Tue, 31 Oct 2017 05:49:06 +0000 Subject: ffmpeg: modify dv check [2/2] PD# 147889 modify dv check, no matter dv tag or el nal or meta nal, all seen is dv Change-Id: I0863275146c61b6a67cd783e26e77d1029236a26 --- diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3d88f95..eba7b84 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3637,6 +3637,7 @@ typedef struct AVCodecContext { */ int hwaccel_flags; int has_dolby_vision_meta; + int has_dolby_vision_el; } AVCodecContext; AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); diff --git a/libavcodec/h264.h b/libavcodec/h264.h index 62ea89b..0b78ff8 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -45,7 +45,8 @@ enum { H264_NAL_SUB_SPS = 15, H264_NAL_AUXILIARY_SLICE = 19, H264_NAL_SLC_EXT = 20, - H264_NAL_264_DV = 0x1c, /*0x7c & 0x1f*/ + H264_NAL_264_DV_META = 0x1c, /*0x7c & 0x1f*/ + H264_NAL_264_DV_EL = 0x1e, /*0x7E & 0x1f*/ }; #endif /* AVCODEC_H264_H */ diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index a96adb7..d22103c 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -324,13 +324,20 @@ static inline int parse_nal_units(AVCodecParserContext *s, case H264_NAL_SEI: ff_h264_sei_decode(&p->sei, &nal.gb, &p->ps, avctx); break; - case H264_NAL_264_DV: + case H264_NAL_264_DV_META: /*00 00 00 01 7c 01 19 08 nal type = 0x7c & 0x1f; any conflict? */ avctx->has_dolby_vision_meta = 1; break; + case H264_NAL_264_DV_EL: + /*00 00 00 01 7e + nal type = 0x7e & 0x1f; + any conflict? + */ + avctx->has_dolby_vision_el = 1; + break; case H264_NAL_IDR_SLICE: s->key_frame = 1; diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 249cced..cb2b441 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -768,6 +768,19 @@ FF_ENABLE_DEPRECATION_WARNINGS avctx->codec_tag = MKTAG('M', 'V', 'C', ' '); } break; + case H264_NAL_264_DV_META: + /*00 00 00 01 7c 01 19 08 + nal type = 0x7c & 0x1f; + any conflict? + */ + avctx->has_dolby_vision_meta = 1; + break; + case H264_NAL_264_DV_EL: + /*00 00 00 01 7e + nal type = 0x7e & 0x1f; + any conflict? + */ + avctx->has_dolby_vision_el = 1; default: av_log(avctx, AV_LOG_DEBUG, "Unknown NAL code: %d (%d bits)\n", nal->type, nal->size_bits); diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h index 165ba45..68c8bb9 100644 --- a/libavcodec/hevc.h +++ b/libavcodec/hevc.h @@ -51,6 +51,7 @@ enum HEVCNALUnitType { HEVC_NAL_SEI_PREFIX = 39, HEVC_NAL_SEI_SUFFIX = 40, HEVC_NAL_SEI_DV_META = 62, + HEVC_NAL_SEI_DV_EL = 63, }; enum HEVCSliceType { diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index f9e8ff0..84527f9 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -42,6 +42,7 @@ #include "hevcdec.h" #include "profiles.h" + const uint8_t ff_hevc_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; /** @@ -2848,6 +2849,21 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) case HEVC_NAL_AUD: case HEVC_NAL_FD_NUT: break; + case HEVC_NAL_SEI_DV_META: + /* + sample dolbyvision meta nal header: + 00 00 01 7C 01 19 08 + nal_type =(0x7C >> 1) 0x3f; + */ + s->avctx->has_dolby_vision_meta = 1; + break; + case HEVC_NAL_SEI_DV_EL: + /* + sample dolbyvision el nal header: + 00 00 01 7E 01 + nal_type =(0x7E >> 1) 0x3f; + */ + s->avctx->has_dolby_vision_el = 1; default: av_log(s->avctx, AV_LOG_INFO, "Skipping NAL unit %d\n", s->nal_unit_type); -- cgit