1 /* WinRT Windows.Media Closed Captions Implementation
3 * Copyright (C) 2022 Mohamad Al-Jaf
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/debug.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(media
);
26 const char *debugstr_hstring( HSTRING hstr
)
30 if (hstr
&& !((ULONG_PTR
)hstr
>> 16)) return "(invalid)";
31 str
= WindowsGetStringRawBuffer( hstr
, &len
);
32 return wine_dbgstr_wn( str
, len
);
35 struct captions_statics
37 IActivationFactory IActivationFactory_iface
;
38 IClosedCaptionPropertiesStatics IClosedCaptionPropertiesStatics_iface
;
42 static inline struct captions_statics
*impl_from_IActivationFactory( IActivationFactory
*iface
)
44 return CONTAINING_RECORD( iface
, struct captions_statics
, IActivationFactory_iface
);
47 static HRESULT WINAPI
factory_QueryInterface( IActivationFactory
*iface
, REFIID iid
, void **out
)
49 struct captions_statics
*impl
= impl_from_IActivationFactory( iface
);
51 TRACE( "iface %p, iid %s, out %p.\n", iface
, debugstr_guid( iid
), out
);
53 if (IsEqualGUID( iid
, &IID_IUnknown
) ||
54 IsEqualGUID( iid
, &IID_IInspectable
) ||
55 IsEqualGUID( iid
, &IID_IActivationFactory
))
57 *out
= &impl
->IActivationFactory_iface
;
58 IInspectable_AddRef( *out
);
62 if (IsEqualGUID( iid
, &IID_IClosedCaptionPropertiesStatics
))
64 *out
= &impl
->IClosedCaptionPropertiesStatics_iface
;
65 IInspectable_AddRef( *out
);
69 FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid
) );
74 static ULONG WINAPI
factory_AddRef( IActivationFactory
*iface
)
76 struct captions_statics
*impl
= impl_from_IActivationFactory( iface
);
77 ULONG ref
= InterlockedIncrement( &impl
->ref
);
78 TRACE( "iface %p increasing refcount to %lu.\n", iface
, ref
);
82 static ULONG WINAPI
factory_Release( IActivationFactory
*iface
)
84 struct captions_statics
*impl
= impl_from_IActivationFactory( iface
);
85 ULONG ref
= InterlockedDecrement( &impl
->ref
);
86 TRACE( "iface %p decreasing refcount to %lu.\n", iface
, ref
);
90 static HRESULT WINAPI
factory_GetIids( IActivationFactory
*iface
, ULONG
*iid_count
, IID
**iids
)
92 FIXME( "iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
96 static HRESULT WINAPI
factory_GetRuntimeClassName( IActivationFactory
*iface
, HSTRING
*class_name
)
98 FIXME( "iface %p, class_name %p stub!\n", iface
, class_name
);
102 static HRESULT WINAPI
factory_GetTrustLevel( IActivationFactory
*iface
, TrustLevel
*trust_level
)
104 FIXME( "iface %p, trust_level %p stub!\n", iface
, trust_level
);
108 static HRESULT WINAPI
factory_ActivateInstance( IActivationFactory
*iface
, IInspectable
**instance
)
110 FIXME( "iface %p, instance %p stub!\n", iface
, instance
);
114 static const struct IActivationFactoryVtbl factory_vtbl
=
116 factory_QueryInterface
,
119 /* IInspectable methods */
121 factory_GetRuntimeClassName
,
122 factory_GetTrustLevel
,
123 /* IActivationFactory methods */
124 factory_ActivateInstance
,
127 DEFINE_IINSPECTABLE( captions
, IClosedCaptionPropertiesStatics
, struct captions_statics
, IActivationFactory_iface
)
129 static HRESULT WINAPI
captions_get_FontColor( IClosedCaptionPropertiesStatics
*iface
, ClosedCaptionColor
*value
)
131 FIXME( "iface %p, value %p semi-stub.\n", iface
, value
);
133 *value
= ClosedCaptionColor_Default
;
137 static HRESULT WINAPI
captions_get_ComputedFontColor( IClosedCaptionPropertiesStatics
*iface
, Color
*value
)
139 FIXME( "iface %p, value %p stub!\n", iface
, value
);
143 static HRESULT WINAPI
captions_get_FontOpacity( IClosedCaptionPropertiesStatics
*iface
, ClosedCaptionOpacity
*value
)
145 FIXME( "iface %p, value %p semi-stub.\n", iface
, value
);
147 *value
= ClosedCaptionOpacity_Default
;
151 static HRESULT WINAPI
captions_get_FontSize( IClosedCaptionPropertiesStatics
*iface
, ClosedCaptionSize
*value
)
153 FIXME( "iface %p, value %p semi-stub.\n", iface
, value
);
155 *value
= ClosedCaptionSize_Default
;
159 static HRESULT WINAPI
captions_get_FontStyle( IClosedCaptionPropertiesStatics
*iface
, ClosedCaptionStyle
*value
)
161 FIXME( "iface %p, value %p semi-stub.\n", iface
, value
);
163 *value
= ClosedCaptionStyle_Default
;
167 static HRESULT WINAPI
captions_get_FontEffect( IClosedCaptionPropertiesStatics
*iface
, ClosedCaptionEdgeEffect
*value
)
169 FIXME( "iface %p, value %p semi-stub.\n", iface
, value
);
171 *value
= ClosedCaptionEdgeEffect_Default
;
175 static HRESULT WINAPI
captions_get_BackgroundColor( IClosedCaptionPropertiesStatics
*iface
, ClosedCaptionColor
*value
)
177 FIXME( "iface %p, value %p semi-stub.\n", iface
, value
);
179 *value
= ClosedCaptionColor_Default
;
183 static HRESULT WINAPI
captions_get_ComputedBackgroundColor( IClosedCaptionPropertiesStatics
*iface
, Color
*value
)
185 FIXME( "iface %p, value %p stub!\n", iface
, value
);
189 static HRESULT WINAPI
captions_get_BackgroundOpacity( IClosedCaptionPropertiesStatics
*iface
, ClosedCaptionOpacity
*value
)
191 FIXME( "iface %p, value %p semi-stub.\n", iface
, value
);
193 *value
= ClosedCaptionOpacity_Default
;
197 static HRESULT WINAPI
captions_get_RegionColor( IClosedCaptionPropertiesStatics
*iface
, ClosedCaptionColor
*value
)
199 FIXME( "iface %p, value %p semi-stub.\n", iface
, value
);
201 *value
= ClosedCaptionColor_Default
;
205 static HRESULT WINAPI
captions_get_ComputedRegionColor( IClosedCaptionPropertiesStatics
*iface
, Color
*value
)
207 FIXME( "iface %p, value %p stub!\n", iface
, value
);
211 static HRESULT WINAPI
captions_get_RegionOpacity( IClosedCaptionPropertiesStatics
*iface
, ClosedCaptionOpacity
*value
)
213 FIXME( "iface %p, value %p semi-stub.\n", iface
, value
);
215 *value
= ClosedCaptionOpacity_Default
;
219 static const struct IClosedCaptionPropertiesStaticsVtbl captions_statics_vtbl
=
221 captions_QueryInterface
,
224 /* IInspectable methods */
226 captions_GetRuntimeClassName
,
227 captions_GetTrustLevel
,
228 /* IClosedCaptionPropertiesStatics methods */
229 captions_get_FontColor
,
230 captions_get_ComputedFontColor
,
231 captions_get_FontOpacity
,
232 captions_get_FontSize
,
233 captions_get_FontStyle
,
234 captions_get_FontEffect
,
235 captions_get_BackgroundColor
,
236 captions_get_ComputedBackgroundColor
,
237 captions_get_BackgroundOpacity
,
238 captions_get_RegionColor
,
239 captions_get_ComputedRegionColor
,
240 captions_get_RegionOpacity
,
243 static struct captions_statics captions_statics
=
246 {&captions_statics_vtbl
},
250 IActivationFactory
*captions_factory
= &captions_statics
.IActivationFactory_iface
;