diff options
-rw-r--r-- | src/libw32dll/DirectShow/DS_Filter.c | 3 | ||||
-rw-r--r-- | src/libw32dll/DirectShow/DS_VideoDecoder.c | 38 | ||||
-rw-r--r-- | src/libw32dll/DirectShow/guids.h | 3 | ||||
-rw-r--r-- | src/libw32dll/libwin32.h | 20 | ||||
-rw-r--r-- | src/libw32dll/w32codec.c | 4 | ||||
-rw-r--r-- | src/libw32dll/wine/vfw.h | 3 |
6 files changed, 47 insertions, 24 deletions
diff --git a/src/libw32dll/DirectShow/DS_Filter.c b/src/libw32dll/DirectShow/DS_Filter.c index 7bb7d70ee..b60e2be75 100644 --- a/src/libw32dll/DirectShow/DS_Filter.c +++ b/src/libw32dll/DirectShow/DS_Filter.c @@ -216,6 +216,9 @@ void DS_Filter_Start(DS_Filter *this) return; Debug printf("DS_Filter::Start() %p\n", this->m_pFilter); + + this->m_pFilter->vt->Pause(this->m_pFilter); + hr=this->m_pFilter->vt->Run(this->m_pFilter, 0); if (hr != 0) { diff --git a/src/libw32dll/DirectShow/DS_VideoDecoder.c b/src/libw32dll/DirectShow/DS_VideoDecoder.c index 8c05a47e8..6d4d5460e 100644 --- a/src/libw32dll/DirectShow/DS_VideoDecoder.c +++ b/src/libw32dll/DirectShow/DS_VideoDecoder.c @@ -79,7 +79,7 @@ DS_VideoDecoder * DS_VideoDecoder_Create(CodecInfo * info, BITMAPINFOHEADER * f bihs = (format->biSize < (int) sizeof(BITMAPINFOHEADER)) ? sizeof(BITMAPINFOHEADER) : format->biSize; bihs = sizeof(VIDEOINFOHEADER) - sizeof(BITMAPINFOHEADER) + bihs; - + this->iv.m_bh = (BITMAPINFOHEADER*)malloc(bihs); memcpy(this->iv.m_bh, format, bihs); this->iv.m_State = STOP; @@ -94,10 +94,10 @@ DS_VideoDecoder * DS_VideoDecoder_Create(CodecInfo * info, BITMAPINFOHEADER * f memset(this->m_sVhdr, 0, bihs); memcpy(&this->m_sVhdr->bmiHeader, this->iv.m_bh, this->iv.m_bh->biSize); this->m_sVhdr->rcSource.left = this->m_sVhdr->rcSource.top = 0; -// this->m_sVhdr->rcSource.right = this->m_sVhdr->bmiHeader.biWidth; -// this->m_sVhdr->rcSource.bottom = this->m_sVhdr->bmiHeader.biHeight; - this->m_sVhdr->rcSource.right = 0; - this->m_sVhdr->rcSource.bottom = 0; + this->m_sVhdr->rcSource.right = this->m_sVhdr->bmiHeader.biWidth; + this->m_sVhdr->rcSource.bottom = this->m_sVhdr->bmiHeader.biHeight; + //this->m_sVhdr->rcSource.right = 0; + //this->m_sVhdr->rcSource.bottom = 0; this->m_sVhdr->rcTarget = this->m_sVhdr->rcSource; this->m_sOurType.majortype = MEDIATYPE_Video; @@ -111,8 +111,8 @@ DS_VideoDecoder * DS_VideoDecoder_Create(CodecInfo * info, BITMAPINFOHEADER * f this->m_sOurType.pbFormat = (char*)this->m_sVhdr; this->m_sVhdr2 = (VIDEOINFOHEADER*)(malloc(sizeof(VIDEOINFOHEADER)+12)); - memcpy(this->m_sVhdr2, this->m_sVhdr, sizeof(VIDEOINFOHEADER)); - memset((char*)this->m_sVhdr2 + sizeof(VIDEOINFOHEADER), 0, 12); + memcpy(this->m_sVhdr2, this->m_sVhdr, sizeof(VIDEOINFOHEADER)+12); + //memset((char*)this->m_sVhdr2 + sizeof(VIDEOINFOHEADER), 0, 12); this->m_sVhdr2->bmiHeader.biCompression = 0; this->m_sVhdr2->bmiHeader.biBitCount = 24; @@ -128,6 +128,7 @@ DS_VideoDecoder * DS_VideoDecoder_Create(CodecInfo * info, BITMAPINFOHEADER * f this->m_sDestType.pUnk = 0; this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); this->m_sDestType.pbFormat = (char*)this->m_sVhdr2; + memset(&this->iv.m_obh, 0, sizeof(this->iv.m_obh)); memcpy(&this->iv.m_obh, this->iv.m_bh, sizeof(this->iv.m_obh) < (unsigned) this->iv.m_bh->biSize ? sizeof(this->iv.m_obh) : (unsigned) this->iv.m_bh->biSize); @@ -154,7 +155,7 @@ DS_VideoDecoder * DS_VideoDecoder_Create(CodecInfo * info, BITMAPINFOHEADER * f } } - this->iv.m_decoder = this->iv.m_obh; + memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh) ); switch (this->iv.m_bh->biCompression) { @@ -253,18 +254,17 @@ int DS_VideoDecoder_DecodeInternal(DS_VideoDecoder *this, const void* src, int s IMediaSample* sample = 0; char* ptr; int result; - int q; Debug printf("DS_VideoDecoder_DecodeInternal(%p,%p,%d,%d,%p)\n",this,src,size,is_keyframe,pImage->ptr); this->m_pDS_Filter->m_pAll->vt->GetBuffer(this->m_pDS_Filter->m_pAll, &sample, 0, 0, 0); - + if (!sample) { Debug printf("ERROR: null sample\n"); return -1; } - + //cout << "DECODE " << (void*) pImage << " d: " << (void*) pImage->Data() << endl; if (pImage) { @@ -305,6 +305,7 @@ int DS_VideoDecoder_DecodeInternal(DS_VideoDecoder *this, const void* src, int s sample->vt->Release((IUnknown*)sample); +#if 0 if (this->m_bIsDivX) { int q; @@ -367,6 +368,7 @@ int DS_VideoDecoder_DecodeInternal(DS_VideoDecoder *this, const void* src, int s } } } +#endif return 0; } @@ -420,13 +422,13 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, fourcc_t csp) } if( bits == 16 ) { - this->iv.colors[0]=0xF800; - this->iv.colors[1]=0x07E0; - this->iv.colors[2]=0x001F; + this->iv.m_obh.colors[0]=0xF800; + this->iv.m_obh.colors[1]=0x07E0; + this->iv.m_obh.colors[2]=0x001F; } else if ( bits == 15 ) { - this->iv.colors[0]=0x7C00; - this->iv.colors[1]=0x03E0; - this->iv.colors[2]=0x001F; + this->iv.m_obh.colors[0]=0x7C00; + this->iv.m_obh.colors[1]=0x03E0; + this->iv.m_obh.colors[2]=0x001F; } else { this->iv.m_obh.biSize = sizeof(BITMAPINFOHEADER); this->iv.m_obh.biCompression = 0; //BI_RGB @@ -541,7 +543,7 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, fourcc_t csp) return -1; } - this->iv.m_decoder = this->iv.m_obh; + memcpy( &this->iv.m_decoder, &this->iv.m_obh, sizeof(this->iv.m_obh)); // m_obh=temp; // if(csp) diff --git a/src/libw32dll/DirectShow/guids.h b/src/libw32dll/DirectShow/guids.h index a2525848a..165119a82 100644 --- a/src/libw32dll/DirectShow/guids.h +++ b/src/libw32dll/DirectShow/guids.h @@ -43,7 +43,8 @@ typedef struct tagVIDEOINFOHEADER { unsigned long dwBitRate; // Approximate bit data rate unsigned long dwBitErrorRate; // Bit error rate for this stream REFERENCE_TIME AvgTimePerFrame; // Average time per frame (100ns units) - BITMAPINFOHEADER bmiHeader; + BITMAPINFOHEADER bmiHeader; + int spare[4]; } VIDEOINFOHEADER; typedef struct _AllocatorProperties diff --git a/src/libw32dll/libwin32.h b/src/libw32dll/libwin32.h index ff3c448a8..c4774c731 100644 --- a/src/libw32dll/libwin32.h +++ b/src/libw32dll/libwin32.h @@ -101,6 +101,21 @@ struct IAudioEncoder START, }; +typedef struct _BitmapInfo +{ + long biSize; + long biWidth; + long biHeight; + short biPlanes; + short biBitCount; + long biCompression; + long biSizeImage; + long biXPelsPerMeter; + long biYPelsPerMeter; + long biClrUsed; + long biClrImportant; + int colors[3]; +} BitmapInfo; typedef struct _IVideoDecoder { @@ -132,9 +147,8 @@ typedef struct _IVideoDecoder int m_bCapable16b; BITMAPINFOHEADER* m_bh; // format of input data (might be larger - e.g. huffyuv) - BITMAPINFOHEADER m_decoder; // format of decoder output - BITMAPINFOHEADER m_obh; // format of returned frames - int colors[3]; + BitmapInfo m_decoder; // format of decoder output + BitmapInfo m_obh; // format of returned frames }IVideoDecoder; /* diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index 950f455e8..774dae12c 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: w32codec.c,v 1.44 2001/11/16 17:55:20 miguelfreitas Exp $ + * $Id: w32codec.c,v 1.45 2001/11/16 20:21:09 miguelfreitas Exp $ * * routines for using w32 codecs * DirectShow support by Miguel Freitas (Nov/2001) @@ -85,7 +85,7 @@ typedef struct w32v_decoder_s { int decoder_ok; BITMAPINFOHEADER bih, o_bih; - char scratch1[10]; /* some codecs overflow o_bih */ + char scratch1[16]; /* some codecs overflow o_bih */ HIC hic; int yuv_supported ; int yuv_hack_needed ; diff --git a/src/libw32dll/wine/vfw.h b/src/libw32dll/wine/vfw.h index f05b8d59b..3eba74e08 100644 --- a/src/libw32dll/wine/vfw.h +++ b/src/libw32dll/wine/vfw.h @@ -31,6 +31,9 @@ typedef struct long biYPelsPerMeter; long biClrUsed; long biClrImportant; + /* very, very dirty HACK to make WMV8 work. + we must fix DS_VideoDecoder.c to remove the line below */ + int colors[3]; } BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER; typedef struct { BITMAPINFOHEADER bmiHeader; |