Maarten Lankhorst : quartz: Fix time on avi parser.

Alexandre Julliard julliard at winehq.org
Mon Nov 8 11:46:21 CST 2010


Module: wine
Branch: master
Commit: dba95c2288ed813b4984c20ee269f8a5e94f1f7e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=dba95c2288ed813b4984c20ee269f8a5e94f1f7e

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Sun Nov  7 15:02:48 2010 +0100

quartz: Fix time on avi parser.

---

 dlls/quartz/avisplit.c |   37 +++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c
index fadca7d..e539d64 100644
--- a/dlls/quartz/avisplit.c
+++ b/dlls/quartz/avisplit.c
@@ -291,7 +291,7 @@ static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample,
 {
     Parser_OutputPin *pin = (Parser_OutputPin *)This->Parser.ppPins[1+streamnumber];
     HRESULT hr;
-    LONGLONG start, stop;
+    LONGLONG start, stop, rtstart, rtstop;
     StreamData *stream = &This->streams[streamnumber];
 
     start = pin->dwSamplesProcessed;
@@ -314,7 +314,29 @@ static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample,
     stop *= 10000000;
     stop /= stream->streamheader.dwRate;
 
-    IMediaSample_SetTime(sample, &start, &stop);
+    if (IMediaSample_IsDiscontinuity(sample) == S_OK) {
+        IPin *victim;
+        EnterCriticalSection(&This->Parser.filter.csFilter);
+        pin->pin.pin.tStart = start;
+        pin->pin.pin.dRate = This->Parser.sourceSeeking.dRate;
+        hr = IPin_ConnectedTo((IPin *)pin, &victim);
+        if (hr == S_OK)
+        {
+            hr = IPin_NewSegment(victim, start, This->Parser.sourceSeeking.llStop,
+                                 This->Parser.sourceSeeking.dRate);
+            if (hr != S_OK)
+                FIXME("NewSegment returns %08x\n", hr);
+            IPin_Release(victim);
+        }
+        LeaveCriticalSection(&This->Parser.filter.csFilter);
+        if (hr != S_OK)
+            return hr;
+    }
+    rtstart = (double)(start - pin->pin.pin.tStart) / pin->pin.pin.dRate;
+    rtstop = (double)(stop - pin->pin.pin.tStart) / pin->pin.pin.dRate;
+    hr = IMediaSample_SetMediaTime(sample, &start, &stop);
+    IMediaSample_SetTime(sample, &rtstart, &rtstop);
+    IMediaSample_SetMediaTime(sample, &start, &stop);
 
     hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)&pin->pin, sample);
 
@@ -426,6 +448,9 @@ static HRESULT AVISplitter_first_request(LPVOID iface)
         stream->pos_next = stream->pos;
         stream->index_next = stream->index;
 
+        /* This was sent after stopped->paused or stopped->playing, so set seek */
+        stream->seek = 1;
+
         /* There should be a packet queued from AVISplitter_next_request last time
          * It needs to be done now because this is the only way to ensure that every
          * stream will have at least 1 packet processed
@@ -1285,7 +1310,6 @@ static HRESULT WINAPI AVISplitter_seek(IMediaSeeking *iface)
     {
         Parser_OutputPin *pin = (Parser_OutputPin *)This->Parser.ppPins[1+x];
         StreamData *stream = This->streams + x;
-        IPin *victim = NULL;
         LONGLONG wanted_frames;
         DWORD last_keyframe = 0, last_keyframeidx = 0, preroll = 0;
 
@@ -1294,13 +1318,6 @@ static HRESULT WINAPI AVISplitter_seek(IMediaSeeking *iface)
         wanted_frames /= 10000000;
         wanted_frames /= stream->streamheader.dwScale;
 
-        IPin_ConnectedTo((IPin *)pin, &victim);
-        if (victim)
-        {
-            IPin_NewSegment(victim, newpos, endpos, pPin->dRate);
-            IPin_Release(victim);
-        }
-
         pin->dwSamplesProcessed = 0;
         stream->index = 0;
         stream->pos = 0;




More information about the wine-cvs mailing list