I am using Exoplayer with SurfaceView and I am displaying diagnostic overlay (TextViews) to check the video/app properties.
I was wondering if there is a way to get the information about the HDR state of the currently played video stream.
I can get the HDR info about a display and a codec - they both support HDR - but I cannot find a way to tell if the stream is in HDR or not.
I have looked into the video formats from DashManifest to check the color info for BT.2020 color space but they are all null.
Any help will be appreciated.
The HDR information, or metadata, will be in the media stream rather than the DASH manifests.
Different containers will carry the container level metadata differently, so you can look at the VP9 and the MP4 ExoPLayer extractors to see how they parse and extract the data.
You can see more info on this in the online ExoPlayer/Android documentation (https://source.android.com/docs/core/display/hdr):
You can look at the actual parsing in the ExoPlayer source code also - look at 'AtomParsers.java' in the mp4 extractors. You could add some hooks here but I suspect this may be more low level than you want to go, as I think you are simply interested in an easy way to detect if the stream is HDR so you can display this on your overlay.
You could also use ffmpeg/ffprobe to detect if the stream is HDR, or more precisely if the metadata says it is, (see https://video.stackexchange.com/a/34827 for example) but this will not necessarily tell you if ExoPlayer has also detected it is HDR.