Commit 42811d77 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf: Implement MFCreateSequencerSegmentOffset().

parent 572cc841
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
@ stdcall MFCreateSampleCopierMFT(ptr) @ stdcall MFCreateSampleCopierMFT(ptr)
@ stdcall MFCreateSampleGrabberSinkActivate(ptr ptr ptr) @ stdcall MFCreateSampleGrabberSinkActivate(ptr ptr ptr)
@ stub MFCreateSecureHttpSchemePlugin @ stub MFCreateSecureHttpSchemePlugin
@ stub MFCreateSequencerSegmentOffset @ stdcall MFCreateSequencerSegmentOffset(long int64 ptr)
@ stdcall MFCreateSequencerSource(ptr ptr) @ stdcall MFCreateSequencerSource(ptr ptr)
@ stub MFCreateSequencerSourceRemoteStream @ stub MFCreateSequencerSourceRemoteStream
@ stdcall MFCreateSimpleTypeHandler(ptr) @ stdcall MFCreateSimpleTypeHandler(ptr)
......
...@@ -7051,6 +7051,22 @@ static void test_mpeg4_media_sink(void) ...@@ -7051,6 +7051,22 @@ static void test_mpeg4_media_sink(void)
IMFMediaType_Release(audio_type); IMFMediaType_Release(audio_type);
} }
static void test_MFCreateSequencerSegmentOffset(void)
{
PROPVARIANT propvar;
HRESULT hr;
hr = MFCreateSequencerSegmentOffset(0, 0, NULL);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
propvar.vt = VT_EMPTY;
hr = MFCreateSequencerSegmentOffset(0, 0, &propvar);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(propvar.vt == VT_UNKNOWN, "Unexpected type %d.\n", propvar.vt);
ok(!!propvar.punkVal, "Unexpected pointer.\n");
PropVariantClear(&propvar);
}
START_TEST(mf) START_TEST(mf)
{ {
init_functions(); init_functions();
...@@ -7085,4 +7101,5 @@ START_TEST(mf) ...@@ -7085,4 +7101,5 @@ START_TEST(mf)
test_MFGetTopoNodeCurrentType(); test_MFGetTopoNodeCurrentType();
test_MFRequireProtectedEnvironment(); test_MFRequireProtectedEnvironment();
test_mpeg4_media_sink(); test_mpeg4_media_sink();
test_MFCreateSequencerSegmentOffset();
} }
...@@ -2230,3 +2230,79 @@ HRESULT WINAPI MFCreateSequencerSource(IUnknown *reserved, IMFSequencerSource ** ...@@ -2230,3 +2230,79 @@ HRESULT WINAPI MFCreateSequencerSource(IUnknown *reserved, IMFSequencerSource **
return S_OK; return S_OK;
} }
struct segment_offset
{
IUnknown IUnknown_iface;
LONG refcount;
MFSequencerElementId id;
MFTIME timeoffset;
};
static inline struct segment_offset *impl_offset_from_IUnknown(IUnknown *iface)
{
return CONTAINING_RECORD(iface, struct segment_offset, IUnknown_iface);
}
static HRESULT WINAPI segment_offset_QueryInterface(IUnknown *iface, REFIID riid, void **obj)
{
if (IsEqualIID(riid, &IID_IUnknown))
{
*obj = iface;
IUnknown_AddRef(iface);
return S_OK;
}
*obj = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI segment_offset_AddRef(IUnknown *iface)
{
struct segment_offset *offset = impl_offset_from_IUnknown(iface);
return InterlockedIncrement(&offset->refcount);
}
static ULONG WINAPI segment_offset_Release(IUnknown *iface)
{
struct segment_offset *offset = impl_offset_from_IUnknown(iface);
ULONG refcount = InterlockedDecrement(&offset->refcount);
if (!refcount)
free(offset);
return refcount;
}
static const IUnknownVtbl segment_offset_vtbl =
{
segment_offset_QueryInterface,
segment_offset_AddRef,
segment_offset_Release,
};
/***********************************************************************
* MFCreateSequencerSegmentOffset (mf.@)
*/
HRESULT WINAPI MFCreateSequencerSegmentOffset(MFSequencerElementId id, MFTIME timeoffset, PROPVARIANT *ret)
{
struct segment_offset *offset;
TRACE("%#lx, %s, %p.\n", id, debugstr_time(timeoffset), ret);
if (!ret)
return E_POINTER;
if (!(offset = calloc(1, sizeof(*offset))))
return E_OUTOFMEMORY;
offset->IUnknown_iface.lpVtbl = &segment_offset_vtbl;
offset->refcount = 1;
offset->id = id;
offset->timeoffset = timeoffset;
V_VT(ret) = VT_UNKNOWN;
V_UNKNOWN(ret) = &offset->IUnknown_iface;
return S_OK;
}
...@@ -709,6 +709,7 @@ cpp_quote("HRESULT WINAPI MFCreateSimpleTypeHandler(IMFMediaTypeHandler **handle ...@@ -709,6 +709,7 @@ cpp_quote("HRESULT WINAPI MFCreateSimpleTypeHandler(IMFMediaTypeHandler **handle
cpp_quote("HRESULT WINAPI MFCreateSampleCopierMFT(IMFTransform **transform);") cpp_quote("HRESULT WINAPI MFCreateSampleCopierMFT(IMFTransform **transform);")
cpp_quote("HRESULT WINAPI MFCreateSampleGrabberSinkActivate(IMFMediaType *media_type,") cpp_quote("HRESULT WINAPI MFCreateSampleGrabberSinkActivate(IMFMediaType *media_type,")
cpp_quote(" IMFSampleGrabberSinkCallback *callback, IMFActivate **activate);") cpp_quote(" IMFSampleGrabberSinkCallback *callback, IMFActivate **activate);")
cpp_quote("HRESULT WINAPI MFCreateSequencerSegmentOffset(MFSequencerElementId id, MFTIME offset, PROPVARIANT *segment_offset);")
cpp_quote("HRESULT WINAPI MFCreateSequencerSource(IUnknown *reserved, IMFSequencerSource **seq_source);" ) cpp_quote("HRESULT WINAPI MFCreateSequencerSource(IUnknown *reserved, IMFSequencerSource **seq_source);" )
cpp_quote("HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver);") cpp_quote("HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver);")
cpp_quote("HRESULT WINAPI MFCreateStandardQualityManager(IMFQualityManager **manager);") cpp_quote("HRESULT WINAPI MFCreateStandardQualityManager(IMFQualityManager **manager);")
......
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