diff options
-rw-r--r-- | decoder/LAVVideo/LAVVideo.cpp | 20 | ||||
-rw-r--r-- | decoder/LAVVideo/LAVVideo.h | 1 |
2 files changed, 20 insertions, 1 deletions
diff --git a/decoder/LAVVideo/LAVVideo.cpp b/decoder/LAVVideo/LAVVideo.cpp index d5b4566e..709bf4d8 100644 --- a/decoder/LAVVideo/LAVVideo.cpp +++ b/decoder/LAVVideo/LAVVideo.cpp @@ -61,6 +61,7 @@ CLAVVideo::CLAVVideo(LPUNKNOWN pUnk, HRESULT* phr) , m_CurrentThread(0) , m_bForceInputAR(FALSE) , m_bWaitingForKeyFrame(FALSE) + , m_bSendMediaType(FALSE) { avcodec_register_all(); @@ -656,7 +657,10 @@ HRESULT CLAVVideo::ReconnectOutput(int width, int height, AVRational ar) #endif DeleteMediaType(pmt); } else { // No Stride Request? We're ok with that, too! - DbgLog((LOG_TRACE, 10, L"We did not get a stride request, sending width no stride; width: %d", width)); + long size = pOut->GetSize(); + pBIH->biWidth = size / pBIH->biHeight * 8 / pBIH->biBitCount; + m_bSendMediaType = TRUE; + DbgLog((LOG_TRACE, 10, L"We did not get a stride request, calculated stride: %d", pBIH->biWidth)); } pOut->Release(); } @@ -984,6 +988,20 @@ HRESULT CLAVVideo::Decode(BYTE *pDataIn, int nSize, const REFERENCE_TIME rtStart m_PixFmtConverter.Convert(m_pFrame, pDataOut, width, height, pBIH->biWidth); + if (m_bSendMediaType) { + AM_MEDIA_TYPE *sendmt = CreateMediaType(&mt); + if (sendmt->formattype == FORMAT_VideoInfo) { + VIDEOINFOHEADER *vih = (VIDEOINFOHEADER *)sendmt->pbFormat; + SetRect(&vih->rcSource, 0, 0, 0, 0); + } else if (sendmt->formattype == FORMAT_VideoInfo2) { + VIDEOINFOHEADER2 *vih2 = (VIDEOINFOHEADER2 *)sendmt->pbFormat; + SetRect(&vih2->rcSource, 0, 0, 0, 0); + } + pSampleOut->SetMediaType(sendmt); + DeleteMediaType(sendmt); + m_bSendMediaType = FALSE; + } + SetTypeSpecificFlags (pSampleOut); hr = m_pOutput->Deliver(pSampleOut); SafeRelease(&pSampleOut); diff --git a/decoder/LAVVideo/LAVVideo.h b/decoder/LAVVideo/LAVVideo.h index a09784cd..b5b2476d 100644 --- a/decoder/LAVVideo/LAVVideo.h +++ b/decoder/LAVVideo/LAVVideo.h @@ -131,6 +131,7 @@ private: BOOL m_bWaitingForKeyFrame; BOOL m_bForceTypeNegotiation; BOOL m_bForceInputAR; + BOOL m_bSendMediaType; int m_nThreads; |