diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2017-07-20 15:39:10 +0300 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2017-07-20 15:39:40 +0300 |
commit | 116df9a5d464809f4a5fc7fa0f49e7130067f2bb (patch) | |
tree | b2558637178e8ddfbe6629fbf22e66836cebe144 /decoder/LAVVideo | |
parent | 8a7986a15eb5c1816002e328416a1993900ce944 (diff) |
Implement sidedata for DXVA2-Native samples
Diffstat (limited to 'decoder/LAVVideo')
-rw-r--r-- | decoder/LAVVideo/LAVVideo.cpp | 22 | ||||
-rw-r--r-- | decoder/LAVVideo/decoders/dxva2/DXVA2SurfaceAllocator.cpp | 6 | ||||
-rw-r--r-- | decoder/LAVVideo/decoders/dxva2/DXVA2SurfaceAllocator.h | 3 |
3 files changed, 16 insertions, 15 deletions
diff --git a/decoder/LAVVideo/LAVVideo.cpp b/decoder/LAVVideo/LAVVideo.cpp index 42b4d92a..398ae854 100644 --- a/decoder/LAVVideo/LAVVideo.cpp +++ b/decoder/LAVVideo/LAVVideo.cpp @@ -1770,6 +1770,17 @@ HRESULT CLAVVideo::DeliverToRenderer(LAVFrame *pFrame) BITMAPINFOHEADER *pBIH = nullptr; videoFormatTypeHandler(mt.Format(), mt.FormatType(), &pBIH); + // Set side data on the media sample + if (pFrame->side_data_count) { + IMediaSideData *pMediaSideData = nullptr; + if (SUCCEEDED(hr = pSampleOut->QueryInterface(&pMediaSideData))) { + for (int i = 0; i < pFrame->side_data_count; i++) + pMediaSideData->SetSideData(pFrame->side_data[i].guidType, pFrame->side_data[i].data, pFrame->side_data[i].size); + + SafeRelease(&pMediaSideData); + } + } + if (pFrame->format != LAVPixFmt_DXVA2) { long required = m_PixFmtConverter.GetImageSize(pBIH->biWidth, abs(pBIH->biHeight)); @@ -1805,17 +1816,6 @@ HRESULT CLAVVideo::DeliverToRenderer(LAVFrame *pFrame) DbgLog((LOG_TRACE, 10, L"Pixel Mapping took %2.3fms in avg", m_pixFmtTimingAvg.Average())); #endif - // Set side data on the media sample - if (pFrame->side_data_count) { - IMediaSideData *pMediaSideData = nullptr; - if (SUCCEEDED(hr = pSampleOut->QueryInterface(&pMediaSideData))) { - for (int i = 0; i < pFrame->side_data_count; i++) - pMediaSideData->SetSideData(pFrame->side_data[i].guidType, pFrame->side_data[i].data, pFrame->side_data[i].size); - - SafeRelease(&pMediaSideData); - } - } - // Write the second view into IMediaSample3D, if available if (pFrame->flags & LAV_FRAME_FLAG_MVC) { IMediaSample3D *pSample3D = nullptr; diff --git a/decoder/LAVVideo/decoders/dxva2/DXVA2SurfaceAllocator.cpp b/decoder/LAVVideo/decoders/dxva2/DXVA2SurfaceAllocator.cpp index 3077d1c3..d1e502ad 100644 --- a/decoder/LAVVideo/decoders/dxva2/DXVA2SurfaceAllocator.cpp +++ b/decoder/LAVVideo/decoders/dxva2/DXVA2SurfaceAllocator.cpp @@ -28,7 +28,7 @@ #include <Mferror.h> CDXVA2Sample::CDXVA2Sample(CDXVA2SurfaceAllocator *pAlloc, HRESULT *phr) - : CMediaSample(NAME("CDXVA2Sample"), (CBaseAllocator*)pAlloc, phr, nullptr, 0) + : CMediaSampleSideData(NAME("CDXVA2Sample"), (CBaseAllocator*)pAlloc, phr, nullptr, 0) { } @@ -48,10 +48,10 @@ STDMETHODIMP CDXVA2Sample::QueryInterface(REFIID riid, __deref_out void **ppv) if (riid == __uuidof(IMFGetService)) { return GetInterface((IMFGetService*) this, ppv); } - if (riid == __uuidof(ILAVDXVA2Sample)) { + else if (riid == __uuidof(ILAVDXVA2Sample)) { return GetInterface((ILAVDXVA2Sample*) this, ppv); } else { - return CMediaSample::QueryInterface(riid, ppv); + return __super::QueryInterface(riid, ppv); } } diff --git a/decoder/LAVVideo/decoders/dxva2/DXVA2SurfaceAllocator.h b/decoder/LAVVideo/decoders/dxva2/DXVA2SurfaceAllocator.h index 402d2b60..08740fc0 100644 --- a/decoder/LAVVideo/decoders/dxva2/DXVA2SurfaceAllocator.h +++ b/decoder/LAVVideo/decoders/dxva2/DXVA2SurfaceAllocator.h @@ -22,6 +22,7 @@ #pragma once #include <Mfidl.h> +#include "MediaSampleSideData.h" class CDecDXVA2; @@ -31,7 +32,7 @@ public IUnknown { STDMETHOD_(int, GetDXSurfaceId()) = 0; }; -class CDXVA2Sample : public CMediaSample, public IMFGetService, public ILAVDXVA2Sample +class CDXVA2Sample : public CMediaSampleSideData, public IMFGetService, public ILAVDXVA2Sample { friend class CDXVA2SurfaceAllocator; |