From: R��mi Bernon rbernon@codeweavers.com
--- dlls/qasf/asfreader.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index 0fdf4a23e12..29a695de77f 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -150,6 +150,12 @@ static HRESULT buffer_create(IMediaSample *sample, INSSBuffer **out) return S_OK; }
+static struct buffer *unsafe_impl_from_INSSBuffer(INSSBuffer *iface) +{ + if (iface->lpVtbl != &buffer_vtbl) return NULL; + return impl_from_INSSBuffer(iface); +} + struct asf_stream { struct strmbase_source source; @@ -746,9 +752,35 @@ static HRESULT WINAPI reader_callback_OnStatus(IWMReaderCallback *iface, WMT_STA static HRESULT WINAPI reader_callback_OnSample(IWMReaderCallback *iface, DWORD output, QWORD time, QWORD duration, DWORD flags, INSSBuffer *sample, void *context) { - FIXME("iface %p, output %lu, time %I64u, duration %I64u, flags %#lx, sample %p, context %p stub!\n", + struct asf_reader *filter = impl_from_IWMReaderCallback(iface)->filter; + REFERENCE_TIME start_time = time, end_time = time + duration; + struct asf_stream *stream = filter->streams + output; + struct buffer *buffer; + HRESULT hr = S_OK; + + TRACE("iface %p, output %lu, time %I64u, duration %I64u, flags %#lx, sample %p, context %p.\n", iface, output, time, duration, flags, sample, context); - return E_NOTIMPL; + + if (!stream->source.pin.peer) + { + WARN("Output %lu pin is not connected, discarding %p.\n", output, sample); + return S_OK; + } + + if (!(buffer = unsafe_impl_from_INSSBuffer(sample))) + WARN("Unexpected buffer iface %p, discarding.\n", sample); + else + { + IMediaSample_SetTime(buffer->sample, &start_time, &end_time); + IMediaSample_SetDiscontinuity(buffer->sample, !!(flags & WM_SF_DISCONTINUITY)); + IMediaSample_SetSyncPoint(buffer->sample, !!(flags & WM_SF_CLEANPOINT)); + + hr = IMemInputPin_Receive(stream->source.pMemInputPin, buffer->sample); + + TRACE("Receive returned hr %#lx.\n", hr); + } + + return hr; }
static const IWMReaderCallbackVtbl reader_callback_vtbl =