Skip to content

Commit

Permalink
Pass the original IMediaSample to the decode functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevcairiel committed Jul 11, 2016
1 parent adad395 commit 82be7b0
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions decoder/LAVVideo/decoders/DecBase.h
Expand Up @@ -29,7 +29,7 @@ class CDecBase : public ILAVDecoder
virtual ~CDecBase(void) {}

STDMETHOD(Init)() PURE;
STDMETHOD(Decode)(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity) PURE;
STDMETHOD(Decode)(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pSample) PURE;

// ILAVDecoder
STDMETHODIMP InitInterfaces(ILAVVideoSettings *pSettings, ILAVVideoCallback *pCallback) { m_pSettings = pSettings; m_pCallback = pCallback; return Init(); }
Expand Down Expand Up @@ -77,7 +77,7 @@ class CDecBase : public ILAVDecoder
rtStop = AV_NOPTS_VALUE;
}

return Decode(pData, nSize, rtStart, rtStop, pSample->IsSyncPoint() == S_OK, pSample->IsDiscontinuity() == S_OK);
return Decode(pData, nSize, rtStart, rtStop, pSample->IsSyncPoint() == S_OK, pSample->IsDiscontinuity() == S_OK, pSample);
}

STDMETHODIMP Flush() {
Expand Down
4 changes: 2 additions & 2 deletions decoder/LAVVideo/decoders/avcodec.cpp
Expand Up @@ -637,7 +637,7 @@ static void lav_avframe_free(LAVFrame *frame)
av_frame_free((AVFrame **)&frame->priv_data);
}

STDMETHODIMP CDecAvcodec::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStartIn, REFERENCE_TIME rtStopIn, BOOL bSyncPoint, BOOL bDiscontinuity)
STDMETHODIMP CDecAvcodec::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStartIn, REFERENCE_TIME rtStopIn, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pSample)
{
CheckPointer(m_pAVCtx, E_UNEXPECTED);

Expand Down Expand Up @@ -1023,7 +1023,7 @@ STDMETHODIMP CDecAvcodec::Flush()

STDMETHODIMP CDecAvcodec::EndOfStream()
{
Decode(nullptr, 0, AV_NOPTS_VALUE, AV_NOPTS_VALUE, FALSE, FALSE);
Decode(nullptr, 0, AV_NOPTS_VALUE, AV_NOPTS_VALUE, FALSE, FALSE, nullptr);
return S_OK;
}

Expand Down
2 changes: 1 addition & 1 deletion decoder/LAVVideo/decoders/avcodec.h
Expand Up @@ -38,7 +38,7 @@ class CDecAvcodec : public CDecBase

// ILAVDecoder
STDMETHODIMP InitDecoder(AVCodecID codec, const CMediaType *pmt);
STDMETHODIMP Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity);
STDMETHODIMP Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pSample);
STDMETHODIMP Flush();
STDMETHODIMP EndOfStream();
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp);
Expand Down
4 changes: 2 additions & 2 deletions decoder/LAVVideo/decoders/cuvid.cpp
Expand Up @@ -1152,7 +1152,7 @@ STDMETHODIMP CDecCuvid::CheckHEVCSequence(const BYTE *buffer, int buflen)
return S_FALSE;
}

STDMETHODIMP CDecCuvid::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity)
STDMETHODIMP CDecCuvid::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pSample)
{
CUresult result;
HRESULT hr = S_OK;
Expand Down Expand Up @@ -1180,7 +1180,7 @@ STDMETHODIMP CDecCuvid::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rt
// If we found a EOS marker, but its not at the end of the packet, then split the packet
// to be able to individually decode the frame before the EOS, and then decode the remainder
if (status & STATE_EOS_FOUND && eosmarker && eosmarker != end) {
Decode(buffer, (int)(eosmarker - buffer), rtStart, rtStop, bSyncPoint, bDiscontinuity);
Decode(buffer, (int)(eosmarker - buffer), rtStart, rtStop, bSyncPoint, bDiscontinuity, nullptr);

rtStart = rtStop = AV_NOPTS_VALUE;
pCuvidPacket.payload = eosmarker;
Expand Down
2 changes: 1 addition & 1 deletion decoder/LAVVideo/decoders/cuvid.h
Expand Up @@ -45,7 +45,7 @@ class CDecCuvid : public CDecBase

// ILAVDecoder
STDMETHODIMP InitDecoder(AVCodecID codec, const CMediaType *pmt);
STDMETHODIMP Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity);
STDMETHODIMP Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pSample);
STDMETHODIMP Flush();
STDMETHODIMP EndOfStream();
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp);
Expand Down
8 changes: 4 additions & 4 deletions decoder/LAVVideo/decoders/msdk_mvc.cpp
Expand Up @@ -221,7 +221,7 @@ STDMETHODIMP CDecMSDKMVC::InitDecoder(AVCodecID codec, const CMediaType *pmt)

// Decode sequence header from the media type
if (mp2vi->cbSequenceHeader) {
HRESULT hr = Decode((const BYTE *)mp2vi->dwSequenceHeader, mp2vi->cbSequenceHeader, AV_NOPTS_VALUE, AV_NOPTS_VALUE, TRUE, TRUE);
HRESULT hr = Decode((const BYTE *)mp2vi->dwSequenceHeader, mp2vi->cbSequenceHeader, AV_NOPTS_VALUE, AV_NOPTS_VALUE, TRUE, TRUE, nullptr);
if (FAILED(hr))
return hr;
}
Expand All @@ -231,7 +231,7 @@ STDMETHODIMP CDecMSDKMVC::InitDecoder(AVCodecID codec, const CMediaType *pmt)
else if (*pmt->Subtype() == MEDIASUBTYPE_AMVC) {
// Decode sequence header from the media type
if (mp2vi->cbSequenceHeader) {
HRESULT hr = Decode((const BYTE *)mp2vi->dwSequenceHeader, mp2vi->cbSequenceHeader, AV_NOPTS_VALUE, AV_NOPTS_VALUE, TRUE, TRUE);
HRESULT hr = Decode((const BYTE *)mp2vi->dwSequenceHeader, mp2vi->cbSequenceHeader, AV_NOPTS_VALUE, AV_NOPTS_VALUE, TRUE, TRUE, nullptr);
if (FAILED(hr))
return hr;
}
Expand Down Expand Up @@ -333,7 +333,7 @@ void CDecMSDKMVC::ReleaseBuffer(mfxFrameSurface1 * pSurface)
}
}

STDMETHODIMP CDecMSDKMVC::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity)
STDMETHODIMP CDecMSDKMVC::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pSample)
{
if (!m_mfxSession)
return E_UNEXPECTED;
Expand Down Expand Up @@ -807,7 +807,7 @@ STDMETHODIMP CDecMSDKMVC::EndOfStream()
return S_FALSE;

// Flush frames out of the decoder
Decode(nullptr, 0, AV_NOPTS_VALUE, AV_NOPTS_VALUE, FALSE, FALSE);
Decode(nullptr, 0, AV_NOPTS_VALUE, AV_NOPTS_VALUE, FALSE, FALSE, nullptr);

// Process all remaining frames in the queue
for (int i = 0; i < ASYNC_QUEUE_SIZE; i++) {
Expand Down
2 changes: 1 addition & 1 deletion decoder/LAVVideo/decoders/msdk_mvc.h
Expand Up @@ -54,7 +54,7 @@ class CDecMSDKMVC : public CDecBase

// ILAVDecoder
STDMETHODIMP InitDecoder(AVCodecID codec, const CMediaType *pmt);
STDMETHODIMP Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity);
STDMETHODIMP Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pSample);
STDMETHODIMP Flush();
STDMETHODIMP EndOfStream();
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp) { if (pPix) *pPix = LAVPixFmt_NV12; if (pBpp) *pBpp = 8; return S_OK; }
Expand Down
4 changes: 2 additions & 2 deletions decoder/LAVVideo/decoders/quicksync.cpp
Expand Up @@ -520,7 +520,7 @@ STDMETHODIMP CDecQuickSync::InitDecoder(AVCodecID codec, const CMediaType *pmt)
return S_OK;
}

STDMETHODIMP CDecQuickSync::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity)
STDMETHODIMP CDecQuickSync::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pMediaSample)
{
HRESULT hr;

Expand All @@ -540,7 +540,7 @@ STDMETHODIMP CDecQuickSync::Decode(const BYTE *buffer, int buflen, REFERENCE_TIM
// If we found a EOS marker, but its not at the end of the packet, then split the packet
// to be able to individually decode the frame before the EOS, and then decode the remainder
if (status & STATE_EOS_FOUND && eosmarker && eosmarker != end) {
Decode(buffer, (int)(eosmarker - buffer), rtStart, rtStop, bSyncPoint, bDiscontinuity);
Decode(buffer, (int)(eosmarker - buffer), rtStart, rtStop, bSyncPoint, bDiscontinuity, nullptr);

rtStart = rtStop = AV_NOPTS_VALUE;
buffer = eosmarker;
Expand Down
2 changes: 1 addition & 1 deletion decoder/LAVVideo/decoders/quicksync.h
Expand Up @@ -37,7 +37,7 @@ class CDecQuickSync : public CDecBase
// ILAVDecoder
STDMETHODIMP Check();
STDMETHODIMP InitDecoder(AVCodecID codec, const CMediaType *pmt);
STDMETHODIMP Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity);
STDMETHODIMP Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pSample);
STDMETHODIMP Flush();
STDMETHODIMP EndOfStream();
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp);
Expand Down
2 changes: 1 addition & 1 deletion decoder/LAVVideo/decoders/wmv9.cpp
Expand Up @@ -381,7 +381,7 @@ STDMETHODIMP CDecWMV9::InitDecoder(AVCodecID codec, const CMediaType *pmt)
return S_OK;
}

STDMETHODIMP CDecWMV9::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity)
STDMETHODIMP CDecWMV9::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pSample)
{
HRESULT hr = S_OK;
DWORD dwStatus = 0;
Expand Down
2 changes: 1 addition & 1 deletion decoder/LAVVideo/decoders/wmv9.h
Expand Up @@ -41,7 +41,7 @@ class CDecWMV9 : public CDecBase

// ILAVDecoder
STDMETHODIMP InitDecoder(AVCodecID codec, const CMediaType *pmt);
STDMETHODIMP Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity);
STDMETHODIMP Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pSample);
STDMETHODIMP Flush();
STDMETHODIMP EndOfStream();
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp);
Expand Down
2 changes: 1 addition & 1 deletion decoder/LAVVideo/decoders/wmv9mft.cpp
Expand Up @@ -280,7 +280,7 @@ IMFMediaBuffer * CDecWMV9MFT::CreateMediaBuffer(const BYTE * pData, DWORD dwData
return pBuffer;
}

STDMETHODIMP CDecWMV9MFT::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity)
STDMETHODIMP CDecWMV9MFT::Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pMediaSample)
{
HRESULT hr = S_OK;
DWORD dwStatus = 0;
Expand Down
2 changes: 1 addition & 1 deletion decoder/LAVVideo/decoders/wmv9mft.h
Expand Up @@ -59,7 +59,7 @@ class CDecWMV9MFT : public CDecBase

// ILAVDecoder
STDMETHODIMP InitDecoder(AVCodecID codec, const CMediaType *pmt);
STDMETHODIMP Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity);
STDMETHODIMP Decode(const BYTE *buffer, int buflen, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, BOOL bSyncPoint, BOOL bDiscontinuity, IMediaSample *pSample);
STDMETHODIMP Flush();
STDMETHODIMP EndOfStream();
STDMETHODIMP GetPixelFormat(LAVPixelFormat *pPix, int *pBpp);
Expand Down

0 comments on commit 82be7b0

Please sign in to comment.