2003-06-13 20:06:44 +02:00
|
|
|
/* DirectShow FilterGraph object (QUARTZ.DLL)
|
|
|
|
*
|
|
|
|
* Copyright 2002 Lionel Ulmer
|
2004-03-05 21:42:40 +01:00
|
|
|
* Copyright 2004 Christian Costa
|
2003-06-13 20:06:44 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-06-13 20:06:44 +02:00
|
|
|
*/
|
|
|
|
|
2020-02-20 03:44:56 +01:00
|
|
|
#include <assert.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2004-10-07 05:06:48 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2004-10-05 04:18:08 +02:00
|
|
|
#include "winuser.h"
|
2008-04-08 07:28:15 +02:00
|
|
|
#include "winreg.h"
|
|
|
|
#include "shlwapi.h"
|
2003-06-13 20:06:44 +02:00
|
|
|
#include "dshow.h"
|
|
|
|
#include "wine/debug.h"
|
2004-11-19 19:17:27 +01:00
|
|
|
#include "quartz_private.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "olectl.h"
|
2003-08-07 00:04:45 +02:00
|
|
|
#include "strmif.h"
|
2004-03-03 03:18:13 +01:00
|
|
|
#include "vfwmsgs.h"
|
2004-03-05 21:42:40 +01:00
|
|
|
#include "evcode.h"
|
2018-09-18 16:40:43 +02:00
|
|
|
#include "wine/heap.h"
|
2018-09-18 16:40:45 +02:00
|
|
|
#include "wine/list.h"
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
|
|
|
|
2021-02-18 23:58:10 +01:00
|
|
|
struct media_event
|
2004-03-05 21:42:40 +01:00
|
|
|
{
|
2021-02-18 23:58:10 +01:00
|
|
|
struct list entry;
|
|
|
|
LONG code;
|
|
|
|
LONG_PTR param1, param2;
|
|
|
|
};
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
#define MAX_ITF_CACHE_ENTRIES 3
|
|
|
|
typedef struct _ITF_CACHE_ENTRY {
|
2006-11-09 23:09:44 +01:00
|
|
|
const IID* riid;
|
2005-09-02 13:20:09 +02:00
|
|
|
IBaseFilter* filter;
|
|
|
|
IUnknown* iface;
|
|
|
|
} ITF_CACHE_ENTRY;
|
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
struct filter
|
|
|
|
{
|
2020-06-12 09:57:09 +02:00
|
|
|
struct list entry;
|
2018-09-18 16:40:45 +02:00
|
|
|
IBaseFilter *filter;
|
2020-04-08 21:38:14 +02:00
|
|
|
IMediaSeeking *seeking;
|
2018-09-18 16:40:45 +02:00
|
|
|
WCHAR *name;
|
2020-02-20 03:44:56 +01:00
|
|
|
BOOL sorting;
|
2018-09-18 16:40:45 +02:00
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph
|
|
|
|
{
|
2012-07-02 00:56:13 +02:00
|
|
|
IUnknown IUnknown_inner;
|
2011-06-30 00:30:45 +02:00
|
|
|
IFilterGraph2 IFilterGraph2_iface;
|
2011-06-30 00:33:21 +02:00
|
|
|
IMediaControl IMediaControl_iface;
|
2011-06-30 00:34:00 +02:00
|
|
|
IMediaSeeking IMediaSeeking_iface;
|
2011-06-30 00:41:55 +02:00
|
|
|
IBasicAudio IBasicAudio_iface;
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo2 IBasicVideo2_iface;
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow IVideoWindow_iface;
|
2011-06-30 00:47:38 +02:00
|
|
|
IMediaEventEx IMediaEventEx_iface;
|
2011-06-30 00:49:40 +02:00
|
|
|
IMediaFilter IMediaFilter_iface;
|
2011-06-30 00:51:10 +02:00
|
|
|
IMediaEventSink IMediaEventSink_iface;
|
2011-06-30 00:53:54 +02:00
|
|
|
IGraphConfig IGraphConfig_iface;
|
2011-06-30 00:56:32 +02:00
|
|
|
IMediaPosition IMediaPosition_iface;
|
2012-01-16 15:12:23 +01:00
|
|
|
IObjectWithSite IObjectWithSite_iface;
|
2013-02-19 15:56:17 +01:00
|
|
|
IGraphVersion IGraphVersion_iface;
|
2003-07-03 20:09:28 +02:00
|
|
|
/* IAMGraphStreams */
|
|
|
|
/* IAMStats */
|
|
|
|
/* IFilterChain */
|
|
|
|
/* IFilterMapper2 */
|
|
|
|
/* IQueueCommand */
|
|
|
|
/* IRegisterServiceProvider */
|
2019-12-13 00:15:08 +01:00
|
|
|
/* IResourceManager */
|
2003-07-03 20:09:28 +02:00
|
|
|
/* IServiceProvider */
|
2020-06-08 17:17:22 +02:00
|
|
|
IVideoFrameStep IVideoFrameStep_iface;
|
2003-07-03 20:09:28 +02:00
|
|
|
|
2012-07-02 00:56:13 +02:00
|
|
|
IUnknown *outer_unk;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2008-07-17 19:24:24 +02:00
|
|
|
IUnknown *punkFilterMapper2;
|
2020-01-22 07:08:56 +01:00
|
|
|
|
2020-06-12 09:57:09 +02:00
|
|
|
struct list filters;
|
2020-01-22 07:08:56 +01:00
|
|
|
unsigned int name_index;
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
FILTER_STATE state;
|
2020-07-15 02:56:26 +02:00
|
|
|
TP_WORK *async_run_work;
|
|
|
|
|
2007-04-03 19:44:41 +02:00
|
|
|
IReferenceClock *refClock;
|
2010-12-06 14:16:41 +01:00
|
|
|
IBaseFilter *refClockProvider;
|
2021-02-18 23:58:10 +01:00
|
|
|
|
2021-04-10 18:45:35 +02:00
|
|
|
/* We may indirectly wait for streaming threads while holding graph->cs in
|
|
|
|
* IMediaFilter::Stop() or IMediaSeeking::SetPositions(). Since streaming
|
|
|
|
* threads call IMediaEventSink::Notify() to queue EC_COMPLETE, we must
|
|
|
|
* use a separate lock to avoid them deadlocking on graph->cs. */
|
|
|
|
CRITICAL_SECTION event_cs;
|
2021-02-18 23:58:10 +01:00
|
|
|
struct list media_events;
|
|
|
|
HANDLE media_event_handle;
|
2021-02-18 23:58:11 +01:00
|
|
|
HWND media_event_window;
|
|
|
|
UINT media_event_message;
|
|
|
|
LPARAM media_event_lparam;
|
2004-03-05 21:42:40 +01:00
|
|
|
HANDLE hEventCompletion;
|
|
|
|
int CompletionStatus;
|
|
|
|
int nRenderers;
|
|
|
|
int EcCompleteCount;
|
|
|
|
int HandleEcComplete;
|
|
|
|
int HandleEcRepaint;
|
2007-04-05 22:19:30 +02:00
|
|
|
int HandleEcClockChanged;
|
2021-04-10 18:45:35 +02:00
|
|
|
unsigned int got_ec_complete : 1;
|
|
|
|
unsigned int media_events_disabled : 1;
|
2021-02-18 23:58:10 +01:00
|
|
|
|
2005-01-03 21:23:14 +01:00
|
|
|
CRITICAL_SECTION cs;
|
2005-09-02 13:20:09 +02:00
|
|
|
ITF_CACHE_ENTRY ItfCacheEntries[MAX_ITF_CACHE_ENTRIES];
|
|
|
|
int nItfCacheEntries;
|
2010-11-29 10:44:18 +01:00
|
|
|
BOOL defaultclock;
|
2008-03-14 20:35:42 +01:00
|
|
|
GUID timeformatseek;
|
2012-01-16 15:12:23 +01:00
|
|
|
IUnknown *pSite;
|
2013-02-19 16:15:20 +01:00
|
|
|
LONG version;
|
2019-10-03 05:01:06 +02:00
|
|
|
|
|
|
|
HANDLE message_thread, message_thread_ret;
|
|
|
|
DWORD message_thread_id;
|
2019-10-21 23:54:48 +02:00
|
|
|
|
2019-10-21 23:54:51 +02:00
|
|
|
/* Respectively: the last timestamp at which we started streaming, and the
|
|
|
|
* current offset within the stream. */
|
|
|
|
REFERENCE_TIME stream_start, stream_elapsed;
|
2020-07-21 00:49:10 +02:00
|
|
|
REFERENCE_TIME stream_stop;
|
2019-10-21 23:54:48 +02:00
|
|
|
LONGLONG current_pos;
|
2020-07-15 02:56:26 +02:00
|
|
|
|
|
|
|
unsigned int needs_async_run : 1;
|
2020-07-14 00:37:16 +02:00
|
|
|
};
|
2003-07-01 06:29:48 +02:00
|
|
|
|
2018-09-18 16:40:43 +02:00
|
|
|
struct enum_filters
|
|
|
|
{
|
|
|
|
IEnumFilters IEnumFilters_iface;
|
|
|
|
LONG ref;
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph;
|
2018-09-18 16:40:43 +02:00
|
|
|
LONG version;
|
2018-09-18 16:40:45 +02:00
|
|
|
struct list *cursor;
|
2018-09-18 16:40:43 +02:00
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT create_enum_filters(struct filter_graph *graph, struct list *cursor, IEnumFilters **out);
|
2018-09-18 16:40:43 +02:00
|
|
|
|
|
|
|
static inline struct enum_filters *impl_from_IEnumFilters(IEnumFilters *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, struct enum_filters, IEnumFilters_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumFilters_QueryInterface(IEnumFilters *iface, REFIID iid, void **out)
|
|
|
|
{
|
|
|
|
struct enum_filters *enum_filters = impl_from_IEnumFilters(iface);
|
|
|
|
TRACE("enum_filters %p, iid %s, out %p.\n", enum_filters, qzdebugstr_guid(iid), out);
|
|
|
|
|
|
|
|
if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IEnumFilters))
|
|
|
|
{
|
|
|
|
IEnumFilters_AddRef(*out = iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("%s not implemented, returning E_NOINTERFACE.\n", qzdebugstr_guid(iid));
|
|
|
|
*out = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI EnumFilters_AddRef(IEnumFilters *iface)
|
|
|
|
{
|
|
|
|
struct enum_filters *enum_filters = impl_from_IEnumFilters(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&enum_filters->ref);
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("%p increasing refcount to %lu.\n", enum_filters, ref);
|
2018-09-18 16:40:43 +02:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI EnumFilters_Release(IEnumFilters *iface)
|
|
|
|
{
|
|
|
|
struct enum_filters *enum_filters = impl_from_IEnumFilters(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&enum_filters->ref);
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("%p decreasing refcount to %lu.\n", enum_filters, ref);
|
2018-09-18 16:40:43 +02:00
|
|
|
|
|
|
|
if (!ref)
|
|
|
|
{
|
2018-09-18 16:40:44 +02:00
|
|
|
IUnknown_Release(enum_filters->graph->outer_unk);
|
2018-09-18 16:40:43 +02:00
|
|
|
heap_free(enum_filters);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumFilters_Next(IEnumFilters *iface, ULONG count,
|
|
|
|
IBaseFilter **filters, ULONG *fetched)
|
|
|
|
{
|
|
|
|
struct enum_filters *enum_filters = impl_from_IEnumFilters(iface);
|
2018-09-18 16:40:45 +02:00
|
|
|
unsigned int i = 0;
|
2018-09-18 16:40:43 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("enum_filters %p, count %lu, filters %p, fetched %p.\n",
|
2018-09-18 16:40:43 +02:00
|
|
|
enum_filters, count, filters, fetched);
|
|
|
|
|
2018-09-18 16:40:44 +02:00
|
|
|
if (enum_filters->version != enum_filters->graph->version)
|
2018-09-18 16:40:43 +02:00
|
|
|
return VFW_E_ENUM_OUT_OF_SYNC;
|
|
|
|
|
|
|
|
if (!filters)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
for (i = 0; i < count; ++i)
|
2018-09-18 16:40:43 +02:00
|
|
|
{
|
2018-09-18 16:40:45 +02:00
|
|
|
struct filter *filter = LIST_ENTRY(enum_filters->cursor, struct filter, entry);
|
2018-09-18 16:40:43 +02:00
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
if (!enum_filters->cursor)
|
|
|
|
break;
|
|
|
|
|
|
|
|
IBaseFilter_AddRef(filters[i] = filter->filter);
|
|
|
|
enum_filters->cursor = list_next(&enum_filters->graph->filters, enum_filters->cursor);
|
|
|
|
}
|
2018-09-18 16:40:43 +02:00
|
|
|
|
|
|
|
if (fetched)
|
2018-09-18 16:40:45 +02:00
|
|
|
*fetched = i;
|
2018-09-18 16:40:43 +02:00
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
return (i == count) ? S_OK : S_FALSE;
|
2018-09-18 16:40:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumFilters_Skip(IEnumFilters *iface, ULONG count)
|
|
|
|
{
|
|
|
|
struct enum_filters *enum_filters = impl_from_IEnumFilters(iface);
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("enum_filters %p, count %lu.\n", enum_filters, count);
|
2018-09-18 16:40:43 +02:00
|
|
|
|
2020-11-23 17:29:26 +01:00
|
|
|
if (enum_filters->version != enum_filters->graph->version)
|
|
|
|
return VFW_E_ENUM_OUT_OF_SYNC;
|
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
if (!enum_filters->cursor)
|
2020-11-23 17:29:27 +01:00
|
|
|
return E_INVALIDARG;
|
2018-09-18 16:40:45 +02:00
|
|
|
|
|
|
|
while (count--)
|
2018-09-18 16:40:43 +02:00
|
|
|
{
|
2018-09-18 16:40:45 +02:00
|
|
|
if (!(enum_filters->cursor = list_next(&enum_filters->graph->filters, enum_filters->cursor)))
|
2020-11-23 17:29:28 +01:00
|
|
|
return count ? S_FALSE : S_OK;
|
2018-09-18 16:40:43 +02:00
|
|
|
}
|
2018-09-18 16:40:45 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2018-09-18 16:40:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumFilters_Reset(IEnumFilters *iface)
|
|
|
|
{
|
|
|
|
struct enum_filters *enum_filters = impl_from_IEnumFilters(iface);
|
|
|
|
|
|
|
|
TRACE("enum_filters %p.\n", enum_filters);
|
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
enum_filters->cursor = list_head(&enum_filters->graph->filters);
|
2018-09-18 16:40:44 +02:00
|
|
|
enum_filters->version = enum_filters->graph->version;
|
2018-09-18 16:40:43 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumFilters_Clone(IEnumFilters *iface, IEnumFilters **out)
|
|
|
|
{
|
|
|
|
struct enum_filters *enum_filters = impl_from_IEnumFilters(iface);
|
|
|
|
|
|
|
|
TRACE("enum_filters %p, out %p.\n", enum_filters, out);
|
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
return create_enum_filters(enum_filters->graph, enum_filters->cursor, out);
|
2018-09-18 16:40:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IEnumFiltersVtbl EnumFilters_vtbl =
|
|
|
|
{
|
|
|
|
EnumFilters_QueryInterface,
|
|
|
|
EnumFilters_AddRef,
|
|
|
|
EnumFilters_Release,
|
|
|
|
EnumFilters_Next,
|
|
|
|
EnumFilters_Skip,
|
|
|
|
EnumFilters_Reset,
|
|
|
|
EnumFilters_Clone,
|
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT create_enum_filters(struct filter_graph *graph, struct list *cursor, IEnumFilters **out)
|
2018-09-18 16:40:43 +02:00
|
|
|
{
|
|
|
|
struct enum_filters *enum_filters;
|
|
|
|
|
|
|
|
if (!(enum_filters = heap_alloc(sizeof(*enum_filters))))
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
enum_filters->IEnumFilters_iface.lpVtbl = &EnumFilters_vtbl;
|
|
|
|
enum_filters->ref = 1;
|
2018-09-18 16:40:45 +02:00
|
|
|
enum_filters->cursor = cursor;
|
2018-09-18 16:40:44 +02:00
|
|
|
enum_filters->graph = graph;
|
|
|
|
IUnknown_AddRef(graph->outer_unk);
|
|
|
|
enum_filters->version = graph->version;
|
2018-09-18 16:40:43 +02:00
|
|
|
|
|
|
|
*out = &enum_filters->IEnumFilters_iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2021-02-18 23:58:10 +01:00
|
|
|
static BOOL queue_media_event(struct filter_graph *graph, LONG code,
|
|
|
|
LONG_PTR param1, LONG_PTR param2)
|
|
|
|
{
|
|
|
|
struct media_event *event;
|
|
|
|
|
|
|
|
if (!(event = malloc(sizeof(*event))))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
event->code = code;
|
|
|
|
event->param1 = param1;
|
|
|
|
event->param2 = param2;
|
|
|
|
list_add_tail(&graph->media_events, &event->entry);
|
|
|
|
|
|
|
|
SetEvent(graph->media_event_handle);
|
2021-02-18 23:58:11 +01:00
|
|
|
if (graph->media_event_window)
|
|
|
|
PostMessageW(graph->media_event_window, graph->media_event_message, 0, graph->media_event_lparam);
|
2021-02-18 23:58:10 +01:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-02-18 23:58:12 +01:00
|
|
|
static void flush_media_events(struct filter_graph *graph)
|
|
|
|
{
|
|
|
|
struct list *cursor;
|
|
|
|
|
|
|
|
while ((cursor = list_head(&graph->media_events)))
|
|
|
|
{
|
|
|
|
struct media_event *event = LIST_ENTRY(cursor, struct media_event, entry);
|
|
|
|
|
|
|
|
list_remove(&event->entry);
|
|
|
|
free(event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IUnknown(IUnknown *iface)
|
2012-07-02 00:56:13 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IUnknown_inner);
|
2012-07-02 00:56:13 +02:00
|
|
|
}
|
2003-07-01 06:29:48 +02:00
|
|
|
|
2012-07-02 00:56:13 +02:00
|
|
|
static HRESULT WINAPI FilterGraphInner_QueryInterface(IUnknown *iface, REFIID riid, void **ppvObj)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IUnknown(iface);
|
2016-08-10 13:03:39 +02:00
|
|
|
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObj);
|
2007-12-21 05:38:59 +01:00
|
|
|
|
|
|
|
if (IsEqualGUID(&IID_IUnknown, riid)) {
|
2012-07-02 00:56:13 +02:00
|
|
|
*ppvObj = &This->IUnknown_inner;
|
2007-12-21 05:38:59 +01:00
|
|
|
TRACE(" returning IUnknown interface (%p)\n", *ppvObj);
|
|
|
|
} else if (IsEqualGUID(&IID_IFilterGraph, riid) ||
|
2007-12-11 08:40:19 +01:00
|
|
|
IsEqualGUID(&IID_IFilterGraph2, riid) ||
|
2003-06-13 20:06:44 +02:00
|
|
|
IsEqualGUID(&IID_IGraphBuilder, riid)) {
|
2011-06-30 00:30:45 +02:00
|
|
|
*ppvObj = &This->IFilterGraph2_iface;
|
2003-06-13 20:06:44 +02:00
|
|
|
TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj);
|
|
|
|
} else if (IsEqualGUID(&IID_IMediaControl, riid)) {
|
2011-06-30 00:33:21 +02:00
|
|
|
*ppvObj = &This->IMediaControl_iface;
|
2003-06-13 20:06:44 +02:00
|
|
|
TRACE(" returning IMediaControl interface (%p)\n", *ppvObj);
|
|
|
|
} else if (IsEqualGUID(&IID_IMediaSeeking, riid)) {
|
2011-06-30 00:34:00 +02:00
|
|
|
*ppvObj = &This->IMediaSeeking_iface;
|
2003-06-13 20:06:44 +02:00
|
|
|
TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj);
|
|
|
|
} else if (IsEqualGUID(&IID_IBasicAudio, riid)) {
|
2011-06-30 00:41:55 +02:00
|
|
|
*ppvObj = &This->IBasicAudio_iface;
|
2003-06-13 20:06:44 +02:00
|
|
|
TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj);
|
2008-06-10 18:17:07 +02:00
|
|
|
} else if (IsEqualGUID(&IID_IBasicVideo, riid) ||
|
|
|
|
IsEqualGUID(&IID_IBasicVideo2, riid)) {
|
2011-06-30 00:44:08 +02:00
|
|
|
*ppvObj = &This->IBasicVideo2_iface;
|
2008-06-10 18:17:07 +02:00
|
|
|
TRACE(" returning IBasicVideo2 interface (%p)\n", *ppvObj);
|
2003-06-13 20:06:44 +02:00
|
|
|
} else if (IsEqualGUID(&IID_IVideoWindow, riid)) {
|
2011-06-30 00:45:48 +02:00
|
|
|
*ppvObj = &This->IVideoWindow_iface;
|
2003-06-13 20:06:44 +02:00
|
|
|
TRACE(" returning IVideoWindow interface (%p)\n", *ppvObj);
|
2003-07-03 20:09:28 +02:00
|
|
|
} else if (IsEqualGUID(&IID_IMediaEvent, riid) ||
|
2003-08-07 00:04:45 +02:00
|
|
|
IsEqualGUID(&IID_IMediaEventEx, riid)) {
|
2011-06-30 00:47:38 +02:00
|
|
|
*ppvObj = &This->IMediaEventEx_iface;
|
2003-06-13 20:06:44 +02:00
|
|
|
TRACE(" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj);
|
2003-07-03 20:09:28 +02:00
|
|
|
} else if (IsEqualGUID(&IID_IMediaFilter, riid) ||
|
|
|
|
IsEqualGUID(&IID_IPersist, riid)) {
|
2011-06-30 00:49:40 +02:00
|
|
|
*ppvObj = &This->IMediaFilter_iface;
|
2003-07-03 20:09:28 +02:00
|
|
|
TRACE(" returning IMediaFilter interface (%p)\n", *ppvObj);
|
2004-03-05 21:42:40 +01:00
|
|
|
} else if (IsEqualGUID(&IID_IMediaEventSink, riid)) {
|
2011-06-30 00:51:10 +02:00
|
|
|
*ppvObj = &This->IMediaEventSink_iface;
|
2004-03-05 21:42:40 +01:00
|
|
|
TRACE(" returning IMediaEventSink interface (%p)\n", *ppvObj);
|
2005-08-17 11:52:15 +02:00
|
|
|
} else if (IsEqualGUID(&IID_IGraphConfig, riid)) {
|
2011-06-30 00:53:54 +02:00
|
|
|
*ppvObj = &This->IGraphConfig_iface;
|
2005-08-17 11:52:15 +02:00
|
|
|
TRACE(" returning IGraphConfig interface (%p)\n", *ppvObj);
|
2007-02-20 02:31:19 +01:00
|
|
|
} else if (IsEqualGUID(&IID_IMediaPosition, riid)) {
|
2011-06-30 00:56:32 +02:00
|
|
|
*ppvObj = &This->IMediaPosition_iface;
|
2007-02-20 02:31:19 +01:00
|
|
|
TRACE(" returning IMediaPosition interface (%p)\n", *ppvObj);
|
2012-01-16 15:12:23 +01:00
|
|
|
} else if (IsEqualGUID(&IID_IObjectWithSite, riid)) {
|
|
|
|
*ppvObj = &This->IObjectWithSite_iface;
|
|
|
|
TRACE(" returning IObjectWithSite interface (%p)\n", *ppvObj);
|
2008-07-17 19:24:24 +02:00
|
|
|
} else if (IsEqualGUID(&IID_IFilterMapper, riid)) {
|
|
|
|
TRACE(" requesting IFilterMapper interface from aggregated filtermapper (%p)\n", *ppvObj);
|
|
|
|
return IUnknown_QueryInterface(This->punkFilterMapper2, riid, ppvObj);
|
|
|
|
} else if (IsEqualGUID(&IID_IFilterMapper2, riid)) {
|
|
|
|
TRACE(" returning IFilterMapper2 interface from aggregated filtermapper (%p)\n", *ppvObj);
|
2015-11-20 15:07:52 +01:00
|
|
|
return IUnknown_QueryInterface(This->punkFilterMapper2, riid, ppvObj);
|
2010-12-03 09:38:09 +01:00
|
|
|
} else if (IsEqualGUID(&IID_IFilterMapper3, riid)) {
|
|
|
|
TRACE(" returning IFilterMapper3 interface from aggregated filtermapper (%p)\n", *ppvObj);
|
2015-11-20 15:07:52 +01:00
|
|
|
return IUnknown_QueryInterface(This->punkFilterMapper2, riid, ppvObj);
|
2013-02-19 15:56:17 +01:00
|
|
|
} else if (IsEqualGUID(&IID_IGraphVersion, riid)) {
|
2018-09-15 01:57:43 +02:00
|
|
|
*ppvObj = &This->IGraphVersion_iface;
|
|
|
|
TRACE(" returning IGraphVersion interface (%p)\n", *ppvObj);
|
2020-06-08 17:17:22 +02:00
|
|
|
} else if (IsEqualGUID(&IID_IVideoFrameStep, riid)) {
|
|
|
|
*ppvObj = &This->IVideoFrameStep_iface;
|
|
|
|
TRACE(" returning IVideoFrameStep interface (%p)\n", *ppvObj);
|
2003-06-13 20:06:44 +02:00
|
|
|
} else {
|
|
|
|
*ppvObj = NULL;
|
2003-07-03 20:09:28 +02:00
|
|
|
FIXME("unknown interface %s\n", debugstr_guid(riid));
|
2003-06-13 20:06:44 +02:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2012-07-02 00:56:13 +02:00
|
|
|
IUnknown_AddRef((IUnknown *)*ppvObj);
|
2003-06-13 20:06:44 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-07-02 00:56:13 +02:00
|
|
|
static ULONG WINAPI FilterGraphInner_AddRef(IUnknown *iface)
|
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
struct filter_graph *graph = impl_from_IUnknown(iface);
|
|
|
|
ULONG refcount = InterlockedIncrement(&graph->ref);
|
2005-01-06 20:36:47 +01:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("%p increasing refcount to %lu.\n", graph, refcount);
|
2012-07-02 00:56:13 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
return refcount;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2012-07-02 00:56:13 +02:00
|
|
|
static ULONG WINAPI FilterGraphInner_Release(IUnknown *iface)
|
2008-06-26 19:59:10 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IUnknown(iface);
|
2022-02-04 22:41:27 +01:00
|
|
|
ULONG refcount = InterlockedDecrement(&This->ref);
|
2021-02-18 23:58:10 +01:00
|
|
|
struct list *cursor;
|
2008-06-26 19:59:10 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("%p decreasing refcount to %lu.\n", This, refcount);
|
2008-06-26 19:59:10 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
if (!refcount)
|
|
|
|
{
|
2005-05-06 16:34:44 +02:00
|
|
|
int i;
|
2007-04-03 19:44:41 +02:00
|
|
|
|
2008-07-17 19:24:24 +02:00
|
|
|
This->ref = 1; /* guard against reentrancy (aggregation). */
|
|
|
|
|
2011-06-30 00:33:21 +02:00
|
|
|
IMediaControl_Stop(&This->IMediaControl_iface);
|
2007-04-03 19:44:41 +02:00
|
|
|
|
2021-02-18 23:58:10 +01:00
|
|
|
while ((cursor = list_head(&This->filters)))
|
2018-09-18 16:40:45 +02:00
|
|
|
{
|
2021-02-18 23:58:10 +01:00
|
|
|
struct filter *filter = LIST_ENTRY(cursor, struct filter, entry);
|
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
IFilterGraph2_RemoveFilter(&This->IFilterGraph2_iface, filter->filter);
|
|
|
|
}
|
2008-03-14 05:47:14 +01:00
|
|
|
|
2008-06-26 19:59:10 +02:00
|
|
|
if (This->refClock)
|
|
|
|
IReferenceClock_Release(This->refClock);
|
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
for (i = 0; i < This->nItfCacheEntries; i++)
|
2007-04-04 18:21:58 +02:00
|
|
|
{
|
|
|
|
if (This->ItfCacheEntries[i].iface)
|
|
|
|
IUnknown_Release(This->ItfCacheEntries[i].iface);
|
|
|
|
}
|
2008-07-17 19:24:24 +02:00
|
|
|
|
|
|
|
IUnknown_Release(This->punkFilterMapper2);
|
|
|
|
|
2012-01-16 15:12:23 +01:00
|
|
|
if (This->pSite) IUnknown_Release(This->pSite);
|
|
|
|
|
2021-02-18 23:58:12 +01:00
|
|
|
flush_media_events(This);
|
2021-02-18 23:58:10 +01:00
|
|
|
CloseHandle(This->media_event_handle);
|
|
|
|
|
2007-03-10 22:10:20 +01:00
|
|
|
This->cs.DebugInfo->Spare[0] = 0;
|
2019-10-03 05:01:06 +02:00
|
|
|
if (This->message_thread)
|
|
|
|
{
|
|
|
|
PostThreadMessageW(This->message_thread_id, WM_USER + 1, 0, 0);
|
|
|
|
WaitForSingleObject(This->message_thread, INFINITE);
|
|
|
|
CloseHandle(This->message_thread);
|
|
|
|
CloseHandle(This->message_thread_ret);
|
|
|
|
}
|
2021-04-10 18:45:35 +02:00
|
|
|
DeleteCriticalSection(&This->event_cs);
|
2005-01-03 21:23:14 +01:00
|
|
|
DeleteCriticalSection(&This->cs);
|
2020-07-14 00:37:15 +02:00
|
|
|
free(This);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
2022-02-04 22:41:27 +01:00
|
|
|
return refcount;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IFilterGraph2(IFilterGraph2 *iface)
|
2011-06-30 00:30:45 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IFilterGraph2_iface);
|
2011-06-30 00:30:45 +02:00
|
|
|
}
|
|
|
|
|
2020-05-17 21:44:30 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_QueryInterface(IFilterGraph2 *iface, REFIID iid, void **out)
|
2011-06-30 00:30:45 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:30:45 +02:00
|
|
|
static ULONG WINAPI FilterGraph2_AddRef(IFilterGraph2 *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:30:45 +02:00
|
|
|
static ULONG WINAPI FilterGraph2_Release(IFilterGraph2 *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static IBaseFilter *find_filter_by_name(struct filter_graph *graph, const WCHAR *name)
|
2018-09-18 16:40:42 +02:00
|
|
|
{
|
2018-09-18 16:40:45 +02:00
|
|
|
struct filter *filter;
|
2018-09-18 16:40:42 +02:00
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
2018-09-18 16:40:42 +02:00
|
|
|
{
|
2019-08-05 17:25:58 +02:00
|
|
|
if (!wcscmp(filter->name, name))
|
2018-09-18 16:40:45 +02:00
|
|
|
return filter->filter;
|
2018-09-18 16:40:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-02-20 03:44:58 +01:00
|
|
|
static BOOL has_output_pins(IBaseFilter *filter)
|
|
|
|
{
|
|
|
|
IEnumPins *enumpins;
|
|
|
|
PIN_DIRECTION dir;
|
|
|
|
IPin *pin;
|
|
|
|
|
|
|
|
if (FAILED(IBaseFilter_EnumPins(filter, &enumpins)))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
while (IEnumPins_Next(enumpins, 1, &pin, NULL) == S_OK)
|
|
|
|
{
|
|
|
|
IPin_QueryDirection(pin, &dir);
|
|
|
|
IPin_Release(pin);
|
|
|
|
if (dir == PINDIR_OUTPUT)
|
|
|
|
{
|
|
|
|
IEnumPins_Release(enumpins);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
IEnumPins_Release(enumpins);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-06-10 18:09:06 +02:00
|
|
|
static void update_seeking(struct filter *filter)
|
|
|
|
{
|
2020-11-02 19:25:17 +01:00
|
|
|
IMediaSeeking *seeking;
|
|
|
|
|
2020-06-10 18:09:06 +02:00
|
|
|
if (!filter->seeking)
|
|
|
|
{
|
|
|
|
/* The Legend of Heroes: Trails of Cold Steel II destroys its filter when
|
|
|
|
* its IMediaSeeking interface is released, so cache the interface instead
|
|
|
|
* of querying for it every time.
|
|
|
|
* Some filters (e.g. MediaStreamFilter) can become seekable when they are
|
|
|
|
* already in the graph, so always try to query IMediaSeeking if it's not
|
|
|
|
* cached yet. */
|
2020-11-02 19:25:17 +01:00
|
|
|
if (SUCCEEDED(IBaseFilter_QueryInterface(filter->filter, &IID_IMediaSeeking, (void **)&seeking)))
|
|
|
|
{
|
|
|
|
if (IMediaSeeking_IsFormatSupported(seeking, &TIME_FORMAT_MEDIA_TIME) == S_OK)
|
|
|
|
filter->seeking = seeking;
|
|
|
|
else
|
|
|
|
IMediaSeeking_Release(seeking);
|
|
|
|
}
|
2020-06-10 18:09:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-08 21:38:14 +02:00
|
|
|
static BOOL is_renderer(struct filter *filter)
|
2020-02-20 03:44:58 +01:00
|
|
|
{
|
2021-05-24 09:33:07 +02:00
|
|
|
IMediaPosition *media_position;
|
2020-02-20 03:44:58 +01:00
|
|
|
IAMFilterMiscFlags *flags;
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
|
2020-04-08 21:38:14 +02:00
|
|
|
if (SUCCEEDED(IBaseFilter_QueryInterface(filter->filter, &IID_IAMFilterMiscFlags, (void **)&flags)))
|
2020-02-20 03:44:58 +01:00
|
|
|
{
|
|
|
|
if (IAMFilterMiscFlags_GetMiscFlags(flags) & AM_FILTER_MISC_FLAGS_IS_RENDERER)
|
|
|
|
ret = TRUE;
|
|
|
|
IAMFilterMiscFlags_Release(flags);
|
|
|
|
}
|
2021-05-24 09:33:07 +02:00
|
|
|
else if (SUCCEEDED(IBaseFilter_QueryInterface(filter->filter, &IID_IMediaPosition, (void **)&media_position)))
|
|
|
|
{
|
|
|
|
if (!has_output_pins(filter->filter))
|
|
|
|
ret = TRUE;
|
|
|
|
IMediaPosition_Release(media_position);
|
|
|
|
}
|
2020-06-10 18:09:06 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
update_seeking(filter);
|
|
|
|
if (filter->seeking && !has_output_pins(filter->filter))
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
2020-02-20 03:44:58 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-06-13 20:06:44 +02:00
|
|
|
/*** IFilterGraph methods ***/
|
2020-01-22 07:08:56 +01:00
|
|
|
static HRESULT WINAPI FilterGraph2_AddFilter(IFilterGraph2 *iface,
|
|
|
|
IBaseFilter *filter, const WCHAR *name)
|
2011-06-30 00:30:45 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2020-01-22 07:08:56 +01:00
|
|
|
BOOL duplicate_name = FALSE;
|
2018-09-18 16:40:45 +02:00
|
|
|
struct filter *entry;
|
2020-01-22 07:08:56 +01:00
|
|
|
unsigned int i;
|
2003-07-03 20:09:28 +02:00
|
|
|
HRESULT hr;
|
2007-06-27 00:12:07 +02:00
|
|
|
|
2020-01-22 07:08:56 +01:00
|
|
|
TRACE("graph %p, filter %p, name %s.\n", graph, filter, debugstr_w(name));
|
2003-07-03 20:09:28 +02:00
|
|
|
|
2020-01-22 07:08:56 +01:00
|
|
|
if (!filter)
|
2008-03-06 09:32:03 +01:00
|
|
|
return E_POINTER;
|
|
|
|
|
2020-01-22 07:08:56 +01:00
|
|
|
if (!(entry = heap_alloc(sizeof(*entry))))
|
|
|
|
return E_OUTOFMEMORY;
|
2007-06-27 00:12:07 +02:00
|
|
|
|
2020-01-22 07:08:56 +01:00
|
|
|
if (!(entry->name = CoTaskMemAlloc((name ? wcslen(name) + 6 : 5) * sizeof(WCHAR))))
|
|
|
|
{
|
|
|
|
heap_free(entry);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name && find_filter_by_name(graph, name))
|
2018-09-18 16:40:42 +02:00
|
|
|
duplicate_name = TRUE;
|
2004-03-03 03:18:13 +01:00
|
|
|
|
2020-01-22 07:08:56 +01:00
|
|
|
if (!name || duplicate_name)
|
2004-03-03 03:18:13 +01:00
|
|
|
{
|
2020-01-22 07:08:56 +01:00
|
|
|
for (i = 0; i < 10000 ; ++i)
|
|
|
|
{
|
|
|
|
if (name)
|
|
|
|
swprintf(entry->name, name ? wcslen(name) + 6 : 5, L"%s %04u", name, graph->name_index);
|
|
|
|
else
|
|
|
|
swprintf(entry->name, name ? wcslen(name) + 6 : 5, L"%04u", graph->name_index);
|
2004-03-03 03:18:13 +01:00
|
|
|
|
2020-01-22 07:08:56 +01:00
|
|
|
graph->name_index = (graph->name_index + 1) % 10000;
|
2018-09-18 16:40:42 +02:00
|
|
|
|
2020-01-22 07:08:56 +01:00
|
|
|
if (!find_filter_by_name(graph, entry->name))
|
2018-09-18 16:40:42 +02:00
|
|
|
break;
|
2020-01-22 07:08:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (i == 10000)
|
|
|
|
{
|
|
|
|
CoTaskMemFree(entry->name);
|
|
|
|
heap_free(entry);
|
|
|
|
return VFW_E_DUPLICATE_NAME;
|
|
|
|
}
|
2004-03-03 03:18:13 +01:00
|
|
|
}
|
|
|
|
else
|
2020-01-22 07:08:56 +01:00
|
|
|
wcscpy(entry->name, name);
|
2004-03-03 03:18:13 +01:00
|
|
|
|
2020-01-22 07:08:56 +01:00
|
|
|
if (FAILED(hr = IBaseFilter_JoinFilterGraph(filter,
|
|
|
|
(IFilterGraph *)&graph->IFilterGraph2_iface, entry->name)))
|
2003-07-03 20:09:28 +02:00
|
|
|
{
|
2020-01-22 07:08:56 +01:00
|
|
|
CoTaskMemFree(entry->name);
|
|
|
|
heap_free(entry);
|
2018-09-18 16:40:45 +02:00
|
|
|
return hr;
|
2003-07-03 20:09:28 +02:00
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-01-22 07:08:56 +01:00
|
|
|
IBaseFilter_AddRef(entry->filter = filter);
|
2020-04-08 21:38:14 +02:00
|
|
|
|
2020-01-22 07:08:56 +01:00
|
|
|
list_add_head(&graph->filters, &entry->entry);
|
2020-02-20 03:44:56 +01:00
|
|
|
entry->sorting = FALSE;
|
2020-06-10 18:09:06 +02:00
|
|
|
entry->seeking = NULL;
|
2020-01-22 07:08:56 +01:00
|
|
|
++graph->version;
|
2012-10-12 05:35:46 +02:00
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
return duplicate_name ? VFW_S_DUPLICATE_NAME : hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2008-06-26 19:59:10 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilter *pFilter)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IFilterGraph2(iface);
|
2018-09-18 16:40:45 +02:00
|
|
|
struct filter *entry;
|
2003-07-03 20:09:28 +02:00
|
|
|
int i;
|
|
|
|
HRESULT hr = E_FAIL;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pFilter);
|
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(entry, &This->filters, struct filter, entry)
|
2003-07-03 20:09:28 +02:00
|
|
|
{
|
2018-09-18 16:40:45 +02:00
|
|
|
if (entry->filter == pFilter)
|
2003-07-03 20:09:28 +02:00
|
|
|
{
|
2008-06-26 19:59:10 +02:00
|
|
|
IEnumPins *penumpins = NULL;
|
|
|
|
|
2010-12-06 14:16:41 +01:00
|
|
|
if (This->defaultclock && This->refClockProvider == pFilter)
|
|
|
|
{
|
2011-06-30 00:49:40 +02:00
|
|
|
IMediaFilter_SetSyncSource(&This->IMediaFilter_iface, NULL);
|
2013-10-10 21:52:46 +02:00
|
|
|
This->defaultclock = TRUE;
|
2010-12-06 14:16:41 +01:00
|
|
|
}
|
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
TRACE("Removing filter %s.\n", debugstr_w(entry->name));
|
2008-06-26 19:59:10 +02:00
|
|
|
|
2007-03-14 15:19:17 +01:00
|
|
|
hr = IBaseFilter_EnumPins(pFilter, &penumpins);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
IPin *ppin;
|
2008-06-26 19:59:10 +02:00
|
|
|
while(IEnumPins_Next(penumpins, 1, &ppin, NULL) == S_OK)
|
|
|
|
{
|
2020-11-15 18:04:37 +01:00
|
|
|
IPin *peer = NULL;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
IPin_ConnectedTo(ppin, &peer);
|
|
|
|
if (peer)
|
2008-03-14 06:00:57 +01:00
|
|
|
{
|
2020-11-15 18:04:37 +01:00
|
|
|
if (FAILED(hr = IPin_Disconnect(peer)))
|
2008-03-14 06:00:57 +01:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
WARN("Failed to disconnect peer %p, hr %#lx.\n", peer, hr);
|
2020-11-15 18:04:37 +01:00
|
|
|
IPin_Release(peer);
|
|
|
|
IPin_Release(ppin);
|
|
|
|
IEnumPins_Release(penumpins);
|
|
|
|
return hr;
|
2008-03-14 06:00:57 +01:00
|
|
|
}
|
2020-11-15 18:04:37 +01:00
|
|
|
IPin_Release(peer);
|
2008-07-17 19:24:54 +02:00
|
|
|
|
2020-11-15 18:04:37 +01:00
|
|
|
if (FAILED(hr = IPin_Disconnect(ppin)))
|
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
WARN("Failed to disconnect pin %p, hr %#lx.\n", ppin, hr);
|
2020-11-15 18:04:37 +01:00
|
|
|
IPin_Release(ppin);
|
|
|
|
IEnumPins_Release(penumpins);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
}
|
2008-07-17 19:24:54 +02:00
|
|
|
IPin_Release(ppin);
|
2007-03-14 15:19:17 +01:00
|
|
|
}
|
|
|
|
IEnumPins_Release(penumpins);
|
|
|
|
}
|
|
|
|
|
2018-09-19 05:44:11 +02:00
|
|
|
hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, NULL);
|
2003-07-03 20:09:28 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2007-04-03 19:44:41 +02:00
|
|
|
IBaseFilter_SetSyncSource(pFilter, NULL);
|
2007-03-14 15:21:59 +01:00
|
|
|
IBaseFilter_Release(pFilter);
|
2020-04-08 21:38:14 +02:00
|
|
|
if (entry->seeking)
|
|
|
|
IMediaSeeking_Release(entry->seeking);
|
2018-09-18 16:40:45 +02:00
|
|
|
list_remove(&entry->entry);
|
2018-12-22 15:47:22 +01:00
|
|
|
CoTaskMemFree(entry->name);
|
2018-09-18 16:40:45 +02:00
|
|
|
heap_free(entry);
|
2013-02-19 16:15:20 +01:00
|
|
|
This->version++;
|
2005-09-02 13:20:09 +02:00
|
|
|
/* Invalidate interfaces in the cache */
|
|
|
|
for (i = 0; i < This->nItfCacheEntries; i++)
|
|
|
|
if (pFilter == This->ItfCacheEntries[i].filter)
|
|
|
|
{
|
|
|
|
IUnknown_Release(This->ItfCacheEntries[i].iface);
|
|
|
|
This->ItfCacheEntries[i].iface = NULL;
|
|
|
|
This->ItfCacheEntries[i].filter = NULL;
|
|
|
|
}
|
2003-07-03 20:09:28 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2003-07-03 20:09:28 +02:00
|
|
|
return hr; /* FIXME: check this error code */
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2018-09-18 16:40:43 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_EnumFilters(IFilterGraph2 *iface, IEnumFilters **out)
|
2011-06-30 00:30:45 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2018-09-18 16:40:43 +02:00
|
|
|
TRACE("graph %p, out %p.\n", graph, out);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
return create_enum_filters(graph, list_head(&graph->filters), out);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2018-09-18 16:40:42 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_FindFilterByName(IFilterGraph2 *iface,
|
|
|
|
const WCHAR *name, IBaseFilter **filter)
|
2011-06-30 00:30:45 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2018-09-18 16:40:42 +02:00
|
|
|
TRACE("graph %p, name %s, filter %p.\n", graph, debugstr_w(name), filter);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2018-09-18 16:40:42 +02:00
|
|
|
if (!filter)
|
2007-12-06 05:11:33 +01:00
|
|
|
return E_POINTER;
|
2003-07-03 20:09:28 +02:00
|
|
|
|
2018-09-18 16:40:42 +02:00
|
|
|
if ((*filter = find_filter_by_name(graph, name)))
|
2003-07-03 20:09:28 +02:00
|
|
|
{
|
2018-09-18 16:40:42 +02:00
|
|
|
IBaseFilter_AddRef(*filter);
|
|
|
|
return S_OK;
|
2003-07-03 20:09:28 +02:00
|
|
|
}
|
|
|
|
|
2007-12-06 05:11:13 +01:00
|
|
|
return VFW_E_NOT_FOUND;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2022-02-03 05:58:09 +01:00
|
|
|
static HRESULT check_cyclic_connection(IPin *source, IPin *sink)
|
2008-06-26 20:13:53 +02:00
|
|
|
{
|
2022-02-03 05:58:09 +01:00
|
|
|
IPin *upstream_source, *upstream_sink;
|
|
|
|
PIN_INFO source_info, sink_info;
|
|
|
|
IEnumPins *enumpins;
|
2008-06-26 20:13:53 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-03 05:58:09 +01:00
|
|
|
hr = IPin_QueryPinInfo(sink, &sink_info);
|
2008-06-26 20:13:53 +02:00
|
|
|
if (FAILED(hr))
|
2022-02-03 05:58:09 +01:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
ERR("Failed to query pin, hr %#lx.\n", hr);
|
2008-06-26 20:13:53 +02:00
|
|
|
return hr;
|
2022-02-03 05:58:09 +01:00
|
|
|
}
|
|
|
|
IBaseFilter_Release(sink_info.pFilter);
|
2008-06-26 20:13:53 +02:00
|
|
|
|
2022-02-03 05:58:09 +01:00
|
|
|
hr = IPin_QueryPinInfo(source, &source_info);
|
2008-06-26 20:13:53 +02:00
|
|
|
if (FAILED(hr))
|
2022-02-03 05:58:09 +01:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
ERR("Failed to query pin, hr %#lx.\n", hr);
|
2022-02-03 05:58:09 +01:00
|
|
|
return hr;
|
|
|
|
}
|
2008-06-26 20:13:53 +02:00
|
|
|
|
2022-02-03 05:58:09 +01:00
|
|
|
if (sink_info.pFilter == source_info.pFilter)
|
2008-06-26 20:13:53 +02:00
|
|
|
{
|
2022-02-03 05:58:09 +01:00
|
|
|
WARN("Cyclic connection detected; returning VFW_E_CIRCULAR_GRAPH.\n");
|
|
|
|
IBaseFilter_Release(source_info.pFilter);
|
|
|
|
return VFW_E_CIRCULAR_GRAPH;
|
|
|
|
}
|
2008-06-26 20:13:53 +02:00
|
|
|
|
2022-02-03 05:58:09 +01:00
|
|
|
hr = IBaseFilter_EnumPins(source_info.pFilter, &enumpins);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
ERR("Failed to enumerate pins, hr %#lx.\n", hr);
|
2022-02-03 05:58:09 +01:00
|
|
|
IBaseFilter_Release(source_info.pFilter);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((hr = IEnumPins_Next(enumpins, 1, &upstream_sink, NULL)) == S_OK)
|
|
|
|
{
|
|
|
|
PIN_DIRECTION dir = PINDIR_OUTPUT;
|
2008-06-26 20:13:53 +02:00
|
|
|
|
2022-02-03 05:58:09 +01:00
|
|
|
IPin_QueryDirection(upstream_sink, &dir);
|
|
|
|
if (dir == PINDIR_INPUT && IPin_ConnectedTo(upstream_sink, &upstream_source) == S_OK)
|
2008-06-26 20:13:53 +02:00
|
|
|
{
|
2022-02-03 05:58:09 +01:00
|
|
|
hr = check_cyclic_connection(upstream_source, sink);
|
|
|
|
IPin_Release(upstream_source);
|
|
|
|
if (FAILED(hr))
|
2008-06-26 20:13:53 +02:00
|
|
|
{
|
2022-02-03 05:58:09 +01:00
|
|
|
IPin_Release(upstream_sink);
|
|
|
|
IEnumPins_Release(enumpins);
|
|
|
|
IBaseFilter_Release(source_info.pFilter);
|
|
|
|
return hr;
|
2008-06-26 20:13:53 +02:00
|
|
|
}
|
|
|
|
}
|
2022-02-03 05:58:09 +01:00
|
|
|
IPin_Release(upstream_sink);
|
2008-06-26 20:13:53 +02:00
|
|
|
}
|
2022-02-03 05:58:09 +01:00
|
|
|
IEnumPins_Release(enumpins);
|
2008-06-26 20:13:53 +02:00
|
|
|
|
2022-02-03 05:58:09 +01:00
|
|
|
IBaseFilter_Release(source_info.pFilter);
|
|
|
|
return S_OK;
|
2008-06-26 20:13:53 +02:00
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter *find_sorted_filter(struct filter_graph *graph, IBaseFilter *iface)
|
2020-02-20 03:44:56 +01:00
|
|
|
{
|
|
|
|
struct filter *filter;
|
|
|
|
|
2020-06-12 09:57:09 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
2020-02-20 03:44:56 +01:00
|
|
|
{
|
|
|
|
if (filter->filter == iface)
|
|
|
|
return filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static void sort_filter_recurse(struct filter_graph *graph, struct filter *filter, struct list *sorted)
|
2020-02-20 03:44:56 +01:00
|
|
|
{
|
|
|
|
struct filter *peer_filter;
|
|
|
|
IEnumPins *enumpins;
|
|
|
|
PIN_DIRECTION dir;
|
|
|
|
IPin *pin, *peer;
|
|
|
|
PIN_INFO info;
|
|
|
|
|
|
|
|
TRACE("Sorting filter %p.\n", filter->filter);
|
|
|
|
|
2022-02-03 05:58:09 +01:00
|
|
|
/* Cyclic connections should be caught by check_cyclic_connection(). */
|
2020-02-20 03:44:56 +01:00
|
|
|
assert(!filter->sorting);
|
|
|
|
|
|
|
|
filter->sorting = TRUE;
|
|
|
|
|
|
|
|
IBaseFilter_EnumPins(filter->filter, &enumpins);
|
|
|
|
while (IEnumPins_Next(enumpins, 1, &pin, NULL) == S_OK)
|
|
|
|
{
|
|
|
|
IPin_QueryDirection(pin, &dir);
|
|
|
|
|
|
|
|
if (dir == PINDIR_INPUT && IPin_ConnectedTo(pin, &peer) == S_OK)
|
|
|
|
{
|
|
|
|
IPin_QueryPinInfo(peer, &info);
|
|
|
|
/* Note that the filter may have already been sorted. */
|
|
|
|
if ((peer_filter = find_sorted_filter(graph, info.pFilter)))
|
|
|
|
sort_filter_recurse(graph, peer_filter, sorted);
|
|
|
|
IBaseFilter_Release(info.pFilter);
|
|
|
|
IPin_Release(peer);
|
|
|
|
}
|
|
|
|
IPin_Release(pin);
|
|
|
|
}
|
|
|
|
IEnumPins_Release(enumpins);
|
|
|
|
|
|
|
|
filter->sorting = FALSE;
|
|
|
|
|
2020-06-12 09:57:09 +02:00
|
|
|
list_remove(&filter->entry);
|
|
|
|
list_add_head(sorted, &filter->entry);
|
2020-02-20 03:44:56 +01:00
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static void sort_filters(struct filter_graph *graph)
|
2020-02-20 03:44:56 +01:00
|
|
|
{
|
|
|
|
struct list sorted = LIST_INIT(sorted), *cursor;
|
|
|
|
|
2020-06-12 09:57:09 +02:00
|
|
|
while ((cursor = list_head(&graph->filters)))
|
2020-02-20 03:44:56 +01:00
|
|
|
{
|
2020-06-12 09:57:09 +02:00
|
|
|
struct filter *filter = LIST_ENTRY(cursor, struct filter, entry);
|
2020-02-20 03:44:56 +01:00
|
|
|
sort_filter_recurse(graph, filter, &sorted);
|
|
|
|
}
|
|
|
|
|
2020-06-12 09:57:09 +02:00
|
|
|
list_move_tail(&graph->filters, &sorted);
|
2020-02-20 03:44:56 +01:00
|
|
|
}
|
2008-06-26 20:13:53 +02:00
|
|
|
|
2003-12-30 20:13:05 +01:00
|
|
|
/* NOTE: despite the implication, it doesn't matter which
|
|
|
|
* way round you put in the input and output pins */
|
2011-06-30 00:30:45 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_ConnectDirect(IFilterGraph2 *iface, IPin *ppinIn, IPin *ppinOut,
|
|
|
|
const AM_MEDIA_TYPE *pmt)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IFilterGraph2(iface);
|
2003-12-30 20:13:05 +01:00
|
|
|
PIN_DIRECTION dir;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2003-07-03 20:09:28 +02:00
|
|
|
TRACE("(%p/%p)->(%p, %p, %p)\n", This, iface, ppinIn, ppinOut, pmt);
|
2019-10-06 02:18:51 +02:00
|
|
|
strmbase_dump_media_type(pmt);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2003-12-30 20:13:05 +01:00
|
|
|
/* FIXME: check pins are in graph */
|
|
|
|
|
2005-08-22 11:21:24 +02:00
|
|
|
if (TRACE_ON(quartz))
|
|
|
|
{
|
|
|
|
PIN_INFO PinInfo;
|
|
|
|
|
|
|
|
hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2016-10-14 21:27:59 +02:00
|
|
|
TRACE("Filter owning ppinIn(%p) => %p\n", ppinIn, PinInfo.pFilter);
|
2005-08-22 11:21:24 +02:00
|
|
|
IBaseFilter_Release(PinInfo.pFilter);
|
|
|
|
|
|
|
|
hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2016-10-14 21:27:59 +02:00
|
|
|
TRACE("Filter owning ppinOut(%p) => %p\n", ppinOut, PinInfo.pFilter);
|
2005-08-22 11:21:24 +02:00
|
|
|
IBaseFilter_Release(PinInfo.pFilter);
|
|
|
|
}
|
|
|
|
|
2003-12-30 20:13:05 +01:00
|
|
|
hr = IPin_QueryDirection(ppinIn, &dir);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
if (dir == PINDIR_INPUT)
|
2008-06-26 20:13:53 +02:00
|
|
|
{
|
2022-02-03 05:58:09 +01:00
|
|
|
hr = check_cyclic_connection(ppinOut, ppinIn);
|
2008-06-26 20:13:53 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = IPin_Connect(ppinOut, ppinIn, pmt);
|
|
|
|
}
|
2003-12-30 20:13:05 +01:00
|
|
|
else
|
2008-06-26 20:13:53 +02:00
|
|
|
{
|
2022-02-03 05:58:09 +01:00
|
|
|
hr = check_cyclic_connection(ppinIn, ppinOut);
|
2008-06-26 20:13:53 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = IPin_Connect(ppinIn, ppinOut, pmt);
|
|
|
|
}
|
2003-12-30 20:13:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2020-02-03 21:15:48 +01:00
|
|
|
static HRESULT WINAPI FilterGraph2_Reconnect(IFilterGraph2 *iface, IPin *pin)
|
2011-06-30 00:30:45 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2017-01-25 22:12:55 +01:00
|
|
|
|
2020-02-03 21:15:48 +01:00
|
|
|
TRACE("graph %p, pin %p.\n", graph, pin);
|
2017-01-25 22:12:55 +01:00
|
|
|
|
2020-02-03 21:15:48 +01:00
|
|
|
return IFilterGraph2_ReconnectEx(iface, pin, NULL);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2008-06-26 20:13:53 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_Disconnect(IFilterGraph2 *iface, IPin *ppin)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IFilterGraph2(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2003-07-03 20:09:28 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, ppin);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-11-12 07:55:38 +01:00
|
|
|
if (!ppin)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2003-07-03 20:09:28 +02:00
|
|
|
return IPin_Disconnect(ppin);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:30:45 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_SetDefaultSyncSource(IFilterGraph2 *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IFilterGraph2(iface);
|
2008-03-14 19:02:01 +01:00
|
|
|
IReferenceClock *pClock = NULL;
|
2018-09-18 16:40:45 +02:00
|
|
|
struct filter *filter;
|
2010-11-29 10:44:18 +01:00
|
|
|
HRESULT hr = S_OK;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2016-12-04 16:37:18 +01:00
|
|
|
TRACE("(%p/%p)->() live sources not handled properly!\n", This, iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2010-11-29 10:44:18 +01:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &This->filters, struct filter, entry)
|
2010-11-29 10:44:18 +01:00
|
|
|
{
|
2019-05-21 00:44:03 +02:00
|
|
|
if (IBaseFilter_QueryInterface(filter->filter, &IID_IReferenceClock, (void **)&pClock) == S_OK)
|
2010-11-29 10:44:18 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pClock)
|
2010-12-06 14:16:41 +01:00
|
|
|
{
|
2010-11-29 10:44:18 +01:00
|
|
|
hr = CoCreateInstance(&CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER, &IID_IReferenceClock, (LPVOID*)&pClock);
|
2010-12-06 14:16:41 +01:00
|
|
|
This->refClockProvider = NULL;
|
|
|
|
}
|
|
|
|
else
|
2018-09-18 16:40:45 +02:00
|
|
|
{
|
|
|
|
filter = LIST_ENTRY(list_tail(&This->filters), struct filter, entry);
|
|
|
|
This->refClockProvider = filter->filter;
|
|
|
|
}
|
2008-03-14 19:02:01 +01:00
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2011-06-30 00:49:40 +02:00
|
|
|
hr = IMediaFilter_SetSyncSource(&This->IMediaFilter_iface, pClock);
|
2010-11-29 10:44:18 +01:00
|
|
|
This->defaultclock = TRUE;
|
2008-03-14 19:02:01 +01:00
|
|
|
IReferenceClock_Release(pClock);
|
|
|
|
}
|
2010-11-29 10:44:18 +01:00
|
|
|
LeaveCriticalSection(&This->cs);
|
2008-03-14 19:02:01 +01:00
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-10-03 05:01:06 +02:00
|
|
|
struct filter_create_params
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IMoniker *moniker;
|
|
|
|
IBaseFilter *filter;
|
|
|
|
};
|
|
|
|
|
|
|
|
static DWORD WINAPI message_thread_run(void *ctx)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = ctx;
|
2019-10-03 05:01:06 +02:00
|
|
|
MSG msg;
|
|
|
|
|
2019-10-10 06:15:10 +02:00
|
|
|
/* Make sure we have a message queue. */
|
|
|
|
PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE);
|
|
|
|
SetEvent(graph->message_thread_ret);
|
|
|
|
|
2019-10-03 05:01:06 +02:00
|
|
|
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
GetMessageW(&msg, NULL, 0, 0);
|
|
|
|
|
|
|
|
if (!msg.hwnd && msg.message == WM_USER)
|
|
|
|
{
|
|
|
|
struct filter_create_params *params = (struct filter_create_params *)msg.wParam;
|
|
|
|
|
|
|
|
params->hr = IMoniker_BindToObject(params->moniker, NULL, NULL,
|
|
|
|
&IID_IBaseFilter, (void **)¶ms->filter);
|
|
|
|
SetEvent(graph->message_thread_ret);
|
|
|
|
}
|
|
|
|
else if (!msg.hwnd && msg.message == WM_USER + 1)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TranslateMessage(&msg);
|
|
|
|
DispatchMessageW(&msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT create_filter(struct filter_graph *graph, IMoniker *moniker, IBaseFilter **filter)
|
2019-10-03 05:01:06 +02:00
|
|
|
{
|
|
|
|
if (graph->message_thread)
|
|
|
|
{
|
|
|
|
struct filter_create_params params;
|
|
|
|
|
|
|
|
params.moniker = moniker;
|
|
|
|
PostThreadMessageW(graph->message_thread_id, WM_USER, (WPARAM)¶ms, 0);
|
|
|
|
WaitForSingleObject(graph->message_thread_ret, INFINITE);
|
|
|
|
*filter = params.filter;
|
|
|
|
return params.hr;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return IMoniker_BindToObject(moniker, NULL, NULL, &IID_IBaseFilter, (void **)filter);
|
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT autoplug(struct filter_graph *graph, IPin *source, IPin *sink,
|
2020-06-16 05:51:26 +02:00
|
|
|
BOOL render_to_existing, unsigned int recursion_depth);
|
2018-09-20 17:36:18 +02:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT autoplug_through_sink(struct filter_graph *graph, IPin *source,
|
2020-06-16 05:51:26 +02:00
|
|
|
IBaseFilter *filter, IPin *middle_sink, IPin *sink,
|
2020-08-15 23:43:35 +02:00
|
|
|
BOOL render_to_existing, unsigned int recursion_depth)
|
2008-06-26 20:13:53 +02:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
BOOL any = FALSE, all = TRUE;
|
|
|
|
IPin *middle_source, *peer;
|
|
|
|
IEnumPins *source_enum;
|
2008-06-26 20:13:53 +02:00
|
|
|
PIN_DIRECTION dir;
|
2020-06-16 05:51:25 +02:00
|
|
|
PIN_INFO info;
|
|
|
|
HRESULT hr;
|
2005-08-22 11:21:24 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
TRACE("Trying to autoplug %p to %p through %p.\n", source, sink, middle_sink);
|
2005-08-22 11:21:24 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
IPin_QueryDirection(middle_sink, &dir);
|
|
|
|
if (dir != PINDIR_INPUT)
|
|
|
|
return E_FAIL;
|
2008-06-26 20:13:53 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (IPin_ConnectedTo(middle_sink, &peer) == S_OK)
|
2008-06-26 20:13:53 +02:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
IPin_Release(peer);
|
|
|
|
return E_FAIL;
|
2008-06-26 20:13:53 +02:00
|
|
|
}
|
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (FAILED(hr = IFilterGraph2_ConnectDirect(&graph->IFilterGraph2_iface, source, middle_sink, NULL)))
|
|
|
|
return E_FAIL;
|
2008-11-14 16:42:41 +01:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (FAILED(hr = IBaseFilter_EnumPins(filter, &source_enum)))
|
|
|
|
goto err;
|
2004-11-19 19:17:27 +01:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
while (IEnumPins_Next(source_enum, 1, &middle_source, NULL) == S_OK)
|
2018-09-20 17:36:19 +02:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
IPin_QueryPinInfo(middle_source, &info);
|
|
|
|
IBaseFilter_Release(info.pFilter);
|
|
|
|
if (info.dir != PINDIR_OUTPUT)
|
2018-09-20 17:36:19 +02:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
IPin_Release(middle_source);
|
|
|
|
continue;
|
2013-02-24 23:21:48 +01:00
|
|
|
}
|
2020-06-16 05:51:25 +02:00
|
|
|
if (info.achName[0] == '~')
|
2012-01-16 15:12:23 +01:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
TRACE("Skipping non-rendered pin %s.\n", debugstr_w(info.achName));
|
|
|
|
IPin_Release(middle_source);
|
|
|
|
continue;
|
2012-01-16 15:12:23 +01:00
|
|
|
}
|
2020-06-16 05:51:25 +02:00
|
|
|
if (IPin_ConnectedTo(middle_source, &peer) == S_OK)
|
2012-01-16 15:12:23 +01:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
IPin_Release(peer);
|
|
|
|
IPin_Release(middle_source);
|
|
|
|
continue;
|
2004-11-19 19:17:27 +01:00
|
|
|
}
|
2005-05-06 16:34:44 +02:00
|
|
|
|
2020-06-16 05:51:26 +02:00
|
|
|
hr = autoplug(graph, middle_source, sink, render_to_existing, recursion_depth + 1);
|
2020-06-16 05:51:25 +02:00
|
|
|
IPin_Release(middle_source);
|
|
|
|
if (SUCCEEDED(hr) && sink)
|
2018-09-20 17:36:18 +02:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
IEnumPins_Release(source_enum);
|
|
|
|
return hr;
|
2004-11-19 19:17:27 +01:00
|
|
|
}
|
2020-06-16 05:51:25 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
any = TRUE;
|
|
|
|
if (hr != S_OK)
|
|
|
|
all = FALSE;
|
2004-11-19 19:17:27 +01:00
|
|
|
}
|
2020-06-16 05:51:25 +02:00
|
|
|
IEnumPins_Release(source_enum);
|
2004-11-19 19:17:27 +01:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (!sink)
|
|
|
|
{
|
2020-08-15 23:43:35 +02:00
|
|
|
if (all)
|
2020-06-16 05:51:25 +02:00
|
|
|
return S_OK;
|
|
|
|
if (any)
|
|
|
|
return VFW_S_PARTIAL_RENDER;
|
|
|
|
}
|
2015-11-20 15:38:35 +01:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
err:
|
|
|
|
IFilterGraph2_Disconnect(&graph->IFilterGraph2_iface, source);
|
|
|
|
IFilterGraph2_Disconnect(&graph->IFilterGraph2_iface, middle_sink);
|
|
|
|
return E_FAIL;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT autoplug_through_filter(struct filter_graph *graph, IPin *source,
|
2020-06-16 05:51:26 +02:00
|
|
|
IBaseFilter *filter, IPin *sink, BOOL render_to_existing,
|
2020-08-15 23:43:35 +02:00
|
|
|
unsigned int recursion_depth)
|
2008-06-26 20:26:53 +02:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
IEnumPins *sink_enum;
|
|
|
|
IPin *filter_sink;
|
|
|
|
HRESULT hr;
|
2008-06-26 20:26:53 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
TRACE("Trying to autoplug %p to %p through %p.\n", source, sink, filter);
|
|
|
|
|
|
|
|
if (FAILED(hr = IBaseFilter_EnumPins(filter, &sink_enum)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
while (IEnumPins_Next(sink_enum, 1, &filter_sink, NULL) == S_OK)
|
2008-06-26 20:26:53 +02:00
|
|
|
{
|
2020-06-16 05:51:26 +02:00
|
|
|
hr = autoplug_through_sink(graph, source, filter, filter_sink, sink,
|
2020-08-15 23:43:35 +02:00
|
|
|
render_to_existing, recursion_depth);
|
2020-06-16 05:51:25 +02:00
|
|
|
IPin_Release(filter_sink);
|
|
|
|
if (SUCCEEDED(hr))
|
2008-06-26 20:26:53 +02:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
IEnumPins_Release(sink_enum);
|
|
|
|
return hr;
|
2008-06-26 20:26:53 +02:00
|
|
|
}
|
|
|
|
}
|
2020-06-16 05:51:25 +02:00
|
|
|
IEnumPins_Release(sink_enum);
|
|
|
|
return VFW_E_CANNOT_CONNECT;
|
2008-06-26 20:26:53 +02:00
|
|
|
}
|
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
/* Common helper for IGraphBuilder::Connect() and IGraphBuilder::Render(), which
|
|
|
|
* share most of the same code. Render() calls this with a NULL sink. */
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT autoplug(struct filter_graph *graph, IPin *source, IPin *sink,
|
2020-06-16 05:51:26 +02:00
|
|
|
BOOL render_to_existing, unsigned int recursion_depth)
|
2008-06-26 20:26:53 +02:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
IAMGraphBuilderCallback *callback = NULL;
|
|
|
|
IEnumMediaTypes *enummt;
|
|
|
|
IFilterMapper2 *mapper;
|
2018-09-18 16:40:45 +02:00
|
|
|
struct filter *filter;
|
2020-06-16 05:51:25 +02:00
|
|
|
AM_MEDIA_TYPE *mt;
|
2004-11-19 19:17:27 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
TRACE("Trying to autoplug %p to %p, recursion depth %u.\n", source, sink, recursion_depth);
|
2004-11-19 19:17:27 +01:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (recursion_depth >= 5)
|
|
|
|
{
|
|
|
|
WARN("Recursion depth has reached 5; aborting.\n");
|
|
|
|
return VFW_E_CANNOT_CONNECT;
|
|
|
|
}
|
2004-11-19 19:17:27 +01:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (sink)
|
2005-08-22 11:21:24 +02:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
/* Try to connect directly to this sink. */
|
|
|
|
hr = IFilterGraph2_ConnectDirect(&graph->IFilterGraph2_iface, source, sink, NULL);
|
2005-08-22 11:21:24 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
/* If direct connection succeeded, we should propagate that return value.
|
|
|
|
* If it returned VFW_E_NOT_CONNECTED or VFW_E_NO_AUDIO_HARDWARE, then don't
|
|
|
|
* even bother trying intermediate filters, since they won't succeed. */
|
|
|
|
if (SUCCEEDED(hr) || hr == VFW_E_NOT_CONNECTED || hr == VFW_E_NO_AUDIO_HARDWARE)
|
2005-08-22 11:21:24 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
/* Always prefer filters in the graph. */
|
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
2008-06-10 18:19:27 +02:00
|
|
|
{
|
2020-06-16 05:51:26 +02:00
|
|
|
if (SUCCEEDED(hr = autoplug_through_filter(graph, source, filter->filter,
|
2020-08-15 23:43:35 +02:00
|
|
|
sink, render_to_existing, recursion_depth)))
|
2020-06-16 05:51:25 +02:00
|
|
|
return hr;
|
2008-06-10 18:19:27 +02:00
|
|
|
}
|
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
IUnknown_QueryInterface(graph->punkFilterMapper2, &IID_IFilterMapper2, (void **)&mapper);
|
2008-06-10 18:19:27 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (FAILED(hr = IPin_EnumMediaTypes(source, &enummt)))
|
|
|
|
{
|
|
|
|
IFilterMapper2_Release(mapper);
|
2004-11-19 19:17:27 +01:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (graph->pSite)
|
|
|
|
IUnknown_QueryInterface(graph->pSite, &IID_IAMGraphBuilderCallback, (void **)&callback);
|
2008-06-10 18:19:27 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
while (IEnumMediaTypes_Next(enummt, 1, &mt, NULL) == S_OK)
|
2004-11-19 19:17:27 +01:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
GUID types[2] = {mt->majortype, mt->subtype};
|
|
|
|
IEnumMoniker *enummoniker;
|
|
|
|
IBaseFilter *filter;
|
|
|
|
IMoniker *moniker;
|
|
|
|
|
|
|
|
DeleteMediaType(mt);
|
|
|
|
|
2020-08-15 23:43:35 +02:00
|
|
|
if (FAILED(hr = IFilterMapper2_EnumMatchingFilters(mapper, &enummoniker,
|
|
|
|
0, FALSE, MERIT_UNLIKELY, TRUE, 1, types, NULL, NULL, FALSE,
|
|
|
|
render_to_existing, 0, NULL, NULL, NULL)))
|
2020-06-16 05:51:25 +02:00
|
|
|
goto out;
|
|
|
|
|
|
|
|
while (IEnumMoniker_Next(enummoniker, 1, &moniker, NULL) == S_OK)
|
2008-06-26 20:26:53 +02:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
IPropertyBag *bag;
|
|
|
|
VARIANT var;
|
2004-11-19 19:17:27 +01:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
VariantInit(&var);
|
|
|
|
IMoniker_BindToStorage(moniker, NULL, NULL, &IID_IPropertyBag, (void **)&bag);
|
|
|
|
hr = IPropertyBag_Read(bag, L"FriendlyName", &var, NULL);
|
|
|
|
IPropertyBag_Release(bag);
|
|
|
|
if (FAILED(hr))
|
2008-06-26 20:26:53 +02:00
|
|
|
{
|
2020-06-16 05:51:25 +02:00
|
|
|
IMoniker_Release(moniker);
|
2008-06-26 20:26:53 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (callback && FAILED(hr = IAMGraphBuilderCallback_SelectedFilter(callback, moniker)))
|
2015-11-20 15:07:52 +01:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("Filter rejected by IAMGraphBuilderCallback::SelectedFilter(), hr %#lx.\n", hr);
|
2020-06-16 05:51:25 +02:00
|
|
|
IMoniker_Release(moniker);
|
|
|
|
continue;
|
2015-11-20 15:07:52 +01:00
|
|
|
}
|
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
hr = create_filter(graph, moniker, &filter);
|
|
|
|
IMoniker_Release(moniker);
|
2008-06-26 20:26:53 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
ERR("Failed to create filter for %s, hr %#lx.\n", debugstr_w(V_BSTR(&var)), hr);
|
2020-06-16 05:51:25 +02:00
|
|
|
VariantClear(&var);
|
|
|
|
continue;
|
2008-06-26 20:26:53 +02:00
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (callback && FAILED(hr = IAMGraphBuilderCallback_CreatedFilter(callback, filter)))
|
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("Filter rejected by IAMGraphBuilderCallback::CreatedFilter(), hr %#lx.\n", hr);
|
2020-06-16 05:51:25 +02:00
|
|
|
IBaseFilter_Release(filter);
|
|
|
|
continue;
|
2004-11-19 19:17:27 +01:00
|
|
|
}
|
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
hr = IFilterGraph2_AddFilter(&graph->IFilterGraph2_iface, filter, V_BSTR(&var));
|
|
|
|
VariantClear(&var);
|
2008-06-26 20:26:53 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
ERR("Failed to add filter, hr %#lx.\n", hr);
|
2020-06-16 05:51:25 +02:00
|
|
|
IBaseFilter_Release(filter);
|
|
|
|
continue;
|
2004-11-19 19:17:27 +01:00
|
|
|
}
|
|
|
|
|
2020-08-15 23:43:35 +02:00
|
|
|
hr = autoplug_through_filter(graph, source, filter, sink, render_to_existing, recursion_depth);
|
2020-06-16 05:51:25 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
IBaseFilter_Release(filter);
|
|
|
|
goto out;
|
2004-11-19 19:17:27 +01:00
|
|
|
}
|
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
IFilterGraph2_RemoveFilter(&graph->IFilterGraph2_iface, filter);
|
|
|
|
IBaseFilter_Release(filter);
|
|
|
|
}
|
|
|
|
IEnumMoniker_Release(enummoniker);
|
|
|
|
}
|
2008-06-26 20:26:53 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
hr = VFW_E_CANNOT_CONNECT;
|
2008-07-17 19:25:29 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
out:
|
|
|
|
if (callback) IAMGraphBuilderCallback_Release(callback);
|
|
|
|
IEnumMediaTypes_Release(enummt);
|
|
|
|
IFilterMapper2_Release(mapper);
|
|
|
|
return hr;
|
|
|
|
}
|
2008-07-17 19:25:29 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *source, IPin *sink)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2020-06-16 05:51:25 +02:00
|
|
|
PIN_DIRECTION dir;
|
|
|
|
HRESULT hr;
|
2008-12-16 00:31:43 +01:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
TRACE("graph %p, source %p, sink %p.\n", graph, source, sink);
|
2008-12-16 00:31:43 +01:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (!source || !sink)
|
|
|
|
return E_POINTER;
|
2008-12-16 00:31:43 +01:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (FAILED(hr = IPin_QueryDirection(source, &dir)))
|
|
|
|
return hr;
|
2008-12-16 00:31:43 +01:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
if (dir == PINDIR_INPUT)
|
|
|
|
{
|
|
|
|
IPin *temp;
|
2004-11-19 19:17:27 +01:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
TRACE("Directions seem backwards, swapping pins\n");
|
2008-06-10 18:19:27 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
temp = sink;
|
|
|
|
sink = source;
|
|
|
|
source = temp;
|
2004-11-19 19:17:27 +01:00
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-06-16 05:51:25 +02:00
|
|
|
EnterCriticalSection(&graph->cs);
|
|
|
|
|
2020-11-24 07:18:01 +01:00
|
|
|
hr = autoplug(graph, source, sink, TRUE, 0);
|
2020-06-16 05:51:25 +02:00
|
|
|
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("Returning %#lx.\n", hr);
|
2020-06-16 05:51:25 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI FilterGraph2_Render(IFilterGraph2 *iface, IPin *source)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2020-06-16 05:51:25 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("graph %p, source %p.\n", graph, source);
|
|
|
|
|
|
|
|
EnterCriticalSection(&graph->cs);
|
2020-06-16 05:51:26 +02:00
|
|
|
hr = autoplug(graph, source, NULL, FALSE, 0);
|
2020-06-16 05:51:25 +02:00
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
if (hr == VFW_E_CANNOT_CONNECT)
|
|
|
|
hr = VFW_E_CANNOT_RENDER;
|
2015-11-20 15:07:52 +01:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("Returning %#lx.\n", hr);
|
2008-06-26 20:26:53 +02:00
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:30:45 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_RenderFile(IFilterGraph2 *iface, LPCWSTR lpcwstrFile,
|
|
|
|
LPCWSTR lpcwstrPlayList)
|
2008-06-26 20:26:53 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IFilterGraph2(iface);
|
2004-11-19 19:17:27 +01:00
|
|
|
IBaseFilter* preader = NULL;
|
2007-03-14 15:21:59 +01:00
|
|
|
IPin* ppinreader = NULL;
|
2008-06-26 20:26:53 +02:00
|
|
|
IEnumPins* penumpins = NULL;
|
2018-09-18 16:40:45 +02:00
|
|
|
struct filter *filter;
|
2004-11-19 19:17:27 +01:00
|
|
|
HRESULT hr;
|
2008-06-26 20:26:53 +02:00
|
|
|
BOOL partial = FALSE;
|
2013-10-10 21:52:46 +02:00
|
|
|
BOOL any = FALSE;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2004-11-19 19:17:27 +01:00
|
|
|
TRACE("(%p/%p)->(%s, %s)\n", This, iface, debugstr_w(lpcwstrFile), debugstr_w(lpcwstrPlayList));
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2007-02-18 08:55:32 +01:00
|
|
|
if (lpcwstrPlayList != NULL)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2020-01-22 23:30:53 +01:00
|
|
|
hr = IFilterGraph2_AddSourceFilter(iface, lpcwstrFile, L"Reader", &preader);
|
2005-01-09 19:24:41 +01:00
|
|
|
if (FAILED(hr))
|
2004-11-19 19:17:27 +01:00
|
|
|
return hr;
|
|
|
|
|
2017-03-20 06:16:31 +01:00
|
|
|
hr = IBaseFilter_EnumPins(preader, &penumpins);
|
2008-06-26 20:26:53 +02:00
|
|
|
if (SUCCEEDED(hr))
|
2004-11-19 19:17:27 +01:00
|
|
|
{
|
2008-06-26 20:26:53 +02:00
|
|
|
while (IEnumPins_Next(penumpins, 1, &ppinreader, NULL) == S_OK)
|
|
|
|
{
|
|
|
|
PIN_DIRECTION dir;
|
2007-02-20 02:26:10 +01:00
|
|
|
|
2008-06-26 20:26:53 +02:00
|
|
|
IPin_QueryDirection(ppinreader, &dir);
|
|
|
|
if (dir == PINDIR_OUTPUT)
|
|
|
|
{
|
|
|
|
hr = IFilterGraph2_Render(iface, ppinreader);
|
2007-02-20 02:26:10 +01:00
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
TRACE("Filters in chain:\n");
|
|
|
|
LIST_FOR_EACH_ENTRY(filter, &This->filters, struct filter, entry)
|
|
|
|
TRACE("- %s.\n", debugstr_w(filter->name));
|
2004-11-19 19:17:27 +01:00
|
|
|
|
2008-06-26 20:26:53 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
any = TRUE;
|
|
|
|
if (hr != S_OK)
|
|
|
|
partial = TRUE;
|
2004-11-19 19:17:27 +01:00
|
|
|
}
|
2008-06-26 20:26:53 +02:00
|
|
|
IPin_Release(ppinreader);
|
2004-11-19 19:17:27 +01:00
|
|
|
}
|
2008-06-26 20:26:53 +02:00
|
|
|
IEnumPins_Release(penumpins);
|
2007-02-18 08:55:32 +01:00
|
|
|
|
2008-06-26 20:26:53 +02:00
|
|
|
if (!any)
|
2021-06-29 21:59:58 +02:00
|
|
|
{
|
|
|
|
if (FAILED(hr = IFilterGraph2_RemoveFilter(iface, preader)))
|
2022-02-04 22:41:27 +01:00
|
|
|
ERR("Failed to remove source filter, hr %#lx.\n", hr);
|
2008-06-26 20:26:53 +02:00
|
|
|
hr = VFW_E_CANNOT_RENDER;
|
2021-06-29 21:59:58 +02:00
|
|
|
}
|
2008-06-26 20:26:53 +02:00
|
|
|
else if (partial)
|
2021-06-29 21:59:58 +02:00
|
|
|
{
|
2008-06-26 20:26:53 +02:00
|
|
|
hr = VFW_S_PARTIAL_RENDER;
|
2021-06-29 21:59:58 +02:00
|
|
|
}
|
2008-06-26 20:26:53 +02:00
|
|
|
else
|
2021-06-29 21:59:58 +02:00
|
|
|
{
|
2008-06-26 20:26:53 +02:00
|
|
|
hr = S_OK;
|
2021-06-29 21:59:58 +02:00
|
|
|
}
|
2004-11-19 19:17:27 +01:00
|
|
|
}
|
2007-03-14 15:21:59 +01:00
|
|
|
IBaseFilter_Release(preader);
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("Returning %#lx.\n", hr);
|
2004-12-06 12:47:13 +01:00
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 21:58:36 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_AddSourceFilter(IFilterGraph2 *iface,
|
|
|
|
const WCHAR *filename, const WCHAR *filter_name, IBaseFilter **ret_filter)
|
2013-02-21 16:57:50 +01:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2019-08-06 21:58:36 +02:00
|
|
|
IFileSourceFilter *filesource;
|
|
|
|
IBaseFilter *filter;
|
|
|
|
HRESULT hr;
|
|
|
|
GUID clsid;
|
2013-02-21 16:57:50 +01:00
|
|
|
|
2019-08-06 21:58:36 +02:00
|
|
|
TRACE("graph %p, filename %s, filter_name %s, ret_filter %p.\n",
|
|
|
|
graph, debugstr_w(filename), debugstr_w(filter_name), ret_filter);
|
|
|
|
|
|
|
|
if (!get_media_type(filename, NULL, NULL, &clsid))
|
|
|
|
clsid = CLSID_AsyncReader;
|
|
|
|
TRACE("Using source filter %s.\n", debugstr_guid(&clsid));
|
|
|
|
|
|
|
|
if (FAILED(hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IBaseFilter, (void **)&filter)))
|
2013-02-21 16:57:50 +01:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
WARN("Failed to create filter, hr %#lx.\n", hr);
|
2013-02-21 16:57:50 +01:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2019-08-06 21:58:36 +02:00
|
|
|
if (FAILED(hr = IBaseFilter_QueryInterface(filter, &IID_IFileSourceFilter, (void **)&filesource)))
|
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
WARN("Failed to get IFileSourceFilter, hr %#lx.\n", hr);
|
2019-08-06 21:58:36 +02:00
|
|
|
IBaseFilter_Release(filter);
|
2013-02-21 16:57:50 +01:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2019-08-06 21:58:36 +02:00
|
|
|
hr = IFileSourceFilter_Load(filesource, filename, NULL);
|
|
|
|
IFileSourceFilter_Release(filesource);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
WARN("Failed to load file, hr %#lx.\n", hr);
|
2004-11-19 19:17:27 +01:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2019-08-06 21:58:36 +02:00
|
|
|
if (FAILED(hr = IFilterGraph2_AddFilter(iface, filter, filter_name)))
|
|
|
|
{
|
|
|
|
IBaseFilter_Release(filter);
|
2004-11-19 19:17:27 +01:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2019-08-06 21:58:36 +02:00
|
|
|
if (ret_filter)
|
|
|
|
*ret_filter = filter;
|
2003-06-13 20:06:44 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
static HRESULT WINAPI FilterGraph2_SetLogFile(IFilterGraph2 *iface, DWORD_PTR file)
|
2011-06-30 00:30:45 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, file %#Ix.\n", graph, file);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:30:45 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_Abort(IFilterGraph2 *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IFilterGraph2(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(): stub !!!\n", This, iface);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:30:45 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_ShouldOperationContinue(IFilterGraph2 *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IFilterGraph2(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(): stub !!!\n", This, iface);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2007-12-11 08:40:19 +01:00
|
|
|
/*** IFilterGraph2 methods ***/
|
|
|
|
static HRESULT WINAPI FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2 *iface,
|
2011-06-30 00:30:45 +02:00
|
|
|
IMoniker *pMoniker, IBindCtx *pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter **ppFilter)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IFilterGraph2(iface);
|
2014-12-16 19:49:34 +01:00
|
|
|
HRESULT hr;
|
|
|
|
IBaseFilter* pfilter;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p %p %s %p)\n", This, iface, pMoniker, pCtx, debugstr_w(lpcwstrFilterName), ppFilter);
|
|
|
|
|
|
|
|
hr = IMoniker_BindToObject(pMoniker, pCtx, NULL, &IID_IBaseFilter, (void**)&pfilter);
|
|
|
|
if(FAILED(hr)) {
|
2022-02-04 22:41:27 +01:00
|
|
|
WARN("Failed to bind moniker, hr %#lx.\n", hr);
|
2014-12-16 19:49:34 +01:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IFilterGraph2_AddFilter(iface, pfilter, lpcwstrFilterName);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-04 22:41:27 +01:00
|
|
|
WARN("Failed to add filter, hr %#lx.\n", hr);
|
2014-12-16 19:49:34 +01:00
|
|
|
IBaseFilter_Release(pfilter);
|
|
|
|
return hr;
|
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2014-12-16 19:49:34 +01:00
|
|
|
if(ppFilter)
|
|
|
|
*ppFilter = pfilter;
|
|
|
|
else IBaseFilter_Release(pfilter);
|
2007-12-11 08:40:19 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-02-03 21:15:48 +01:00
|
|
|
static HRESULT WINAPI FilterGraph2_ReconnectEx(IFilterGraph2 *iface, IPin *pin, const AM_MEDIA_TYPE *mt)
|
2011-06-30 00:30:45 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2020-02-03 21:15:48 +01:00
|
|
|
PIN_DIRECTION dir;
|
|
|
|
HRESULT hr;
|
|
|
|
IPin *peer;
|
2007-12-11 08:40:19 +01:00
|
|
|
|
2020-02-03 21:15:48 +01:00
|
|
|
TRACE("graph %p, pin %p, mt %p.\n", graph, pin, mt);
|
2007-12-11 08:40:19 +01:00
|
|
|
|
2020-02-03 21:15:48 +01:00
|
|
|
if (FAILED(hr = IPin_ConnectedTo(pin, &peer)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
IPin_QueryDirection(pin, &dir);
|
|
|
|
IFilterGraph2_Disconnect(iface, peer);
|
|
|
|
IFilterGraph2_Disconnect(iface, pin);
|
|
|
|
|
|
|
|
if (dir == PINDIR_INPUT)
|
|
|
|
hr = IFilterGraph2_ConnectDirect(iface, peer, pin, mt);
|
|
|
|
else
|
|
|
|
hr = IFilterGraph2_ConnectDirect(iface, pin, peer, mt);
|
|
|
|
|
|
|
|
IPin_Release(peer);
|
|
|
|
return hr;
|
2007-12-11 08:40:19 +01:00
|
|
|
}
|
|
|
|
|
2020-06-16 05:51:26 +02:00
|
|
|
static HRESULT WINAPI FilterGraph2_RenderEx(IFilterGraph2 *iface, IPin *source, DWORD flags, DWORD *context)
|
2011-06-30 00:30:45 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IFilterGraph2(iface);
|
2020-06-16 05:51:26 +02:00
|
|
|
HRESULT hr;
|
2007-12-11 08:40:19 +01:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, source %p, flags %#lx, context %p.\n", graph, source, flags, context);
|
2007-12-11 08:40:19 +01:00
|
|
|
|
2020-06-16 05:51:26 +02:00
|
|
|
if (flags & ~AM_RENDEREX_RENDERTOEXISTINGRENDERERS)
|
2022-02-04 22:41:27 +01:00
|
|
|
FIXME("Unknown flags %#lx.\n", flags);
|
2020-06-16 05:51:26 +02:00
|
|
|
|
|
|
|
EnterCriticalSection(&graph->cs);
|
|
|
|
hr = autoplug(graph, source, NULL, !!(flags & AM_RENDEREX_RENDERTOEXISTINGRENDERERS), 0);
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
if (hr == VFW_E_CANNOT_CONNECT)
|
|
|
|
hr = VFW_E_CANNOT_RENDER;
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("Returning %#lx.\n", hr);
|
2020-06-16 05:51:26 +02:00
|
|
|
return hr;
|
2007-12-11 08:40:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const IFilterGraph2Vtbl IFilterGraph2_VTable =
|
2003-06-13 20:06:44 +02:00
|
|
|
{
|
2007-12-11 08:40:19 +01:00
|
|
|
FilterGraph2_QueryInterface,
|
|
|
|
FilterGraph2_AddRef,
|
|
|
|
FilterGraph2_Release,
|
|
|
|
FilterGraph2_AddFilter,
|
|
|
|
FilterGraph2_RemoveFilter,
|
|
|
|
FilterGraph2_EnumFilters,
|
|
|
|
FilterGraph2_FindFilterByName,
|
|
|
|
FilterGraph2_ConnectDirect,
|
|
|
|
FilterGraph2_Reconnect,
|
|
|
|
FilterGraph2_Disconnect,
|
|
|
|
FilterGraph2_SetDefaultSyncSource,
|
|
|
|
FilterGraph2_Connect,
|
|
|
|
FilterGraph2_Render,
|
|
|
|
FilterGraph2_RenderFile,
|
|
|
|
FilterGraph2_AddSourceFilter,
|
|
|
|
FilterGraph2_SetLogFile,
|
|
|
|
FilterGraph2_Abort,
|
|
|
|
FilterGraph2_ShouldOperationContinue,
|
|
|
|
FilterGraph2_AddSourceFilterForMoniker,
|
|
|
|
FilterGraph2_ReconnectEx,
|
|
|
|
FilterGraph2_RenderEx
|
2003-06-13 20:06:44 +02:00
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IMediaControl(IMediaControl *iface)
|
2011-06-30 00:33:21 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IMediaControl_iface);
|
2011-06-30 00:33:21 +02:00
|
|
|
}
|
|
|
|
|
2020-05-17 21:44:30 +02:00
|
|
|
static HRESULT WINAPI MediaControl_QueryInterface(IMediaControl *iface, REFIID iid, void **out)
|
2011-06-30 00:33:21 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaControl(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:33:21 +02:00
|
|
|
static ULONG WINAPI MediaControl_AddRef(IMediaControl *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaControl(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:33:21 +02:00
|
|
|
static ULONG WINAPI MediaControl_Release(IMediaControl *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaControl(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-02-02 05:37:42 +01:00
|
|
|
static HRESULT WINAPI MediaControl_GetTypeInfoCount(IMediaControl *iface, UINT *count)
|
2011-06-30 00:33:21 +02:00
|
|
|
{
|
2022-02-02 05:37:42 +01:00
|
|
|
TRACE("iface %p, count %p.\n", iface, count);
|
|
|
|
*count = 1;
|
2003-06-13 20:06:44 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2022-02-02 05:37:42 +01:00
|
|
|
static HRESULT WINAPI MediaControl_GetTypeInfo(IMediaControl *iface, UINT index,
|
|
|
|
LCID lcid, ITypeInfo **typeinfo)
|
2011-06-30 00:33:21 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo);
|
2022-02-02 05:37:42 +01:00
|
|
|
return strmbase_get_typeinfo(IMediaControl_tid, typeinfo);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2022-02-02 05:37:42 +01:00
|
|
|
static HRESULT WINAPI MediaControl_GetIDsOfNames(IMediaControl *iface, REFIID iid,
|
|
|
|
LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
|
2011-06-30 00:33:21 +02:00
|
|
|
{
|
2022-02-02 05:37:42 +01:00
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n",
|
2022-02-02 05:37:42 +01:00
|
|
|
iface, debugstr_guid(iid), names, count, lcid, ids);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-02 05:37:42 +01:00
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaControl_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2022-02-02 05:37:42 +01:00
|
|
|
static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface, DISPID id, REFIID iid, LCID lcid,
|
|
|
|
WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
|
2011-06-30 00:33:21 +02:00
|
|
|
{
|
2022-02-02 05:37:42 +01:00
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
|
2022-02-02 05:37:42 +01:00
|
|
|
iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-02 05:37:42 +01:00
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaControl_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-15 02:56:26 +02:00
|
|
|
static void update_render_count(struct filter_graph *graph)
|
|
|
|
{
|
|
|
|
/* Some filters (e.g. MediaStreamFilter) can become renderers when they are
|
|
|
|
* already in the graph. */
|
|
|
|
struct filter *filter;
|
|
|
|
graph->nRenderers = 0;
|
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
|
|
|
{
|
|
|
|
if (is_renderer(filter))
|
|
|
|
++graph->nRenderers;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Perform the paused -> running transition. The caller must hold graph->cs. */
|
|
|
|
static HRESULT graph_start(struct filter_graph *graph, REFERENCE_TIME stream_start)
|
|
|
|
{
|
2021-02-18 23:58:14 +01:00
|
|
|
struct media_event *event, *next;
|
2020-07-21 00:49:10 +02:00
|
|
|
REFERENCE_TIME stream_stop;
|
2020-07-15 02:56:26 +02:00
|
|
|
struct filter *filter;
|
|
|
|
HRESULT hr = S_OK;
|
|
|
|
|
2021-04-10 18:45:35 +02:00
|
|
|
EnterCriticalSection(&graph->event_cs);
|
2020-07-15 02:56:26 +02:00
|
|
|
graph->EcCompleteCount = 0;
|
|
|
|
update_render_count(graph);
|
2021-04-10 18:45:35 +02:00
|
|
|
LeaveCriticalSection(&graph->event_cs);
|
2020-07-15 02:56:26 +02:00
|
|
|
|
2021-02-18 23:58:14 +01:00
|
|
|
LIST_FOR_EACH_ENTRY_SAFE(event, next, &graph->media_events, struct media_event, entry)
|
|
|
|
{
|
|
|
|
if (event->code == EC_COMPLETE)
|
|
|
|
{
|
|
|
|
list_remove(&event->entry);
|
|
|
|
free(event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (list_empty(&graph->media_events))
|
|
|
|
ResetEvent(graph->media_event_handle);
|
|
|
|
|
2020-07-15 02:56:26 +02:00
|
|
|
if (graph->defaultclock && !graph->refClock)
|
|
|
|
IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface);
|
|
|
|
|
|
|
|
if (!stream_start && graph->refClock)
|
|
|
|
{
|
|
|
|
IReferenceClock_GetTime(graph->refClock, &graph->stream_start);
|
|
|
|
stream_start = graph->stream_start - graph->stream_elapsed;
|
|
|
|
/* Delay presentation time by 200 ms, to give filters time to
|
|
|
|
* initialize. */
|
|
|
|
stream_start += 200 * 10000;
|
|
|
|
}
|
|
|
|
|
2020-07-21 00:49:10 +02:00
|
|
|
if (SUCCEEDED(IMediaSeeking_GetStopPosition(&graph->IMediaSeeking_iface, &stream_stop)))
|
|
|
|
graph->stream_stop = stream_stop;
|
|
|
|
|
2020-07-15 02:56:26 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
|
|
|
{
|
|
|
|
HRESULT filter_hr = IBaseFilter_Run(filter->filter, stream_start);
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = filter_hr;
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("Filter %p returned %#lx.\n", filter->filter, filter_hr);
|
2020-07-15 02:56:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
2022-02-04 22:41:27 +01:00
|
|
|
WARN("Failed to start stream, hr %#lx.\n", hr);
|
2020-07-15 02:56:26 +02:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CALLBACK async_run_cb(TP_CALLBACK_INSTANCE *instance, void *context, TP_WORK *work)
|
|
|
|
{
|
|
|
|
struct filter_graph *graph = context;
|
|
|
|
struct filter *filter;
|
|
|
|
FILTER_STATE state;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("Performing asynchronous state change.\n");
|
|
|
|
|
|
|
|
/* We can't just call GetState(), since that will return State_Running and
|
|
|
|
* VFW_S_STATE_INTERMEDIATE regardless of whether we're done pausing yet.
|
|
|
|
* Instead replicate it here. */
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
IBaseFilter *async_filter = NULL;
|
|
|
|
|
|
|
|
hr = S_OK;
|
|
|
|
|
|
|
|
EnterCriticalSection(&graph->cs);
|
|
|
|
|
|
|
|
if (!graph->needs_async_run)
|
|
|
|
break;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
|
|
|
{
|
|
|
|
hr = IBaseFilter_GetState(filter->filter, 0, &state);
|
|
|
|
|
|
|
|
if (hr == VFW_S_STATE_INTERMEDIATE)
|
|
|
|
async_filter = filter->filter;
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr) && state != State_Paused)
|
|
|
|
ERR("Filter %p reported incorrect state %u.\n", filter->filter, state);
|
|
|
|
|
|
|
|
if (hr != S_OK)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hr != VFW_S_STATE_INTERMEDIATE)
|
|
|
|
break;
|
|
|
|
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
|
|
|
|
IBaseFilter_GetState(async_filter, 10, &state);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hr == S_OK && graph->needs_async_run)
|
|
|
|
{
|
|
|
|
sort_filters(graph);
|
|
|
|
graph_start(graph, 0);
|
|
|
|
graph->needs_async_run = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:33:21 +02:00
|
|
|
static HRESULT WINAPI MediaControl_Run(IMediaControl *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaControl(iface);
|
2020-07-15 02:56:26 +02:00
|
|
|
BOOL need_async_run = TRUE;
|
|
|
|
struct filter *filter;
|
|
|
|
FILTER_STATE state;
|
|
|
|
HRESULT hr = S_OK;
|
2010-11-29 10:44:18 +01:00
|
|
|
|
2020-07-15 02:56:19 +02:00
|
|
|
TRACE("graph %p.\n", graph);
|
|
|
|
|
2020-07-15 02:56:26 +02:00
|
|
|
EnterCriticalSection(&graph->cs);
|
|
|
|
|
|
|
|
if (graph->state == State_Running)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
sort_filters(graph);
|
2021-04-10 18:45:35 +02:00
|
|
|
|
|
|
|
EnterCriticalSection(&graph->event_cs);
|
2020-07-15 02:56:26 +02:00
|
|
|
update_render_count(graph);
|
2021-04-10 18:45:35 +02:00
|
|
|
LeaveCriticalSection(&graph->event_cs);
|
2020-07-15 02:56:26 +02:00
|
|
|
|
|
|
|
if (graph->state == State_Stopped)
|
|
|
|
{
|
|
|
|
if (graph->defaultclock && !graph->refClock)
|
|
|
|
IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface);
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
|
|
|
{
|
|
|
|
HRESULT filter_hr = IBaseFilter_Pause(filter->filter);
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = filter_hr;
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("Filter %p returned %#lx.\n", filter->filter, filter_hr);
|
2020-07-15 02:56:26 +02:00
|
|
|
|
|
|
|
/* If a filter returns VFW_S_CANT_CUE, we shouldn't wait for a
|
|
|
|
* paused state. */
|
|
|
|
filter_hr = IBaseFilter_GetState(filter->filter, 0, &state);
|
|
|
|
if (filter_hr != S_OK && filter_hr != VFW_S_STATE_INTERMEDIATE)
|
|
|
|
need_async_run = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
2022-02-04 22:41:27 +01:00
|
|
|
WARN("Failed to pause, hr %#lx.\n", hr);
|
2020-07-15 02:56:26 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
graph->state = State_Running;
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
if (hr != S_OK && need_async_run)
|
|
|
|
{
|
|
|
|
if (!graph->async_run_work)
|
|
|
|
graph->async_run_work = CreateThreadpoolWork(async_run_cb, graph, NULL);
|
|
|
|
graph->needs_async_run = 1;
|
|
|
|
SubmitThreadpoolWork(graph->async_run_work);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
graph_start(graph, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:33:21 +02:00
|
|
|
static HRESULT WINAPI MediaControl_Pause(IMediaControl *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaControl(iface);
|
2011-06-30 00:33:21 +02:00
|
|
|
|
2020-07-15 02:56:19 +02:00
|
|
|
TRACE("graph %p.\n", graph);
|
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
return IMediaFilter_Pause(&graph->IMediaFilter_iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:33:21 +02:00
|
|
|
static HRESULT WINAPI MediaControl_Stop(IMediaControl *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaControl(iface);
|
2011-06-30 00:33:21 +02:00
|
|
|
|
2020-07-15 02:56:19 +02:00
|
|
|
TRACE("graph %p.\n", graph);
|
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
return IMediaFilter_Stop(&graph->IMediaFilter_iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
static HRESULT WINAPI MediaControl_GetState(IMediaControl *iface, LONG timeout, OAFilterState *state)
|
2011-06-30 00:33:21 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaControl(iface);
|
2005-01-03 21:23:14 +01:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, timeout %ld, state %p.\n", graph, timeout, state);
|
2020-07-15 02:56:19 +02:00
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
if (timeout < 0) timeout = INFINITE;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
return IMediaFilter_GetState(&graph->IMediaFilter_iface, timeout, (FILTER_STATE *)state);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:33:21 +02:00
|
|
|
static HRESULT WINAPI MediaControl_RenderFile(IMediaControl *iface, BSTR strFilename)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaControl(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2012-10-07 22:01:00 +02:00
|
|
|
TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strFilename), strFilename);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2012-10-07 22:01:00 +02:00
|
|
|
return IFilterGraph2_RenderFile(&This->IFilterGraph2_iface, strFilename, NULL);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:33:21 +02:00
|
|
|
static HRESULT WINAPI MediaControl_AddSourceFilter(IMediaControl *iface, BSTR strFilename,
|
|
|
|
IDispatch **ppUnk)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaControl(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-14 21:29:28 +01:00
|
|
|
FIXME("(%p/%p)->(%s (%p), %p): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename, ppUnk);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:33:21 +02:00
|
|
|
static HRESULT WINAPI MediaControl_get_FilterCollection(IMediaControl *iface, IDispatch **ppUnk)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaControl(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-14 21:29:28 +01:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:33:21 +02:00
|
|
|
static HRESULT WINAPI MediaControl_get_RegFilterCollection(IMediaControl *iface, IDispatch **ppUnk)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaControl(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-14 21:29:28 +01:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-05-18 22:57:59 +02:00
|
|
|
static void CALLBACK wait_pause_cb(TP_CALLBACK_INSTANCE *instance, void *context)
|
|
|
|
{
|
|
|
|
IMediaControl *control = context;
|
|
|
|
OAFilterState state;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if ((hr = IMediaControl_GetState(control, INFINITE, &state)) != S_OK)
|
2022-02-04 22:41:27 +01:00
|
|
|
ERR("Failed to get paused state, hr %#lx.\n", hr);
|
2020-05-18 22:57:59 +02:00
|
|
|
|
|
|
|
if (FAILED(hr = IMediaControl_Stop(control)))
|
2022-02-04 22:41:27 +01:00
|
|
|
ERR("Failed to stop, hr %#lx.\n", hr);
|
2020-05-18 22:57:59 +02:00
|
|
|
|
|
|
|
if ((hr = IMediaControl_GetState(control, INFINITE, &state)) != S_OK)
|
2022-02-04 22:41:27 +01:00
|
|
|
ERR("Failed to get paused state, hr %#lx.\n", hr);
|
2020-05-18 22:57:59 +02:00
|
|
|
|
|
|
|
IMediaControl_Release(control);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CALLBACK wait_stop_cb(TP_CALLBACK_INSTANCE *instance, void *context)
|
|
|
|
{
|
|
|
|
IMediaControl *control = context;
|
|
|
|
OAFilterState state;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if ((hr = IMediaControl_GetState(control, INFINITE, &state)) != S_OK)
|
2022-02-04 22:41:27 +01:00
|
|
|
ERR("Failed to get state, hr %#lx.\n", hr);
|
2020-05-18 22:57:59 +02:00
|
|
|
|
|
|
|
IMediaControl_Release(control);
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:33:21 +02:00
|
|
|
static HRESULT WINAPI MediaControl_StopWhenReady(IMediaControl *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaControl(iface);
|
2020-05-18 22:57:59 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("graph %p.\n", graph);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-05-18 22:57:59 +02:00
|
|
|
/* Even if we are already stopped, we still pause. */
|
|
|
|
hr = IMediaControl_Pause(iface);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
else if (hr == S_FALSE)
|
|
|
|
{
|
|
|
|
IMediaControl_AddRef(iface);
|
|
|
|
TrySubmitThreadpoolCallback(wait_pause_cb, iface, NULL);
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IMediaControl_Stop(iface);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
else if (hr == S_FALSE)
|
|
|
|
{
|
|
|
|
IMediaControl_AddRef(iface);
|
|
|
|
TrySubmitThreadpoolCallback(wait_stop_cb, iface, NULL);
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IMediaControlVtbl IMediaControl_VTable =
|
2003-06-13 20:06:44 +02:00
|
|
|
{
|
2005-09-25 17:17:30 +02:00
|
|
|
MediaControl_QueryInterface,
|
|
|
|
MediaControl_AddRef,
|
|
|
|
MediaControl_Release,
|
|
|
|
MediaControl_GetTypeInfoCount,
|
|
|
|
MediaControl_GetTypeInfo,
|
|
|
|
MediaControl_GetIDsOfNames,
|
|
|
|
MediaControl_Invoke,
|
|
|
|
MediaControl_Run,
|
|
|
|
MediaControl_Pause,
|
|
|
|
MediaControl_Stop,
|
|
|
|
MediaControl_GetState,
|
|
|
|
MediaControl_RenderFile,
|
|
|
|
MediaControl_AddSourceFilter,
|
|
|
|
MediaControl_get_FilterCollection,
|
|
|
|
MediaControl_get_RegFilterCollection,
|
|
|
|
MediaControl_StopWhenReady
|
2003-06-13 20:06:44 +02:00
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IMediaSeeking(IMediaSeeking *iface)
|
2011-06-30 00:34:00 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IMediaSeeking_iface);
|
2011-06-30 00:34:00 +02:00
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-05-17 21:44:30 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_QueryInterface(IMediaSeeking *iface, REFIID iid, void **out)
|
2011-06-30 00:34:00 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaSeeking(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static ULONG WINAPI MediaSeeking_AddRef(IMediaSeeking *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaSeeking(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static ULONG WINAPI MediaSeeking_Release(IMediaSeeking *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaSeeking(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
typedef HRESULT (WINAPI *fnFoundSeek)(struct filter_graph *This, IMediaSeeking*, DWORD_PTR arg);
|
2008-03-15 00:22:55 +01:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT all_renderers_seek(struct filter_graph *This, fnFoundSeek FoundSeek, DWORD_PTR arg) {
|
2008-03-15 00:22:55 +01:00
|
|
|
BOOL allnotimpl = TRUE;
|
|
|
|
HRESULT hr, hr_return = S_OK;
|
2018-09-18 16:40:45 +02:00
|
|
|
struct filter *filter;
|
2008-03-15 00:22:55 +01:00
|
|
|
|
2018-09-18 16:40:45 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &This->filters, struct filter, entry)
|
2008-03-15 00:22:55 +01:00
|
|
|
{
|
2020-06-10 18:09:06 +02:00
|
|
|
update_seeking(filter);
|
2020-04-08 21:38:14 +02:00
|
|
|
if (!filter->seeking)
|
2010-11-04 17:54:27 +01:00
|
|
|
continue;
|
2020-04-08 21:38:14 +02:00
|
|
|
hr = FoundSeek(This, filter->seeking, arg);
|
2010-11-04 17:54:27 +01:00
|
|
|
if (hr_return != E_NOTIMPL)
|
|
|
|
allnotimpl = FALSE;
|
|
|
|
if (hr_return == S_OK || (FAILED(hr) && hr != E_NOTIMPL && SUCCEEDED(hr_return)))
|
|
|
|
hr_return = hr;
|
2008-03-15 00:22:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (allnotimpl)
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return hr_return;
|
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT WINAPI FoundCapabilities(struct filter_graph *This, IMediaSeeking *seek, DWORD_PTR pcaps)
|
2008-03-15 00:22:55 +01:00
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
DWORD caps = 0;
|
|
|
|
|
|
|
|
hr = IMediaSeeking_GetCapabilities(seek, &caps);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
/* Only add common capabilities everything supports */
|
|
|
|
*(DWORD*)pcaps &= caps;
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2003-06-13 20:06:44 +02:00
|
|
|
/*** IMediaSeeking methods ***/
|
2011-06-30 00:34:00 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_GetCapabilities(IMediaSeeking *iface, DWORD *pCapabilities)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaSeeking(iface);
|
2008-03-15 00:22:55 +01:00
|
|
|
HRESULT hr;
|
2011-06-30 00:34:00 +02:00
|
|
|
|
2008-03-15 00:22:55 +01:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pCapabilities);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-15 00:22:55 +01:00
|
|
|
if (!pCapabilities)
|
|
|
|
return E_POINTER;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-15 00:22:55 +01:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
*pCapabilities = 0xffffffff;
|
|
|
|
|
|
|
|
hr = all_renderers_seek(This, FoundCapabilities, (DWORD_PTR)pCapabilities);
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_CheckCapabilities(IMediaSeeking *iface, DWORD *pCapabilities)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaSeeking(iface);
|
2008-03-15 00:22:55 +01:00
|
|
|
DWORD originalcaps;
|
|
|
|
HRESULT hr;
|
2011-06-30 00:34:00 +02:00
|
|
|
|
2008-03-15 00:22:55 +01:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pCapabilities);
|
|
|
|
|
|
|
|
if (!pCapabilities)
|
|
|
|
return E_POINTER;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-15 00:22:55 +01:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
originalcaps = *pCapabilities;
|
|
|
|
hr = all_renderers_seek(This, FoundCapabilities, (DWORD_PTR)pCapabilities);
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-15 00:22:55 +01:00
|
|
|
if (!*pCapabilities)
|
|
|
|
return E_FAIL;
|
|
|
|
if (*pCapabilities != originalcaps)
|
|
|
|
return S_FALSE;
|
2003-06-13 20:06:44 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_IsFormatSupported(IMediaSeeking *iface, const GUID *pFormat)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaSeeking(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-14 20:35:42 +01:00
|
|
|
if (!pFormat)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%s)\n", This, iface, debugstr_guid(pFormat));
|
|
|
|
|
|
|
|
if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, pFormat))
|
|
|
|
{
|
2017-01-25 22:13:01 +01:00
|
|
|
WARN("Unhandled time format %s\n", debugstr_guid(pFormat));
|
2008-03-14 20:35:42 +01:00
|
|
|
return S_FALSE;
|
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_QueryPreferredFormat(IMediaSeeking *iface, GUID *pFormat)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaSeeking(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-14 20:35:42 +01:00
|
|
|
if (!pFormat)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p): semi-stub !!!\n", This, iface, pFormat);
|
|
|
|
memcpy(pFormat, &TIME_FORMAT_MEDIA_TIME, sizeof(GUID));
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_GetTimeFormat(IMediaSeeking *iface, GUID *pFormat)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaSeeking(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-14 20:35:42 +01:00
|
|
|
if (!pFormat)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pFormat);
|
|
|
|
memcpy(pFormat, &This->timeformatseek, sizeof(GUID));
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_IsUsingTimeFormat(IMediaSeeking *iface, const GUID *pFormat)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaSeeking(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-14 20:35:42 +01:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pFormat);
|
|
|
|
if (!pFormat)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
if (memcmp(pFormat, &This->timeformatseek, sizeof(GUID)))
|
|
|
|
return S_FALSE;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_SetTimeFormat(IMediaSeeking *iface, const GUID *pFormat)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaSeeking(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-14 20:35:42 +01:00
|
|
|
if (!pFormat)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%s)\n", This, iface, debugstr_guid(pFormat));
|
|
|
|
|
|
|
|
if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, pFormat))
|
|
|
|
{
|
|
|
|
FIXME("Unhandled time format %s\n", debugstr_guid(pFormat));
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-11-21 22:25:02 +01:00
|
|
|
static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface, LONGLONG *duration)
|
2008-03-15 00:22:55 +01:00
|
|
|
{
|
2020-11-21 22:25:02 +01:00
|
|
|
struct filter_graph *graph = impl_from_IMediaSeeking(iface);
|
|
|
|
HRESULT hr = E_NOTIMPL, filter_hr;
|
|
|
|
LONGLONG filter_duration;
|
|
|
|
struct filter *filter;
|
2008-03-15 00:22:55 +01:00
|
|
|
|
2020-11-21 22:25:02 +01:00
|
|
|
TRACE("graph %p, duration %p.\n", graph, duration);
|
2008-03-15 00:22:55 +01:00
|
|
|
|
2020-11-21 22:25:02 +01:00
|
|
|
if (!duration)
|
|
|
|
return E_POINTER;
|
2008-03-15 00:22:55 +01:00
|
|
|
|
2020-11-21 22:25:02 +01:00
|
|
|
*duration = 0;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-11-21 22:25:02 +01:00
|
|
|
EnterCriticalSection(&graph->cs);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-11-21 22:25:02 +01:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
|
|
|
{
|
|
|
|
update_seeking(filter);
|
|
|
|
if (!filter->seeking)
|
|
|
|
continue;
|
2008-03-15 00:22:55 +01:00
|
|
|
|
2020-11-21 22:25:02 +01:00
|
|
|
filter_hr = IMediaSeeking_GetDuration(filter->seeking, &filter_duration);
|
|
|
|
if (SUCCEEDED(filter_hr))
|
|
|
|
{
|
|
|
|
hr = S_OK;
|
|
|
|
*duration = max(*duration, filter_duration);
|
|
|
|
}
|
|
|
|
else if (filter_hr != E_NOTIMPL)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
return filter_hr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
2008-03-15 00:22:55 +01:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("Returning hr %#lx, duration %s (%s seconds).\n", hr,
|
2020-11-21 22:25:02 +01:00
|
|
|
wine_dbgstr_longlong(*duration), debugstr_time(*duration));
|
2008-03-15 00:22:55 +01:00
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-10-19 17:48:23 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop)
|
2011-06-30 00:34:00 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaSeeking(iface);
|
2019-10-19 17:48:23 +02:00
|
|
|
HRESULT hr = E_NOTIMPL, filter_hr;
|
|
|
|
struct filter *filter;
|
|
|
|
LONGLONG filter_stop;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2019-10-19 17:48:23 +02:00
|
|
|
TRACE("graph %p, stop %p.\n", graph, stop);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2019-10-19 17:48:23 +02:00
|
|
|
if (!stop)
|
2008-04-09 21:00:13 +02:00
|
|
|
return E_POINTER;
|
|
|
|
|
2019-10-19 17:48:23 +02:00
|
|
|
*stop = 0;
|
|
|
|
|
|
|
|
EnterCriticalSection(&graph->cs);
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
|
|
|
{
|
2020-06-10 18:09:06 +02:00
|
|
|
update_seeking(filter);
|
2020-04-08 21:38:14 +02:00
|
|
|
if (!filter->seeking)
|
2019-10-19 17:48:23 +02:00
|
|
|
continue;
|
|
|
|
|
2020-04-08 21:38:14 +02:00
|
|
|
filter_hr = IMediaSeeking_GetStopPosition(filter->seeking, &filter_stop);
|
2019-10-19 17:48:23 +02:00
|
|
|
if (SUCCEEDED(filter_hr))
|
|
|
|
{
|
|
|
|
hr = S_OK;
|
|
|
|
*stop = max(*stop, filter_stop);
|
|
|
|
}
|
|
|
|
else if (filter_hr != E_NOTIMPL)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
return filter_hr;
|
|
|
|
}
|
|
|
|
}
|
2008-04-09 21:00:13 +02:00
|
|
|
|
2019-10-19 17:48:23 +02:00
|
|
|
LeaveCriticalSection(&graph->cs);
|
2020-01-31 02:05:17 +01:00
|
|
|
|
|
|
|
TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(*stop), debugstr_time(*stop));
|
2008-04-09 21:00:13 +02:00
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-10-21 23:54:48 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *current)
|
2011-06-30 00:34:00 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaSeeking(iface);
|
2019-10-21 23:54:48 +02:00
|
|
|
LONGLONG ret = graph->current_pos;
|
|
|
|
|
|
|
|
TRACE("graph %p, current %p.\n", graph, current);
|
2008-03-28 00:28:51 +01:00
|
|
|
|
2019-10-21 23:54:48 +02:00
|
|
|
if (!current)
|
2008-03-28 00:28:51 +01:00
|
|
|
return E_POINTER;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2019-10-21 23:54:48 +02:00
|
|
|
EnterCriticalSection(&graph->cs);
|
|
|
|
|
2020-07-21 00:49:10 +02:00
|
|
|
if (graph->got_ec_complete)
|
|
|
|
{
|
|
|
|
ret = graph->stream_stop;
|
|
|
|
}
|
2020-10-20 23:42:57 +02:00
|
|
|
else if (graph->state == State_Running && !graph->needs_async_run && graph->refClock)
|
2013-02-26 14:13:57 +01:00
|
|
|
{
|
2019-10-21 23:54:48 +02:00
|
|
|
REFERENCE_TIME time;
|
|
|
|
IReferenceClock_GetTime(graph->refClock, &time);
|
2013-02-26 14:13:57 +01:00
|
|
|
if (time)
|
2019-10-21 23:54:51 +02:00
|
|
|
ret += time - graph->stream_start;
|
2008-03-28 00:28:51 +01:00
|
|
|
}
|
2008-04-19 07:23:19 +02:00
|
|
|
|
2019-10-21 23:54:48 +02:00
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
|
2020-01-31 02:05:17 +01:00
|
|
|
TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(ret), debugstr_time(ret));
|
2019-10-21 23:54:48 +02:00
|
|
|
*current = ret;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2013-02-26 14:13:57 +01:00
|
|
|
return S_OK;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface, LONGLONG *pTarget,
|
|
|
|
const GUID *pTargetFormat, LONGLONG Source, const GUID *pSourceFormat)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaSeeking(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2015-05-15 18:35:25 +02:00
|
|
|
TRACE("(%p/%p)->(%p, %s, 0x%s, %s)\n", This, iface, pTarget,
|
|
|
|
debugstr_guid(pTargetFormat), wine_dbgstr_longlong(Source), debugstr_guid(pSourceFormat));
|
|
|
|
|
|
|
|
if (!pSourceFormat)
|
|
|
|
pSourceFormat = &This->timeformatseek;
|
|
|
|
|
2016-01-06 18:29:42 +01:00
|
|
|
if (!pTargetFormat)
|
|
|
|
pTargetFormat = &This->timeformatseek;
|
|
|
|
|
2015-05-15 18:35:25 +02:00
|
|
|
if (IsEqualGUID(pTargetFormat, pSourceFormat))
|
|
|
|
*pTarget = Source;
|
|
|
|
else
|
|
|
|
FIXME("conversion %s->%s not supported\n", debugstr_guid(pSourceFormat), debugstr_guid(pTargetFormat));
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2019-10-21 23:54:47 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG *current_ptr,
|
|
|
|
DWORD current_flags, LONGLONG *stop_ptr, DWORD stop_flags)
|
2008-04-01 23:07:38 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaSeeking(iface);
|
2019-10-21 23:54:47 +02:00
|
|
|
HRESULT hr = E_NOTIMPL, filter_hr;
|
|
|
|
struct filter *filter;
|
|
|
|
FILTER_STATE state;
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, current %s, current_flags %#lx, stop %s, stop_flags %#lx.\n", graph,
|
2019-10-21 23:54:47 +02:00
|
|
|
current_ptr ? wine_dbgstr_longlong(*current_ptr) : "<null>", current_flags,
|
|
|
|
stop_ptr ? wine_dbgstr_longlong(*stop_ptr): "<null>", stop_flags);
|
2020-01-31 02:05:17 +01:00
|
|
|
if (current_ptr)
|
|
|
|
TRACE("Setting current position to %s (%s seconds).\n",
|
|
|
|
wine_dbgstr_longlong(*current_ptr), debugstr_time(*current_ptr));
|
|
|
|
if (stop_ptr)
|
|
|
|
TRACE("Setting stop position to %s (%s seconds).\n",
|
|
|
|
wine_dbgstr_longlong(*stop_ptr), debugstr_time(*stop_ptr));
|
2019-10-21 23:54:47 +02:00
|
|
|
|
|
|
|
if ((current_flags & 0x7) != AM_SEEKING_AbsolutePositioning
|
|
|
|
&& (current_flags & 0x7) != AM_SEEKING_NoPositioning)
|
2022-02-04 22:41:27 +01:00
|
|
|
FIXME("Unhandled current_flags %#lx.\n", current_flags & 0x7);
|
2008-04-01 23:07:38 +02:00
|
|
|
|
2019-10-21 23:54:47 +02:00
|
|
|
if ((stop_flags & 0x7) != AM_SEEKING_NoPositioning
|
|
|
|
&& (stop_flags & 0x7) != AM_SEEKING_AbsolutePositioning)
|
2022-02-04 22:41:27 +01:00
|
|
|
FIXME("Unhandled stop_flags %#lx.\n", stop_flags & 0x7);
|
2019-10-21 23:54:47 +02:00
|
|
|
|
|
|
|
EnterCriticalSection(&graph->cs);
|
|
|
|
|
|
|
|
state = graph->state;
|
2020-07-24 02:29:24 +02:00
|
|
|
if (state == State_Running && !graph->needs_async_run)
|
2019-10-21 23:54:47 +02:00
|
|
|
IMediaControl_Pause(&graph->IMediaControl_iface);
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
2019-10-19 17:48:25 +02:00
|
|
|
{
|
2019-10-21 23:54:47 +02:00
|
|
|
LONGLONG current = current_ptr ? *current_ptr : 0, stop = stop_ptr ? *stop_ptr : 0;
|
2008-04-01 23:07:38 +02:00
|
|
|
|
2020-06-10 18:09:06 +02:00
|
|
|
update_seeking(filter);
|
2020-04-08 21:38:14 +02:00
|
|
|
if (!filter->seeking)
|
2019-10-21 23:54:47 +02:00
|
|
|
continue;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-04-08 21:38:14 +02:00
|
|
|
filter_hr = IMediaSeeking_SetPositions(filter->seeking, ¤t,
|
2019-10-21 23:54:48 +02:00
|
|
|
current_flags | AM_SEEKING_ReturnTime, &stop, stop_flags);
|
2019-10-21 23:54:47 +02:00
|
|
|
if (SUCCEEDED(filter_hr))
|
|
|
|
{
|
|
|
|
hr = S_OK;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2019-10-21 23:54:47 +02:00
|
|
|
if (current_ptr && (current_flags & AM_SEEKING_ReturnTime))
|
|
|
|
*current_ptr = current;
|
|
|
|
if (stop_ptr && (stop_flags & AM_SEEKING_ReturnTime))
|
|
|
|
*stop_ptr = stop;
|
2019-10-21 23:54:48 +02:00
|
|
|
graph->current_pos = current;
|
2019-10-21 23:54:47 +02:00
|
|
|
}
|
|
|
|
else if (filter_hr != E_NOTIMPL)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
return filter_hr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-21 23:54:51 +02:00
|
|
|
if ((current_flags & 0x7) != AM_SEEKING_NoPositioning && graph->refClock)
|
|
|
|
{
|
|
|
|
IReferenceClock_GetTime(graph->refClock, &graph->stream_start);
|
|
|
|
graph->stream_elapsed = 0;
|
|
|
|
}
|
2008-04-01 23:07:38 +02:00
|
|
|
|
2020-07-24 02:29:24 +02:00
|
|
|
if (state == State_Running && !graph->needs_async_run)
|
2019-10-21 23:54:47 +02:00
|
|
|
IMediaControl_Run(&graph->IMediaControl_iface);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
2008-04-01 23:07:38 +02:00
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-23 01:29:21 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface,
|
|
|
|
LONGLONG *current, LONGLONG *stop)
|
2011-06-30 00:34:00 +02:00
|
|
|
{
|
2020-07-23 01:29:21 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaSeeking(iface);
|
|
|
|
HRESULT hr = S_OK;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-07-23 01:29:21 +02:00
|
|
|
TRACE("graph %p, current %p, stop %p.\n", graph, current, stop);
|
|
|
|
|
|
|
|
if (current)
|
|
|
|
hr = IMediaSeeking_GetCurrentPosition(iface, current);
|
|
|
|
if (SUCCEEDED(hr) && stop)
|
|
|
|
hr = IMediaSeeking_GetStopPosition(iface, stop);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-28 23:16:58 +01:00
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface, LONGLONG *pEarliest,
|
|
|
|
LONGLONG *pLatest)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaSeeking(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-14 19:56:43 +01:00
|
|
|
FIXME("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pEarliest, pLatest);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_SetRate(IMediaSeeking *iface, double dRate)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaSeeking(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-14 19:56:43 +01:00
|
|
|
FIXME("(%p/%p)->(%f): stub !!!\n", This, iface, dRate);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_GetRate(IMediaSeeking *iface, double *pdRate)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaSeeking(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-14 19:56:43 +01:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pdRate);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2016-02-13 17:12:56 +01:00
|
|
|
if (!pdRate)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
*pdRate = 1.0;
|
|
|
|
|
2003-06-13 20:06:44 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:34:00 +02:00
|
|
|
static HRESULT WINAPI MediaSeeking_GetPreroll(IMediaSeeking *iface, LONGLONG *pllPreroll)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaSeeking(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-03-14 19:56:43 +01:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pllPreroll);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IMediaSeekingVtbl IMediaSeeking_VTable =
|
2003-06-13 20:06:44 +02:00
|
|
|
{
|
2005-09-25 17:17:30 +02:00
|
|
|
MediaSeeking_QueryInterface,
|
|
|
|
MediaSeeking_AddRef,
|
|
|
|
MediaSeeking_Release,
|
|
|
|
MediaSeeking_GetCapabilities,
|
|
|
|
MediaSeeking_CheckCapabilities,
|
|
|
|
MediaSeeking_IsFormatSupported,
|
|
|
|
MediaSeeking_QueryPreferredFormat,
|
|
|
|
MediaSeeking_GetTimeFormat,
|
|
|
|
MediaSeeking_IsUsingTimeFormat,
|
|
|
|
MediaSeeking_SetTimeFormat,
|
|
|
|
MediaSeeking_GetDuration,
|
|
|
|
MediaSeeking_GetStopPosition,
|
|
|
|
MediaSeeking_GetCurrentPosition,
|
|
|
|
MediaSeeking_ConvertTimeFormat,
|
|
|
|
MediaSeeking_SetPositions,
|
|
|
|
MediaSeeking_GetPositions,
|
|
|
|
MediaSeeking_GetAvailable,
|
|
|
|
MediaSeeking_SetRate,
|
|
|
|
MediaSeeking_GetRate,
|
|
|
|
MediaSeeking_GetPreroll
|
2003-06-13 20:06:44 +02:00
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IMediaPosition(IMediaPosition *iface)
|
2009-11-24 13:13:56 +01:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IMediaPosition_iface);
|
2009-11-24 13:13:56 +01:00
|
|
|
}
|
|
|
|
|
2007-02-20 02:31:19 +01:00
|
|
|
/*** IUnknown methods ***/
|
2020-05-17 21:44:30 +02:00
|
|
|
static HRESULT WINAPI MediaPosition_QueryInterface(IMediaPosition *iface, REFIID iid, void **out)
|
2009-11-24 13:13:56 +01:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaPosition(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2009-11-24 13:13:56 +01:00
|
|
|
static ULONG WINAPI MediaPosition_AddRef(IMediaPosition *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaPosition(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2009-11-24 13:13:56 +01:00
|
|
|
static ULONG WINAPI MediaPosition_Release(IMediaPosition *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaPosition(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2022-02-02 05:37:43 +01:00
|
|
|
static HRESULT WINAPI MediaPosition_GetTypeInfoCount(IMediaPosition *iface, UINT *count)
|
2012-10-12 05:35:46 +02:00
|
|
|
{
|
2022-02-02 05:37:43 +01:00
|
|
|
TRACE("iface %p, count %p.\n", iface, count);
|
|
|
|
*count = 1;
|
|
|
|
return S_OK;
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2022-02-02 05:37:43 +01:00
|
|
|
static HRESULT WINAPI MediaPosition_GetTypeInfo(IMediaPosition *iface, UINT index,
|
|
|
|
LCID lcid, ITypeInfo **typeinfo)
|
2012-10-12 05:35:46 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo);
|
2022-02-02 05:37:43 +01:00
|
|
|
return strmbase_get_typeinfo(IMediaPosition_tid, typeinfo);
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2022-02-02 05:37:43 +01:00
|
|
|
static HRESULT WINAPI MediaPosition_GetIDsOfNames(IMediaPosition *iface, REFIID iid,
|
|
|
|
LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
|
2012-10-12 05:35:46 +02:00
|
|
|
{
|
2022-02-02 05:37:43 +01:00
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n",
|
2022-02-02 05:37:43 +01:00
|
|
|
iface, debugstr_guid(iid), names, count, lcid, ids);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaPosition_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
return hr;
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2022-02-02 05:37:43 +01:00
|
|
|
static HRESULT WINAPI MediaPosition_Invoke(IMediaPosition *iface, DISPID id, REFIID iid, LCID lcid,
|
|
|
|
WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
|
2012-10-12 05:35:46 +02:00
|
|
|
{
|
2022-02-02 05:37:43 +01:00
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
|
2022-02-02 05:37:43 +01:00
|
|
|
iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaPosition_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
return hr;
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2011-09-11 22:11:10 +02:00
|
|
|
static HRESULT ConvertFromREFTIME(IMediaSeeking *seek, REFTIME time_in, LONGLONG *time_out)
|
|
|
|
{
|
|
|
|
GUID time_format;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = MediaSeeking_GetTimeFormat(seek, &time_format);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, &time_format))
|
|
|
|
{
|
|
|
|
FIXME("Unsupported time format.\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*time_out = (LONGLONG) (time_in * 10000000); /* convert from 1 second intervals to 100 ns intervals */
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT ConvertToREFTIME(IMediaSeeking *seek, LONGLONG time_in, REFTIME *time_out)
|
|
|
|
{
|
|
|
|
GUID time_format;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = MediaSeeking_GetTimeFormat(seek, &time_format);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, &time_format))
|
|
|
|
{
|
|
|
|
FIXME("Unsupported time format.\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
*time_out = (REFTIME)time_in / 10000000; /* convert from 100 ns intervals to 1 second intervals */
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2007-02-20 02:31:19 +01:00
|
|
|
/*** IMediaPosition methods ***/
|
2009-11-24 13:13:56 +01:00
|
|
|
static HRESULT WINAPI MediaPosition_get_Duration(IMediaPosition * iface, REFTIME *plength)
|
|
|
|
{
|
|
|
|
LONGLONG duration;
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaPosition( iface );
|
2011-06-30 00:34:00 +02:00
|
|
|
HRESULT hr = IMediaSeeking_GetDuration(&This->IMediaSeeking_iface, &duration);
|
2011-09-11 22:11:10 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
return ConvertToREFTIME(&This->IMediaSeeking_iface, duration, plength);
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2009-11-24 13:13:56 +01:00
|
|
|
static HRESULT WINAPI MediaPosition_put_CurrentPosition(IMediaPosition * iface, REFTIME llTime)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaPosition( iface );
|
2011-09-11 22:11:10 +02:00
|
|
|
LONGLONG reftime;
|
|
|
|
HRESULT hr;
|
2008-09-11 12:45:57 +02:00
|
|
|
|
2011-09-11 22:11:10 +02:00
|
|
|
hr = ConvertFromREFTIME(&This->IMediaSeeking_iface, llTime, &reftime);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
2011-06-30 00:34:00 +02:00
|
|
|
return IMediaSeeking_SetPositions(&This->IMediaSeeking_iface, &reftime,
|
|
|
|
AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2009-11-24 13:13:56 +01:00
|
|
|
static HRESULT WINAPI MediaPosition_get_CurrentPosition(IMediaPosition * iface, REFTIME *pllTime)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaPosition( iface );
|
2009-11-24 13:13:56 +01:00
|
|
|
LONGLONG pos;
|
2011-09-11 22:11:10 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = IMediaSeeking_GetCurrentPosition(&This->IMediaSeeking_iface, &pos);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
return ConvertToREFTIME(&This->IMediaSeeking_iface, pos, pllTime);
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2009-11-24 13:13:56 +01:00
|
|
|
static HRESULT WINAPI MediaPosition_get_StopTime(IMediaPosition * iface, REFTIME *pllTime)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaPosition( iface );
|
2009-11-24 13:13:56 +01:00
|
|
|
LONGLONG pos;
|
2011-06-30 00:34:00 +02:00
|
|
|
HRESULT hr = IMediaSeeking_GetStopPosition(&This->IMediaSeeking_iface, &pos);
|
2011-09-11 22:11:10 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
return ConvertToREFTIME(&This->IMediaSeeking_iface, pos, pllTime);
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2009-11-24 13:13:56 +01:00
|
|
|
static HRESULT WINAPI MediaPosition_put_StopTime(IMediaPosition * iface, REFTIME llTime)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaPosition( iface );
|
2011-09-11 22:11:10 +02:00
|
|
|
LONGLONG reftime;
|
|
|
|
HRESULT hr;
|
2009-11-24 13:13:56 +01:00
|
|
|
|
2011-09-11 22:11:10 +02:00
|
|
|
hr = ConvertFromREFTIME(&This->IMediaSeeking_iface, llTime, &reftime);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
2011-06-30 00:34:00 +02:00
|
|
|
return IMediaSeeking_SetPositions(&This->IMediaSeeking_iface, NULL, AM_SEEKING_NoPositioning,
|
|
|
|
&reftime, AM_SEEKING_AbsolutePositioning);
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2012-10-12 05:35:46 +02:00
|
|
|
static HRESULT WINAPI MediaPosition_get_PrerollTime(IMediaPosition * iface, REFTIME *pllTime)
|
|
|
|
{
|
2007-02-20 02:31:19 +01:00
|
|
|
FIXME("(%p)->(%p) stub!\n", iface, pllTime);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2012-10-12 05:35:46 +02:00
|
|
|
static HRESULT WINAPI MediaPosition_put_PrerollTime(IMediaPosition * iface, REFTIME llTime)
|
|
|
|
{
|
2007-02-20 02:31:19 +01:00
|
|
|
FIXME("(%p)->(%f) stub!\n", iface, llTime);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-11-24 13:13:56 +01:00
|
|
|
static HRESULT WINAPI MediaPosition_put_Rate(IMediaPosition * iface, double dRate)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaPosition( iface );
|
2011-06-30 00:34:00 +02:00
|
|
|
return IMediaSeeking_SetRate(&This->IMediaSeeking_iface, dRate);
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2009-11-24 13:13:56 +01:00
|
|
|
static HRESULT WINAPI MediaPosition_get_Rate(IMediaPosition * iface, double *pdRate)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaPosition( iface );
|
2011-06-30 00:34:00 +02:00
|
|
|
return IMediaSeeking_GetRate(&This->IMediaSeeking_iface, pdRate);
|
2007-02-20 02:31:19 +01:00
|
|
|
}
|
|
|
|
|
2012-10-12 05:35:46 +02:00
|
|
|
static HRESULT WINAPI MediaPosition_CanSeekForward(IMediaPosition * iface, LONG *pCanSeekForward)
|
|
|
|
{
|
2007-02-20 02:31:19 +01:00
|
|
|
FIXME("(%p)->(%p) stub!\n", iface, pCanSeekForward);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2012-10-12 05:35:46 +02:00
|
|
|
static HRESULT WINAPI MediaPosition_CanSeekBackward(IMediaPosition * iface, LONG *pCanSeekBackward)
|
|
|
|
{
|
2007-02-20 02:31:19 +01:00
|
|
|
FIXME("(%p)->(%p) stub!\n", iface, pCanSeekBackward);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const IMediaPositionVtbl IMediaPosition_VTable =
|
|
|
|
{
|
|
|
|
MediaPosition_QueryInterface,
|
|
|
|
MediaPosition_AddRef,
|
|
|
|
MediaPosition_Release,
|
|
|
|
MediaPosition_GetTypeInfoCount,
|
|
|
|
MediaPosition_GetTypeInfo,
|
|
|
|
MediaPosition_GetIDsOfNames,
|
|
|
|
MediaPosition_Invoke,
|
|
|
|
MediaPosition_get_Duration,
|
|
|
|
MediaPosition_put_CurrentPosition,
|
|
|
|
MediaPosition_get_CurrentPosition,
|
|
|
|
MediaPosition_get_StopTime,
|
|
|
|
MediaPosition_put_StopTime,
|
|
|
|
MediaPosition_get_PrerollTime,
|
|
|
|
MediaPosition_put_PrerollTime,
|
|
|
|
MediaPosition_put_Rate,
|
|
|
|
MediaPosition_get_Rate,
|
|
|
|
MediaPosition_CanSeekForward,
|
|
|
|
MediaPosition_CanSeekBackward
|
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IObjectWithSite(IObjectWithSite *iface)
|
2012-01-16 15:12:23 +01:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IObjectWithSite_iface);
|
2012-01-16 15:12:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** IUnknown methods ***/
|
2020-05-17 21:44:30 +02:00
|
|
|
static HRESULT WINAPI ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID iid, void **out)
|
2012-01-16 15:12:23 +01:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IObjectWithSite(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2012-01-16 15:12:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ObjectWithSite_AddRef(IObjectWithSite *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IObjectWithSite(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2012-01-16 15:12:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ObjectWithSite_Release(IObjectWithSite *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IObjectWithSite(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2012-01-16 15:12:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** IObjectWithSite methods ***/
|
|
|
|
|
|
|
|
static HRESULT WINAPI ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *pUnkSite)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IObjectWithSite( iface );
|
2012-01-16 15:12:23 +01:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
if (This->pSite) IUnknown_Release(This->pSite);
|
|
|
|
This->pSite = pUnkSite;
|
|
|
|
IUnknown_AddRef(This->pSite);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ObjectWithSite_GetSite(IObjectWithSite *iface, REFIID riid, PVOID *ppvSite)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IObjectWithSite( iface );
|
2012-01-16 15:12:23 +01:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%s)\n", This, iface,debugstr_guid(riid));
|
|
|
|
|
|
|
|
*ppvSite = NULL;
|
|
|
|
if (!This->pSite)
|
|
|
|
return E_FAIL;
|
|
|
|
else
|
|
|
|
return IUnknown_QueryInterface(This->pSite, riid, ppvSite);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IObjectWithSiteVtbl IObjectWithSite_VTable =
|
|
|
|
{
|
|
|
|
ObjectWithSite_QueryInterface,
|
|
|
|
ObjectWithSite_AddRef,
|
|
|
|
ObjectWithSite_Release,
|
|
|
|
ObjectWithSite_SetSite,
|
|
|
|
ObjectWithSite_GetSite,
|
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT GetTargetInterface(struct filter_graph* pGraph, REFIID riid, LPVOID* ppvObj)
|
2005-09-02 13:20:09 +02:00
|
|
|
{
|
2018-09-18 16:40:45 +02:00
|
|
|
struct filter *filter;
|
2018-08-23 19:43:14 +02:00
|
|
|
HRESULT hr;
|
2005-09-02 13:20:09 +02:00
|
|
|
int entry;
|
|
|
|
|
|
|
|
/* Check if the interface type is already registered */
|
|
|
|
for (entry = 0; entry < pGraph->nItfCacheEntries; entry++)
|
|
|
|
if (riid == pGraph->ItfCacheEntries[entry].riid)
|
|
|
|
{
|
|
|
|
if (pGraph->ItfCacheEntries[entry].iface)
|
|
|
|
{
|
|
|
|
/* Return the interface if available */
|
|
|
|
*ppvObj = pGraph->ItfCacheEntries[entry].iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (entry >= MAX_ITF_CACHE_ENTRIES)
|
|
|
|
{
|
|
|
|
FIXME("Not enough space to store interface in the cache\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find a filter supporting the requested interface */
|
2018-09-18 16:40:45 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &pGraph->filters, struct filter, entry)
|
2005-09-02 13:20:09 +02:00
|
|
|
{
|
2018-09-18 16:40:45 +02:00
|
|
|
hr = IBaseFilter_QueryInterface(filter->filter, riid, ppvObj);
|
2005-09-02 13:20:09 +02:00
|
|
|
if (hr == S_OK)
|
|
|
|
{
|
2006-11-09 23:09:44 +01:00
|
|
|
pGraph->ItfCacheEntries[entry].riid = riid;
|
2018-09-18 16:40:45 +02:00
|
|
|
pGraph->ItfCacheEntries[entry].filter = filter->filter;
|
2009-01-29 11:14:55 +01:00
|
|
|
pGraph->ItfCacheEntries[entry].iface = *ppvObj;
|
2005-09-02 13:20:09 +02:00
|
|
|
if (entry >= pGraph->nItfCacheEntries)
|
|
|
|
pGraph->nItfCacheEntries++;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
if (hr != E_NOINTERFACE)
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2018-08-23 19:43:14 +02:00
|
|
|
return IsEqualGUID(riid, &IID_IBasicAudio) ? E_NOTIMPL : E_NOINTERFACE;
|
2005-09-02 13:20:09 +02:00
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IBasicAudio(IBasicAudio *iface)
|
2011-06-30 00:41:55 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IBasicAudio_iface);
|
2011-06-30 00:41:55 +02:00
|
|
|
}
|
|
|
|
|
2020-05-17 21:44:30 +02:00
|
|
|
static HRESULT WINAPI BasicAudio_QueryInterface(IBasicAudio *iface, REFIID iid, void **out)
|
2011-06-30 00:41:55 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IBasicAudio(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:41:55 +02:00
|
|
|
static ULONG WINAPI BasicAudio_AddRef(IBasicAudio *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IBasicAudio(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:41:55 +02:00
|
|
|
static ULONG WINAPI BasicAudio_Release(IBasicAudio *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IBasicAudio(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 16:42:13 +02:00
|
|
|
static HRESULT WINAPI BasicAudio_GetTypeInfoCount(IBasicAudio *iface, UINT *count)
|
2011-06-30 00:41:55 +02:00
|
|
|
{
|
2019-06-11 16:42:13 +02:00
|
|
|
TRACE("iface %p, count %p.\n", iface, count);
|
|
|
|
*count = 1;
|
|
|
|
return S_OK;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 16:42:13 +02:00
|
|
|
static HRESULT WINAPI BasicAudio_GetTypeInfo(IBasicAudio *iface, UINT index,
|
|
|
|
LCID lcid, ITypeInfo **typeinfo)
|
2011-06-30 00:41:55 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo);
|
2019-06-11 16:42:13 +02:00
|
|
|
return strmbase_get_typeinfo(IBasicAudio_tid, typeinfo);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 16:42:13 +02:00
|
|
|
static HRESULT WINAPI BasicAudio_GetIDsOfNames(IBasicAudio *iface, REFIID iid,
|
|
|
|
LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
|
2011-06-30 00:41:55 +02:00
|
|
|
{
|
2019-06-11 16:42:13 +02:00
|
|
|
ITypeInfo *typeinfo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n",
|
2019-06-11 16:42:13 +02:00
|
|
|
iface, debugstr_guid(iid), names, count, lcid, ids);
|
2005-09-02 13:20:09 +02:00
|
|
|
|
2019-06-11 16:42:13 +02:00
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IBasicAudio_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
2005-09-02 13:20:09 +02:00
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 16:42:13 +02:00
|
|
|
static HRESULT WINAPI BasicAudio_Invoke(IBasicAudio *iface, DISPID id, REFIID iid, LCID lcid,
|
|
|
|
WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
|
2011-06-30 00:41:55 +02:00
|
|
|
{
|
2019-06-11 16:42:13 +02:00
|
|
|
ITypeInfo *typeinfo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
|
2019-06-11 16:42:13 +02:00
|
|
|
iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
|
2005-09-02 13:20:09 +02:00
|
|
|
|
2019-06-11 16:42:13 +02:00
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IBasicAudio_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
2005-09-02 13:20:09 +02:00
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** IBasicAudio methods ***/
|
2011-06-30 00:41:55 +02:00
|
|
|
static HRESULT WINAPI BasicAudio_put_Volume(IBasicAudio *iface, LONG lVolume)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicAudio(iface);
|
2005-09-02 13:20:09 +02:00
|
|
|
IBasicAudio* pBasicAudio;
|
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, volume %ld.\n", This, lVolume);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicAudio_put_Volume(pBasicAudio, lVolume);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:41:55 +02:00
|
|
|
static HRESULT WINAPI BasicAudio_get_Volume(IBasicAudio *iface, LONG *plVolume)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicAudio(iface);
|
2005-09-02 13:20:09 +02:00
|
|
|
IBasicAudio* pBasicAudio;
|
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, plVolume);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicAudio_get_Volume(pBasicAudio, plVolume);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:41:55 +02:00
|
|
|
static HRESULT WINAPI BasicAudio_put_Balance(IBasicAudio *iface, LONG lBalance)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicAudio(iface);
|
2005-09-02 13:20:09 +02:00
|
|
|
IBasicAudio* pBasicAudio;
|
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, balance %ld.\n", This, lBalance);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicAudio_put_Balance(pBasicAudio, lBalance);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:41:55 +02:00
|
|
|
static HRESULT WINAPI BasicAudio_get_Balance(IBasicAudio *iface, LONG *plBalance)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicAudio(iface);
|
2005-09-02 13:20:09 +02:00
|
|
|
IBasicAudio* pBasicAudio;
|
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, plBalance);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicAudio_get_Balance(pBasicAudio, plBalance);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IBasicAudioVtbl IBasicAudio_VTable =
|
2003-06-13 20:06:44 +02:00
|
|
|
{
|
2005-09-25 17:17:30 +02:00
|
|
|
BasicAudio_QueryInterface,
|
|
|
|
BasicAudio_AddRef,
|
|
|
|
BasicAudio_Release,
|
|
|
|
BasicAudio_GetTypeInfoCount,
|
|
|
|
BasicAudio_GetTypeInfo,
|
|
|
|
BasicAudio_GetIDsOfNames,
|
|
|
|
BasicAudio_Invoke,
|
|
|
|
BasicAudio_put_Volume,
|
|
|
|
BasicAudio_get_Volume,
|
|
|
|
BasicAudio_put_Balance,
|
|
|
|
BasicAudio_get_Balance
|
2003-06-13 20:06:44 +02:00
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IBasicVideo2(IBasicVideo2 *iface)
|
2011-06-30 00:44:08 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IBasicVideo2_iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
}
|
|
|
|
|
2020-05-17 21:44:30 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_QueryInterface(IBasicVideo2 *iface, REFIID iid, void **out)
|
2011-06-30 00:44:08 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IBasicVideo2(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static ULONG WINAPI BasicVideo_AddRef(IBasicVideo2 *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IBasicVideo2(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static ULONG WINAPI BasicVideo_Release(IBasicVideo2 *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IBasicVideo2(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 16:42:15 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_GetTypeInfoCount(IBasicVideo2 *iface, UINT *count)
|
2011-06-30 00:44:08 +02:00
|
|
|
{
|
2019-06-11 16:42:15 +02:00
|
|
|
TRACE("iface %p, count %p.\n", iface, count);
|
|
|
|
*count = 1;
|
|
|
|
return S_OK;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 16:42:15 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_GetTypeInfo(IBasicVideo2 *iface, UINT index,
|
|
|
|
LCID lcid, ITypeInfo **typeinfo)
|
2011-06-30 00:44:08 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo);
|
2019-06-11 16:42:15 +02:00
|
|
|
return strmbase_get_typeinfo(IBasicVideo_tid, typeinfo);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 16:42:15 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_GetIDsOfNames(IBasicVideo2 *iface, REFIID iid,
|
|
|
|
LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
|
2011-06-30 00:44:08 +02:00
|
|
|
{
|
2019-06-11 16:42:15 +02:00
|
|
|
ITypeInfo *typeinfo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n",
|
2019-06-11 16:42:15 +02:00
|
|
|
iface, debugstr_guid(iid), names, count, lcid, ids);
|
2005-09-02 13:20:09 +02:00
|
|
|
|
2019-06-11 16:42:15 +02:00
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IBasicVideo_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
2005-09-02 13:20:09 +02:00
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 16:42:15 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_Invoke(IBasicVideo2 *iface, DISPID id, REFIID iid, LCID lcid,
|
|
|
|
WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
|
2011-06-30 00:44:08 +02:00
|
|
|
{
|
2019-06-11 16:42:15 +02:00
|
|
|
ITypeInfo *typeinfo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
|
2019-06-11 16:42:15 +02:00
|
|
|
iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
|
2005-09-02 13:20:09 +02:00
|
|
|
|
2019-06-11 16:42:15 +02:00
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IBasicVideo_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
2005-09-02 13:20:09 +02:00
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** IBasicVideo methods ***/
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_AvgTimePerFrame(IBasicVideo2 *iface, REFTIME *pAvgTimePerFrame)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_AvgTimePerFrame(pBasicVideo, pAvgTimePerFrame);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_BitRate(IBasicVideo2 *iface, LONG *pBitRate)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pBitRate);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_BitRate(pBasicVideo, pBitRate);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_BitErrorRate(IBasicVideo2 *iface, LONG *pBitErrorRate)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pBitErrorRate);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_BitErrorRate(pBasicVideo, pBitErrorRate);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_VideoWidth(IBasicVideo2 *iface, LONG *pVideoWidth)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_VideoWidth(pBasicVideo, pVideoWidth);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_VideoHeight(IBasicVideo2 *iface, LONG *pVideoHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_VideoHeight(pBasicVideo, pVideoHeight);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_put_SourceLeft(IBasicVideo2 *iface, LONG SourceLeft)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, left %ld.\n", This, SourceLeft);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_put_SourceLeft(pBasicVideo, SourceLeft);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_SourceLeft(IBasicVideo2 *iface, LONG *pSourceLeft)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_SourceLeft(pBasicVideo, pSourceLeft);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_put_SourceWidth(IBasicVideo2 *iface, LONG SourceWidth)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, width %ld.\n", This, SourceWidth);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_put_SourceWidth(pBasicVideo, SourceWidth);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_SourceWidth(IBasicVideo2 *iface, LONG *pSourceWidth)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_SourceWidth(pBasicVideo, pSourceWidth);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_put_SourceTop(IBasicVideo2 *iface, LONG SourceTop)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, top %ld.\n", This, SourceTop);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_put_SourceTop(pBasicVideo, SourceTop);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_SourceTop(IBasicVideo2 *iface, LONG *pSourceTop)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_SourceTop(pBasicVideo, pSourceTop);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_put_SourceHeight(IBasicVideo2 *iface, LONG SourceHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, height %ld.\n", This, SourceHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_put_SourceHeight(pBasicVideo, SourceHeight);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_SourceHeight(IBasicVideo2 *iface, LONG *pSourceHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_SourceHeight(pBasicVideo, pSourceHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_put_DestinationLeft(IBasicVideo2 *iface, LONG DestinationLeft)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, left %ld.\n", This, DestinationLeft);
|
2005-09-02 13:20:09 +02:00
|
|
|
|
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_put_DestinationLeft(pBasicVideo, DestinationLeft);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_DestinationLeft(IBasicVideo2 *iface, LONG *pDestinationLeft)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_DestinationLeft(pBasicVideo, pDestinationLeft);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_put_DestinationWidth(IBasicVideo2 *iface, LONG DestinationWidth)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, width %ld.\n", This, DestinationWidth);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_put_DestinationWidth(pBasicVideo, DestinationWidth);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_DestinationWidth(IBasicVideo2 *iface, LONG *pDestinationWidth)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_DestinationWidth(pBasicVideo, pDestinationWidth);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_put_DestinationTop(IBasicVideo2 *iface, LONG DestinationTop)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, top %ld.\n", This, DestinationTop);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_put_DestinationTop(pBasicVideo, DestinationTop);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_DestinationTop(IBasicVideo2 *iface, LONG *pDestinationTop)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_DestinationTop(pBasicVideo, pDestinationTop);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_put_DestinationHeight(IBasicVideo2 *iface, LONG DestinationHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, height %ld.\n", This, DestinationHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_put_DestinationHeight(pBasicVideo, DestinationHeight);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2008-06-10 18:17:07 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_get_DestinationHeight(IBasicVideo2 *iface,
|
2011-06-30 00:44:08 +02:00
|
|
|
LONG *pDestinationHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_get_DestinationHeight(pBasicVideo, pDestinationHeight);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_SetSourcePosition(IBasicVideo2 *iface, LONG Left, LONG Top,
|
|
|
|
LONG Width, LONG Height)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, left %ld, top %ld, width %ld, height %ld.\n", This, Left, Top, Width, Height);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_SetSourcePosition(pBasicVideo, Left, Top, Width, Height);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_GetSourcePosition(IBasicVideo2 *iface, LONG *pLeft, LONG *pTop,
|
|
|
|
LONG *pWidth, LONG *pHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_GetSourcePosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_SetDefaultSourcePosition(IBasicVideo2 *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_SetDefaultSourcePosition(pBasicVideo);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_SetDestinationPosition(IBasicVideo2 *iface, LONG Left, LONG Top,
|
|
|
|
LONG Width, LONG Height)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, left %ld, top %ld, width %ld, height %ld.\n", This, Left, Top, Width, Height);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_SetDestinationPosition(pBasicVideo, Left, Top, Width, Height);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_GetDestinationPosition(IBasicVideo2 *iface, LONG *pLeft,
|
|
|
|
LONG *pTop, LONG *pWidth, LONG *pHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_GetDestinationPosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_SetDefaultDestinationPosition(IBasicVideo2 *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_SetDefaultDestinationPosition(pBasicVideo);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_GetVideoSize(IBasicVideo2 *iface, LONG *pWidth, LONG *pHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_GetVideoSize(pBasicVideo, pWidth, pHeight);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_GetVideoPaletteEntries(IBasicVideo2 *iface, LONG StartIndex,
|
|
|
|
LONG Entries, LONG *pRetrieved, LONG *pPalette)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, start_index %ld, count %ld, ret_count %p, entries %p.\n",
|
|
|
|
This, StartIndex, Entries, pRetrieved, pPalette);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_GetVideoPaletteEntries(pBasicVideo, StartIndex, Entries, pRetrieved, pPalette);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_GetCurrentImage(IBasicVideo2 *iface, LONG *pBufferSize,
|
|
|
|
LONG *pDIBImage)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pBufferSize, pDIBImage);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_GetCurrentImage(pBasicVideo, pBufferSize, pDIBImage);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_IsUsingDefaultSource(IBasicVideo2 *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_IsUsingDefaultSource(pBasicVideo);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo_IsUsingDefaultDestination(IBasicVideo2 *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2011-06-30 00:44:08 +02:00
|
|
|
IBasicVideo *pBasicVideo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IBasicVideo_IsUsingDefaultDestination(pBasicVideo);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:44:08 +02:00
|
|
|
static HRESULT WINAPI BasicVideo2_GetPreferredAspectRatio(IBasicVideo2 *iface, LONG *plAspectX,
|
|
|
|
LONG *plAspectY)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IBasicVideo2(iface);
|
2008-06-10 18:17:07 +02:00
|
|
|
IBasicVideo2 *pBasicVideo2;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IBasicVideo2, (LPVOID*)&pBasicVideo2);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = BasicVideo2_GetPreferredAspectRatio(iface, plAspectX, plAspectY);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2008-06-10 18:17:07 +02:00
|
|
|
static const IBasicVideo2Vtbl IBasicVideo_VTable =
|
2003-06-13 20:06:44 +02:00
|
|
|
{
|
2005-09-25 17:17:30 +02:00
|
|
|
BasicVideo_QueryInterface,
|
|
|
|
BasicVideo_AddRef,
|
|
|
|
BasicVideo_Release,
|
|
|
|
BasicVideo_GetTypeInfoCount,
|
|
|
|
BasicVideo_GetTypeInfo,
|
|
|
|
BasicVideo_GetIDsOfNames,
|
|
|
|
BasicVideo_Invoke,
|
|
|
|
BasicVideo_get_AvgTimePerFrame,
|
|
|
|
BasicVideo_get_BitRate,
|
|
|
|
BasicVideo_get_BitErrorRate,
|
|
|
|
BasicVideo_get_VideoWidth,
|
|
|
|
BasicVideo_get_VideoHeight,
|
|
|
|
BasicVideo_put_SourceLeft,
|
|
|
|
BasicVideo_get_SourceLeft,
|
|
|
|
BasicVideo_put_SourceWidth,
|
|
|
|
BasicVideo_get_SourceWidth,
|
|
|
|
BasicVideo_put_SourceTop,
|
|
|
|
BasicVideo_get_SourceTop,
|
|
|
|
BasicVideo_put_SourceHeight,
|
|
|
|
BasicVideo_get_SourceHeight,
|
|
|
|
BasicVideo_put_DestinationLeft,
|
|
|
|
BasicVideo_get_DestinationLeft,
|
|
|
|
BasicVideo_put_DestinationWidth,
|
|
|
|
BasicVideo_get_DestinationWidth,
|
|
|
|
BasicVideo_put_DestinationTop,
|
|
|
|
BasicVideo_get_DestinationTop,
|
|
|
|
BasicVideo_put_DestinationHeight,
|
|
|
|
BasicVideo_get_DestinationHeight,
|
|
|
|
BasicVideo_SetSourcePosition,
|
|
|
|
BasicVideo_GetSourcePosition,
|
|
|
|
BasicVideo_SetDefaultSourcePosition,
|
|
|
|
BasicVideo_SetDestinationPosition,
|
|
|
|
BasicVideo_GetDestinationPosition,
|
|
|
|
BasicVideo_SetDefaultDestinationPosition,
|
|
|
|
BasicVideo_GetVideoSize,
|
|
|
|
BasicVideo_GetVideoPaletteEntries,
|
|
|
|
BasicVideo_GetCurrentImage,
|
|
|
|
BasicVideo_IsUsingDefaultSource,
|
2008-06-10 18:17:07 +02:00
|
|
|
BasicVideo_IsUsingDefaultDestination,
|
|
|
|
BasicVideo2_GetPreferredAspectRatio
|
2003-06-13 20:06:44 +02:00
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IVideoWindow(IVideoWindow *iface)
|
2011-06-30 00:45:48 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IVideoWindow_iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-05-17 21:44:30 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_QueryInterface(IVideoWindow *iface, REFIID iid, void **out)
|
2011-06-30 00:45:48 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IVideoWindow(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static ULONG WINAPI VideoWindow_AddRef(IVideoWindow *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IVideoWindow(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IVideoWindow(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 16:42:14 +02:00
|
|
|
HRESULT WINAPI VideoWindow_GetTypeInfoCount(IVideoWindow *iface, UINT *count)
|
2011-06-30 00:45:48 +02:00
|
|
|
{
|
2019-06-11 16:42:14 +02:00
|
|
|
TRACE("iface %p, count %p.\n", iface, count);
|
|
|
|
*count = 1;
|
|
|
|
return S_OK;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 16:42:14 +02:00
|
|
|
HRESULT WINAPI VideoWindow_GetTypeInfo(IVideoWindow *iface, UINT index,
|
|
|
|
LCID lcid, ITypeInfo **typeinfo)
|
2011-06-30 00:45:48 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo);
|
2019-06-11 16:42:14 +02:00
|
|
|
return strmbase_get_typeinfo(IVideoWindow_tid, typeinfo);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 16:42:14 +02:00
|
|
|
HRESULT WINAPI VideoWindow_GetIDsOfNames(IVideoWindow *iface, REFIID iid,
|
|
|
|
LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
|
2011-06-30 00:45:48 +02:00
|
|
|
{
|
2019-06-11 16:42:14 +02:00
|
|
|
ITypeInfo *typeinfo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n",
|
2019-06-11 16:42:14 +02:00
|
|
|
iface, debugstr_guid(iid), names, count, lcid, ids);
|
2005-09-02 13:20:09 +02:00
|
|
|
|
2019-06-11 16:42:14 +02:00
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IVideoWindow_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
2005-09-02 13:20:09 +02:00
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2019-06-11 16:42:14 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface, DISPID id, REFIID iid, LCID lcid,
|
|
|
|
WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
|
2011-06-30 00:45:48 +02:00
|
|
|
{
|
2019-06-11 16:42:14 +02:00
|
|
|
ITypeInfo *typeinfo;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
|
2019-06-11 16:42:14 +02:00
|
|
|
iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
|
2005-09-02 13:20:09 +02:00
|
|
|
|
2019-06-11 16:42:14 +02:00
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IVideoWindow_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
2005-09-02 13:20:09 +02:00
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** IVideoWindow methods ***/
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_Caption(IVideoWindow *iface, BSTR strCaption)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2012-10-12 05:35:46 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
|
|
|
|
|
|
|
|
EnterCriticalSection(&This->cs);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_Caption(pVideoWindow, strCaption);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_Caption(IVideoWindow *iface, BSTR *strCaption)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_Caption(pVideoWindow, strCaption);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_WindowStyle(IVideoWindow *iface, LONG WindowStyle)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, style %#lx.\n", This, WindowStyle);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_WindowStyle(pVideoWindow, WindowStyle);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_WindowStyle(IVideoWindow *iface, LONG *WindowStyle)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_WindowStyle(pVideoWindow, WindowStyle);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_WindowStyleEx(IVideoWindow *iface, LONG WindowStyleEx)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, style %#lx.\n", This, WindowStyleEx);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_WindowStyleEx(pVideoWindow, WindowStyleEx);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_WindowStyleEx(IVideoWindow *iface, LONG *WindowStyleEx)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_WindowStyleEx(pVideoWindow, WindowStyleEx);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_AutoShow(IVideoWindow *iface, LONG AutoShow)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, show %#lx.\n", This, AutoShow);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_AutoShow(pVideoWindow, AutoShow);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_AutoShow(IVideoWindow *iface, LONG *AutoShow)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_AutoShow(pVideoWindow, AutoShow);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_WindowState(IVideoWindow *iface, LONG WindowState)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, state %ld.\n", This, WindowState);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_WindowState(pVideoWindow, WindowState);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_WindowState(IVideoWindow *iface, LONG *WindowState)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_WindowState(pVideoWindow, WindowState);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_BackgroundPalette(IVideoWindow *iface, LONG BackgroundPalette)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, palette %ld.\n", This, BackgroundPalette);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_BackgroundPalette(pVideoWindow, BackgroundPalette);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2005-09-25 17:17:30 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_BackgroundPalette(IVideoWindow *iface,
|
2011-06-30 00:45:48 +02:00
|
|
|
LONG *pBackgroundPalette)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pBackgroundPalette);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_BackgroundPalette(pVideoWindow, pBackgroundPalette);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_Visible(IVideoWindow *iface, LONG Visible)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, visible %ld.\n", This, Visible);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_Visible(pVideoWindow, Visible);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_Visible(IVideoWindow *iface, LONG *pVisible)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_Visible(pVideoWindow, pVisible);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_Left(IVideoWindow *iface, LONG Left)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, left %ld.\n", This, Left);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_Left(pVideoWindow, Left);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_Left(IVideoWindow *iface, LONG *pLeft)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_Left(pVideoWindow, pLeft);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_Width(IVideoWindow *iface, LONG Width)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, width %ld.\n", This, Width);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_Width(pVideoWindow, Width);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_Width(IVideoWindow *iface, LONG *pWidth)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_Width(pVideoWindow, pWidth);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_Top(IVideoWindow *iface, LONG Top)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, top %ld.\n", This, Top);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_Top(pVideoWindow, Top);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_Top(IVideoWindow *iface, LONG *pTop)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_Top(pVideoWindow, pTop);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_Height(IVideoWindow *iface, LONG Height)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, height %ld.\n", This, Height);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_Height(pVideoWindow, Height);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_Height(IVideoWindow *iface, LONG *pHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_Height(pVideoWindow, pHeight);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_Owner(IVideoWindow *iface, OAHWND Owner)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, owner %#Ix.\n", This, Owner);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_Owner(pVideoWindow, Owner);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_Owner(IVideoWindow *iface, OAHWND *Owner)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-12 16:12:46 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_Owner(pVideoWindow, Owner);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_MessageDrain(IVideoWindow *iface, OAHWND Drain)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, drain %#Ix.\n", This, Drain);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_MessageDrain(pVideoWindow, Drain);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_MessageDrain(IVideoWindow *iface, OAHWND *Drain)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_MessageDrain(pVideoWindow, Drain);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_BorderColor(IVideoWindow *iface, LONG *Color)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, Color);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_BorderColor(pVideoWindow, Color);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_BorderColor(IVideoWindow *iface, LONG Color)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, colour %#lx.\n", This, Color);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_BorderColor(pVideoWindow, Color);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface, LONG *FullScreenMode)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, FullScreenMode);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_get_FullScreenMode(pVideoWindow, FullScreenMode);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface, LONG FullScreenMode)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, fullscreen %ld.\n", This, FullScreenMode);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_put_FullScreenMode(pVideoWindow, FullScreenMode);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_SetWindowForeground(IVideoWindow *iface, LONG Focus)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, focus %ld.\n", This, Focus);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_SetWindowForeground(pVideoWindow, Focus);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_NotifyOwnerMessage(IVideoWindow *iface, OAHWND hwnd, LONG uMsg,
|
|
|
|
LONG_PTR wParam, LONG_PTR lParam)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, hwnd %#Ix, message %#lx, wparam %#Ix, lparam %#Ix.\n", This, hwnd, uMsg, wParam, lParam);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_NotifyOwnerMessage(pVideoWindow, hwnd, uMsg, wParam, lParam);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_SetWindowPosition(IVideoWindow *iface, LONG Left, LONG Top,
|
|
|
|
LONG Width, LONG Height)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2009-03-11 00:31:26 +01:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, left %ld, top %ld, width %ld, height %ld.\n", This, Left, Top, Width, Height);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_SetWindowPosition(pVideoWindow, Left, Top, Width, Height);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_GetWindowPosition(IVideoWindow *iface, LONG *pLeft, LONG *pTop,
|
|
|
|
LONG *pWidth, LONG *pHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_GetWindowPosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_GetMinIdealImageSize(IVideoWindow *iface, LONG *pWidth,
|
|
|
|
LONG *pHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_GetMinIdealImageSize(pVideoWindow, pWidth, pHeight);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_GetMaxIdealImageSize(IVideoWindow *iface, LONG *pWidth,
|
|
|
|
LONG *pHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_GetMaxIdealImageSize(pVideoWindow, pWidth, pHeight);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_GetRestorePosition(IVideoWindow *iface, LONG *pLeft, LONG *pTop,
|
|
|
|
LONG *pWidth, LONG *pHeight)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_GetRestorePosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_HideCursor(IVideoWindow *iface, LONG HideCursor)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, hide %ld.\n", This, HideCursor);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_HideCursor(pVideoWindow, HideCursor);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:45:48 +02:00
|
|
|
static HRESULT WINAPI VideoWindow_IsCursorHidden(IVideoWindow *iface, LONG *CursorHidden)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IVideoWindow(iface);
|
2011-06-30 00:45:48 +02:00
|
|
|
IVideoWindow *pVideoWindow;
|
2005-09-02 13:20:09 +02:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, CursorHidden);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2005-09-02 13:20:09 +02:00
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
|
|
|
|
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = IVideoWindow_IsCursorHidden(pVideoWindow, CursorHidden);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IVideoWindowVtbl IVideoWindow_VTable =
|
2003-06-13 20:06:44 +02:00
|
|
|
{
|
2005-09-25 17:17:30 +02:00
|
|
|
VideoWindow_QueryInterface,
|
|
|
|
VideoWindow_AddRef,
|
|
|
|
VideoWindow_Release,
|
|
|
|
VideoWindow_GetTypeInfoCount,
|
|
|
|
VideoWindow_GetTypeInfo,
|
|
|
|
VideoWindow_GetIDsOfNames,
|
|
|
|
VideoWindow_Invoke,
|
|
|
|
VideoWindow_put_Caption,
|
|
|
|
VideoWindow_get_Caption,
|
|
|
|
VideoWindow_put_WindowStyle,
|
|
|
|
VideoWindow_get_WindowStyle,
|
|
|
|
VideoWindow_put_WindowStyleEx,
|
|
|
|
VideoWindow_get_WindowStyleEx,
|
|
|
|
VideoWindow_put_AutoShow,
|
|
|
|
VideoWindow_get_AutoShow,
|
|
|
|
VideoWindow_put_WindowState,
|
|
|
|
VideoWindow_get_WindowState,
|
|
|
|
VideoWindow_put_BackgroundPalette,
|
|
|
|
VideoWindow_get_BackgroundPalette,
|
|
|
|
VideoWindow_put_Visible,
|
|
|
|
VideoWindow_get_Visible,
|
|
|
|
VideoWindow_put_Left,
|
|
|
|
VideoWindow_get_Left,
|
|
|
|
VideoWindow_put_Width,
|
|
|
|
VideoWindow_get_Width,
|
|
|
|
VideoWindow_put_Top,
|
|
|
|
VideoWindow_get_Top,
|
|
|
|
VideoWindow_put_Height,
|
|
|
|
VideoWindow_get_Height,
|
|
|
|
VideoWindow_put_Owner,
|
|
|
|
VideoWindow_get_Owner,
|
|
|
|
VideoWindow_put_MessageDrain,
|
|
|
|
VideoWindow_get_MessageDrain,
|
|
|
|
VideoWindow_get_BorderColor,
|
|
|
|
VideoWindow_put_BorderColor,
|
|
|
|
VideoWindow_get_FullScreenMode,
|
|
|
|
VideoWindow_put_FullScreenMode,
|
|
|
|
VideoWindow_SetWindowForeground,
|
|
|
|
VideoWindow_NotifyOwnerMessage,
|
|
|
|
VideoWindow_SetWindowPosition,
|
|
|
|
VideoWindow_GetWindowPosition,
|
|
|
|
VideoWindow_GetMinIdealImageSize,
|
|
|
|
VideoWindow_GetMaxIdealImageSize,
|
|
|
|
VideoWindow_GetRestorePosition,
|
|
|
|
VideoWindow_HideCursor,
|
|
|
|
VideoWindow_IsCursorHidden
|
2003-06-13 20:06:44 +02:00
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IMediaEventEx(IMediaEventEx *iface)
|
2011-06-30 00:47:38 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IMediaEventEx_iface);
|
2011-06-30 00:47:38 +02:00
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-05-17 21:44:30 +02:00
|
|
|
static HRESULT WINAPI MediaEvent_QueryInterface(IMediaEventEx *iface, REFIID iid, void **out)
|
2011-06-30 00:47:38 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventEx(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:47:38 +02:00
|
|
|
static ULONG WINAPI MediaEvent_AddRef(IMediaEventEx *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventEx(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:47:38 +02:00
|
|
|
static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventEx(iface);
|
2020-05-17 21:44:30 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2022-02-02 05:37:44 +01:00
|
|
|
static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface, UINT *count)
|
2011-06-30 00:47:38 +02:00
|
|
|
{
|
2022-02-02 05:37:44 +01:00
|
|
|
TRACE("iface %p, count %p.\n", iface, count);
|
|
|
|
*count = 1;
|
2003-06-13 20:06:44 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2022-02-02 05:37:44 +01:00
|
|
|
static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface, UINT index,
|
|
|
|
LCID lcid, ITypeInfo **typeinfo)
|
2011-06-30 00:47:38 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo);
|
2022-02-02 05:37:44 +01:00
|
|
|
return strmbase_get_typeinfo(IMediaEvent_tid, typeinfo);
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2022-02-02 05:37:44 +01:00
|
|
|
static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface, REFIID iid,
|
|
|
|
LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
|
2011-06-30 00:47:38 +02:00
|
|
|
{
|
2022-02-02 05:37:44 +01:00
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n",
|
2022-02-02 05:37:44 +01:00
|
|
|
iface, debugstr_guid(iid), names, count, lcid, ids);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-02 05:37:44 +01:00
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaEvent_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2022-02-02 05:37:44 +01:00
|
|
|
static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface, DISPID id, REFIID iid, LCID lcid,
|
|
|
|
WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
|
2011-06-30 00:47:38 +02:00
|
|
|
{
|
2022-02-02 05:37:44 +01:00
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
|
2022-02-02 05:37:44 +01:00
|
|
|
iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-02 05:37:44 +01:00
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaEvent_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
return hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2021-02-18 23:58:10 +01:00
|
|
|
static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface, OAEVENT *event)
|
2011-06-30 00:47:38 +02:00
|
|
|
{
|
2021-02-18 23:58:10 +01:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventEx(iface);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2021-02-18 23:58:10 +01:00
|
|
|
TRACE("graph %p, event %p.\n", graph, event);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2021-02-18 23:58:10 +01:00
|
|
|
*event = (OAEVENT)graph->media_event_handle;
|
2003-06-13 20:06:44 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2021-02-18 23:58:10 +01:00
|
|
|
static HRESULT WINAPI MediaEvent_GetEvent(IMediaEventEx *iface, LONG *code,
|
|
|
|
LONG_PTR *param1, LONG_PTR *param2, LONG timeout)
|
2011-06-30 00:47:38 +02:00
|
|
|
{
|
2021-02-18 23:58:10 +01:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventEx(iface);
|
|
|
|
struct media_event *event;
|
|
|
|
struct list *entry;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, code %p, param1 %p, param2 %p, timeout %ld.\n", graph, code, param1, param2, timeout);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2021-02-18 23:58:10 +01:00
|
|
|
*code = 0;
|
|
|
|
|
|
|
|
if (WaitForSingleObject(graph->media_event_handle, timeout))
|
2021-02-18 23:58:09 +01:00
|
|
|
return E_ABORT;
|
|
|
|
|
2021-04-10 18:45:35 +02:00
|
|
|
EnterCriticalSection(&graph->event_cs);
|
2021-02-18 23:58:09 +01:00
|
|
|
|
2021-02-18 23:58:10 +01:00
|
|
|
if (!(entry = list_head(&graph->media_events)))
|
2004-03-05 21:42:40 +01:00
|
|
|
{
|
2021-02-18 23:58:13 +01:00
|
|
|
ResetEvent(graph->media_event_handle);
|
2021-04-10 18:45:35 +02:00
|
|
|
LeaveCriticalSection(&graph->event_cs);
|
2021-02-18 23:58:10 +01:00
|
|
|
return E_ABORT;
|
2004-03-05 21:42:40 +01:00
|
|
|
}
|
2021-02-18 23:58:10 +01:00
|
|
|
event = LIST_ENTRY(entry, struct media_event, entry);
|
|
|
|
list_remove(&event->entry);
|
|
|
|
*code = event->code;
|
|
|
|
*param1 = event->param1;
|
|
|
|
*param2 = event->param2;
|
|
|
|
free(event);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2021-04-10 18:45:35 +02:00
|
|
|
LeaveCriticalSection(&graph->event_cs);
|
2021-02-18 23:58:10 +01:00
|
|
|
return S_OK;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:47:38 +02:00
|
|
|
static HRESULT WINAPI MediaEvent_WaitForCompletion(IMediaEventEx *iface, LONG msTimeout,
|
|
|
|
LONG *pEvCode)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaEventEx(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, timeout %ld, code %p.\n", This, msTimeout, pEvCode);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2009-12-23 18:55:13 +01:00
|
|
|
if (This->state != State_Running)
|
|
|
|
return VFW_E_WRONG_STATE;
|
|
|
|
|
2004-03-05 21:42:40 +01:00
|
|
|
if (WaitForSingleObject(This->hEventCompletion, msTimeout) == WAIT_OBJECT_0)
|
|
|
|
{
|
|
|
|
*pEvCode = This->CompletionStatus;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*pEvCode = 0;
|
|
|
|
return E_ABORT;
|
2003-06-13 20:06:44 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:47:38 +02:00
|
|
|
static HRESULT WINAPI MediaEvent_CancelDefaultHandling(IMediaEventEx *iface, LONG lEvCode)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaEventEx(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, code %#lx.\n", This, lEvCode);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
|
|
|
if (lEvCode == EC_COMPLETE)
|
|
|
|
This->HandleEcComplete = FALSE;
|
|
|
|
else if (lEvCode == EC_REPAINT)
|
|
|
|
This->HandleEcRepaint = FALSE;
|
2007-04-05 22:19:30 +02:00
|
|
|
else if (lEvCode == EC_CLOCK_CHANGED)
|
|
|
|
This->HandleEcClockChanged = FALSE;
|
2004-03-05 21:42:40 +01:00
|
|
|
else
|
|
|
|
return S_FALSE;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:47:38 +02:00
|
|
|
static HRESULT WINAPI MediaEvent_RestoreDefaultHandling(IMediaEventEx *iface, LONG lEvCode)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaEventEx(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, code %#lx.\n", This, lEvCode);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
|
|
|
if (lEvCode == EC_COMPLETE)
|
|
|
|
This->HandleEcComplete = TRUE;
|
|
|
|
else if (lEvCode == EC_REPAINT)
|
|
|
|
This->HandleEcRepaint = TRUE;
|
2007-04-05 22:19:30 +02:00
|
|
|
else if (lEvCode == EC_CLOCK_CHANGED)
|
|
|
|
This->HandleEcClockChanged = TRUE;
|
2004-03-05 21:42:40 +01:00
|
|
|
else
|
|
|
|
return S_FALSE;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
static HRESULT WINAPI MediaEvent_FreeEventParams(IMediaEventEx *iface, LONG code,
|
|
|
|
LONG_PTR param1, LONG_PTR param2)
|
2011-06-30 00:47:38 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventEx(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
WARN("graph %p, code %#lx, param1 %Id, param2 %Id, stub!\n", graph, code, param1, param2);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IMediaEventEx methods ***/
|
2021-02-18 23:58:11 +01:00
|
|
|
static HRESULT WINAPI MediaEvent_SetNotifyWindow(IMediaEventEx *iface,
|
|
|
|
OAHWND window, LONG message, LONG_PTR lparam)
|
2011-06-30 00:47:38 +02:00
|
|
|
{
|
2021-02-18 23:58:11 +01:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventEx(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, window %#Ix, message %#lx, lparam %#Ix.\n", graph, window, message, lparam);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2021-02-18 23:58:11 +01:00
|
|
|
graph->media_event_window = (HWND)window;
|
|
|
|
graph->media_event_message = message;
|
|
|
|
graph->media_event_lparam = lparam;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2021-02-18 23:58:11 +01:00
|
|
|
static HRESULT WINAPI MediaEvent_SetNotifyFlags(IMediaEventEx *iface, LONG flags)
|
2011-06-30 00:47:38 +02:00
|
|
|
{
|
2021-02-18 23:58:11 +01:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventEx(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, flags %#lx.\n", graph, flags);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2021-02-18 23:58:11 +01:00
|
|
|
if (flags & ~AM_MEDIAEVENT_NONOTIFY)
|
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
WARN("Invalid flags %#lx, returning E_INVALIDARG.\n", flags);
|
2021-02-18 23:58:11 +01:00
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2021-02-18 23:58:11 +01:00
|
|
|
graph->media_events_disabled = flags;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2021-02-18 23:58:12 +01:00
|
|
|
if (flags)
|
|
|
|
{
|
|
|
|
flush_media_events(graph);
|
|
|
|
ResetEvent(graph->media_event_handle);
|
|
|
|
}
|
|
|
|
|
2003-06-13 20:06:44 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2021-02-18 23:58:11 +01:00
|
|
|
static HRESULT WINAPI MediaEvent_GetNotifyFlags(IMediaEventEx *iface, LONG *flags)
|
2011-06-30 00:47:38 +02:00
|
|
|
{
|
2021-02-18 23:58:11 +01:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventEx(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2021-02-18 23:58:11 +01:00
|
|
|
TRACE("graph %p, flags %p.\n", graph, flags);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2021-02-18 23:58:11 +01:00
|
|
|
if (!flags)
|
|
|
|
return E_POINTER;
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2021-02-18 23:58:11 +01:00
|
|
|
*flags = graph->media_events_disabled;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IMediaEventExVtbl IMediaEventEx_VTable =
|
2003-06-13 20:06:44 +02:00
|
|
|
{
|
2005-09-25 17:17:30 +02:00
|
|
|
MediaEvent_QueryInterface,
|
|
|
|
MediaEvent_AddRef,
|
|
|
|
MediaEvent_Release,
|
|
|
|
MediaEvent_GetTypeInfoCount,
|
|
|
|
MediaEvent_GetTypeInfo,
|
|
|
|
MediaEvent_GetIDsOfNames,
|
|
|
|
MediaEvent_Invoke,
|
|
|
|
MediaEvent_GetEventHandle,
|
|
|
|
MediaEvent_GetEvent,
|
|
|
|
MediaEvent_WaitForCompletion,
|
|
|
|
MediaEvent_CancelDefaultHandling,
|
|
|
|
MediaEvent_RestoreDefaultHandling,
|
|
|
|
MediaEvent_FreeEventParams,
|
|
|
|
MediaEvent_SetNotifyWindow,
|
|
|
|
MediaEvent_SetNotifyFlags,
|
|
|
|
MediaEvent_GetNotifyFlags
|
2003-06-13 20:06:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IMediaFilter(IMediaFilter *iface)
|
2003-07-03 20:09:28 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IMediaFilter_iface);
|
2011-06-30 00:49:40 +02:00
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT WINAPI MediaFilter_QueryInterface(IMediaFilter *iface, REFIID iid, void **out)
|
2011-06-30 00:49:40 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaFilter(iface);
|
2003-07-03 20:09:28 +02:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2003-07-03 20:09:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI MediaFilter_AddRef(IMediaFilter *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaFilter(iface);
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2003-07-03 20:09:28 +02:00
|
|
|
}
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2003-07-03 20:09:28 +02:00
|
|
|
static ULONG WINAPI MediaFilter_Release(IMediaFilter *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaFilter(iface);
|
2003-07-03 20:09:28 +02:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2003-07-03 20:09:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID * pClassID)
|
|
|
|
{
|
|
|
|
FIXME("(%p): stub\n", pClassID);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaFilter(iface);
|
2020-02-20 03:44:58 +01:00
|
|
|
HRESULT hr = S_OK, filter_hr;
|
|
|
|
struct filter *filter;
|
2020-07-15 02:56:26 +02:00
|
|
|
TP_WORK *work;
|
2011-06-30 00:49:40 +02:00
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
TRACE("graph %p.\n", graph);
|
|
|
|
|
|
|
|
EnterCriticalSection(&graph->cs);
|
|
|
|
|
|
|
|
if (graph->state == State_Stopped)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-06-12 09:57:09 +02:00
|
|
|
sort_filters(graph);
|
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
if (graph->state == State_Running)
|
2020-02-20 03:44:58 +01:00
|
|
|
{
|
2020-06-12 09:57:09 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
2020-02-20 03:44:58 +01:00
|
|
|
{
|
|
|
|
filter_hr = IBaseFilter_Pause(filter->filter);
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = filter_hr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-12 09:57:09 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
2020-02-20 03:44:58 +01:00
|
|
|
{
|
|
|
|
filter_hr = IBaseFilter_Stop(filter->filter);
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = filter_hr;
|
|
|
|
}
|
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
graph->state = State_Stopped;
|
2020-07-15 02:56:26 +02:00
|
|
|
graph->needs_async_run = 0;
|
|
|
|
work = graph->async_run_work;
|
2020-07-21 00:49:10 +02:00
|
|
|
graph->got_ec_complete = 0;
|
2018-09-26 06:30:21 +02:00
|
|
|
|
2019-10-21 23:54:49 +02:00
|
|
|
/* Update the current position, probably to synchronize multiple streams. */
|
|
|
|
IMediaSeeking_SetPositions(&graph->IMediaSeeking_iface, &graph->current_pos,
|
|
|
|
AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
|
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
LeaveCriticalSection(&graph->cs);
|
2003-07-03 20:09:28 +02:00
|
|
|
|
2020-07-15 02:56:26 +02:00
|
|
|
if (work)
|
2020-11-06 20:46:05 +01:00
|
|
|
WaitForThreadpoolWorkCallbacks(work, TRUE);
|
2020-07-15 02:56:26 +02:00
|
|
|
|
|
|
|
return hr;
|
2020-06-10 18:09:07 +02:00
|
|
|
}
|
|
|
|
|
2003-07-03 20:09:28 +02:00
|
|
|
static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaFilter(iface);
|
2020-02-20 03:44:58 +01:00
|
|
|
HRESULT hr = S_OK, filter_hr;
|
|
|
|
struct filter *filter;
|
2020-07-15 02:56:26 +02:00
|
|
|
TP_WORK *work;
|
2011-06-30 00:49:40 +02:00
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
TRACE("graph %p.\n", graph);
|
|
|
|
|
|
|
|
EnterCriticalSection(&graph->cs);
|
|
|
|
|
|
|
|
if (graph->state == State_Paused)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-06-12 09:57:09 +02:00
|
|
|
sort_filters(graph);
|
2021-04-10 18:45:35 +02:00
|
|
|
|
|
|
|
EnterCriticalSection(&graph->event_cs);
|
2020-06-10 18:09:07 +02:00
|
|
|
update_render_count(graph);
|
2021-04-10 18:45:35 +02:00
|
|
|
LeaveCriticalSection(&graph->event_cs);
|
2020-06-10 18:09:07 +02:00
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
if (graph->defaultclock && !graph->refClock)
|
|
|
|
IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface);
|
|
|
|
|
2021-12-10 15:58:15 +01:00
|
|
|
if (graph->state == State_Running && !graph->needs_async_run && graph->refClock)
|
2019-10-21 23:54:48 +02:00
|
|
|
{
|
2019-10-21 23:54:51 +02:00
|
|
|
REFERENCE_TIME time;
|
|
|
|
IReferenceClock_GetTime(graph->refClock, &time);
|
|
|
|
graph->stream_elapsed += time - graph->stream_start;
|
|
|
|
graph->current_pos += graph->stream_elapsed;
|
2019-10-21 23:54:48 +02:00
|
|
|
}
|
2018-09-26 06:30:21 +02:00
|
|
|
|
2020-06-12 09:57:09 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
2020-02-20 03:44:58 +01:00
|
|
|
{
|
|
|
|
filter_hr = IBaseFilter_Pause(filter->filter);
|
|
|
|
if (hr == S_OK)
|
|
|
|
hr = filter_hr;
|
|
|
|
}
|
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
graph->state = State_Paused;
|
2020-07-15 02:56:26 +02:00
|
|
|
graph->needs_async_run = 0;
|
|
|
|
work = graph->async_run_work;
|
2018-09-26 06:30:21 +02:00
|
|
|
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
2020-07-15 02:56:26 +02:00
|
|
|
|
|
|
|
if (work)
|
2020-11-06 20:46:05 +01:00
|
|
|
WaitForThreadpoolWorkCallbacks(work, TRUE);
|
2020-07-15 02:56:26 +02:00
|
|
|
|
2020-02-20 03:44:58 +01:00
|
|
|
return hr;
|
2003-07-03 20:09:28 +02:00
|
|
|
}
|
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME start)
|
2003-07-03 20:09:28 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaFilter(iface);
|
2020-07-15 02:56:26 +02:00
|
|
|
HRESULT hr;
|
2018-09-26 06:30:21 +02:00
|
|
|
|
2020-01-31 02:05:17 +01:00
|
|
|
TRACE("graph %p, start %s.\n", graph, debugstr_time(start));
|
2011-06-30 00:49:40 +02:00
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
EnterCriticalSection(&graph->cs);
|
2011-06-30 00:49:40 +02:00
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
if (graph->state == State_Running)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2020-06-12 09:57:09 +02:00
|
|
|
sort_filters(graph);
|
2018-09-26 06:30:21 +02:00
|
|
|
|
2020-07-15 02:56:26 +02:00
|
|
|
hr = graph_start(graph, start);
|
2020-02-20 03:44:58 +01:00
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
graph->state = State_Running;
|
2020-07-15 02:56:26 +02:00
|
|
|
graph->needs_async_run = 0;
|
2018-09-26 06:30:21 +02:00
|
|
|
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
2020-02-20 03:44:58 +01:00
|
|
|
return hr;
|
2003-07-03 20:09:28 +02:00
|
|
|
}
|
|
|
|
|
2018-09-26 06:30:21 +02:00
|
|
|
static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD timeout, FILTER_STATE *state)
|
2003-07-03 20:09:28 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaFilter(iface);
|
2020-02-20 03:44:58 +01:00
|
|
|
DWORD end = GetTickCount() + timeout;
|
2020-07-15 02:56:22 +02:00
|
|
|
HRESULT hr;
|
2018-09-26 06:30:21 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, timeout %lu, state %p.\n", graph, timeout, state);
|
2018-09-26 06:30:21 +02:00
|
|
|
|
|
|
|
if (!state)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2020-07-15 02:56:22 +02:00
|
|
|
/* Thread safety is a little tricky here. GetState() shouldn't block other
|
|
|
|
* functions from being called on the filter graph. However, we can't just
|
|
|
|
* call IBaseFilter::GetState() in one loop and drop the lock on every
|
|
|
|
* iteration, since the filter list might change beneath us. So instead we
|
|
|
|
* do what native does, and poll for it every 10 ms. */
|
2011-06-30 00:49:40 +02:00
|
|
|
|
2020-07-15 02:56:22 +02:00
|
|
|
EnterCriticalSection(&graph->cs);
|
2018-09-26 06:30:21 +02:00
|
|
|
*state = graph->state;
|
2020-02-20 03:44:58 +01:00
|
|
|
|
2020-07-15 02:56:22 +02:00
|
|
|
for (;;)
|
2020-02-20 03:44:58 +01:00
|
|
|
{
|
2020-07-15 02:56:22 +02:00
|
|
|
IBaseFilter *async_filter = NULL;
|
2020-02-20 03:44:58 +01:00
|
|
|
FILTER_STATE filter_state;
|
2020-07-15 02:56:22 +02:00
|
|
|
struct filter *filter;
|
2020-02-20 03:44:58 +01:00
|
|
|
|
2020-07-15 02:56:22 +02:00
|
|
|
hr = S_OK;
|
2020-02-20 03:44:58 +01:00
|
|
|
|
2020-07-15 02:56:22 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
|
|
|
|
{
|
|
|
|
HRESULT filter_hr = IBaseFilter_GetState(filter->filter, 0, &filter_state);
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("Filter %p returned hr %#lx, state %u.\n", filter->filter, filter_hr, filter_state);
|
2020-07-15 02:56:22 +02:00
|
|
|
|
|
|
|
if (filter_hr == VFW_S_STATE_INTERMEDIATE)
|
|
|
|
async_filter = filter->filter;
|
|
|
|
|
|
|
|
if (hr == S_OK && filter_hr == VFW_S_STATE_INTERMEDIATE)
|
|
|
|
hr = VFW_S_STATE_INTERMEDIATE;
|
|
|
|
else if (filter_hr != S_OK && filter_hr != VFW_S_STATE_INTERMEDIATE)
|
|
|
|
hr = filter_hr;
|
2020-07-15 02:56:25 +02:00
|
|
|
|
|
|
|
if (hr == S_OK && filter_state == State_Paused && graph->state != State_Paused)
|
|
|
|
{
|
|
|
|
async_filter = filter->filter;
|
|
|
|
hr = VFW_S_STATE_INTERMEDIATE;
|
|
|
|
}
|
|
|
|
else if (filter_state != graph->state && filter_state != State_Paused)
|
|
|
|
hr = E_FAIL;
|
|
|
|
|
2021-06-29 22:00:15 +02:00
|
|
|
if (graph->needs_async_run)
|
|
|
|
{
|
|
|
|
if (filter_state != State_Paused && filter_state != State_Running)
|
|
|
|
ERR("Filter %p reported incorrect state %u (expected %u or %u).\n",
|
|
|
|
filter->filter, filter_state, State_Paused, State_Running);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (filter_state != graph->state)
|
|
|
|
ERR("Filter %p reported incorrect state %u (expected %u).\n",
|
|
|
|
filter->filter, filter_state, graph->state);
|
|
|
|
}
|
2020-07-15 02:56:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
LeaveCriticalSection(&graph->cs);
|
|
|
|
|
|
|
|
if (hr != VFW_S_STATE_INTERMEDIATE || (timeout != INFINITE && GetTickCount() >= end))
|
|
|
|
break;
|
|
|
|
|
|
|
|
IBaseFilter_GetState(async_filter, 10, &filter_state);
|
|
|
|
|
|
|
|
EnterCriticalSection(&graph->cs);
|
2020-02-20 03:44:58 +01:00
|
|
|
}
|
2018-09-26 06:30:21 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("Returning %#lx, state %u.\n", hr, *state);
|
2020-02-20 03:44:58 +01:00
|
|
|
return hr;
|
2003-07-03 20:09:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceClock *pClock)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaFilter(iface);
|
2018-09-18 16:40:45 +02:00
|
|
|
struct filter *filter;
|
2007-04-03 19:44:41 +02:00
|
|
|
HRESULT hr = S_OK;
|
2003-07-03 20:09:28 +02:00
|
|
|
|
2016-12-04 16:37:18 +01:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pClock);
|
2007-04-03 19:44:41 +02:00
|
|
|
|
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
{
|
2018-09-18 16:40:45 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &This->filters, struct filter, entry)
|
2007-04-03 19:44:41 +02:00
|
|
|
{
|
2018-09-18 16:40:45 +02:00
|
|
|
hr = IBaseFilter_SetSyncSource(filter->filter, pClock);
|
2007-04-03 19:44:41 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2018-09-18 16:40:45 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(filter, &This->filters, struct filter, entry)
|
|
|
|
IBaseFilter_SetSyncSource(filter->filter, This->refClock);
|
2007-04-03 19:44:41 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (This->refClock)
|
|
|
|
IReferenceClock_Release(This->refClock);
|
|
|
|
This->refClock = pClock;
|
|
|
|
if (This->refClock)
|
|
|
|
IReferenceClock_AddRef(This->refClock);
|
2010-11-29 10:44:18 +01:00
|
|
|
This->defaultclock = FALSE;
|
2007-04-05 22:19:30 +02:00
|
|
|
|
|
|
|
if (This->HandleEcClockChanged)
|
|
|
|
{
|
|
|
|
IMediaEventSink *pEventSink;
|
|
|
|
HRESULT eshr;
|
|
|
|
|
2013-12-01 22:37:30 +01:00
|
|
|
eshr = IMediaFilter_QueryInterface(iface, &IID_IMediaEventSink, (void **)&pEventSink);
|
2007-04-05 22:19:30 +02:00
|
|
|
if (SUCCEEDED(eshr))
|
|
|
|
{
|
|
|
|
IMediaEventSink_Notify(pEventSink, EC_CLOCK_CHANGED, 0, 0);
|
|
|
|
IMediaEventSink_Release(pEventSink);
|
|
|
|
}
|
|
|
|
}
|
2007-04-03 19:44:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return hr;
|
2003-07-03 20:09:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaFilter_GetSyncSource(IMediaFilter *iface, IReferenceClock **ppClock)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IMediaFilter(iface);
|
2003-07-03 20:09:28 +02:00
|
|
|
|
2016-12-04 16:37:18 +01:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, ppClock);
|
2007-04-03 19:44:41 +02:00
|
|
|
|
|
|
|
if (!ppClock)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
EnterCriticalSection(&This->cs);
|
|
|
|
{
|
|
|
|
*ppClock = This->refClock;
|
|
|
|
if (*ppClock)
|
|
|
|
IReferenceClock_AddRef(*ppClock);
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&This->cs);
|
|
|
|
|
|
|
|
return S_OK;
|
2003-07-03 20:09:28 +02:00
|
|
|
}
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IMediaFilterVtbl IMediaFilter_VTable =
|
2003-07-03 20:09:28 +02:00
|
|
|
{
|
|
|
|
MediaFilter_QueryInterface,
|
|
|
|
MediaFilter_AddRef,
|
|
|
|
MediaFilter_Release,
|
|
|
|
MediaFilter_GetClassID,
|
|
|
|
MediaFilter_Stop,
|
|
|
|
MediaFilter_Pause,
|
|
|
|
MediaFilter_Run,
|
|
|
|
MediaFilter_GetState,
|
|
|
|
MediaFilter_SetSyncSource,
|
|
|
|
MediaFilter_GetSyncSource
|
|
|
|
};
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IMediaEventSink(IMediaEventSink *iface)
|
2004-03-05 21:42:40 +01:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IMediaEventSink_iface);
|
2011-06-30 00:51:10 +02:00
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT WINAPI MediaEventSink_QueryInterface(IMediaEventSink *iface, REFIID iid, void **out)
|
2011-06-30 00:51:10 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventSink(iface);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2004-03-05 21:42:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI MediaEventSink_AddRef(IMediaEventSink *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventSink(iface);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2004-03-05 21:42:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI MediaEventSink_Release(IMediaEventSink *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventSink(iface);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2004-03-05 21:42:40 +01:00
|
|
|
}
|
|
|
|
|
2021-02-18 23:58:10 +01:00
|
|
|
static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, LONG code,
|
|
|
|
LONG_PTR param1, LONG_PTR param2)
|
2004-03-05 21:42:40 +01:00
|
|
|
{
|
2021-02-18 23:58:10 +01:00
|
|
|
struct filter_graph *graph = impl_from_IMediaEventSink(iface);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, code %#lx, param1 %#Ix, param2 %#Ix.\n", graph, code, param1, param2);
|
2004-03-05 21:42:40 +01:00
|
|
|
|
2021-04-10 18:45:35 +02:00
|
|
|
EnterCriticalSection(&graph->event_cs);
|
2005-01-03 21:23:14 +01:00
|
|
|
|
2021-02-18 23:58:10 +01:00
|
|
|
if (code == EC_COMPLETE && graph->HandleEcComplete)
|
2004-03-05 21:42:40 +01:00
|
|
|
{
|
2021-02-18 23:58:10 +01:00
|
|
|
if (++graph->EcCompleteCount == graph->nRenderers)
|
2005-03-02 11:12:12 +01:00
|
|
|
{
|
2021-02-18 23:58:11 +01:00
|
|
|
if (graph->media_events_disabled)
|
2021-02-18 23:58:10 +01:00
|
|
|
SetEvent(graph->media_event_handle);
|
2021-02-17 07:09:03 +01:00
|
|
|
else
|
2021-02-18 23:58:10 +01:00
|
|
|
queue_media_event(graph, EC_COMPLETE, S_OK, 0);
|
|
|
|
graph->CompletionStatus = EC_COMPLETE;
|
|
|
|
graph->got_ec_complete = 1;
|
|
|
|
SetEvent(graph->hEventCompletion);
|
2005-03-02 11:12:12 +01:00
|
|
|
}
|
2004-03-05 21:42:40 +01:00
|
|
|
}
|
2021-02-18 23:58:10 +01:00
|
|
|
else if ((code == EC_REPAINT) && graph->HandleEcRepaint)
|
2004-03-05 21:42:40 +01:00
|
|
|
{
|
2021-02-18 23:58:10 +01:00
|
|
|
FIXME("EC_REPAINT is not handled.\n");
|
2004-03-05 21:42:40 +01:00
|
|
|
}
|
2021-02-18 23:58:11 +01:00
|
|
|
else if (!graph->media_events_disabled)
|
2004-03-05 21:42:40 +01:00
|
|
|
{
|
2021-02-18 23:58:10 +01:00
|
|
|
queue_media_event(graph, code, param1, param2);
|
2004-03-05 21:42:40 +01:00
|
|
|
}
|
|
|
|
|
2021-04-10 18:45:35 +02:00
|
|
|
LeaveCriticalSection(&graph->event_cs);
|
2004-03-05 21:42:40 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-06 21:50:35 +02:00
|
|
|
static const IMediaEventSinkVtbl IMediaEventSink_VTable =
|
2004-03-05 21:42:40 +01:00
|
|
|
{
|
|
|
|
MediaEventSink_QueryInterface,
|
|
|
|
MediaEventSink_AddRef,
|
|
|
|
MediaEventSink_Release,
|
|
|
|
MediaEventSink_Notify
|
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IGraphConfig(IGraphConfig *iface)
|
2005-08-17 11:52:15 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IGraphConfig_iface);
|
2011-06-30 00:53:54 +02:00
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT WINAPI GraphConfig_QueryInterface(IGraphConfig *iface, REFIID iid, void **out)
|
2011-06-30 00:53:54 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IGraphConfig(iface);
|
2005-08-17 11:52:15 +02:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2005-08-17 11:52:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI GraphConfig_AddRef(IGraphConfig *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IGraphConfig(iface);
|
2005-08-17 11:52:15 +02:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2005-08-17 11:52:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI GraphConfig_Release(IGraphConfig *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IGraphConfig(iface);
|
2005-08-17 11:52:15 +02:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2005-08-17 11:52:15 +02:00
|
|
|
}
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
static HRESULT WINAPI GraphConfig_Reconnect(IGraphConfig *iface, IPin *source, IPin *sink,
|
|
|
|
const AM_MEDIA_TYPE *mt, IBaseFilter *filter, HANDLE abort_event, DWORD flags)
|
2005-08-17 11:52:15 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
struct filter_graph *graph = impl_from_IGraphConfig(iface);
|
|
|
|
|
|
|
|
FIXME("graph %p, source %p, sink %p, mt %p, filter %p, abort_event %p, flags %#lx, stub!\n",
|
|
|
|
graph, source, sink, mt, filter, abort_event, flags);
|
|
|
|
strmbase_dump_media_type(mt);
|
2005-08-17 11:52:15 +02:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
static HRESULT WINAPI GraphConfig_Reconfigure(IGraphConfig *iface,
|
|
|
|
IGraphConfigCallback *callback, void *context, DWORD flags, HANDLE abort_event)
|
2005-08-17 11:52:15 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
struct filter_graph *graph = impl_from_IGraphConfig(iface);
|
2008-06-23 22:15:46 +02:00
|
|
|
HRESULT hr;
|
2005-08-17 11:52:15 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, callback %p, context %p, flags %#lx, abort_event %p.\n",
|
|
|
|
graph, callback, context, flags, abort_event);
|
2008-06-23 22:15:46 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
if (abort_event)
|
2008-06-23 22:15:46 +02:00
|
|
|
FIXME("The parameter hAbortEvent is not handled!\n");
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
EnterCriticalSection(&graph->cs);
|
2008-06-23 22:15:46 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
hr = IGraphConfigCallback_Reconfigure(callback, context, flags);
|
2008-06-23 22:15:46 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
LeaveCriticalSection(&graph->cs);
|
2008-06-23 22:15:46 +02:00
|
|
|
|
|
|
|
return hr;
|
2005-08-17 11:52:15 +02:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:53:54 +02:00
|
|
|
static HRESULT WINAPI GraphConfig_AddFilterToCache(IGraphConfig *iface, IBaseFilter *pFilter)
|
2005-08-17 11:52:15 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IGraphConfig(iface);
|
2005-08-17 11:52:15 +02:00
|
|
|
|
|
|
|
FIXME("(%p)->(%p): stub!\n", This, pFilter);
|
2011-06-30 00:53:54 +02:00
|
|
|
|
2005-08-17 11:52:15 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:53:54 +02:00
|
|
|
static HRESULT WINAPI GraphConfig_EnumCacheFilter(IGraphConfig *iface, IEnumFilters **pEnum)
|
2005-08-17 11:52:15 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IGraphConfig(iface);
|
2005-08-17 11:52:15 +02:00
|
|
|
|
|
|
|
FIXME("(%p)->(%p): stub!\n", This, pEnum);
|
2011-06-30 00:53:54 +02:00
|
|
|
|
2005-08-17 11:52:15 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:53:54 +02:00
|
|
|
static HRESULT WINAPI GraphConfig_RemoveFilterFromCache(IGraphConfig *iface, IBaseFilter *pFilter)
|
2005-08-17 11:52:15 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IGraphConfig(iface);
|
2005-08-17 11:52:15 +02:00
|
|
|
|
|
|
|
FIXME("(%p)->(%p): stub!\n", This, pFilter);
|
2011-06-30 00:53:54 +02:00
|
|
|
|
2005-08-17 11:52:15 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:53:54 +02:00
|
|
|
static HRESULT WINAPI GraphConfig_GetStartTime(IGraphConfig *iface, REFERENCE_TIME *prtStart)
|
2005-08-17 11:52:15 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IGraphConfig(iface);
|
2005-08-17 11:52:15 +02:00
|
|
|
|
|
|
|
FIXME("(%p)->(%p): stub!\n", This, prtStart);
|
2011-06-30 00:53:54 +02:00
|
|
|
|
2005-08-17 11:52:15 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:53:54 +02:00
|
|
|
static HRESULT WINAPI GraphConfig_PushThroughData(IGraphConfig *iface, IPin *pOutputPin,
|
|
|
|
IPinConnection *pConnection, HANDLE hEventAbort)
|
2005-08-17 11:52:15 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IGraphConfig(iface);
|
2005-08-17 11:52:15 +02:00
|
|
|
|
|
|
|
FIXME("(%p)->(%p, %p, %p): stub!\n", This, pOutputPin, pConnection, hEventAbort);
|
2011-06-30 00:53:54 +02:00
|
|
|
|
2005-08-17 11:52:15 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
static HRESULT WINAPI GraphConfig_SetFilterFlags(IGraphConfig *iface, IBaseFilter *filter, DWORD flags)
|
2005-08-17 11:52:15 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
struct filter_graph *graph = impl_from_IGraphConfig(iface);
|
2005-08-17 11:52:15 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
FIXME("graph %p, filter %p, flags %#lx, stub!\n", graph, filter, flags);
|
2011-06-30 00:53:54 +02:00
|
|
|
|
2005-08-17 11:52:15 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-06-30 00:53:54 +02:00
|
|
|
static HRESULT WINAPI GraphConfig_GetFilterFlags(IGraphConfig *iface, IBaseFilter *pFilter,
|
|
|
|
DWORD *dwFlags)
|
2005-08-17 11:52:15 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *This = impl_from_IGraphConfig(iface);
|
2005-08-17 11:52:15 +02:00
|
|
|
|
|
|
|
FIXME("(%p)->(%p, %p): stub!\n", This, pFilter, dwFlags);
|
2011-06-30 00:53:54 +02:00
|
|
|
|
2005-08-17 11:52:15 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
static HRESULT WINAPI GraphConfig_RemoveFilterEx(IGraphConfig *iface, IBaseFilter *filter, DWORD flags)
|
2005-08-17 11:52:15 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
struct filter_graph *graph = impl_from_IGraphConfig(iface);
|
2005-08-17 11:52:15 +02:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
FIXME("graph %p, filter %p, flags %#lx, stub!\n", graph, filter, flags);
|
2011-06-30 00:53:54 +02:00
|
|
|
|
2005-08-17 11:52:15 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IGraphConfigVtbl IGraphConfig_VTable =
|
|
|
|
{
|
|
|
|
GraphConfig_QueryInterface,
|
|
|
|
GraphConfig_AddRef,
|
|
|
|
GraphConfig_Release,
|
|
|
|
GraphConfig_Reconnect,
|
|
|
|
GraphConfig_Reconfigure,
|
|
|
|
GraphConfig_AddFilterToCache,
|
|
|
|
GraphConfig_EnumCacheFilter,
|
|
|
|
GraphConfig_RemoveFilterFromCache,
|
|
|
|
GraphConfig_GetStartTime,
|
|
|
|
GraphConfig_PushThroughData,
|
|
|
|
GraphConfig_SetFilterFlags,
|
|
|
|
GraphConfig_GetFilterFlags,
|
|
|
|
GraphConfig_RemoveFilterEx
|
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IGraphVersion(IGraphVersion *iface)
|
2013-02-19 15:56:17 +01:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IGraphVersion_iface);
|
2013-02-19 15:56:17 +01:00
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static HRESULT WINAPI GraphVersion_QueryInterface(IGraphVersion *iface, REFIID iid, void **out)
|
2013-02-19 15:56:17 +01:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IGraphVersion(iface);
|
2013-02-19 15:56:17 +01:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
2013-02-19 15:56:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI GraphVersion_AddRef(IGraphVersion *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IGraphVersion(iface);
|
2013-02-19 15:56:17 +01:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
2013-02-19 15:56:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI GraphVersion_Release(IGraphVersion *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IGraphVersion(iface);
|
2013-02-19 15:56:17 +01:00
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
2013-02-19 15:56:17 +01:00
|
|
|
}
|
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
static HRESULT WINAPI GraphVersion_QueryVersion(IGraphVersion *iface, LONG *version)
|
2013-02-19 15:56:17 +01:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
struct filter_graph *graph = impl_from_IGraphVersion(iface);
|
2013-02-19 15:56:17 +01:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
TRACE("graph %p, version %p, returning %ld.\n", graph, version, graph->version);
|
2013-02-19 15:56:17 +01:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
if (!version)
|
|
|
|
return E_POINTER;
|
2013-02-19 16:15:20 +01:00
|
|
|
|
2022-02-04 22:41:27 +01:00
|
|
|
*version = graph->version;
|
2013-02-19 16:15:20 +01:00
|
|
|
return S_OK;
|
2013-02-19 15:56:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IGraphVersionVtbl IGraphVersion_VTable =
|
|
|
|
{
|
|
|
|
GraphVersion_QueryInterface,
|
|
|
|
GraphVersion_AddRef,
|
|
|
|
GraphVersion_Release,
|
|
|
|
GraphVersion_QueryVersion,
|
|
|
|
};
|
|
|
|
|
2020-07-14 00:37:16 +02:00
|
|
|
static struct filter_graph *impl_from_IVideoFrameStep(IVideoFrameStep *iface)
|
2020-06-08 17:17:22 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct filter_graph, IVideoFrameStep_iface);
|
2020-06-08 17:17:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoFrameStep_QueryInterface(IVideoFrameStep *iface, REFIID iid, void **out)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IVideoFrameStep(iface);
|
2020-06-08 17:17:22 +02:00
|
|
|
return IUnknown_QueryInterface(graph->outer_unk, iid, out);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI VideoFrameStep_AddRef(IVideoFrameStep *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IVideoFrameStep(iface);
|
2020-06-08 17:17:22 +02:00
|
|
|
return IUnknown_AddRef(graph->outer_unk);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI VideoFrameStep_Release(IVideoFrameStep *iface)
|
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *graph = impl_from_IVideoFrameStep(iface);
|
2020-06-08 17:17:22 +02:00
|
|
|
return IUnknown_Release(graph->outer_unk);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoFrameStep_Step(IVideoFrameStep *iface, DWORD frame_count, IUnknown *filter)
|
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
FIXME("iface %p, frame_count %lu, filter %p, stub!\n", iface, frame_count, filter);
|
2020-06-08 17:17:22 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoFrameStep_CanStep(IVideoFrameStep *iface, LONG multiple, IUnknown *filter)
|
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
FIXME("iface %p, multiple %ld, filter %p, stub!\n", iface, multiple, filter);
|
2020-06-08 17:17:22 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoFrameStep_CancelStep(IVideoFrameStep *iface)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, stub!\n", iface);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IVideoFrameStepVtbl VideoFrameStep_vtbl =
|
|
|
|
{
|
|
|
|
VideoFrameStep_QueryInterface,
|
|
|
|
VideoFrameStep_AddRef,
|
|
|
|
VideoFrameStep_Release,
|
|
|
|
VideoFrameStep_Step,
|
|
|
|
VideoFrameStep_CanStep,
|
|
|
|
VideoFrameStep_CancelStep
|
|
|
|
};
|
|
|
|
|
2007-12-21 05:38:59 +01:00
|
|
|
static const IUnknownVtbl IInner_VTable =
|
|
|
|
{
|
|
|
|
FilterGraphInner_QueryInterface,
|
|
|
|
FilterGraphInner_AddRef,
|
|
|
|
FilterGraphInner_Release
|
|
|
|
};
|
|
|
|
|
2020-03-12 03:10:10 +01:00
|
|
|
static HRESULT filter_graph_common_create(IUnknown *outer, IUnknown **out, BOOL threaded)
|
2005-05-05 11:50:35 +02:00
|
|
|
{
|
2020-07-14 00:37:16 +02:00
|
|
|
struct filter_graph *object;
|
2004-11-19 19:17:27 +01:00
|
|
|
HRESULT hr;
|
2003-06-13 20:06:44 +02:00
|
|
|
|
2019-10-03 05:01:06 +02:00
|
|
|
*out = NULL;
|
2004-10-18 23:21:19 +02:00
|
|
|
|
2020-07-14 00:37:15 +02:00
|
|
|
if (!(object = calloc(1, sizeof(*object))))
|
|
|
|
return E_OUTOFMEMORY;
|
2008-07-17 19:24:24 +02:00
|
|
|
|
2020-07-14 00:37:15 +02:00
|
|
|
object->IBasicAudio_iface.lpVtbl = &IBasicAudio_VTable;
|
|
|
|
object->IBasicVideo2_iface.lpVtbl = &IBasicVideo_VTable;
|
|
|
|
object->IFilterGraph2_iface.lpVtbl = &IFilterGraph2_VTable;
|
|
|
|
object->IGraphConfig_iface.lpVtbl = &IGraphConfig_VTable;
|
|
|
|
object->IGraphVersion_iface.lpVtbl = &IGraphVersion_VTable;
|
|
|
|
object->IMediaControl_iface.lpVtbl = &IMediaControl_VTable;
|
|
|
|
object->IMediaEventEx_iface.lpVtbl = &IMediaEventEx_VTable;
|
|
|
|
object->IMediaEventSink_iface.lpVtbl = &IMediaEventSink_VTable;
|
|
|
|
object->IMediaFilter_iface.lpVtbl = &IMediaFilter_VTable;
|
|
|
|
object->IMediaPosition_iface.lpVtbl = &IMediaPosition_VTable;
|
|
|
|
object->IMediaSeeking_iface.lpVtbl = &IMediaSeeking_VTable;
|
|
|
|
object->IObjectWithSite_iface.lpVtbl = &IObjectWithSite_VTable;
|
|
|
|
object->IUnknown_inner.lpVtbl = &IInner_VTable;
|
|
|
|
object->IVideoFrameStep_iface.lpVtbl = &VideoFrameStep_vtbl;
|
|
|
|
object->IVideoWindow_iface.lpVtbl = &IVideoWindow_VTable;
|
|
|
|
object->ref = 1;
|
|
|
|
object->outer_unk = outer ? outer : &object->IUnknown_inner;
|
|
|
|
|
|
|
|
if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, object->outer_unk,
|
|
|
|
CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&object->punkFilterMapper2)))
|
2019-10-03 05:01:06 +02:00
|
|
|
{
|
2022-02-04 22:41:27 +01:00
|
|
|
ERR("Failed to create filter mapper, hr %#lx.\n", hr);
|
2020-07-14 00:37:15 +02:00
|
|
|
free(object);
|
|
|
|
return hr;
|
2019-10-03 05:01:06 +02:00
|
|
|
}
|
|
|
|
|
2020-07-14 00:37:15 +02:00
|
|
|
InitializeCriticalSection(&object->cs);
|
2020-07-14 00:37:16 +02:00
|
|
|
object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": filter_graph.cs");
|
2021-04-10 18:45:35 +02:00
|
|
|
InitializeCriticalSection(&object->event_cs);
|
|
|
|
object->event_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": filter_graph.event_cs");
|
2012-07-02 00:56:13 +02:00
|
|
|
|
2020-07-14 00:37:15 +02:00
|
|
|
object->defaultclock = TRUE;
|
2021-02-18 23:58:10 +01:00
|
|
|
|
|
|
|
object->media_event_handle = CreateEventW(NULL, TRUE, FALSE, NULL);
|
|
|
|
list_init(&object->media_events);
|
2020-07-14 00:37:15 +02:00
|
|
|
list_init(&object->filters);
|
|
|
|
object->HandleEcClockChanged = TRUE;
|
|
|
|
object->HandleEcComplete = TRUE;
|
|
|
|
object->HandleEcRepaint = TRUE;
|
|
|
|
object->hEventCompletion = CreateEventW(0, TRUE, FALSE, 0);
|
2021-02-18 23:58:10 +01:00
|
|
|
|
2020-07-14 00:37:15 +02:00
|
|
|
object->name_index = 1;
|
|
|
|
object->timeformatseek = TIME_FORMAT_MEDIA_TIME;
|
2008-07-17 19:24:24 +02:00
|
|
|
|
2020-07-14 00:37:15 +02:00
|
|
|
if (threaded)
|
|
|
|
{
|
|
|
|
object->message_thread_ret = CreateEventW(NULL, FALSE, FALSE, NULL);
|
|
|
|
object->message_thread = CreateThread(NULL, 0, message_thread_run, object, 0, &object->message_thread_id);
|
|
|
|
WaitForSingleObject(object->message_thread_ret, INFINITE);
|
2004-11-19 19:17:27 +01:00
|
|
|
}
|
2020-07-14 00:37:15 +02:00
|
|
|
else
|
|
|
|
object->message_thread = NULL;
|
2004-11-19 19:17:27 +01:00
|
|
|
|
2020-07-14 00:37:15 +02:00
|
|
|
TRACE("Created %sthreaded filter graph %p.\n", threaded ? "" : "non-", object);
|
|
|
|
*out = &object->IUnknown_inner;
|
2003-06-13 20:06:44 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
2005-05-05 11:50:35 +02:00
|
|
|
|
2020-03-12 03:10:10 +01:00
|
|
|
HRESULT filter_graph_create(IUnknown *outer, IUnknown **out)
|
2005-05-05 11:50:35 +02:00
|
|
|
{
|
2019-10-03 05:01:06 +02:00
|
|
|
return filter_graph_common_create(outer, out, TRUE);
|
|
|
|
}
|
|
|
|
|
2020-03-12 03:10:10 +01:00
|
|
|
HRESULT filter_graph_no_thread_create(IUnknown *outer, IUnknown **out)
|
2019-10-03 05:01:06 +02:00
|
|
|
{
|
|
|
|
return filter_graph_common_create(outer, out, FALSE);
|
2005-05-05 11:50:35 +02:00
|
|
|
}
|