Skip to content

Commit

Permalink
Add untested HDR10Plus code
Browse files Browse the repository at this point in the history
  • Loading branch information
myrsloik committed Sep 29, 2023
1 parent 8e1f8bf commit b406a8d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/videosource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,17 +486,26 @@ BestVideoFrame::BestVideoFrame(AVFrame *f) {

HasContentLightLevel = !!ContentLightLevelMax || !!ContentLightLevelAverage;

#if VERSION_CHECK(LIBAVUTIL_VERSION_INT, >=, 57, 9, 100)
const AVFrameSideData *DolbyVisionRPUSideData = av_frame_get_side_data(Frame, AV_FRAME_DATA_DOVI_RPU_BUFFER);
if (DolbyVisionRPUSideData) {
DolbyVisionRPU = DolbyVisionRPUSideData->data;
DolbyVisionRPUSize = DolbyVisionRPUSideData->size;
}

#if VERSION_CHECK(LIBAVUTIL_VERSION_INT, >=, 58, 5, 100)
AVFrameSideData *HDR10PlusSideData = av_frame_get_side_data(Frame, AV_FRAME_DATA_DYNAMIC_HDR_PLUS);
if (HDR10PlusSideData) {
int ret = av_dynamic_hdr_plus_to_t35(reinterpret_cast<const AVDynamicHDRPlus *>(HDR10PlusSideData->data), &HDR10Plus, &HDR10PlusSize);
if (ret < 0) {
// report error here "HDR10+ dynamic metadata could not be serialized."
}
}
#endif
}

BestVideoFrame::~BestVideoFrame() {
av_frame_free(&Frame);
av_freep(&HDR10Plus);
}

const AVFrame *BestVideoFrame::GetAVFrame() const {
Expand Down

0 comments on commit b406a8d

Please sign in to comment.