evr/sample: Implement IMFDesiredSample.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
db8f859114
commit
1cb37f7e80
|
@ -59,6 +59,10 @@ struct video_sample
|
|||
|
||||
IMFAsyncResult *tracked_result;
|
||||
LONG tracked_refcount;
|
||||
|
||||
LONGLONG desired_time;
|
||||
LONGLONG desired_duration;
|
||||
BOOL desired_set;
|
||||
};
|
||||
|
||||
static struct video_sample *impl_from_IMFSample(IMFSample *iface)
|
||||
|
@ -869,20 +873,50 @@ static ULONG WINAPI desired_video_sample_Release(IMFDesiredSample *iface)
|
|||
static HRESULT WINAPI desired_video_sample_GetDesiredSampleTimeAndDuration(IMFDesiredSample *iface,
|
||||
LONGLONG *sample_time, LONGLONG *sample_duration)
|
||||
{
|
||||
FIXME("%p, %p, %p.\n", iface, sample_time, sample_duration);
|
||||
struct video_sample *sample = impl_from_IMFDesiredSample(iface);
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("%p, %p, %p.\n", iface, sample_time, sample_duration);
|
||||
|
||||
if (!sample_time || !sample_duration)
|
||||
return E_POINTER;
|
||||
|
||||
IMFSample_LockStore(sample->sample);
|
||||
if (sample->desired_set)
|
||||
{
|
||||
*sample_time = sample->desired_time;
|
||||
*sample_duration = sample->desired_duration;
|
||||
}
|
||||
else
|
||||
hr = MF_E_NOT_AVAILABLE;
|
||||
IMFSample_UnlockStore(sample->sample);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static void WINAPI desired_video_sample_SetDesiredSampleTimeAndDuration(IMFDesiredSample *iface,
|
||||
LONGLONG sample_time, LONGLONG sample_duration)
|
||||
{
|
||||
FIXME("%p, %s, %s.\n", iface, debugstr_time(sample_time), debugstr_time(sample_duration));
|
||||
struct video_sample *sample = impl_from_IMFDesiredSample(iface);
|
||||
|
||||
TRACE("%p, %s, %s.\n", iface, debugstr_time(sample_time), debugstr_time(sample_duration));
|
||||
|
||||
IMFSample_LockStore(sample->sample);
|
||||
sample->desired_set = TRUE;
|
||||
sample->desired_time = sample_time;
|
||||
sample->desired_duration = sample_duration;
|
||||
IMFSample_UnlockStore(sample->sample);
|
||||
}
|
||||
|
||||
static void WINAPI desired_video_sample_Clear(IMFDesiredSample *iface)
|
||||
{
|
||||
FIXME("%p.\n", iface);
|
||||
struct video_sample *sample = impl_from_IMFDesiredSample(iface);
|
||||
|
||||
TRACE("%p.\n", iface);
|
||||
|
||||
IMFSample_LockStore(sample->sample);
|
||||
sample->desired_set = FALSE;
|
||||
IMFSample_UnlockStore(sample->sample);
|
||||
}
|
||||
|
||||
static const IMFDesiredSampleVtbl desired_video_sample_vtbl =
|
||||
|
|
|
@ -721,11 +721,11 @@ static void test_surface_sample(void)
|
|||
IDirect3DSurface9 *backbuffer = NULL;
|
||||
IMFDesiredSample *desired_sample;
|
||||
IMFMediaBuffer *buffer, *buffer2;
|
||||
LONGLONG duration, time1, time2;
|
||||
IDirect3DSwapChain9 *swapchain;
|
||||
DWORD flags, count, length;
|
||||
IDirect3DDevice9 *device;
|
||||
IMFSample *sample;
|
||||
LONGLONG duration;
|
||||
IDirect3D9 *d3d;
|
||||
IUnknown *unk;
|
||||
HWND window;
|
||||
|
@ -764,8 +764,37 @@ static void test_surface_sample(void)
|
|||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(!count, "Unexpected attribute count %u.\n", count);
|
||||
|
||||
hr = IMFDesiredSample_GetDesiredSampleTimeAndDuration(desired_sample, NULL, NULL);
|
||||
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFDesiredSample_GetDesiredSampleTimeAndDuration(desired_sample, NULL, &time2);
|
||||
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFDesiredSample_GetDesiredSampleTimeAndDuration(desired_sample, &time1, NULL);
|
||||
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFDesiredSample_GetDesiredSampleTimeAndDuration(desired_sample, &time1, &time2);
|
||||
ok(hr == MF_E_NOT_AVAILABLE, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
IMFDesiredSample_SetDesiredSampleTimeAndDuration(desired_sample, 123, 456);
|
||||
|
||||
time1 = time2 = 0;
|
||||
hr = IMFDesiredSample_GetDesiredSampleTimeAndDuration(desired_sample, &time1, &time2);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(time1 == 123 && time2 == 456, "Unexpected time values.\n");
|
||||
|
||||
IMFDesiredSample_SetDesiredSampleTimeAndDuration(desired_sample, 0, 0);
|
||||
|
||||
time1 = time2 = 1;
|
||||
hr = IMFDesiredSample_GetDesiredSampleTimeAndDuration(desired_sample, &time1, &time2);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(time1 == 0 && time2 == 0, "Unexpected time values.\n");
|
||||
|
||||
IMFDesiredSample_Clear(desired_sample);
|
||||
|
||||
hr = IMFDesiredSample_GetDesiredSampleTimeAndDuration(desired_sample, &time1, &time2);
|
||||
ok(hr == MF_E_NOT_AVAILABLE, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFSample_GetCount(sample, &count);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(!count, "Unexpected attribute count %u.\n", count);
|
||||
|
|
Loading…
Reference in New Issue