Commit 2567ff49 authored by Anton Baskanov's avatar Anton Baskanov Committed by Alexandre Julliard

winegstreamer: Set sample timestamps in MPEG audio decoder.

parent 5db4b0cf
...@@ -888,11 +888,11 @@ static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample ...@@ -888,11 +888,11 @@ static HRESULT WINAPI testsink_Receive(struct strmbase_sink *iface, IMediaSample
start = 0xdeadbeef; start = 0xdeadbeef;
stop = 0xdeadbeef; stop = 0xdeadbeef;
hr = IMediaSample_GetTime(sample, &start, &stop); hr = IMediaSample_GetTime(sample, &start, &stop);
todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); ok(hr == S_OK, "Got hr %#lx.\n", hr);
if (filter->got_sample == 1) if (filter->got_sample == 1)
{ {
todo_wine ok(start == filter->expected_start_time, "Got start time %s.\n", wine_dbgstr_longlong(start)); ok(start == filter->expected_start_time, "Got start time %s.\n", wine_dbgstr_longlong(start));
todo_wine ok(stop == filter->expected_stop_time, "Got stop time %s.\n", wine_dbgstr_longlong(stop)); ok(stop == filter->expected_stop_time, "Got stop time %s.\n", wine_dbgstr_longlong(stop));
} }
return S_OK; return S_OK;
......
...@@ -281,6 +281,8 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa ...@@ -281,6 +281,8 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
{ {
struct transform *filter = impl_from_strmbase_filter(pin->pin.filter); struct transform *filter = impl_from_strmbase_filter(pin->pin.filter);
struct wg_sample input_wg_sample = {0}; struct wg_sample input_wg_sample = {0};
REFERENCE_TIME start_time;
REFERENCE_TIME end_time;
HRESULT hr; HRESULT hr;
/* We do not expect pin connection state to change while the filter is /* We do not expect pin connection state to change while the filter is
...@@ -306,6 +308,18 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa ...@@ -306,6 +308,18 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
hr = IMediaSample_GetTime(sample, &start_time, &end_time);
if (SUCCEEDED(hr))
{
input_wg_sample.pts = start_time;
input_wg_sample.flags |= WG_SAMPLE_FLAG_HAS_PTS;
}
if (hr == S_OK)
{
input_wg_sample.duration = end_time - start_time;
input_wg_sample.flags |= WG_SAMPLE_FLAG_HAS_DURATION;
}
hr = wg_transform_push_data(filter->transform, &input_wg_sample); hr = wg_transform_push_data(filter->transform, &input_wg_sample);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
...@@ -347,6 +361,20 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa ...@@ -347,6 +361,20 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
return hr; return hr;
} }
if (output_wg_sample.flags & WG_SAMPLE_FLAG_HAS_PTS)
{
start_time = output_wg_sample.pts;
if (output_wg_sample.flags & WG_SAMPLE_FLAG_HAS_DURATION)
{
end_time = start_time + output_wg_sample.duration;
IMediaSample_SetTime(output_sample, &start_time, &end_time);
}
else
{
IMediaSample_SetTime(output_sample, &start_time, NULL);
}
}
hr = IMemInputPin_Receive(filter->source.pMemInputPin, output_sample); hr = IMemInputPin_Receive(filter->source.pMemInputPin, output_sample);
if (FAILED(hr)) if (FAILED(hr))
{ {
......
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