[Mplayer-cvslog] CVS: main/loader/DirectShow DS_Filter.cpp,1.6,1.7 DS_VideoDec.cpp,1.8,1.9 formats.h,1.3,1.4

Arpi of Ize arpi at mplayer.dev.hu
Wed Aug 15 02:38:03 CEST 2001


Update of /cvsroot/mplayer/main/loader/DirectShow
In directory mplayer:/var/tmp.root/cvs-serv21866

Modified Files:
	DS_Filter.cpp DS_VideoDec.cpp formats.h 
Log Message:
fixed BITMAPINFO struct length truncation (WMV8)

Index: DS_Filter.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/DS_Filter.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DS_Filter.cpp	11 Jun 2001 12:46:53 -0000	1.6
+++ DS_Filter.cpp	15 Aug 2001 00:38:01 -0000	1.7
@@ -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;
 }
 

Index: DS_VideoDec.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/DS_VideoDec.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DS_VideoDec.cpp	4 Aug 2001 13:53:26 -0000	1.8
+++ DS_VideoDec.cpp	15 Aug 2001 00:38:01 -0000	1.9
@@ -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;
+#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;

Index: formats.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/DirectShow/formats.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- formats.h	14 Aug 2001 20:21:06 -0000	1.3
+++ formats.h	15 Aug 2001 00:38:01 -0000	1.4
@@ -38,7 +38,7 @@
     long  	biYPelsPerMeter;
     long 	biClrUsed;
     long 	biClrImportant;
-    long	spec[16];
+//    long	spec[16];
 } BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
 typedef struct {
 	BITMAPINFOHEADER bmiHeader;




More information about the MPlayer-cvslog mailing list