[QUARTZ] Sync with Wine Staging 2.16. CORE-13762
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 16 Sep 2017 20:45:04 +0000 (20:45 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 16 Sep 2017 20:45:04 +0000 (20:45 +0000)
84f5761 quartz: Use standard wine_dbgstr_longlong.
e994c62 quartz: Use nAvgBytesPerSec to calculate length.
e1d14d2 quartz: Restore a comment explaining mediatime.
bf9eaac quartz: Small readability fix.

svn path=/trunk/; revision=75858

reactos/dll/directx/wine/quartz/avisplit.c
reactos/dll/directx/wine/quartz/dsoundrender.c
reactos/dll/directx/wine/quartz/filesource.c
reactos/dll/directx/wine/quartz/quartz_private.h
reactos/dll/directx/wine/quartz/vmr9.c
reactos/dll/directx/wine/quartz/waveparser.c

index b70383c..fbdd01a 100644 (file)
@@ -558,7 +558,7 @@ static HRESULT AVISplitter_ProcessIndex(AVISplitterImpl *This, AVISTDINDEX **ind
     TRACE("bIndexType: %u\n", pIndex->bIndexType);
     TRACE("nEntriesInUse: %u\n", pIndex->nEntriesInUse);
     TRACE("dwChunkId: %.4s\n", (char *)&pIndex->dwChunkId);
-    TRACE("qwBaseOffset: %x%08x\n", (DWORD)(pIndex->qwBaseOffset >> 32), (DWORD)pIndex->qwBaseOffset);
+    TRACE("qwBaseOffset: %s\n", wine_dbgstr_longlong(pIndex->qwBaseOffset));
     TRACE("dwReserved_3: %u\n", pIndex->dwReserved_3);
 
     if (pIndex->bIndexType != AVI_INDEX_OF_CHUNKS
@@ -578,7 +578,7 @@ static HRESULT AVISplitter_ProcessIndex(AVISplitterImpl *This, AVISTDINDEX **ind
     {
         BOOL keyframe = !(pIndex->aIndex[x].dwSize >> 31);
         DWORDLONG offset = pIndex->qwBaseOffset + pIndex->aIndex[x].dwOffset;
-        TRACE("dwOffset: %x%08x\n", (DWORD)(offset >> 32), (DWORD)offset);
+        TRACE("dwOffset: %s\n", wine_dbgstr_longlong(offset));
         TRACE("dwSize: %u\n", (pIndex->aIndex[x].dwSize & ~(1u << 31)));
         TRACE("Frame is a keyframe: %s\n", keyframe ? "yes" : "no");
     }
@@ -629,9 +629,9 @@ static HRESULT AVISplitter_ProcessOldIndex(AVISplitterImpl *This)
                 }
                 else if (temp2 != chunkid)
                 {
-                    ERR("Faulty index or bug in handling: Wanted FCC: %s, Abs FCC: %s (@ %x), Rel FCC: %s (@ %.0x%08x)\n",
+                    ERR("Faulty index or bug in handling: Wanted FCC: %s, Abs FCC: %s (@ %x), Rel FCC: %s (@ %s)\n",
                         debugstr_an((char *)&chunkid, 4), debugstr_an((char *)&temp, 4), offset,
-                        debugstr_an((char *)&temp2, 4), (DWORD)((mov_pos + offset) >> 32), (DWORD)(mov_pos + offset));
+                        debugstr_an((char *)&temp2, 4), wine_dbgstr_longlong(mov_pos + offset));
                     relative = -1;
                 }
                 else
@@ -828,7 +828,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
             stream->stdindex = CoTaskMemRealloc(stream->stdindex, sizeof(*stream->stdindex) * stream->entries);
             for (x = 0; x < pIndex->nEntriesInUse; ++x)
             {
-                TRACE("qwOffset: %x%08x\n", (DWORD)(pIndex->aIndex[x].qwOffset >> 32), (DWORD)pIndex->aIndex[x].qwOffset);
+                TRACE("qwOffset: %s\n", wine_dbgstr_longlong(pIndex->aIndex[x].qwOffset));
                 TRACE("dwSize: %u\n", pIndex->aIndex[x].dwSize);
                 TRACE("dwDuration: %u (unreliable)\n", pIndex->aIndex[x].dwDuration);
 
@@ -1117,7 +1117,7 @@ static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin,
     pAviSplit->EndOfFile = This->rtStop = MEDIATIME_FROM_BYTES(pos);
     if (pos > total)
     {
-        ERR("File smaller (%x%08x) then EndOfFile (%x%08x)\n", (DWORD)(total >> 32), (DWORD)total, (DWORD)(pAviSplit->EndOfFile >> 32), (DWORD)pAviSplit->EndOfFile);
+        ERR("File smaller (%s) then EndOfFile (%s)\n", wine_dbgstr_longlong(total), wine_dbgstr_longlong(pAviSplit->EndOfFile));
         return E_FAIL;
     }
 
index 3d1ffb4..35daaef 100644 (file)
@@ -97,9 +97,9 @@ static REFERENCE_TIME time_from_pos(DSoundRenderImpl *This, DWORD pos) {
 static DWORD pos_from_time(DSoundRenderImpl *This, REFERENCE_TIME time) {
     WAVEFORMATEX *wfx = (WAVEFORMATEX*)This->renderer.pInputPin->pin.mtCurrent.pbFormat;
     REFERENCE_TIME ret = time;
-    ret *= wfx->nSamplesPerSec;
+    ret *= wfx->nAvgBytesPerSec;
     ret /= 10000000;
-    ret *= wfx->nBlockAlign;
+    ret -= ret % wfx->nBlockAlign;
     return ret;
 }
 
@@ -406,7 +406,7 @@ static HRESULT WINAPI DSoundRender_CheckMediaType(BaseRenderer *iface, const AM_
     TRACE("Format = %p\n", format);
     TRACE("wFormatTag = %x %x\n", format->wFormatTag, WAVE_FORMAT_PCM);
     TRACE("nChannels = %d\n", format->nChannels);
-    TRACE("nSamplesPerSec = %d\n", format->nAvgBytesPerSec);
+    TRACE("nSamplesPerSec = %d\n", format->nSamplesPerSec);
     TRACE("nAvgBytesPerSec = %d\n", format->nAvgBytesPerSec);
     TRACE("nBlockAlign = %d\n", format->nBlockAlign);
     TRACE("wBitsPerSample = %d\n", format->wBitsPerSample);
index 3e7a473..16a0419 100644 (file)
@@ -1320,7 +1320,7 @@ static HRESULT WINAPI FileAsyncReader_SyncRead(IAsyncReader * iface, LONGLONG ll
     HRESULT hr = S_OK;
     FileAsyncReader *This = impl_from_IAsyncReader(iface);
 
-    TRACE("(%x%08x, %d, %p)\n", (ULONG)(llPosition >> 32), (ULONG)llPosition, lLength, pBuffer);
+    TRACE("(%s, %d, %p)\n", wine_dbgstr_longlong(llPosition), lLength, pBuffer);
 
     ZeroMemory(&ovl, sizeof(ovl));
 
index c85a033..4556593 100644 (file)
@@ -52,6 +52,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
 #include "pin.h"
 #include "parser.h"
 
+/* see IAsyncReader::Request on MSDN for the explanation of this */
 #define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
 #define SEC_FROM_MEDIATIME(time) ((time) / 10000000)
 #define BYTES_FROM_MEDIATIME(time) SEC_FROM_MEDIATIME(time)
index ab2a975..6e06cf4 100644 (file)
@@ -365,7 +365,7 @@ static HRESULT WINAPI VMR9_CheckMediaType(BaseRenderer *iface, const AM_MEDIA_TY
         ERR("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
         return S_FALSE;
     }
-    if (This->bmiheader.biCompression)
+    if (This->bmiheader.biCompression != BI_RGB)
         return S_FALSE;
     return S_OK;
 }
index 31ec627..27006be 100644 (file)
@@ -27,9 +27,8 @@ typedef struct WAVEParserImpl
     ParserImpl Parser;
     LONGLONG StartOfFile; /* in media time */
     LONGLONG EndOfFile;
-    DWORD dwSampleSize;
-    DWORD nSamplesPerSec;
-    DWORD dwLength;
+    DWORD nAvgBytesPerSec;
+    DWORD nBlockAlign;
 } WAVEParserImpl;
 
 static inline WAVEParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
@@ -46,7 +45,7 @@ static LONGLONG bytepos_to_duration(WAVEParserImpl *This, LONGLONG bytepos)
 {
     LONGLONG duration = BYTES_FROM_MEDIATIME(bytepos - This->StartOfFile);
     duration *= 10000000;
-    duration /= (This->dwSampleSize * This->nSamplesPerSec);
+    duration /= This->nAvgBytesPerSec;
 
     return duration;
 }
@@ -55,11 +54,11 @@ static LONGLONG duration_to_bytepos(WAVEParserImpl *This, LONGLONG duration)
 {
     LONGLONG bytepos;
 
-    bytepos = (This->dwSampleSize * This->nSamplesPerSec);
+    bytepos = This->nAvgBytesPerSec;
     bytepos *= duration;
     bytepos /= 10000000;
+    bytepos -= bytepos % This->nBlockAlign;
     bytepos += BYTES_FROM_MEDIATIME(This->StartOfFile);
-    bytepos -= bytepos % This->dwSampleSize;
 
     return MEDIATIME_FROM_BYTES(bytepos);
 }
@@ -236,7 +235,6 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin,
     PIN_INFO piOutput;
     AM_MEDIA_TYPE amt;
     WAVEParserImpl * pWAVEParser = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
-    LONGLONG length, avail;
 
     piOutput.dir = PINDIR_OUTPUT;
     piOutput.pFilter = &pWAVEParser->Parser.filter.IBaseFilter_iface;
@@ -305,10 +303,8 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin,
     props->cbPrefix = 0;
     props->cbBuffer = 4096;
     props->cBuffers = 3;
-    pWAVEParser->dwSampleSize = ((WAVEFORMATEX*)amt.pbFormat)->nBlockAlign;
-    IAsyncReader_Length(This->pReader, &length, &avail);
-    pWAVEParser->dwLength = length / (ULONGLONG)pWAVEParser->dwSampleSize;
-    pWAVEParser->nSamplesPerSec = ((WAVEFORMATEX*)amt.pbFormat)->nSamplesPerSec;
+    pWAVEParser->nBlockAlign = ((WAVEFORMATEX*)amt.pbFormat)->nBlockAlign;
+    pWAVEParser->nAvgBytesPerSec = ((WAVEFORMATEX*)amt.pbFormat)->nAvgBytesPerSec;
     hr = Parser_AddPin(&(pWAVEParser->Parser), &piOutput, props, &amt);
     CoTaskMemFree(amt.pbFormat);