[QUARTZ]
authorChristoph von Wittich <christoph_vw@reactos.org>
Sat, 29 May 2010 09:07:32 +0000 (09:07 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sat, 29 May 2010 09:07:32 +0000 (09:07 +0000)
sync to wine 1.2 RC2

svn path=/trunk/; revision=47401

12 files changed:
reactos/dll/directx/quartz/acmwrapper.c
reactos/dll/directx/quartz/avidec.c
reactos/dll/directx/quartz/avisplit.c
reactos/dll/directx/quartz/dsoundrender.c
reactos/dll/directx/quartz/enumfilters.c
reactos/dll/directx/quartz/filtergraph.c
reactos/dll/directx/quartz/filtermapper.c
reactos/dll/directx/quartz/memallocator.c
reactos/dll/directx/quartz/mpegsplit.c
reactos/dll/directx/quartz/pin.c
reactos/dll/directx/quartz/pin.h
reactos/dll/directx/quartz/videorenderer.c

index c275d83..a032391 100644 (file)
@@ -105,7 +105,7 @@ static HRESULT ACMWrapper_ProcessSampleData(InputPin *pin, IMediaSample *pSample
 
     tMed = tStart;
 
-    TRACE("Sample data ptr = %p, size = %ld\n", pbSrcStream, (long)cbSrcStream);
+    TRACE("Sample data ptr = %p, size = %d\n", pbSrcStream, cbSrcStream);
 
     hr = IPin_ConnectionMediaType(This->tf.ppPins[0], &amt);
     if (FAILED(hr))
index 8469bbc..b7d45e9 100644 (file)
@@ -101,7 +101,7 @@ static HRESULT AVIDec_ProcessSampleData(InputPin *pin, IMediaSample *pSample)
 
     cbSrcStream = IMediaSample_GetActualDataLength(pSample);
 
-    TRACE("Sample data ptr = %p, size = %ld\n", pbSrcStream, (long)cbSrcStream);
+    TRACE("Sample data ptr = %p, size = %d\n", pbSrcStream, cbSrcStream);
 
     hr = IPin_ConnectionMediaType(This->tf.ppPins[0], &amt);
     if (FAILED(hr)) {
index 42ec2ae..6107880 100644 (file)
@@ -178,7 +178,6 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
         {
             AVISTDINDEX *index = stream->stdindex[stream->index];
             AVISTDINDEX_ENTRY *entry = &index->aIndex[stream->pos];
-            BOOL keyframe;
 
             /* End of file */
             if (stream->index >= stream->entries)
@@ -189,7 +188,6 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
             }
 
             rtSampleStart = index->qwBaseOffset;
-            keyframe = !(entry->dwSize >> 31);
             rtSampleStart += entry->dwOffset;
             rtSampleStart = MEDIATIME_FROM_BYTES(rtSampleStart);
 
@@ -208,7 +206,6 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
         {
             DWORD flags = This->oldindex->aIndex[stream->pos].dwFlags;
             DWORD size = This->oldindex->aIndex[stream->pos].dwSize;
-            BOOL keyframe;
 
             /* End of file */
             if (stream->index)
@@ -218,8 +215,6 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
                 return S_FALSE;
             }
 
-            keyframe = !!(flags & AVIIF_KEYFRAME);
-
             rtSampleStart = MEDIATIME_FROM_BYTES(This->offset);
             rtSampleStart += MEDIATIME_FROM_BYTES(This->oldindex->aIndex[stream->pos].dwOffset);
             rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(size);
@@ -775,7 +770,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
         {
             const AVISUPERINDEX *pIndex = (const AVISUPERINDEX *)pChunk;
             DWORD x;
-            long rest = pIndex->cb - sizeof(AVISUPERINDEX) + sizeof(RIFFCHUNK) + sizeof(pIndex->aIndex[0]) * ANYSIZE_ARRAY;
+            UINT rest = pIndex->cb - sizeof(AVISUPERINDEX) + sizeof(RIFFCHUNK) + sizeof(pIndex->aIndex[0]) * ANYSIZE_ARRAY;
 
             if (pIndex->cb < sizeof(AVISUPERINDEX) - sizeof(RIFFCHUNK))
             {
index 1d87a7f..b327c00 100644 (file)
@@ -78,8 +78,8 @@ typedef struct DSoundRenderImpl
 
     HANDLE state_change, blocked;
 
-    long volume;
-    long pan;
+    LONG volume;
+    LONG pan;
 } DSoundRenderImpl;
 
 /* Seeking is not needed for a renderer, rely on newsegment for the appropriate changes */
@@ -238,7 +238,7 @@ static HRESULT DSoundRender_Sample(LPVOID iface, IMediaSample * pSample)
 {
     DSoundRenderImpl *This = iface;
     LPBYTE pbSrcStream = NULL;
-    long cbSrcStream = 0;
+    LONG cbSrcStream = 0;
     REFERENCE_TIME tStart, tStop;
     HRESULT hr;
     AM_MEDIA_TYPE *amt;
@@ -344,7 +344,7 @@ static HRESULT DSoundRender_Sample(LPVOID iface, IMediaSample * pSample)
     }
 
     cbSrcStream = IMediaSample_GetActualDataLength(pSample);
-    TRACE("Sample data ptr = %p, size = %ld\n", pbSrcStream, cbSrcStream);
+    TRACE("Sample data ptr = %p, size = %d\n", pbSrcStream, cbSrcStream);
 
 #if 0 /* For debugging purpose */
     {
@@ -677,7 +677,7 @@ static HRESULT WINAPI DSoundRender_GetState(IBaseFilter * iface, DWORD dwMilliSe
     }
     LeaveCriticalSection(&This->csFilter);
 
-    return S_OK;
+    return hr;
 }
 
 static HRESULT WINAPI DSoundRender_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock)
@@ -877,11 +877,11 @@ static HRESULT WINAPI DSoundRender_InputPin_ReceiveConnection(IPin * iface, IPin
         {
             hr = IDirectSoundBuffer_SetVolume(DSImpl->dsbuffer, DSImpl->volume);
             if (FAILED(hr))
-                ERR("Can't set volume to %ld (%x)\n", DSImpl->volume, hr);
+                ERR("Can't set volume to %d (%x)\n", DSImpl->volume, hr);
 
             hr = IDirectSoundBuffer_SetPan(DSImpl->dsbuffer, DSImpl->pan);
             if (FAILED(hr))
-                ERR("Can't set pan to %ld (%x)\n", DSImpl->pan, hr);
+                ERR("Can't set pan to %d (%x)\n", DSImpl->pan, hr);
 
             DSImpl->write_pos = 0;
             hr = S_OK;
index ca6a989..ab1f6ec 100644 (file)
@@ -126,6 +126,9 @@ static HRESULT WINAPI IEnumFiltersImpl_Next(IEnumFilters * iface, ULONG cFilters
 
     TRACE("(%p)->(%u, %p, %p)\n", iface, cFilters, ppFilters, pcFetched);
 
+    if (!ppFilters)
+        return E_POINTER;
+
     for (i = 0; i < cFetched; i++)
     {
        ppFilters[i] = This->ppFilters[This->uIndex + i];
index 3e9a1da..18bf97c 100644 (file)
 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
 
 typedef struct {
-    HWND hWnd;      /* Target window */
-    long msg;       /* User window message */
-    long instance;  /* User data */
-    int  disabled;  /* Disabled messages posting */
+    HWND     hWnd;      /* Target window */
+    UINT     msg;       /* User window message */
+    LONG_PTR instance;  /* User data */
+    int      disabled;  /* Disabled messages posting */
 } WndNotify;
 
 typedef struct {
-    long lEventCode;   /* Event code */
+    LONG lEventCode;   /* Event code */
     LONG_PTR lParam1;  /* Param1 */
     LONG_PTR lParam2;  /* Param2 */
 } Event;
@@ -120,7 +120,7 @@ static int EventsQueue_PutEvent(EventsQueue* omr, const Event* evt)
     return TRUE;
 }
 
-static int EventsQueue_GetEvent(EventsQueue* omr, Event* evt, long msTimeOut)
+static int EventsQueue_GetEvent(EventsQueue* omr, Event* evt, LONG msTimeOut)
 {
     if (WaitForSingleObject(omr->msg_event, msTimeOut) != WAIT_OBJECT_0)
        return FALSE;
@@ -182,7 +182,7 @@ typedef struct _IFilterGraphImpl {
     LPWSTR * pFilterNames;
     int nFilters;
     int filterCapacity;
-    long nameIndex;
+    LONG nameIndex;
     IReferenceClock *refClock;
     EventsQueue evqueue;
     HANDLE hEventCompletion;
@@ -4970,7 +4970,7 @@ static HRESULT WINAPI MediaEvent_SetNotifyWindow(IMediaEventEx *iface,
 
     This->notif.hWnd = (HWND)hwnd;
     This->notif.msg = lMsg;
-    This->notif.instance = (long) lInstanceData;
+    This->notif.instance = lInstanceData;
 
     return S_OK;
 }
@@ -5055,30 +5055,26 @@ static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID * pClass
 
 static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
 {
-    FIXME("(): stub\n");
-
-    return E_NOTIMPL;
+    ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
+    return MediaControl_Stop((IMediaControl*)&This->IMediaControl_vtbl);
 }
 
 static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
 {
-    FIXME("(): stub\n");
-
-    return E_NOTIMPL;
+    ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
+    return MediaControl_Pause((IMediaControl*)&This->IMediaControl_vtbl);
 }
 
 static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME tStart)
 {
-    FIXME("(0x%s): stub\n", wine_dbgstr_longlong(tStart));
-
-    return E_NOTIMPL;
+    ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
+    return MediaControl_Run((IMediaControl*)&This->IMediaControl_vtbl);
 }
 
 static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD dwMsTimeout, FILTER_STATE * pState)
 {
-    FIXME("(%d, %p): stub\n", dwMsTimeout, pState);
-
-    return E_NOTIMPL;
+    ICOM_THIS_MULTI(IFilterGraphImpl, IMediaFilter_vtbl, iface);
+    return MediaControl_GetState((IMediaControl*)&This->IMediaControl_vtbl, dwMsTimeout, (OAFilterState*)pState);
 }
 
 static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceClock *pClock)
index bacb729..aeacfac 100644 (file)
@@ -1778,7 +1778,7 @@ static HRESULT WINAPI AMFilterData_ParseFilterData(IAMFilterData* iface,
     prf2 = CoTaskMemAlloc(sizeof(*prf2));
     if (!prf2)
         return E_OUTOFMEMORY;
-    *ppRegFilter2 = (BYTE *)&prf2;
+    *ppRegFilter2 = (BYTE *)prf2;
 
     hr = FM2_ReadFilterData(pData, prf2);
     if (FAILED(hr))
index 7f799c9..a1c4473 100644 (file)
@@ -534,7 +534,7 @@ static HRESULT WINAPI StdMediaSample2_GetTime(IMediaSample2 * iface, REFERENCE_T
         hr = S_OK;
     }
 
-    return S_OK;
+    return hr;
 }
 
 static HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 * iface, REFERENCE_TIME * pStart, REFERENCE_TIME * pEnd)
@@ -785,7 +785,7 @@ static HRESULT StdMemAllocator_Alloc(IMemAllocator * iface)
     StdMemAllocator *This = (StdMemAllocator *)iface;
     StdMediaSample2 * pSample = NULL;
     SYSTEM_INFO si;
-    long i;
+    LONG i;
 
     assert(list_empty(&This->base.free_list));
 
index e44a10f..7eb2d2c 100644 (file)
@@ -246,11 +246,8 @@ static HRESULT MPEGSplitter_process_sample(LPVOID iface, IMediaSample * pSample,
     BYTE *pbSrcStream;
     DWORD cbSrcStream = 0;
     REFERENCE_TIME tStart, tStop, tAviStart = This->position;
-    Parser_OutputPin * pOutputPin;
     HRESULT hr;
 
-    pOutputPin = (Parser_OutputPin*)This->Parser.ppPins[1];
-
     hr = IMediaSample_GetTime(pSample, &tStart, &tStop);
     if (SUCCEEDED(hr))
     {
index ca34d93..fd0d5a2 100644 (file)
@@ -1834,7 +1834,7 @@ HRESULT InputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinI
     return E_FAIL;
 }
 
-HRESULT OutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, long outputpin_size, const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin)
+HRESULT OutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin)
 {
     OutputPin * pPinImpl;
 
index 2cbaddb..e356ef3 100644 (file)
@@ -143,7 +143,7 @@ typedef struct PullPin
 
 /*** Constructors ***/
 HRESULT InputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC_PUSH pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin);
-HRESULT OutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, long outputpin_size, const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
+HRESULT OutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
 HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, STOPPROCESSPROC, REQUESTPROC pCustomRequest, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
 
 /**************************/
index b31959e..268373f 100644 (file)
@@ -82,8 +82,8 @@ typedef struct VideoRendererImpl
     RECT SourceRect;
     RECT DestRect;
     RECT WindowPos;
-    long VideoWidth;
-    long VideoHeight;
+    LONG VideoWidth;
+    LONG VideoHeight;
     IUnknown * pUnkOuter;
     BOOL bUnkOuterValid;
     BOOL bAggregatable;
@@ -287,7 +287,6 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data,
         return VFW_E_RUNTIME_ERROR;
     }
 
-
     TRACE("biSize = %d\n", bmiHeader->biSize);
     TRACE("biWidth = %d\n", bmiHeader->biWidth);
     TRACE("biHeight = %d\n", bmiHeader->biHeight);
@@ -344,7 +343,7 @@ static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample)
 {
     VideoRendererImpl *This = iface;
     LPBYTE pbSrcStream = NULL;
-    long cbSrcStream = 0;
+    LONG cbSrcStream = 0;
     REFERENCE_TIME tStart, tStop;
     HRESULT hr;
 
@@ -396,7 +395,7 @@ static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample)
 
     cbSrcStream = IMediaSample_GetActualDataLength(pSample);
 
-    TRACE("val %p %ld\n", pbSrcStream, cbSrcStream);
+    TRACE("val %p %d\n", pbSrcStream, cbSrcStream);
 
 #if 0 /* For debugging purpose */
     {
@@ -483,6 +482,7 @@ static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt
         IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
     {
         VideoRendererImpl* This = iface;
+        LONG height;
 
         if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
         {
@@ -490,7 +490,11 @@ static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt
             This->SourceRect.left = 0;
             This->SourceRect.top = 0;
             This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
-            This->SourceRect.bottom = This->VideoHeight = format->bmiHeader.biHeight;
+            height = format->bmiHeader.biHeight;
+            if (height < 0)
+                This->SourceRect.bottom = This->VideoHeight = -height;
+            else
+                This->SourceRect.bottom = This->VideoHeight = height;
         }
         else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
         {
@@ -499,7 +503,11 @@ static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt
             This->SourceRect.left = 0;
             This->SourceRect.top = 0;
             This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
-            This->SourceRect.bottom = This->VideoHeight = format2->bmiHeader.biHeight;
+            height = format2->bmiHeader.biHeight;
+            if (height < 0)
+                This->SourceRect.bottom = This->VideoHeight = -height;
+            else
+                This->SourceRect.bottom = This->VideoHeight = height;
         }
         else
         {
@@ -1176,10 +1184,25 @@ static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
 /*** IBasicVideo methods ***/
 static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
                                                     REFTIME *pAvgTimePerFrame) {
+    AM_MEDIA_TYPE *pmt;
     ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
 
-    FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pAvgTimePerFrame);
+    if (!This->pInputPin->pin.pConnectedTo)
+        return VFW_E_NOT_CONNECTED;
 
+    TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
+
+    pmt = &This->pInputPin->pin.mtCurrent;
+    if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) {
+        VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)pmt->pbFormat;
+        *pAvgTimePerFrame = vih->AvgTimePerFrame;
+    } else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) {
+        VIDEOINFOHEADER2 *vih = (VIDEOINFOHEADER2*)pmt->pbFormat;
+        *pAvgTimePerFrame = vih->AvgTimePerFrame;
+    } else {
+        ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt->formattype));
+        *pAvgTimePerFrame = 0;
+    }
     return S_OK;
 }
 
@@ -1779,9 +1802,6 @@ static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
 
     TRACE("(%p/%p)->(%d)\n", This, iface, WindowStyleEx);
 
-    if (WindowStyleEx & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
-        return E_INVALIDARG;
-
     if (!SetWindowLongA(This->hWnd, GWL_EXSTYLE, WindowStyleEx))
         return E_FAIL;
 
@@ -1805,7 +1825,7 @@ static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
 
     TRACE("(%p/%p)->(%d)\n", This, iface, AutoShow);
 
-    This->AutoShow = 1; /* FIXME: Should be AutoShow */;
+    This->AutoShow = AutoShow;
 
     return S_OK;
 }
@@ -1825,16 +1845,20 @@ static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
                                                   LONG WindowState) {
     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
 
-    FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, WindowState);
-
+    TRACE("(%p/%p)->(%d)\n", This, iface, WindowState);
+    ShowWindow(This->hWnd, WindowState);
     return S_OK;
 }
 
 static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
                                                   LONG *WindowState) {
+    WINDOWPLACEMENT place;
     ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
 
-    FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, WindowState);
+    place.length = sizeof(place);
+    GetWindowPlacement(This->hWnd, &place);
+    TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
+    *WindowState = place.showCmd;
 
     return S_OK;
 }