From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Needed by Chromium-based browsers. --- v2: - Add property prefixes to function names. - Rename captions_vtbl to captions_statics_vtbl. -- v3: - Remove () from fixme messages. - Match parameter name in fixme message to function parameter. - Remove error checks. --- dlls/windows.media/captions.c | 107 ++++++++++++++++++++++++++++ dlls/windows.media/private.h | 40 +++++++++++ dlls/windows.media/tests/captions.c | 11 +++ 3 files changed, 158 insertions(+)
diff --git a/dlls/windows.media/captions.c b/dlls/windows.media/captions.c index 212039d18ad..2e68948209e 100644 --- a/dlls/windows.media/captions.c +++ b/dlls/windows.media/captions.c @@ -35,6 +35,7 @@ const char *debugstr_hstring( HSTRING hstr ) struct captions_statics { IActivationFactory IActivationFactory_iface; + IClosedCaptionPropertiesStatics IClosedCaptionPropertiesStatics_iface; LONG ref; };
@@ -58,6 +59,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_IClosedCaptionPropertiesStatics )) + { + *out = &impl->IClosedCaptionPropertiesStatics_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -116,9 +124,108 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+DEFINE_IINSPECTABLE( captions, IClosedCaptionPropertiesStatics, struct captions_statics, IActivationFactory_iface ) + +static HRESULT WINAPI captions_get_FontColor( IClosedCaptionPropertiesStatics *iface, ClosedCaptionColor *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI captions_get_ComputedFontColor( IClosedCaptionPropertiesStatics *iface, Color *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI captions_get_FontOpacity( IClosedCaptionPropertiesStatics *iface, ClosedCaptionOpacity *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI captions_get_FontSize( IClosedCaptionPropertiesStatics *iface, ClosedCaptionSize *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI captions_get_FontStyle( IClosedCaptionPropertiesStatics *iface, ClosedCaptionStyle *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI captions_get_FontEffect( IClosedCaptionPropertiesStatics *iface, ClosedCaptionEdgeEffect *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI captions_get_BackgroundColor( IClosedCaptionPropertiesStatics *iface, ClosedCaptionColor *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI captions_get_ComputedBackgroundColor( IClosedCaptionPropertiesStatics *iface, Color *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI captions_get_BackgroundOpacity( IClosedCaptionPropertiesStatics *iface, ClosedCaptionOpacity *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI captions_get_RegionColor( IClosedCaptionPropertiesStatics *iface, ClosedCaptionColor *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI captions_get_ComputedRegionColor( IClosedCaptionPropertiesStatics *iface, Color *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI captions_get_RegionOpacity( IClosedCaptionPropertiesStatics *iface, ClosedCaptionOpacity *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static const struct IClosedCaptionPropertiesStaticsVtbl captions_statics_vtbl = +{ + captions_QueryInterface, + captions_AddRef, + captions_Release, + /* IInspectable methods */ + captions_GetIids, + captions_GetRuntimeClassName, + captions_GetTrustLevel, + /* IClosedCaptionPropertiesStatics methods */ + captions_get_FontColor, + captions_get_ComputedFontColor, + captions_get_FontOpacity, + captions_get_FontSize, + captions_get_FontStyle, + captions_get_FontEffect, + captions_get_BackgroundColor, + captions_get_ComputedBackgroundColor, + captions_get_BackgroundOpacity, + captions_get_RegionColor, + captions_get_ComputedRegionColor, + captions_get_RegionOpacity, +}; + static struct captions_statics captions_statics = { {&factory_vtbl}, + {&captions_statics_vtbl}, 1, };
diff --git a/dlls/windows.media/private.h b/dlls/windows.media/private.h index defe56006fb..d6353dede56 100644 --- a/dlls/windows.media/private.h +++ b/dlls/windows.media/private.h @@ -32,6 +32,8 @@ #define WIDL_using_Windows_Foundation #define WIDL_using_Windows_Foundation_Collections #include "windows.foundation.h" +#define WIDL_using_Windows_UI +#include "windows.ui.h" #define WIDL_using_Windows_Media_ClosedCaptioning #include "windows.media.closedcaptioning.h"
@@ -39,4 +41,42 @@ extern const char *debugstr_hstring( HSTRING hstr );
extern IActivationFactory *captions_factory;
+#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ + static inline impl_type *impl_from( iface_type *iface ) \ + { \ + return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ + } \ + static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ + } \ + static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_AddRef( (IInspectable *)(expr) ); \ + } \ + static ULONG WINAPI pfx##_Release( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_Release( (IInspectable *)(expr) ); \ + } \ + static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ + } \ + static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ + } \ + static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ + } +#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ + DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) + #endif diff --git a/dlls/windows.media/tests/captions.c b/dlls/windows.media/tests/captions.c index db67c0891f6..b1e1f4fd334 100644 --- a/dlls/windows.media/tests/captions.c +++ b/dlls/windows.media/tests/captions.c @@ -25,6 +25,11 @@
#include "roapi.h"
+#define WIDL_using_Windows_Foundation +#include "windows.foundation.h" +#define WIDL_using_Windows_Media_ClosedCaptioning +#include "windows.media.closedcaptioning.h" + #include "wine/test.h"
#define check_interface( obj, iid, exp ) check_interface_( __LINE__, obj, iid, exp ) @@ -45,6 +50,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid, BOOL static void test_CaptionStatics(void) { static const WCHAR *caption_properties_name = L"Windows.Media.ClosedCaptioning.ClosedCaptionProperties"; + IClosedCaptionPropertiesStatics *caption_statics; IActivationFactory *factory; HSTRING str; HRESULT hr; @@ -66,6 +72,11 @@ static void test_CaptionStatics(void) check_interface( factory, &IID_IInspectable, TRUE ); check_interface( factory, &IID_IAgileObject, FALSE );
+ hr = IActivationFactory_QueryInterface( factory, &IID_IClosedCaptionPropertiesStatics, (void **)&caption_statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = IClosedCaptionPropertiesStatics_Release( caption_statics ); + ok( ref == 2, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref ); }