From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winegstreamer/gst_private.h | 2 ++ dlls/winegstreamer/quartz_transform.c | 31 +++------------------- dlls/winegstreamer/wg_sample.c | 38 +++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 28 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 10d0497ba3e..6657cb792f9 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -136,6 +136,8 @@ HRESULT wg_transform_push_qz(struct wg_transform *transform, struct wg_sample *s struct wg_sample_queue *queue); HRESULT wg_transform_read_mf(struct wg_transform *transform, struct wg_sample *sample, struct wg_format *format); +HRESULT wg_transform_read_qz(struct wg_transform *transform, struct wg_sample *sample, + struct wg_format *format);
HRESULT winegstreamer_stream_handler_create(REFIID riid, void **obj);
diff --git a/dlls/winegstreamer/quartz_transform.c b/dlls/winegstreamer/quartz_transform.c index 0adad9b4c6c..4801de7d3b5 100644 --- a/dlls/winegstreamer/quartz_transform.c +++ b/dlls/winegstreamer/quartz_transform.c @@ -291,8 +291,6 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa { struct transform *filter = impl_from_strmbase_filter(pin->pin.filter); struct wg_sample *wg_sample; - REFERENCE_TIME start_time; - REFERENCE_TIME end_time; HRESULT hr;
/* We do not expect pin connection state to change while the filter is @@ -335,10 +333,11 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa return hr; }
- hr = wg_transform_read_data(filter->transform, wg_sample, NULL); + hr = wg_transform_read_qz(filter->transform, wg_sample, NULL); + wg_sample_release(wg_sample); + if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) { - wg_sample_release(wg_sample); IMediaSample_Release(output_sample); break; } @@ -346,36 +345,12 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa { if (hr == MF_E_TRANSFORM_STREAM_CHANGE) FIXME("Unexpected stream format change!\n"); - wg_sample_release(wg_sample); IMediaSample_Release(output_sample); return hr; }
wg_sample_queue_flush(filter->sample_queue, false);
- hr = IMediaSample_SetActualDataLength(output_sample, wg_sample->size); - if (FAILED(hr)) - { - wg_sample_release(wg_sample); - IMediaSample_Release(output_sample); - return hr; - } - - if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_PTS) - { - start_time = wg_sample->pts; - if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_DURATION) - { - end_time = start_time + wg_sample->duration; - IMediaSample_SetTime(output_sample, &start_time, &end_time); - } - else - { - IMediaSample_SetTime(output_sample, &start_time, NULL); - } - } - wg_sample_release(wg_sample); - hr = IMemInputPin_Receive(filter->source.pMemInputPin, output_sample); if (FAILED(hr)) { diff --git a/dlls/winegstreamer/wg_sample.c b/dlls/winegstreamer/wg_sample.c index 4a0be9460a7..646d8511821 100644 --- a/dlls/winegstreamer/wg_sample.c +++ b/dlls/winegstreamer/wg_sample.c @@ -301,3 +301,41 @@ HRESULT wg_transform_read_mf(struct wg_transform *transform, struct wg_sample *w
return S_OK; } + +HRESULT wg_transform_read_qz(struct wg_transform *transform, struct wg_sample *wg_sample, + struct wg_format *format) +{ + struct sample *sample = CONTAINING_RECORD(wg_sample, struct sample, wg_sample); + REFERENCE_TIME start_pts, end_pts; + HRESULT hr; + BOOL value; + + if (sample->type != WG_SAMPLE_TYPE_QZ) + return E_INVALIDARG; + + if (FAILED(hr = wg_transform_read_data(transform, wg_sample, format))) + return hr; + + hr = IMediaSample_SetActualDataLength(sample->u.qz.sample, wg_sample->size); + if (FAILED(hr)) + return hr; + + if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_PTS) + { + start_pts = wg_sample->pts; + if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_DURATION) + { + end_pts = start_pts + wg_sample->duration; + IMediaSample_SetTime(sample->u.qz.sample, &start_pts, &end_pts); + } + else + { + IMediaSample_SetTime(sample->u.qz.sample, &start_pts, NULL); + } + } + + value = !!(wg_sample->flags & WG_SAMPLE_FLAG_SYNC_POINT); + IMediaSample_SetSyncPoint(sample->u.qz.sample, value); + + return S_OK; +}