diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-08-15 00:38:01 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-08-15 00:38:01 +0000 |
commit | 5fa1cc63206209d6e4816e5c3e3b90c5fb2513e5 (patch) | |
tree | 217bb86e2b302b2a138869a73ea036f3f46f8f7e /loader/dshow | |
parent | b15e5745af8ed9333329d0c8f6d7006f83bf02ca (diff) |
fixed BITMAPINFO struct length truncation (WMV8)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1526 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'loader/dshow')
-rw-r--r-- | loader/dshow/DS_Filter.c | 3 | ||||
-rw-r--r-- | loader/dshow/DS_VideoDec.c | 40 |
2 files changed, 31 insertions, 12 deletions
diff --git a/loader/dshow/DS_Filter.c b/loader/dshow/DS_Filter.c index d3a530ddb4..e2eeb1301a 100644 --- a/loader/dshow/DS_Filter.c +++ b/loader/dshow/DS_Filter.c @@ -181,6 +181,8 @@ void DS_Filter::Start() if (m_iState != 1) return; + m_pFilter->vt->Pause(m_pFilter); + HRESULT hr=m_pFilter->vt->Run(m_pFilter, 0); if (hr != 0) { @@ -194,6 +196,7 @@ void DS_Filter::Start() return; } m_pImp->vt->NotifyAllocator(m_pImp, m_pAll, 0); + m_iState = 2; } diff --git a/loader/dshow/DS_VideoDec.c b/loader/dshow/DS_VideoDec.c index eade91bcf0..48509602d3 100644 --- a/loader/dshow/DS_VideoDec.c +++ b/loader/dshow/DS_VideoDec.c @@ -52,11 +52,11 @@ extern "C" char* def_path; static DS_Filter* dsf=0; static AM_MEDIA_TYPE m_sOurType, m_sDestType; - static VIDEOINFOHEADER m_sVhdr; + static VIDEOINFOHEADER *m_sVhdr; static VIDEOINFOHEADER *m_sVhdr2; static void* m_pCust; - static BITMAPINFOHEADER m_bh;//format of input data + static BITMAPINFOHEADER *m_bh;//format of input data static BitmapInfo m_decoder;//format of decoder output static BitmapInfo m_obh; //format of returned frames // CImage* m_outFrame; @@ -76,29 +76,46 @@ extern "C" int DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER* try { - m_bh=*format; + m_bh=format; memset(&m_obh, 0, sizeof(m_obh)); m_obh.biSize=sizeof(m_obh); +#if 0 memset(&m_sVhdr, 0, sizeof(m_sVhdr)); m_sVhdr.bmiHeader=m_bh; m_sVhdr.rcSource.left=m_sVhdr.rcSource.top=0; m_sVhdr.rcSource.right=m_sVhdr.bmiHeader.biWidth; m_sVhdr.rcSource.bottom=m_sVhdr.bmiHeader.biHeight; m_sVhdr.rcTarget=m_sVhdr.rcSource; +#else + unsigned bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ? + sizeof(BITMAPINFOHEADER) : format->biSize; + bihs = sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER) + bihs; + + m_sVhdr = (VIDEOINFOHEADER*) new char[bihs]; + memset(m_sVhdr, 0, bihs); + memcpy(&m_sVhdr->bmiHeader, m_bh, m_bh->biSize); + + m_sVhdr->rcSource.left = m_sVhdr->rcSource.top = 0; + m_sVhdr->rcSource.right = m_sVhdr->bmiHeader.biWidth; + m_sVhdr->rcSource.bottom = m_sVhdr->bmiHeader.biHeight; + m_sVhdr->rcTarget = m_sVhdr->rcSource; +#endif m_sOurType.majortype=MEDIATYPE_Video; - m_sOurType.subtype=MEDIATYPE_Video; - m_sOurType.subtype.f1=m_sVhdr.bmiHeader.biCompression; + m_sOurType.subtype.f1=m_sVhdr->bmiHeader.biCompression; m_sOurType.formattype=FORMAT_VideoInfo; m_sOurType.bFixedSizeSamples=false; m_sOurType.bTemporalCompression=true; m_sOurType.pUnk=0; - m_sOurType.cbFormat=sizeof(m_sVhdr); - m_sOurType.pbFormat=(char*)&m_sVhdr; +// m_sOurType.cbFormat=sizeof(m_sVhdr); +// m_sOurType.pbFormat=(char*)&m_sVhdr; + m_sOurType.cbFormat = bihs; + m_sOurType.pbFormat = (char*)m_sVhdr; m_sVhdr2=(VIDEOINFOHEADER*)(new char[sizeof(VIDEOINFOHEADER)+12]); - *m_sVhdr2=m_sVhdr; +// *m_sVhdr2=m_sVhdr; + memcpy(m_sVhdr2, m_sVhdr, sizeof(VIDEOINFOHEADER)+12); m_sVhdr2->bmiHeader.biCompression=0; m_sVhdr2->bmiHeader.biBitCount=24; @@ -114,8 +131,7 @@ extern "C" int DS_VideoDecoder_Open(char* dllname, GUID* guid, BITMAPINFOHEADER* m_sDestType.pUnk=0; m_sDestType.cbFormat=sizeof(VIDEOINFOHEADER); m_sDestType.pbFormat=(char*)m_sVhdr2; - - m_obh=m_bh; + m_obh = *m_bh; m_obh.setBits(24); HRESULT result; @@ -218,7 +234,7 @@ extern "C" int DS_VideoDecoder_DecodeFrame(char* src, int size, int is_keyframe, if(!size)return 0; - m_bh.biSizeImage=size; + m_bh->biSizeImage=size; IMediaSample* sample=0; //printf("GetBuffer... (m_pAll=%X) ",dsf->m_pAll);fflush(stdout); @@ -336,7 +352,7 @@ extern "C" int DS_VideoDecoder_SetDestFmt(int bits, int csp){ // m_obh=temp; // if(csp) // m_obh.biBitCount=BitmapInfo::BitCount(csp); - m_bh.biBitCount=bits; + m_bh->biBitCount=bits; if(dsf->m_iState>0) { int old_state=dsf->m_iState; |