From e94e055c9c8c9f9afdca98b4c404f22243f9e23a Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Fri, 18 Apr 2008 16:07:40 -0700 Subject: [PATCH] quartz: Set media time in file source --- dlls/quartz/filesource.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index 8704b50..930ebfc 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -1127,6 +1127,9 @@ static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader * iface, DWORD dw if (SUCCEEDED(hr)) { + REFERENCE_TIME rtStart, rtStop; + REFERENCE_TIME rtSampleStart, rtSampleStop; + /* get any errors */ if (!This->bFlushing && !GetOverlappedResult(This->hFile, &pDataRq->ovl, &dwBytes, FALSE)) hr = HRESULT_FROM_WIN32(GetLastError()); @@ -1141,7 +1144,18 @@ static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader * iface, DWORD dw dwBytes = 0; } + /* Set the time on the sample */ IMediaSample_SetActualDataLength(pDataRq->pSample, dwBytes); + + rtStart = (DWORD64)pDataRq->ovl.u.s.Offset + ((DWORD64)pDataRq->ovl.u.s.OffsetHigh << 32); + rtStart = MEDIATIME_FROM_BYTES(rtStart); + rtStop = rtStart + MEDIATIME_FROM_BYTES(dwBytes); + + IMediaSample_GetTime(pDataRq->pSample, &rtSampleStart, &rtSampleStop); + assert(rtStart == rtSampleStart); + assert(rtStop <= rtSampleStop); + + IMediaSample_SetTime(pDataRq->pSample, &rtStart, &rtStop); } /* no need to close event handle since we will close it when the pin is destroyed */ -- 1.5.4.1