From 567f713f66d4a41d6245132a509bad3cb08167b9 Mon Sep 17 00:00:00 2001 From: Crend King <975235+CrendKing@users.noreply.github.com> Date: Wed, 30 Jun 2021 15:44:00 -0700 Subject: [PATCH] Make HDR side data unique pointer --- avisynth_filter/src/frame_handler.cpp | 4 ++-- avisynth_filter/src/frame_handler.h | 2 +- vapoursynth_filter/src/frame_handler.cpp | 4 ++-- vapoursynth_filter/src/frame_handler.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/avisynth_filter/src/frame_handler.cpp b/avisynth_filter/src/frame_handler.cpp index bcc35bc..c0312e5 100644 --- a/avisynth_filter/src/frame_handler.cpp +++ b/avisynth_filter/src/frame_handler.cpp @@ -62,7 +62,7 @@ auto FrameHandler::AddInputSample(IMediaSample *inputSample) -> HRESULT { const PVideoFrame frame = Format::CreateFrame(_filter._inputVideoFormat, sampleBuffer); - std::shared_ptr hdrSideData = std::make_shared(); + std::unique_ptr hdrSideData = std::make_unique(); { if (const ATL::CComQIPtr inputSampleSideData(inputSample); inputSampleSideData != nullptr) { hdrSideData->ReadFrom(inputSampleSideData); @@ -89,7 +89,7 @@ auto FrameHandler::AddInputSample(IMediaSample *inputSample) -> HRESULT { _sourceFrames.emplace(std::piecewise_construct, std::forward_as_tuple(_nextSourceFrameNb), - std::forward_as_tuple(frame, inputSampleStartTime, hdrSideData)); + std::forward_as_tuple(frame, inputSampleStartTime, std::move(hdrSideData))); } _newSourceFrameCv.notify_all(); diff --git a/avisynth_filter/src/frame_handler.h b/avisynth_filter/src/frame_handler.h index 3a72303..c7ae84c 100644 --- a/avisynth_filter/src/frame_handler.h +++ b/avisynth_filter/src/frame_handler.h @@ -34,7 +34,7 @@ class FrameHandler { struct SourceFrameInfo { PVideoFrame frame; REFERENCE_TIME startTime; - std::shared_ptr hdrSideData; + std::unique_ptr hdrSideData; }; static auto RefreshFrameRatesTemplate(int sampleNb, int &checkpointSampleNb, DWORD &checkpointTime, int ¤tFrameRate) -> void; diff --git a/vapoursynth_filter/src/frame_handler.cpp b/vapoursynth_filter/src/frame_handler.cpp index 1fe00a6..73a231c 100644 --- a/vapoursynth_filter/src/frame_handler.cpp +++ b/vapoursynth_filter/src/frame_handler.cpp @@ -66,7 +66,7 @@ auto FrameHandler::AddInputSample(IMediaSample *inputSample) -> HRESULT { AVSF_VS_API->propSetInt(frameProps, "_SARDen", _filter._inputVideoFormat.pixelAspectRatioDen, paReplace); AVSF_VS_API->propSetInt(frameProps, VS_PROP_NAME_SOURCE_FRAME_NB, _nextSourceFrameNb, paReplace); - std::shared_ptr hdrSideData = std::make_shared(); + std::unique_ptr hdrSideData = std::make_unique(); { if (const ATL::CComQIPtr inputSampleSideData(inputSample); inputSampleSideData != nullptr) { hdrSideData->ReadFrom(inputSampleSideData); @@ -93,7 +93,7 @@ auto FrameHandler::AddInputSample(IMediaSample *inputSample) -> HRESULT { _sourceFrames.emplace(std::piecewise_construct, std::forward_as_tuple(_nextSourceFrameNb), - std::forward_as_tuple(frame, inputSampleStartTime, hdrSideData)); + std::forward_as_tuple(frame, inputSampleStartTime, std::move(hdrSideData))); } Environment::GetInstance().Log(L"Stored source frame: %6i at %10lli ~ %10lli duration(literal) %10lli, last_used %6i, extra_buffer %6i", diff --git a/vapoursynth_filter/src/frame_handler.h b/vapoursynth_filter/src/frame_handler.h index 72cbf87..1394bd8 100644 --- a/vapoursynth_filter/src/frame_handler.h +++ b/vapoursynth_filter/src/frame_handler.h @@ -36,7 +36,7 @@ class FrameHandler { VSFrameRef *frame; REFERENCE_TIME startTime; - std::shared_ptr hdrSideData; + std::unique_ptr hdrSideData; }; static auto VS_CC VpsGetFrameCallback(void *userData, const VSFrameRef *f, int n, VSNodeRef *node, const char *errorMsg) -> void;