Commit 54d74a05 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

winegstreamer: Don't query the pad position in IMediaSeeking::SetPositions().

parent 1bb7ef1c
......@@ -1897,63 +1897,43 @@ static ULONG WINAPI GST_Seeking_Release(IMediaSeeking *iface)
return IPin_Release(&This->pin.pin.IPin_iface);
}
static GstSeekType type_from_flags(DWORD flags)
{
switch (flags & AM_SEEKING_PositioningBitsMask) {
case AM_SEEKING_NoPositioning:
return GST_SEEK_TYPE_NONE;
case AM_SEEKING_AbsolutePositioning:
case AM_SEEKING_RelativePositioning:
return GST_SEEK_TYPE_SET;
case AM_SEEKING_IncrementalPositioning:
return GST_SEEK_TYPE_END;
}
return GST_SEEK_TYPE_NONE;
}
static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface,
REFERENCE_TIME *pCur, DWORD curflags, REFERENCE_TIME *pStop,
DWORD stopflags)
LONGLONG *current, DWORD current_flags, LONGLONG *stop, DWORD stop_flags)
{
HRESULT hr;
struct gstdemux_source *This = impl_from_IMediaSeeking(iface);
GstSeekFlags f = 0;
GstSeekType curtype, stoptype;
GstEvent *e;
gint64 stop_pos = 0, curr_pos = 0;
GstSeekType current_type = GST_SEEK_TYPE_SET, stop_type = GST_SEEK_TYPE_SET;
struct gstdemux_source *pin = impl_from_IMediaSeeking(iface);
GstSeekFlags flags = 0;
TRACE("(%p)->(%p, 0x%x, %p, 0x%x)\n", This, pCur, curflags, pStop, stopflags);
TRACE("pin %p, current %s, current_flags %#x, stop %s, stop_flags %#x.\n",
pin, current ? debugstr_time(*current) : "<null>", current_flags,
stop ? debugstr_time(*stop) : "<null>", stop_flags);
mark_wine_thread();
hr = SourceSeekingImpl_SetPositions(iface, pCur, curflags, pStop, stopflags);
if (This->pin.pin.filter->state == State_Stopped)
return hr;
curtype = type_from_flags(curflags);
stoptype = type_from_flags(stopflags);
if (curflags & AM_SEEKING_SeekToKeyFrame)
f |= GST_SEEK_FLAG_KEY_UNIT;
if (curflags & AM_SEEKING_Segment)
f |= GST_SEEK_FLAG_SEGMENT;
if (!(curflags & AM_SEEKING_NoFlush))
f |= GST_SEEK_FLAG_FLUSH;
if (((curflags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_RelativePositioning) ||
((stopflags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_RelativePositioning)) {
gint64 tmp_pos;
gst_pad_query_position (This->my_sink, GST_FORMAT_TIME, &tmp_pos);
if ((curflags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_RelativePositioning)
curr_pos = tmp_pos;
if ((stopflags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_RelativePositioning)
stop_pos = tmp_pos;
}
e = gst_event_new_seek(This->seek.dRate, GST_FORMAT_TIME, f, curtype, pCur ? curr_pos + *pCur * 100 : -1, stoptype, pStop ? stop_pos + *pStop * 100 : -1);
if (gst_pad_push_event(This->my_sink, e))
SourceSeekingImpl_SetPositions(iface, current, current_flags, stop, stop_flags);
if (pin->pin.pin.filter->state == State_Stopped)
return S_OK;
else
return E_NOTIMPL;
if (current_flags & AM_SEEKING_SeekToKeyFrame)
flags |= GST_SEEK_FLAG_KEY_UNIT;
if (current_flags & AM_SEEKING_Segment)
flags |= GST_SEEK_FLAG_SEGMENT;
if (!(current_flags & AM_SEEKING_NoFlush))
flags |= GST_SEEK_FLAG_FLUSH;
if ((current_flags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
current_type = GST_SEEK_TYPE_NONE;
if ((stop_flags & AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
stop_type = GST_SEEK_TYPE_NONE;
if (!gst_pad_push_event(pin->my_sink, gst_event_new_seek(pin->seek.dRate, GST_FORMAT_TIME, flags,
current_type, pin->seek.llCurrent * 100, stop_type, pin->seek.llStop * 100)))
{
ERR("Failed to seek (current %s, stop %s).\n",
debugstr_time(pin->seek.llCurrent), debugstr_time(pin->seek.llStop));
return E_FAIL;
}
return S_OK;
}
static const IMediaSeekingVtbl GST_Seeking_Vtbl =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment