Commit f2bb763c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf/session: Get rid of some interface pointers casts.

parent d8bbbfd5
...@@ -122,7 +122,11 @@ enum media_source_flags ...@@ -122,7 +122,11 @@ enum media_source_flags
struct media_source struct media_source
{ {
struct list entry; struct list entry;
union
{
IMFMediaSource *source; IMFMediaSource *source;
IUnknown *object;
};
IMFPresentationDescriptor *pd; IMFPresentationDescriptor *pd;
enum object_state state; enum object_state state;
unsigned int flags; unsigned int flags;
...@@ -131,7 +135,11 @@ struct media_source ...@@ -131,7 +135,11 @@ struct media_source
struct media_sink struct media_sink
{ {
struct list entry; struct list entry;
union
{
IMFMediaSink *sink; IMFMediaSink *sink;
IUnknown *object;
};
IMFMediaSinkPreroll *preroll; IMFMediaSinkPreroll *preroll;
IMFMediaEventGenerator *event_generator; IMFMediaEventGenerator *event_generator;
BOOL finalized; BOOL finalized;
...@@ -861,7 +869,7 @@ static void session_start(struct media_session *session, const GUID *time_format ...@@ -861,7 +869,7 @@ static void session_start(struct media_session *session, const GUID *time_format
if (!(session->presentation.flags & SESSION_FLAG_SOURCES_SUBSCRIBED)) if (!(session->presentation.flags & SESSION_FLAG_SOURCES_SUBSCRIBED))
{ {
if (FAILED(hr = IMFMediaSource_BeginGetEvent(source->source, &session->events_callback, if (FAILED(hr = IMFMediaSource_BeginGetEvent(source->source, &session->events_callback,
(IUnknown *)source->source))) source->object)))
{ {
WARN("Failed to subscribe to source events, hr %#x.\n", hr); WARN("Failed to subscribe to source events, hr %#x.\n", hr);
} }
...@@ -1534,7 +1542,7 @@ static HRESULT session_set_current_topology(struct media_session *session, IMFTo ...@@ -1534,7 +1542,7 @@ static HRESULT session_set_current_topology(struct media_session *session, IMFTo
/* Mask unsupported rate caps. */ /* Mask unsupported rate caps. */
caps &= session_get_object_rate_caps((IUnknown *)source->source) caps &= session_get_object_rate_caps(source->object)
| ~(MFSESSIONCAP_RATE_FORWARD | MFSESSIONCAP_RATE_REVERSE); | ~(MFSESSIONCAP_RATE_FORWARD | MFSESSIONCAP_RATE_REVERSE);
} }
...@@ -1547,7 +1555,7 @@ static HRESULT session_set_current_topology(struct media_session *session, IMFTo ...@@ -1547,7 +1555,7 @@ static HRESULT session_set_current_topology(struct media_session *session, IMFTo
if (SUCCEEDED(IMFMediaSink_GetCharacteristics(sink->sink, &object_flags))) if (SUCCEEDED(IMFMediaSink_GetCharacteristics(sink->sink, &object_flags)))
{ {
if (!(object_flags & MEDIASINK_RATELESS)) if (!(object_flags & MEDIASINK_RATELESS))
caps &= session_get_object_rate_caps((IUnknown *)sink->sink) caps &= session_get_object_rate_caps(sink->object)
| ~(MFSESSIONCAP_RATE_FORWARD | MFSESSIONCAP_RATE_REVERSE); | ~(MFSESSIONCAP_RATE_FORWARD | MFSESSIONCAP_RATE_REVERSE);
} }
} }
...@@ -2382,7 +2390,7 @@ static void session_set_presentation_clock(struct media_session *session) ...@@ -2382,7 +2390,7 @@ static void session_set_presentation_clock(struct media_session *session)
/* Set clock for all topology nodes. */ /* Set clock for all topology nodes. */
LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry) LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry)
{ {
session_set_consumed_clock((IUnknown *)source->source, session->clock); session_set_consumed_clock(source->object, session->clock);
} }
LIST_FOR_EACH_ENTRY(sink, &session->presentation.sinks, struct media_sink, entry) LIST_FOR_EACH_ENTRY(sink, &session->presentation.sinks, struct media_sink, entry)
...@@ -2484,7 +2492,7 @@ static void session_set_source_object_state(struct media_session *session, IUnkn ...@@ -2484,7 +2492,7 @@ static void session_set_source_object_state(struct media_session *session, IUnkn
LIST_FOR_EACH_ENTRY(src, &session->presentation.sources, struct media_source, entry) LIST_FOR_EACH_ENTRY(src, &session->presentation.sources, struct media_source, entry)
{ {
if (object == (IUnknown *)src->source) if (object == src->object)
{ {
changed = src->state != state; changed = src->state != state;
src->state = state; src->state = state;
...@@ -3403,7 +3411,7 @@ static HRESULT WINAPI session_sink_finalizer_callback_Invoke(IMFAsyncCallback *i ...@@ -3403,7 +3411,7 @@ static HRESULT WINAPI session_sink_finalizer_callback_Invoke(IMFAsyncCallback *i
LIST_FOR_EACH_ENTRY(sink, &session->presentation.sinks, struct media_sink, entry) LIST_FOR_EACH_ENTRY(sink, &session->presentation.sinks, struct media_sink, entry)
{ {
if (state == (IUnknown *)sink->sink) if (state == sink->object)
{ {
if (FAILED(hr = IMFMediaSink_QueryInterface(sink->sink, &IID_IMFFinalizableMediaSink, (void **)&fin_sink))) if (FAILED(hr = IMFMediaSink_QueryInterface(sink->sink, &IID_IMFFinalizableMediaSink, (void **)&fin_sink)))
WARN("Unexpected, missing IMFFinalizableMediaSink, hr %#x.\n", hr); WARN("Unexpected, missing IMFFinalizableMediaSink, hr %#x.\n", hr);
...@@ -3515,7 +3523,7 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA ...@@ -3515,7 +3523,7 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA
{ {
LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry) LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry)
{ {
if (FAILED(hr = session_presentation_object_get_rate((IUnknown *)source->source, direction, thin, fastest, &rate))) if (FAILED(hr = session_presentation_object_get_rate(source->object, direction, thin, fastest, &rate)))
break; break;
} }
...@@ -3523,7 +3531,7 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA ...@@ -3523,7 +3531,7 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA
{ {
LIST_FOR_EACH_ENTRY(sink, &session->presentation.sinks, struct media_sink, entry) LIST_FOR_EACH_ENTRY(sink, &session->presentation.sinks, struct media_sink, entry)
{ {
if (FAILED(hr = session_presentation_object_get_rate((IUnknown *)sink->sink, direction, thin, fastest, &rate))) if (FAILED(hr = session_presentation_object_get_rate(sink->object, direction, thin, fastest, &rate)))
break; break;
} }
} }
...@@ -3561,7 +3569,7 @@ static HRESULT session_is_presentation_rate_supported(struct media_session *sess ...@@ -3561,7 +3569,7 @@ static HRESULT session_is_presentation_rate_supported(struct media_session *sess
{ {
LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry) LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry)
{ {
if (FAILED(hr = MFGetService((IUnknown *)source->source, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateSupport, if (FAILED(hr = MFGetService(source->object, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateSupport,
(void **)&rate_support))) (void **)&rate_support)))
{ {
value = 1.0f; value = 1.0f;
...@@ -3589,7 +3597,7 @@ static HRESULT session_is_presentation_rate_supported(struct media_session *sess ...@@ -3589,7 +3597,7 @@ static HRESULT session_is_presentation_rate_supported(struct media_session *sess
if (flags & MEDIASINK_RATELESS) if (flags & MEDIASINK_RATELESS)
continue; continue;
if (FAILED(MFGetService((IUnknown *)sink->sink, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateSupport, if (FAILED(MFGetService(sink->object, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateSupport,
(void **)&rate_support))) (void **)&rate_support)))
continue; continue;
......
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