# HG changeset patch # User arpi # Date 997835881 0 # Node ID 9525bff8bea8596e3c0498dfdbb5cbea640571e6 # Parent 1c8f80aeecdb203c8ac71b2d37fbf2d11f9ed199 fixed BITMAPINFO struct length truncation (WMV8) diff -r 1c8f80aeecdb -r 9525bff8bea8 loader/dshow/DS_Filter.c --- a/loader/dshow/DS_Filter.c Wed Aug 15 00:35:35 2001 +0000 +++ b/loader/dshow/DS_Filter.c Wed Aug 15 00:38:01 2001 +0000 @@ -181,6 +181,8 @@ 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 @@ return; } m_pImp->vt->NotifyAllocator(m_pImp, m_pAll, 0); + m_iState = 2; } diff -r 1c8f80aeecdb -r 9525bff8bea8 loader/dshow/DS_VideoDec.c --- a/loader/dshow/DS_VideoDec.c Wed Aug 15 00:35:35 2001 +0000 +++ b/loader/dshow/DS_VideoDec.c Wed Aug 15 00:38:01 2001 +0000 @@ -52,11 +52,11 @@ 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 @@ 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; - m_sOurType.majortype=MEDIATYPE_Video; +#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 @@ 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 @@ 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 @@ // 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;