mf/evr: Set stream media type to the mixer.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7b54ce1e07
commit
430c179fe8
|
@ -392,16 +392,47 @@ static HRESULT WINAPI video_stream_typehandler_GetMediaTypeByIndex(IMFMediaTypeH
|
|||
|
||||
static HRESULT WINAPI video_stream_typehandler_SetCurrentMediaType(IMFMediaTypeHandler *iface, IMFMediaType *type)
|
||||
{
|
||||
FIXME("%p, %p.\n", iface, type);
|
||||
struct video_stream *stream = impl_from_IMFMediaTypeHandler(iface);
|
||||
IMFVideoMediaType *video_type;
|
||||
GUID subtype;
|
||||
HRESULT hr;
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("%p, %p.\n", iface, type);
|
||||
|
||||
if (!type)
|
||||
return E_POINTER;
|
||||
|
||||
if (!stream->parent)
|
||||
return MF_E_STREAMSINK_REMOVED;
|
||||
|
||||
if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_SUBTYPE, &subtype)))
|
||||
return hr;
|
||||
|
||||
/* Mixer expects special video media type instance. */
|
||||
if (FAILED(hr = MFCreateVideoMediaTypeFromSubtype(&subtype, &video_type)))
|
||||
return hr;
|
||||
|
||||
if (SUCCEEDED(hr = IMFMediaType_CopyAllItems(type, (IMFAttributes *)video_type)))
|
||||
hr = IMFTransform_SetInputType(stream->parent->mixer, stream->id, (IMFMediaType *)video_type, 0);
|
||||
|
||||
IMFVideoMediaType_Release(video_type);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI video_stream_typehandler_GetCurrentMediaType(IMFMediaTypeHandler *iface, IMFMediaType **type)
|
||||
{
|
||||
FIXME("%p, %p.\n", iface, type);
|
||||
struct video_stream *stream = impl_from_IMFMediaTypeHandler(iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("%p, %p.\n", iface, type);
|
||||
|
||||
if (!type)
|
||||
return E_POINTER;
|
||||
|
||||
if (!stream->parent)
|
||||
return MF_E_STREAMSINK_REMOVED;
|
||||
|
||||
return IMFTransform_GetInputCurrentType(stream->parent->mixer, stream->id, type);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI video_stream_typehandler_GetMajorType(IMFMediaTypeHandler *iface, GUID *type)
|
||||
|
|
|
@ -3237,6 +3237,7 @@ static void test_evr(void)
|
|||
{
|
||||
IMFVideoSampleAllocatorCallback *allocator_callback;
|
||||
IMFStreamSink *stream_sink, *stream_sink2;
|
||||
IMFMediaType *media_type, *media_type2;
|
||||
IMFMediaEventGenerator *ev_generator;
|
||||
IMFVideoSampleAllocator *allocator;
|
||||
IMFMediaTypeHandler *type_handler;
|
||||
|
@ -3305,6 +3306,47 @@ static void test_evr(void)
|
|||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
ok(!count, "Unexpected count %u.\n", count);
|
||||
|
||||
hr = IMFMediaTypeHandler_GetMediaTypeByIndex(type_handler, 0, NULL);
|
||||
ok(hr == MF_E_NO_MORE_TYPES, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFMediaTypeHandler_GetMediaTypeByIndex(type_handler, 0, &media_type);
|
||||
ok(hr == MF_E_NO_MORE_TYPES, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFMediaTypeHandler_GetCurrentMediaType(type_handler, NULL);
|
||||
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFMediaTypeHandler_GetCurrentMediaType(type_handler, &media_type);
|
||||
ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFMediaTypeHandler_SetCurrentMediaType(type_handler, NULL);
|
||||
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = MFCreateMediaType(&media_type);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFVideoFormat_RGB32);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, (UINT64)640 << 32 | 480);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
hr = IMFMediaType_SetUINT32(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFMediaTypeHandler_SetCurrentMediaType(type_handler, media_type);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IMFMediaTypeHandler_GetCurrentMediaType(type_handler, &media_type2);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
hr = IMFMediaType_QueryInterface(media_type2, &IID_IMFVideoMediaType, (void **)&unk);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
IUnknown_Release(unk);
|
||||
IMFMediaType_Release(media_type2);
|
||||
|
||||
IMFMediaType_Release(media_type);
|
||||
|
||||
IMFMediaTypeHandler_Release(type_handler);
|
||||
|
||||
/* Stream uses an allocator. */
|
||||
|
|
Loading…
Reference in New Issue