[vlc-commits] [Git][videolan/vlc][master] 11 commits: direct3d11: avoid using GetAddressOf with ComPtr
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Tue Mar 1 13:26:10 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
6d074c10 by Steve Lhomme at 2022-03-01T13:07:04+00:00
direct3d11: avoid using GetAddressOf with ComPtr
It's better not to use it when reference counting is not involved. Otherwise
operator& and ReleaseAndGetAddressOf() are better.
And use ComPtr::As() rather than interface::QueryInterface() to avoid using
GetAddressOf.
- - - - -
4a0e6ab0 by Steve Lhomme at 2022-03-01T13:07:04+00:00
vout: dxgi_swapchain: avoid using GetAddressOf with ComPtr
It's better not to use it when reference counting is not involved. Otherwise
operator& and ReleaseAndGetAddressOf() are better.
- - - - -
89dae28f by Steve Lhomme at 2022-03-01T13:07:04+00:00
mft: avoid using GetAddressOf with ComPtr
It's better not to use it when reference counting is not involved. Otherwise
operator& and ReleaseAndGetAddressOf() are better.
And use ComPtr::As() rather than interface::QueryInterface() to avoid using
GetAddressOf.
- - - - -
b3b46f42 by Steve Lhomme at 2022-03-01T13:07:04+00:00
win32: sensors: avoid using GetAddressOf with ComPtr
It's better not to use it when reference counting is not involved. Otherwise
operator& and ReleaseAndGetAddressOf() are better.
- - - - -
396635bf by Steve Lhomme at 2022-03-01T13:07:04+00:00
freetype: avoid using GetAddressOf with ComPtr
It's better not to use it when reference counting is not involved. Otherwise
operator& and ReleaseAndGetAddressOf() are better.
- - - - -
ea357b3f by Steve Lhomme at 2022-03-01T13:07:04+00:00
freetype: factorize the code calling DWriteCreateFactory
Either from direct pointer from the DLL, or via GetProcAddress.
- - - - -
eca4944d by Steve Lhomme at 2022-03-01T13:07:04+00:00
qt/CompositorDComp: avoid using GetAddressOf with ComPtr
It's better not to use it when reference counting is not involved. Otherwise
operator& and ReleaseAndGetAddressOf() are better.
And use ComPtr::As() rather than interface::QueryInterface() to avoid using
GetAddressOf.
- - - - -
74210ad1 by Steve Lhomme at 2022-03-01T13:07:04+00:00
access:dshow: avoid using GetAddressOf with ComPtr
It's better not to use it when reference counting is not involved. Otherwise
operator& and ReleaseAndGetAddressOf() are better.
And use ComPtr::As() rather than interface::QueryInterface() to avoid using
GetAddressOf.
- - - - -
2c363e75 by Steve Lhomme at 2022-03-01T13:07:04+00:00
access:dshow: more ComPtr usage
Pass some ComPtr as reference to avoid using .Get() and losing the ComPtr helpers.
Factorize some code to get the tv tuner interface.
- - - - -
365d4173 by Steve Lhomme at 2022-03-01T13:07:04+00:00
access:dshow: misc code cleaning
Now FindCaptureDevice always returns p_base_filter.
Fix some dirty casts.
- - - - -
abe95feb by Steve Lhomme at 2022-03-01T13:07:04+00:00
access: dshow: use __uuidof() instead of direct type GUID
IID_PPV_ARGS would be a lot cleaner though
Some uuidof are not always present in various mingw-w64 so we use their IID directly.
- - - - -
15 changed files:
- modules/access/dshow/access.h
- modules/access/dshow/crossbar.cpp
- modules/access/dshow/dshow.cpp
- modules/codec/mft.cpp
- modules/gui/qt/maininterface/compositor_dcomp.cpp
- modules/gui/qt/maininterface/compositor_dcomp_acrylicsurface.cpp
- modules/gui/qt/maininterface/compositor_dcomp_acrylicsurface.hpp
- modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
- modules/text_renderer/freetype/fonts/dwrite.cpp
- modules/video_output/win32/d3d11_quad.cpp
- modules/video_output/win32/d3d11_shaders.cpp
- modules/video_output/win32/d3d11_swapchain.cpp
- modules/video_output/win32/direct3d11.cpp
- modules/video_output/win32/dxgi_swapchain.cpp
- modules/video_output/win32/sensors.cpp
Changes:
=====================================
modules/access/dshow/access.h
=====================================
@@ -54,7 +54,7 @@ struct access_sys_t;
void DeleteCrossbarRoutes( access_sys_t * );
HRESULT FindCrossbarRoutes( vlc_object_t *, access_sys_t *,
- IPin *, LONG, int = 0 );
+ ComPtr<IPin> &, LONG, int = 0 );
/****************************************************************************
* Access descriptor declaration
=====================================
modules/access/dshow/crossbar.cpp
=====================================
@@ -30,10 +30,7 @@
#include <vlc_common.h>
-#ifndef _MSC_VER
- /* Work-around a bug in w32api-2.5 */
-# define QACONTAINERFLAGS QACONTAINERFLAGS_ANOTHERSOMETHINGELSE
-#endif
+#include <assert.h>
#include "access.h"
#include "vlc_dshow.h"
@@ -89,8 +86,8 @@ void DeleteCrossbarRoutes( access_sys_t *p_sys )
/*****************************************************************************
* RouteCrossbars (Does not AddRef the returned *Pin)
*****************************************************************************/
-static HRESULT GetCrossbarIPinAtIndex( IAMCrossbar *pXbar, LONG PinIndex,
- BOOL IsInputPin, ComPtr<IPin>* ppPin )
+static HRESULT GetCrossbarIPinAtIndex( ComPtr<IAMCrossbar> & pXbar, LONG PinIndex,
+ BOOL IsInputPin, ComPtr<IPin> & pin )
{
LONG cntInPins, cntOutPins;
ComPtr<IPin> pP;
@@ -98,37 +95,35 @@ static HRESULT GetCrossbarIPinAtIndex( IAMCrossbar *pXbar, LONG PinIndex,
ComPtr<IEnumPins> pins;
ULONG n;
- if( !pXbar || !ppPin ) return E_POINTER;
-
if( S_OK != pXbar->get_PinCounts(&cntOutPins, &cntInPins) ) return E_FAIL;
LONG TrueIndex = IsInputPin ? PinIndex : PinIndex + cntInPins;
- if( pXbar->QueryInterface(IID_IBaseFilter, (void **)pFilter.GetAddressOf()) == S_OK )
+ if( pXbar.As(&pFilter) == S_OK )
{
- if( SUCCEEDED(pFilter->EnumPins(pins.GetAddressOf())) )
+ if( SUCCEEDED(pFilter->EnumPins(&pins)) )
{
LONG i = 0;
- while( pins->Next(1, pP.ReleaseAndGetAddressOf(), &n) == S_OK )
+ while( pins->Next(1, &pP, &n) == S_OK )
{
if( i == TrueIndex )
{
- *ppPin = pP;
- break;
+ pin = pP;
+ return S_OK;
}
i++;
}
}
}
- return *ppPin ? S_OK : E_FAIL;
+ return E_FAIL;
}
/*****************************************************************************
* GetCrossbarIndexFromIPin: Find corresponding index of an IPin on a crossbar
*****************************************************************************/
-static HRESULT GetCrossbarIndexFromIPin( IAMCrossbar * pXbar, LONG * PinIndex,
- BOOL IsInputPin, IPin * pPin )
+static HRESULT GetCrossbarIndexFromIPin( ComPtr<IAMCrossbar> & pXbar, LONG * PinIndex,
+ BOOL IsInputPin, ComPtr<IPin> & pPin )
{
LONG cntInPins, cntOutPins;
ComPtr<IPin> pP;
@@ -137,21 +132,20 @@ static HRESULT GetCrossbarIndexFromIPin( IAMCrossbar * pXbar, LONG * PinIndex,
ULONG n;
BOOL fOK = FALSE;
- if(!pXbar || !PinIndex || !pPin )
- return E_POINTER;
+ assert(!PinIndex);
if( S_OK != pXbar->get_PinCounts(&cntOutPins, &cntInPins) )
return E_FAIL;
- if( pXbar->QueryInterface(IID_IBaseFilter, (void **)pFilter.GetAddressOf()) == S_OK )
+ if( pXbar.As(&pFilter) == S_OK )
{
if( SUCCEEDED(pFilter->EnumPins(&pins)) )
{
LONG i=0;
- while( pins->Next(1, pP.ReleaseAndGetAddressOf(), &n) == S_OK )
+ while( pins->Next(1, &pP, &n) == S_OK )
{
- if( pPin == pP.Get() )
+ if( pPin.Get() == pP.Get() )
{
*PinIndex = IsInputPin ? i : i - cntInPins;
fOK = TRUE;
@@ -169,12 +163,12 @@ static HRESULT GetCrossbarIndexFromIPin( IAMCrossbar * pXbar, LONG * PinIndex,
* FindCrossbarRoutes
*****************************************************************************/
HRESULT FindCrossbarRoutes( vlc_object_t *p_this, access_sys_t *p_sys,
- IPin *p_input_pin, LONG physicalType, int depth )
+ ComPtr<IPin> & p_input_pin, LONG physicalType, int depth )
{
HRESULT result = S_FALSE;
ComPtr<IPin> p_output_pin;
- if( FAILED(p_input_pin->ConnectedTo(p_output_pin.GetAddressOf())) ) return S_FALSE;
+ if( FAILED(p_input_pin->ConnectedTo(&p_output_pin)) ) return S_FALSE;
// It is connected, so now find out if the filter supports IAMCrossbar
PIN_INFO pinInfo;
@@ -185,8 +179,7 @@ HRESULT FindCrossbarRoutes( vlc_object_t *p_this, access_sys_t *p_sys,
}
ComPtr<IAMCrossbar> pXbar;
- if( FAILED(pinInfo.pFilter->QueryInterface(IID_IAMCrossbar,
- (void **)pXbar.GetAddressOf())) )
+ if( FAILED(pinInfo.pFilter->QueryInterface(__uuidof(pXbar.Get()), &pXbar)) )
{
pinInfo.pFilter->Release();
return S_FALSE;
@@ -202,8 +195,8 @@ HRESULT FindCrossbarRoutes( vlc_object_t *p_this, access_sys_t *p_sys,
LONG inputPinIndexRelated, outputPinIndexRelated;
LONG inputPinPhysicalType = 0, outputPinPhysicalType;
LONG inputPinIndex = 0, outputPinIndex;
- if( FAILED(GetCrossbarIndexFromIPin( pXbar.Get(), &outputPinIndex,
- FALSE, p_output_pin.Get() )) ||
+ if( FAILED(GetCrossbarIndexFromIPin( pXbar, &outputPinIndex,
+ FALSE, p_output_pin )) ||
FAILED(pXbar->get_CrossbarPinInfo( FALSE, outputPinIndex,
&outputPinIndexRelated,
&outputPinPhysicalType )) )
@@ -259,10 +252,10 @@ HRESULT FindCrossbarRoutes( vlc_object_t *p_this, access_sys_t *p_sys,
ComPtr<IPin> pPin;
- if( FAILED(GetCrossbarIPinAtIndex( pXbar.Get(), inputPinIndex,
- TRUE, &pPin ) ) ) continue;
+ if( FAILED(GetCrossbarIPinAtIndex( pXbar, inputPinIndex,
+ TRUE, pPin ) ) ) continue;
- result = FindCrossbarRoutes( p_this, p_sys, pPin.Get(),
+ result = FindCrossbarRoutes( p_this, p_sys, pPin,
physicalType, depth+1 );
if( S_OK == result || (S_FALSE == result &&
=====================================
modules/access/dshow/dshow.cpp
=====================================
@@ -65,19 +65,19 @@ static int DemuxControl( demux_t *, int, va_list );
static int OpenDevice( vlc_object_t *, access_sys_t *, std::string, bool );
static ComPtr<IBaseFilter> FindCaptureDevice( vlc_object_t *, std::string *,
std::list<std::string> *, bool );
-static size_t EnumDeviceCaps( vlc_object_t *, IBaseFilter *,
+static size_t EnumDeviceCaps( vlc_object_t *, ComPtr<IBaseFilter> &,
int, int, int, int, int, int,
AM_MEDIA_TYPE *mt, size_t, bool );
static bool ConnectFilters( vlc_object_t *, access_sys_t *,
- IBaseFilter *, CaptureFilter * );
+ ComPtr<IBaseFilter> &, ComPtr<CaptureFilter> & );
-static void ShowPropertyPage( IUnknown * );
-static void ShowDeviceProperties( vlc_object_t *, ICaptureGraphBuilder2 *,
- IBaseFilter *, bool );
-static void ShowTunerProperties( vlc_object_t *, ICaptureGraphBuilder2 *,
- IBaseFilter *, bool );
-static void ConfigTuner( vlc_object_t *, ICaptureGraphBuilder2 *,
- IBaseFilter * );
+static void ShowPropertyPageO( ComPtr<IUnknown> & );
+static void ShowDeviceProperties( vlc_object_t *, ComPtr<ICaptureGraphBuilder2> &,
+ ComPtr<IBaseFilter> &, bool );
+static void ShowTunerProperties( vlc_object_t *, ComPtr<ICaptureGraphBuilder2> &,
+ ComPtr<IBaseFilter> &, bool );
+static void ConfigTuner( vlc_object_t *, ComPtr<ICaptureGraphBuilder2> &,
+ ComPtr<IBaseFilter> & );
/*****************************************************************************
* Module descriptor
@@ -273,6 +273,13 @@ struct ComContext
}
};
+template<typename T>
+static void ShowPropertyPage( ComPtr<T> & t )
+{
+ ComPtr<IUnknown> obj(t);
+ ShowPropertyPageO(obj);
+}
+
/*****************************************************************************
* DirectShow elementary stream descriptor
*****************************************************************************/
@@ -307,19 +314,17 @@ static void CreateDirectShowGraph( access_sys_t *p_sys )
/* Create directshow filter graph */
if( SUCCEEDED( CoCreateInstance( CLSID_FilterGraph, 0, CLSCTX_INPROC,
- (REFIID)IID_IFilterGraph, (void**)p_sys->p_graph.GetAddressOf() ) ) )
+ __uuidof(p_sys->p_graph.Get()), &p_sys->p_graph ) ) )
{
/* Create directshow capture graph builder if available */
if( SUCCEEDED( CoCreateInstance( CLSID_CaptureGraphBuilder2, 0,
- CLSCTX_INPROC, (REFIID)IID_ICaptureGraphBuilder2,
- (void**)p_sys->p_capture_graph_builder2.GetAddressOf() ) ) )
+ CLSCTX_INPROC, __uuidof(p_sys->p_capture_graph_builder2.Get()), &p_sys->p_capture_graph_builder2 ) ) )
{
p_sys->p_capture_graph_builder2->
- SetFiltergraph((IGraphBuilder *)p_sys->p_graph.Get() );
+ SetFiltergraph(static_cast<IGraphBuilder *>(p_sys->p_graph.Get()) );
}
- p_sys->p_graph->QueryInterface( IID_IMediaControl,
- (void**)p_sys->p_control.GetAddressOf() );
+ p_sys->p_graph.As( &p_sys->p_control );
}
}
@@ -519,8 +524,8 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
{
/* FIXME: we do MEDIATYPE_Stream here so we don't do
* it twice. */
- ShowTunerProperties( p_this, p_sys->p_capture_graph_builder2.Get(),
- p_stream->p_device_filter.Get(), 0 );
+ ShowTunerProperties( p_this, p_sys->p_capture_graph_builder2,
+ p_stream->p_device_filter, 0 );
}
}
}
@@ -562,7 +567,7 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
if( i_val >= 0 )
p_sys->crossbar_routes[i].AudioOutputIndex = i_val;
- IAMCrossbar *pXbar = p_sys->crossbar_routes[i].pXbar.Get();
+ ComPtr<IAMCrossbar> pXbar = p_sys->crossbar_routes[i].pXbar;
LONG VideoInputIndex = p_sys->crossbar_routes[i].VideoInputIndex;
LONG VideoOutputIndex = p_sys->crossbar_routes[i].VideoOutputIndex;
LONG AudioInputIndex = p_sys->crossbar_routes[i].AudioInputIndex;
@@ -597,13 +602,12 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
{
for( int i = p_sys->i_crossbar_route_depth-1; i >= 0 ; --i )
{
- IAMCrossbar *pXbar = p_sys->crossbar_routes[i].pXbar.Get();
+ ComPtr<IAMCrossbar> & pXbar = p_sys->crossbar_routes[i].pXbar;
ComPtr<IBaseFilter> p_XF;
- if( SUCCEEDED( pXbar->QueryInterface( IID_IBaseFilter,
- (void**)p_XF.ReleaseAndGetAddressOf() ) ) )
+ if( SUCCEEDED( pXbar.As( &p_XF ) ) )
{
- ShowPropertyPage( p_XF.Get() );
+ ShowPropertyPage( p_XF );
}
}
}
@@ -854,8 +858,8 @@ static void DemuxClose( vlc_object_t *p_this )
* ConnectFilters
****************************************************************************/
static bool ConnectFilters( vlc_object_t *p_this, access_sys_t *p_sys,
- IBaseFilter *p_filter,
- CaptureFilter *p_capture_filter )
+ ComPtr<IBaseFilter> & p_filter,
+ ComPtr<CaptureFilter> & p_capture_filter )
{
ComPtr<CapturePin> p_input_pin = p_capture_filter->CustomGetPin();
@@ -865,7 +869,7 @@ static bool ConnectFilters( vlc_object_t *p_this, access_sys_t *p_sys,
{
if( FAILED(p_sys->p_capture_graph_builder2->
RenderStream( &PIN_CATEGORY_CAPTURE, &mediaType.majortype,
- p_filter, 0, (IBaseFilter *)p_capture_filter )) )
+ p_filter.Get(), 0, p_capture_filter.Get() )) )
{
return false;
}
@@ -875,7 +879,7 @@ static bool ConnectFilters( vlc_object_t *p_this, access_sys_t *p_sys,
ComPtr<IEnumPins> pins;
if( ( mediaType.majortype == MEDIATYPE_Video ||
mediaType.majortype == MEDIATYPE_Stream ) &&
- SUCCEEDED(p_filter->EnumPins(pins.GetAddressOf())) )
+ SUCCEEDED(p_filter->EnumPins(&pins)) )
{
ComPtr<IPin> pP;
ULONG n;
@@ -884,15 +888,14 @@ static bool ConnectFilters( vlc_object_t *p_this, access_sys_t *p_sys,
GUID guid;
DWORD dw;
- while( !Found && ( S_OK == pins->Next(1, pP.ReleaseAndGetAddressOf(), &n) ) )
+ while( !Found && ( S_OK == pins->Next(1, &pP, &n) ) )
{
if( S_OK == pP->QueryPinInfo(&pinInfo) )
{
ComPtr<IKsPropertySet> pKs;
// is this pin an ANALOGVIDEOIN input pin?
if( pinInfo.dir == PINDIR_INPUT &&
- pP->QueryInterface( IID_IKsPropertySet,
- (void**)pKs.GetAddressOf() ) == S_OK )
+ pP.As( &pKs ) == S_OK )
{
if( pKs->Get( AMPROPSETID_Pin,
AMPROPERTY_PIN_CATEGORY, NULL, 0,
@@ -901,7 +904,7 @@ static bool ConnectFilters( vlc_object_t *p_this, access_sys_t *p_sys,
if( guid == PIN_CATEGORY_ANALOGVIDEOIN )
{
// recursively search crossbar routes
- FindCrossbarRoutes( p_this, p_sys, pP.Get(), 0 );
+ FindCrossbarRoutes( p_this, p_sys, pP, 0 );
// found it
Found = TRUE;
}
@@ -921,9 +924,9 @@ static bool ConnectFilters( vlc_object_t *p_this, access_sys_t *p_sys,
ComPtr<IEnumPins> p_enumpins;
ComPtr<IPin> p_pin;
- if( S_OK != p_filter->EnumPins( p_enumpins.GetAddressOf() ) ) return false;
+ if( S_OK != p_filter->EnumPins( &p_enumpins ) ) return false;
- while( S_OK == p_enumpins->Next( 1, p_pin.ReleaseAndGetAddressOf(), NULL ) )
+ while( S_OK == p_enumpins->Next( 1, &p_pin, NULL ) )
{
PIN_DIRECTION pin_dir;
p_pin->QueryDirection( &pin_dir );
@@ -982,7 +985,7 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
wchar_t *pwsz_devicename = ToWide( devicename.c_str() );
if( likely( pwsz_devicename ) )
- p_sys->p_graph->FindFilterByName( pwsz_devicename, p_device_filter.GetAddressOf() );
+ p_sys->p_graph->FindFilterByName( pwsz_devicename, &p_device_filter );
free( pwsz_devicename );
@@ -1042,9 +1045,10 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
wchar_t *pwsz_devicename = ToWide( devicename.c_str() );
if( likely( pwsz_devicename ) )
+ {
hr = p_sys->p_graph->AddFilter( p_device_filter.Get(), pwsz_devicename );
-
- free( pwsz_devicename );
+ free( pwsz_devicename );
+ }
if( FAILED( hr ) )
{
@@ -1056,7 +1060,7 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
// Retrieve acceptable media types supported by device
AM_MEDIA_TYPE media_types[MAX_MEDIA_TYPES];
size_t media_count =
- EnumDeviceCaps( p_this, p_device_filter.Get(), b_audio ? 0 : p_sys->i_chroma,
+ EnumDeviceCaps( p_this, p_device_filter, b_audio ? 0 : p_sys->i_chroma,
p_sys->i_width, p_sys->i_height,
b_audio ? var_CreateGetInteger( p_this, "dshow-audio-channels" ) : 0,
b_audio ? var_CreateGetInteger( p_this, "dshow-audio-samplerate" ) : 0,
@@ -1113,7 +1117,7 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
/* Attempt to connect one of this device's capture output pins */
msg_Dbg( p_this, "connecting filters" );
- if( ConnectFilters( p_this, p_sys, p_device_filter.Get(), p_capture_filter.Get() ) )
+ if( ConnectFilters( p_this, p_sys, p_device_filter, p_capture_filter ) )
{
/* Success */
msg_Dbg( p_this, "filters connected successfully !" );
@@ -1129,19 +1133,19 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
* the proper parameters. */
if( var_GetBool( p_this, "dshow-config" ) )
{
- ShowDeviceProperties( p_this, p_sys->p_capture_graph_builder2.Get(),
- p_device_filter.Get(), b_audio );
+ ShowDeviceProperties( p_this, p_sys->p_capture_graph_builder2,
+ p_device_filter, b_audio );
}
- ConfigTuner( p_this, p_sys->p_capture_graph_builder2.Get(),
- p_device_filter.Get() );
+ ConfigTuner( p_this, p_sys->p_capture_graph_builder2,
+ p_device_filter );
if( var_GetBool( p_this, "dshow-tuner" ) &&
dshow_stream.mt.majortype != MEDIATYPE_Stream )
{
/* FIXME: we do MEDIATYPE_Stream later so we don't do it twice. */
- ShowTunerProperties( p_this, p_sys->p_capture_graph_builder2.Get(),
- p_device_filter.Get(), b_audio );
+ ShowTunerProperties( p_this, p_sys->p_capture_graph_builder2,
+ p_device_filter, b_audio );
}
dshow_stream.mt =
@@ -1216,7 +1220,7 @@ FindCaptureDevice( vlc_object_t *p_this, std::string *p_devicename,
ComPtr<ICreateDevEnum> p_dev_enum;
hr = CoCreateInstance( CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
- IID_ICreateDevEnum, (void**)p_dev_enum.GetAddressOf() );
+ __uuidof(p_dev_enum.Get()), &p_dev_enum );
if( FAILED(hr) )
{
msg_Err( p_this, "failed to create the device enumerator (0x%lX)", hr);
@@ -1227,10 +1231,10 @@ FindCaptureDevice( vlc_object_t *p_this, std::string *p_devicename,
ComPtr<IEnumMoniker> p_class_enum;
if( !b_audio )
hr = p_dev_enum->CreateClassEnumerator( CLSID_VideoInputDeviceCategory,
- p_class_enum.GetAddressOf(), 0 );
+ &p_class_enum, 0 );
else
hr = p_dev_enum->CreateClassEnumerator( CLSID_AudioInputDeviceCategory,
- p_class_enum.GetAddressOf(), 0 );
+ &p_class_enum, 0 );
if( FAILED(hr) )
{
msg_Err( p_this, "failed to create the class enumerator (0x%lX)", hr );
@@ -1239,7 +1243,7 @@ FindCaptureDevice( vlc_object_t *p_this, std::string *p_devicename,
/* If there are no enumerators for the requested type, then
* CreateClassEnumerator will succeed, but p_class_enum will be NULL */
- if( p_class_enum == NULL )
+ if( !p_class_enum )
{
msg_Err( p_this, "no %s capture device was detected", ( b_audio ? "audio" : "video" ) );
return p_base_filter;
@@ -1251,12 +1255,11 @@ FindCaptureDevice( vlc_object_t *p_this, std::string *p_devicename,
* it will return S_FALSE (which is not a failure). Therefore, we check
* that the return code is S_OK instead of using SUCCEEDED() macro. */
- while( p_class_enum->Next( 1, p_moniker.ReleaseAndGetAddressOf(), &i_fetched ) == S_OK )
+ while( p_class_enum->Next( 1, &p_moniker, &i_fetched ) == S_OK )
{
/* Getting the property page to get the device name */
ComPtr<IPropertyBag> p_bag;
- hr = p_moniker->BindToStorage( 0, 0, IID_IPropertyBag,
- (void**)p_bag.GetAddressOf() );
+ hr = p_moniker->BindToStorage( 0, 0, __uuidof(p_bag.Get()), &p_bag );
if( SUCCEEDED(hr) )
{
VARIANT var;
@@ -1292,13 +1295,12 @@ FindCaptureDevice( vlc_object_t *p_this, std::string *p_devicename,
{
msg_Dbg( p_this, "asked for %s, binding to %s", p_devicename->c_str() , devname.c_str() ) ;
/* NULL possibly means we don't need BindMoniker BindCtx ?? */
- hr = p_moniker->BindToObject( NULL, 0, IID_IBaseFilter,
- (void**)p_base_filter.GetAddressOf() );
+ hr = p_moniker->BindToObject( NULL, 0, __uuidof(p_base_filter.Get()), &p_base_filter );
if( FAILED(hr) )
{
msg_Err( p_this, "couldn't bind moniker to filter "
"object (0x%lX)", hr );
- return NULL;
+ p_base_filter.Reset();
}
return p_base_filter;
}
@@ -1313,7 +1315,7 @@ FindCaptureDevice( vlc_object_t *p_this, std::string *p_devicename,
return p_base_filter;
}
-static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
+static size_t EnumDeviceCaps( vlc_object_t *p_this, ComPtr<IBaseFilter> &p_filter,
int i_fourcc, int i_width, int i_height,
int i_channels, int i_samplespersec,
int i_bitspersample, AM_MEDIA_TYPE *mt,
@@ -1329,13 +1331,13 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
if( r_fps )
i_AvgTimePerFrame = 10000000000LL/(LONGLONG)(r_fps*1000.0f);
- if( FAILED(p_filter->EnumPins( p_enumpins.GetAddressOf() )) )
+ if( FAILED(p_filter->EnumPins( &p_enumpins )) )
{
msg_Dbg( p_this, "EnumDeviceCaps failed: no pin enumeration !");
return 0;
}
- while( S_OK == p_enumpins->Next( 1, p_output_pin.ReleaseAndGetAddressOf(), NULL ) )
+ while( S_OK == p_enumpins->Next( 1, &p_output_pin, NULL ) )
{
PIN_INFO info;
@@ -1350,7 +1352,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
p_enumpins->Reset();
- while( !mt_count && p_enumpins->Next( 1, p_output_pin.ReleaseAndGetAddressOf(), NULL ) == S_OK )
+ while( !mt_count && p_enumpins->Next( 1, &p_output_pin, NULL ) == S_OK )
{
PIN_INFO info;
@@ -1369,19 +1371,18 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
*/
ComPtr<IAMStreamConfig> pSC;
- if( SUCCEEDED(p_output_pin->QueryInterface( IID_IAMStreamConfig,
- (void**)pSC.GetAddressOf() )) )
+ if( SUCCEEDED(p_output_pin.As(&pSC)) )
{
int piCount, piSize;
if( SUCCEEDED(pSC->GetNumberOfCapabilities(&piCount, &piSize)) )
{
- BYTE *pSCC= (BYTE *)CoTaskMemAlloc(piSize);
+ void *pSCC= CoTaskMemAlloc(piSize);
if( NULL != pSCC )
{
int i_priority = ES_PRIORITY_NOT_DEFAULTABLE;
for( int i=0; i<piCount; ++i )
{
- if( SUCCEEDED(pSC->GetStreamCaps(i, &p_mt, pSCC)) )
+ if( SUCCEEDED(pSC->GetStreamCaps(i, &p_mt, static_cast<BYTE*>(pSCC))) )
{
int i_current_fourcc = GetFourCCFromMediaType( *p_mt );
int i_current_priority = GetFourCCPriority(i_current_fourcc);
@@ -1398,7 +1399,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
if( !b_audio && MEDIATYPE_Video == p_mt->majortype
&& FORMAT_VideoInfo == p_mt->formattype )
{
- VIDEO_STREAM_CONFIG_CAPS *pVSCC = reinterpret_cast<VIDEO_STREAM_CONFIG_CAPS*>(pSCC);
+ VIDEO_STREAM_CONFIG_CAPS *pVSCC = static_cast<VIDEO_STREAM_CONFIG_CAPS*>(pSCC);
VIDEOINFOHEADER *pVih = reinterpret_cast<VIDEOINFOHEADER*>(p_mt->pbFormat);
if( i_AvgTimePerFrame )
@@ -1474,7 +1475,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
else if( b_audio && p_mt->majortype == MEDIATYPE_Audio
&& p_mt->formattype == FORMAT_WaveFormatEx )
{
- AUDIO_STREAM_CONFIG_CAPS *pASCC = reinterpret_cast<AUDIO_STREAM_CONFIG_CAPS*>(pSCC);
+ AUDIO_STREAM_CONFIG_CAPS *pASCC = static_cast<AUDIO_STREAM_CONFIG_CAPS*>(pSCC);
WAVEFORMATEX *pWfx = reinterpret_cast<WAVEFORMATEX*>(p_mt->pbFormat);
if( i_current_fourcc && (WAVE_FORMAT_PCM == pWfx->wFormatTag) )
@@ -1558,7 +1559,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
CoTaskMemFree( (PVOID)p_mt );
}
}
- CoTaskMemFree( (LPVOID)pSCC );
+ CoTaskMemFree( pSCC );
if( i_priority >= ES_PRIORITY_SELECTABLE_MIN )
msg_Dbg( p_this, "EnumDeviceCaps: input pin default format configured");
}
@@ -1569,7 +1570,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
** Probe pin for available medias (may be a previously configured one)
*/
- if( FAILED( p_output_pin->EnumMediaTypes( p_enummt.ReleaseAndGetAddressOf() ) ) )
+ if( FAILED( p_output_pin->EnumMediaTypes( &p_enummt ) ) )
{
continue;
}
@@ -1631,8 +1632,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
/* Setup a few properties like the audio latency */
ComPtr<IAMBufferNegotiation> p_ambuf;
- if( SUCCEEDED( p_output_pin->QueryInterface(
- IID_IAMBufferNegotiation, (void **)p_ambuf.GetAddressOf() ) ) )
+ if( SUCCEEDED( p_output_pin->QueryInterface( IID_IAMBufferNegotiation, &p_ambuf ) ) )
{
ALLOCATOR_PROPERTIES AllocProp;
AllocProp.cbAlign = -1;
@@ -1977,15 +1977,14 @@ static int AppendAudioEnabledVDevs( vlc_object_t *p_this, std::list<std::string>
ComPtr<IGraphBuilder> p_gbuilder;
ComPtr<ICaptureGraphBuilder2> p_cgbuilder;
- if( FAILED( CoCreateInstance( CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IFilterGraph,
- ( void ** ) p_graph.GetAddressOf() ) ) )
+ if( FAILED( CoCreateInstance( CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, __uuidof(p_graph.Get()), &p_graph ) ) )
return VLC_EGENERIC;
- if( FAILED( p_graph->QueryInterface( IID_IGraphBuilder, ( void ** ) p_gbuilder.GetAddressOf() ) ) )
+ if( FAILED( p_graph.As( &p_gbuilder ) ) )
return VLC_EGENERIC;
if( FAILED( CoCreateInstance( CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC_SERVER,
- IID_ICaptureGraphBuilder2, ( void ** ) p_cgbuilder.GetAddressOf() ) ) )
+ __uuidof(p_cgbuilder.Get()), &p_cgbuilder ) ) )
return VLC_EGENERIC;
if( FAILED( p_cgbuilder->SetFiltergraph( p_gbuilder.Get() ) ) )
@@ -2005,7 +2004,7 @@ static int AppendAudioEnabledVDevs( vlc_object_t *p_this, std::list<std::string>
continue;
if( SUCCEEDED( p_cgbuilder->FindPin( p_device.Get(), PINDIR_OUTPUT, NULL, &MEDIATYPE_Audio,
- true, 0, p_pin.GetAddressOf() ) ) )
+ true, 0, &p_pin ) ) )
audio_list.push_back( *iter );
p_gbuilder->RemoveFilter( p_device.Get() );
@@ -2074,13 +2073,12 @@ VLC_CONFIG_STRING_ENUM(FindDevices)
* Properties
*****************************************************************************/
-static void ShowPropertyPage( IUnknown *obj )
+static void ShowPropertyPageO( ComPtr<IUnknown> & obj )
{
ComPtr<ISpecifyPropertyPages> p_spec;
CAUUID cauuid;
- HRESULT hr = obj->QueryInterface( IID_ISpecifyPropertyPages,
- (void **)p_spec.GetAddressOf() );
+ HRESULT hr = obj.As( &p_spec );
if( FAILED(hr) ) return;
if( SUCCEEDED(p_spec->GetPages( &cauuid )) )
@@ -2098,8 +2096,8 @@ static void ShowPropertyPage( IUnknown *obj )
}
static void ShowDeviceProperties( vlc_object_t *p_this,
- ICaptureGraphBuilder2 *p_graph,
- IBaseFilter *p_device_filter,
+ ComPtr<ICaptureGraphBuilder2> & p_graph,
+ ComPtr<IBaseFilter> & p_device_filter,
bool b_audio )
{
HRESULT hr;
@@ -2120,11 +2118,11 @@ static void ShowDeviceProperties( vlc_object_t *p_this,
msg_Dbg( p_this, "showing WDM Audio Configuration Pages" );
hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE,
- &MEDIATYPE_Audio, p_device_filter,
- IID_IAMStreamConfig, (void **)p_SC.GetAddressOf() );
+ &MEDIATYPE_Audio, p_device_filter.Get(),
+ __uuidof(p_SC.Get()), &p_SC );
if( SUCCEEDED(hr) )
{
- ShowPropertyPage(p_SC.Get());
+ ShowPropertyPage(p_SC);
}
/*
@@ -2132,11 +2130,11 @@ static void ShowDeviceProperties( vlc_object_t *p_this,
*/
ComPtr<IAMTVAudio> p_TVA;
hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE,
- &MEDIATYPE_Audio, p_device_filter,
- IID_IAMTVAudio, (void **)p_TVA.GetAddressOf() );
+ &MEDIATYPE_Audio, p_device_filter.Get(),
+ IID_IAMTVAudio, &p_TVA );
if( SUCCEEDED(hr) )
{
- ShowPropertyPage(p_TVA.Get());
+ ShowPropertyPage(p_TVA);
}
}
@@ -2150,65 +2148,74 @@ static void ShowDeviceProperties( vlc_object_t *p_this,
msg_Dbg( p_this, "showing WDM Video Configuration Pages" );
hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE,
- &MEDIATYPE_Interleaved, p_device_filter,
- IID_IAMStreamConfig, (void **)p_SC.GetAddressOf() );
+ &MEDIATYPE_Interleaved, p_device_filter.Get(),
+ __uuidof(p_SC.Get()), &p_SC );
if( FAILED(hr) )
{
hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE,
- &MEDIATYPE_Video, p_device_filter,
- IID_IAMStreamConfig, (void **)p_SC.GetAddressOf() );
+ &MEDIATYPE_Video, p_device_filter.Get(),
+ __uuidof(p_SC.Get()), &p_SC );
}
if( FAILED(hr) )
{
hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE,
- &MEDIATYPE_Stream, p_device_filter,
- IID_IAMStreamConfig, (void **)p_SC.GetAddressOf() );
+ &MEDIATYPE_Stream, p_device_filter.Get(),
+ __uuidof(p_SC.Get()), &p_SC );
}
if( SUCCEEDED(hr) )
{
- ShowPropertyPage(p_SC.Get());
+ ShowPropertyPage(p_SC);
}
}
}
+static HRESULT GetCaptureTVTuner(ComPtr<ICaptureGraphBuilder2> & p_graph,
+ ComPtr<IBaseFilter> & p_device_filter,
+ ComPtr<IAMTVTuner> & p_TV)
+{
+ HRESULT hr;
+ hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE,
+ &MEDIATYPE_Interleaved, p_device_filter.Get(),
+ IID_IAMTVTuner, &p_TV );
+ if( SUCCEEDED(hr) )
+ goto done;
+
+ hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE,
+ &MEDIATYPE_Video, p_device_filter.Get(),
+ IID_IAMTVTuner, &p_TV );
+ if( SUCCEEDED(hr) )
+ goto done;
+
+ hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE,
+ &MEDIATYPE_Stream, p_device_filter.Get(),
+ IID_IAMTVTuner, &p_TV );
+ if( SUCCEEDED(hr) )
+ goto done;
+
+done:
+ return hr;
+}
+
static void ShowTunerProperties( vlc_object_t *p_this,
- ICaptureGraphBuilder2 *p_graph,
- IBaseFilter *p_device_filter,
+ ComPtr<ICaptureGraphBuilder2> & p_graph,
+ ComPtr<IBaseFilter> & p_device_filter,
bool b_audio )
{
- HRESULT hr;
msg_Dbg( p_this, "configuring Tuner Properties" );
if( !p_graph || b_audio ) return;
ComPtr<IAMTVTuner> p_TV;
- hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE,
- &MEDIATYPE_Interleaved, p_device_filter,
- IID_IAMTVTuner, (void **)p_TV.GetAddressOf() );
- if( FAILED(hr) )
+ if (SUCCEEDED(GetCaptureTVTuner(p_graph, p_device_filter, p_TV)))
{
- hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE,
- &MEDIATYPE_Video, p_device_filter,
- IID_IAMTVTuner, (void **)p_TV.GetAddressOf() );
- }
-
- if( FAILED(hr) )
- {
- hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE,
- &MEDIATYPE_Stream, p_device_filter,
- IID_IAMTVTuner, (void **)p_TV.GetAddressOf() );
- }
-
- if( SUCCEEDED(hr) )
- {
- ShowPropertyPage(p_TV.Get());
+ ShowPropertyPage(p_TV);
}
}
-static void ConfigTuner( vlc_object_t *p_this, ICaptureGraphBuilder2 *p_graph,
- IBaseFilter *p_device_filter )
+static void ConfigTuner( vlc_object_t *p_this, ComPtr<ICaptureGraphBuilder2> & p_graph,
+ ComPtr<IBaseFilter> & p_device_filter )
{
int i_channel, i_country, i_input, i_amtuner_mode;
long l_modes = 0;
@@ -2227,24 +2234,7 @@ static void ConfigTuner( vlc_object_t *p_this, ICaptureGraphBuilder2 *p_graph,
msg_Dbg( p_this, "tuner config: channel %i, country %i, input type %i",
i_channel, i_country, i_input );
- hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved,
- p_device_filter, IID_IAMTVTuner,
- (void **)p_TV.GetAddressOf() );
- if( FAILED(hr) )
- {
- hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video,
- p_device_filter, IID_IAMTVTuner,
- (void **)p_TV.GetAddressOf() );
- }
-
- if( FAILED(hr) )
- {
- hr = p_graph->FindInterface( &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Stream,
- p_device_filter, IID_IAMTVTuner,
- (void **)p_TV.GetAddressOf() );
- }
-
- if( FAILED(hr) )
+ if (FAILED(GetCaptureTVTuner(p_graph, p_device_filter, p_TV)))
{
msg_Dbg( p_this, "couldn't find tuner interface" );
return;
=====================================
modules/codec/mft.cpp
=====================================
@@ -343,7 +343,7 @@ static int SetInputType(decoder_t *p_dec, DWORD stream_id, ComPtr<IMFMediaType>
bool found = false;
for (int i = 0; !found; ++i)
{
- hr = p_sys->mft->GetInputAvailableType(stream_id, i, input_media_type.GetAddressOf());
+ hr = p_sys->mft->GetInputAvailableType(stream_id, i, &input_media_type);
if (hr == MF_E_NO_MORE_TYPES)
break;
else if (hr == MF_E_TRANSFORM_TYPE_NOT_SET)
@@ -370,7 +370,7 @@ static int SetInputType(decoder_t *p_dec, DWORD stream_id, ComPtr<IMFMediaType>
if (!found)
goto error;
- hr = p_sys->mft->GetInputAvailableType(stream_id, input_type_index, input_media_type.GetAddressOf());
+ hr = p_sys->mft->GetInputAvailableType(stream_id, input_type_index, &input_media_type);
if (FAILED(hr))
goto error;
@@ -476,7 +476,7 @@ static int SetOutputType(decoder_t *p_dec, DWORD stream_id)
bool found = false;
for (int i = 0; !found; ++i)
{
- hr = p_sys->mft->GetOutputAvailableType(stream_id, i, output_media_type.GetAddressOf());
+ hr = p_sys->mft->GetOutputAvailableType(stream_id, i, &output_media_type);
if (hr == MF_E_NO_MORE_TYPES)
break;
else if (hr == MF_E_TRANSFORM_TYPE_NOT_SET)
@@ -525,7 +525,7 @@ static int SetOutputType(decoder_t *p_dec, DWORD stream_id)
* by the MFT */
output_type_index = 0;
- hr = p_sys->mft->GetOutputAvailableType(stream_id, output_type_index, output_media_type.GetAddressOf());
+ hr = p_sys->mft->GetOutputAvailableType(stream_id, output_type_index, &output_media_type);
if (FAILED(hr))
goto error;
@@ -602,12 +602,12 @@ static int AllocateInputSample(decoder_t *p_dec, DWORD stream_id, ComPtr<IMFSamp
if (FAILED(hr))
goto error;
- hr = MFCreateSample(input_sample.GetAddressOf());
+ hr = MFCreateSample(&input_sample);
if (FAILED(hr))
goto error;
allocation_size = __MAX(input_info.cbSize, size);
- hr = MFCreateMemoryBuffer(allocation_size, input_media_buffer.GetAddressOf());
+ hr = MFCreateMemoryBuffer(allocation_size, &input_media_buffer);
if (FAILED(hr))
goto error;
@@ -658,16 +658,16 @@ static int AllocateOutputSample(decoder_t *p_dec, DWORD stream_id, ComPtr<IMFSam
goto error;
}
- hr = MFCreateSample(output_sample.GetAddressOf());
+ hr = MFCreateSample(&output_sample);
if (FAILED(hr))
goto error;
allocation_size = output_info.cbSize;
alignment = output_info.cbAlignment;
if (alignment > 0)
- hr = MFCreateAlignedMemoryBuffer(allocation_size, alignment - 1, output_media_buffer.GetAddressOf());
+ hr = MFCreateAlignedMemoryBuffer(allocation_size, alignment - 1, &output_media_buffer);
else
- hr = MFCreateMemoryBuffer(allocation_size, output_media_buffer.GetAddressOf());
+ hr = MFCreateMemoryBuffer(allocation_size, &output_media_buffer);
if (FAILED(hr))
goto error;
@@ -715,7 +715,7 @@ static int ProcessInputStream(decoder_t *p_dec, DWORD stream_id, block_t *p_bloc
if (AllocateInputSample(p_dec, stream_id, input_sample, alloc_size))
goto error;
- hr = input_sample->GetBufferByIndex(0, input_media_buffer.GetAddressOf());
+ hr = input_sample->GetBufferByIndex(0, &input_media_buffer);
if (FAILED(hr))
goto error;
@@ -900,7 +900,7 @@ static int ProcessOutputStream(decoder_t *p_dec, DWORD stream_id, bool & keep_re
{
picture_t *picture = NULL;
ComPtr<IMFMediaBuffer> output_media_buffer;
- hr = output_sample->GetBufferByIndex(buf_index, output_media_buffer.GetAddressOf());
+ hr = output_sample->GetBufferByIndex(buf_index, &output_media_buffer);
if (FAILED(hr))
goto error;
@@ -1162,7 +1162,7 @@ static HRESULT DequeueMediaEvent(decoder_t *p_dec)
HRESULT hr;
ComPtr<IMFMediaEvent> event;
- hr = p_sys->event_generator->GetEvent(MF_EVENT_FLAG_NO_WAIT, event.GetAddressOf());
+ hr = p_sys->event_generator->GetEvent(MF_EVENT_FLAG_NO_WAIT, &event);
if (FAILED(hr))
return hr;
MediaEventType event_type;
@@ -1291,7 +1291,7 @@ static int SetD3D11(decoder_t *p_dec, d3d11_device_t *d3d_dev)
{
mft_dec_sys_t *p_sys = static_cast<mft_dec_sys_t*>(p_dec->p_sys);
HRESULT hr;
- hr = p_sys->fptr_MFCreateDXGIDeviceManager(&p_sys->dxgi_token, p_sys->dxgi_manager.GetAddressOf());
+ hr = p_sys->fptr_MFCreateDXGIDeviceManager(&p_sys->dxgi_token, &p_sys->dxgi_manager);
if (FAILED(hr))
return VLC_EGENERIC;
@@ -1316,7 +1316,7 @@ static int InitializeMFT(decoder_t *p_dec)
HRESULT hr;
ComPtr<IMFAttributes> attributes;
- hr = p_sys->mft->GetAttributes(attributes.GetAddressOf());
+ hr = p_sys->mft->GetAttributes(&attributes);
if (hr != E_NOTIMPL && FAILED(hr))
goto error;
if (SUCCEEDED(hr))
=====================================
modules/gui/qt/maininterface/compositor_dcomp.cpp
=====================================
@@ -149,7 +149,7 @@ bool CompositorDirectComposition::preInit(qt_intf_t * p_intf)
requestedFeatureLevels,
ARRAY_SIZE(requestedFeatureLevels),
D3D11_SDK_VERSION,
- d3dDevice.GetAddressOf(),
+ &d3dDevice,
nullptr, // Actual feature level
nullptr);
@@ -227,7 +227,7 @@ bool CompositorDirectComposition::init()
requestedFeatureLevels,
ARRAY_SIZE(requestedFeatureLevels),
D3D11_SDK_VERSION,
- m_d3d11Device.GetAddressOf(),
+ &m_d3d11Device,
nullptr, // Actual feature level
nullptr);
=====================================
modules/gui/qt/maininterface/compositor_dcomp_acrylicsurface.cpp
=====================================
@@ -204,7 +204,7 @@ catch (std::exception &err)
return false;
}
-bool CompositorDCompositionAcrylicSurface::createDevice(ID3D11Device *device)
+bool CompositorDCompositionAcrylicSurface::createDevice(Microsoft::WRL::ComPtr<ID3D11Device> device)
try
{
QLibrary dcompDll("DCOMP.dll");
@@ -219,25 +219,25 @@ try
using namespace Microsoft::WRL;
ComPtr<IDXGIDevice> dxgiDevice;
- HR(device->QueryInterface(dxgiDevice.GetAddressOf()), "query dxgi device");
+ HR(device.As(&dxgiDevice), "query dxgi device");
ComPtr<IDCompositionDevice> dcompDevice1;
HR(myDCompositionCreateDevice3(
dxgiDevice.Get(),
__uuidof(IDCompositionDevice),
- (void**)dcompDevice1.GetAddressOf()), "create composition device");
+ &dcompDevice1), "create composition device");
- HR(dcompDevice1->QueryInterface(m_dcompDevice.GetAddressOf()), "dcompdevice not an IDCompositionDevice3");
+ HR(dcompDevice1.As(&m_dcompDevice), "dcompdevice not an IDCompositionDevice3");
- HR(m_dcompDevice->CreateVisual(m_rootVisual.GetAddressOf()), "create root visual");
+ HR(m_dcompDevice->CreateVisual(&m_rootVisual), "create root visual");
- HR(m_dcompDevice->CreateRectangleClip(m_rootClip.GetAddressOf()), "create root clip");
+ HR(m_dcompDevice->CreateRectangleClip(&m_rootClip), "create root clip");
- HR(m_dcompDevice->CreateTranslateTransform(m_translateTransform.GetAddressOf()), "create translate transform");
+ HR(m_dcompDevice->CreateTranslateTransform(&m_translateTransform), "create translate transform");
- HR(m_dcompDevice->CreateSaturationEffect(m_saturationEffect.GetAddressOf()), "create saturation effect");
+ HR(m_dcompDevice->CreateSaturationEffect(&m_saturationEffect), "create saturation effect");
- HR(m_dcompDevice->CreateGaussianBlurEffect(m_gaussianBlur.GetAddressOf()), "create gaussian effect");
+ HR(m_dcompDevice->CreateGaussianBlurEffect(&m_gaussianBlur), "create gaussian effect");
m_saturationEffect->SetSaturation(2);
@@ -275,7 +275,7 @@ try
thumbnail.rcSource = RECT{ 0, 0, desktopWidth, desktopHeight };
HTHUMBNAIL desktopThumbnail;
- HR(lDwmpCreateSharedThumbnailVisual(hwnd(), desktopWindow, 2, &thumbnail, m_dcompDevice.Get(), (void**)m_desktopVisual.GetAddressOf(), &desktopThumbnail), "create desktop visual");
+ HR(lDwmpCreateSharedThumbnailVisual(hwnd(), desktopWindow, 2, &thumbnail, m_dcompDevice.Get(), &m_desktopVisual, &desktopThumbnail), "create desktop visual");
HR(m_rootVisual->AddVisual(m_desktopVisual.Get(), FALSE, nullptr), "Add desktop visual");
return true;
@@ -307,7 +307,7 @@ try
lSetWindowCompositionAttribute(m_dummyWindow, &CompositionAttribute);
vlc_assert(!m_backHostVisual);
- HR(lDwmpCreateSharedMultiWindowVisual(m_dummyWindow, m_dcompDevice.Get(), (void**)m_backHostVisual.GetAddressOf(), &m_backHostThumbnail)
+ HR(lDwmpCreateSharedMultiWindowVisual(m_dummyWindow, m_dcompDevice.Get(), &m_backHostVisual, &m_backHostThumbnail)
, "failed to create shared multi visual");
updateVisual();
=====================================
modules/gui/qt/maininterface/compositor_dcomp_acrylicsurface.hpp
=====================================
@@ -183,7 +183,7 @@ protected:
private:
bool init(ID3D11Device *device);
bool loadFunctions();
- bool createDevice(ID3D11Device *device);
+ bool createDevice(Microsoft::WRL::ComPtr<ID3D11Device> device);
bool createDesktopVisual();
bool createBackHostVisual();
=====================================
modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
=====================================
@@ -185,14 +185,14 @@ bool CompositorDCompositionUISurface::init()
msg_Err(m_intf, "failed to retrieve egl device");
return false;
}
- ID3D11Device* d3dDevice = nullptr;
- eglRet = eglQueryDeviceAttribEXT(m_eglDevice, EGL_D3D11_DEVICE_ANGLE, reinterpret_cast<EGLAttrib*>(&d3dDevice));
+ ComPtr<ID3D11Device> d3dDevice;
+ eglRet = eglQueryDeviceAttribEXT(m_eglDevice, EGL_D3D11_DEVICE_ANGLE, reinterpret_cast<EGLAttrib*>(static_cast<void**>(&d3dDevice)));
if (!eglRet || !d3dDevice)
{
msg_Err(m_intf, "failed to retrieve egl device");
return false;
}
- HR(d3dDevice->QueryInterface(__uuidof(ID3D11Device1), (void **)(m_qtd3dDevice1.GetAddressOf())));
+ HR(d3dDevice.As(&m_qtd3dDevice1));
m_uiOffscreenSurface = new QOffscreenSurface();
m_uiOffscreenSurface->setFormat(format);;
=====================================
modules/text_renderer/freetype/fonts/dwrite.cpp
=====================================
@@ -57,30 +57,28 @@ struct dw_sys_t
dw_sys_t( HMODULE p_dw_dll ) : p_dw_dll( p_dw_dll )
{
/* This will fail on versions of Windows prior to 8.1 */
+ DWriteCreateFactoryProc pf;
#ifdef VLC_WINSTORE_APP
- if( DWriteCreateFactory( DWRITE_FACTORY_TYPE_SHARED, __uuidof( IDWriteFactory2 ),
- reinterpret_cast<IUnknown **>( p_dw_factory.GetAddressOf() ) ) )
- throw runtime_error( "failed to create DWrite factory" );
+ pf = DWriteCreateFactory;
#else
- DWriteCreateFactoryProc pf =
- ( DWriteCreateFactoryProc ) GetProcAddress( p_dw_dll, "DWriteCreateFactory" );
+ pf = ( DWriteCreateFactoryProc ) GetProcAddress( p_dw_dll, "DWriteCreateFactory" );
if( pf == NULL )
throw runtime_error( "GetProcAddress() failed" );
+#endif
if( pf( DWRITE_FACTORY_TYPE_SHARED, __uuidof( IDWriteFactory2 ),
- reinterpret_cast<IUnknown **>( p_dw_factory.GetAddressOf() ) ) )
+ &p_dw_factory ) )
throw runtime_error( "failed to create DWrite factory" );
-#endif
- if( p_dw_factory->GetSystemFontCollection( p_dw_system_fonts.GetAddressOf() ) )
+ if( p_dw_factory->GetSystemFontCollection( &p_dw_system_fonts ) )
throw runtime_error( "GetSystemFontCollection() failed" );
- if( p_dw_factory->GetSystemFontFallback( p_dw_fallbacks.GetAddressOf() ) )
+ if( p_dw_factory->GetSystemFontFallback( &p_dw_fallbacks ) )
throw runtime_error( "GetSystemFontFallback() failed" );
if( p_dw_factory->CreateNumberSubstitution( DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL,
- L"en-US", true, p_dw_substitution.GetAddressOf() ) )
+ L"en-US", true, &p_dw_substitution ) )
throw runtime_error( "CreateNumberSubstitution() failed" );
}
@@ -446,10 +444,10 @@ static vector< ComPtr< IDWriteFont > > DWrite_GetFonts( vlc_font_select_t *fs, I
ComPtr< IDWriteFont > p_dw_font;
ComPtr< IDWriteLocalizedStrings > p_dw_names;
- if( FAILED( p_dw_family->GetFont( i, p_dw_font.GetAddressOf() ) ) )
+ if( FAILED( p_dw_family->GetFont( i, &p_dw_font ) ) )
throw runtime_error( "GetFont() failed" );
- if( FAILED( p_dw_font->GetFaceNames( p_dw_names.GetAddressOf() ) ) )
+ if( FAILED( p_dw_font->GetFaceNames( &p_dw_names ) ) )
throw runtime_error( "GetFaceNames() failed" );
if( DWrite_PartialMatch( fs, p_dw_names, face_name, true ) )
@@ -480,7 +478,7 @@ static vector< ComPtr< IDWriteFont > > DWrite_GetFonts( vlc_font_select_t *fs, I
break;
}
- if( FAILED( p_dw_family->GetFirstMatchingFont( weight, DWRITE_FONT_STRETCH_NORMAL, style, p_dw_font.GetAddressOf() ) ) )
+ if( FAILED( p_dw_family->GetFirstMatchingFont( weight, DWRITE_FONT_STRETCH_NORMAL, style, &p_dw_font ) ) )
throw runtime_error( "GetFirstMatchingFont() failed" );
result.push_back( p_dw_font );
@@ -551,7 +549,7 @@ static void DWrite_ParseFamily( vlc_font_select_t *fs, IDWriteFontFamily *p_dw_f
if( i & 2 )
i_flags |= VLC_FONT_FLAG_ITALIC;
- if( p_dw_font->CreateFontFace( p_dw_face.GetAddressOf() ) )
+ if( p_dw_font->CreateFontFace( &p_dw_face ) )
throw runtime_error( "CreateFontFace() failed" );
UINT32 i_num_files = 0;
@@ -559,12 +557,12 @@ static void DWrite_ParseFamily( vlc_font_select_t *fs, IDWriteFontFamily *p_dw_f
throw runtime_error( "GetFiles() failed" );
i_num_files = 1;
- if( p_dw_face->GetFiles( &i_num_files, p_dw_file.GetAddressOf() ) )
+ if( p_dw_face->GetFiles( &i_num_files, &p_dw_file ) )
throw runtime_error( "GetFiles() failed" );
UINT32 i_font_index = p_dw_face->GetIndex();
- if( p_dw_file->GetLoader( p_dw_loader.GetAddressOf() ) )
+ if( p_dw_file->GetLoader( &p_dw_loader ) )
throw runtime_error( "GetLoader() failed" );
const void *key;
@@ -573,7 +571,7 @@ static void DWrite_ParseFamily( vlc_font_select_t *fs, IDWriteFontFamily *p_dw_f
throw runtime_error( "GetReferenceKey() failed" );
ComPtr< IDWriteFontFileStream > p_dw_stream;
- if( p_dw_loader->CreateStreamFromKey( key, keySize, p_dw_stream.GetAddressOf() ) )
+ if( p_dw_loader->CreateStreamFromKey( key, keySize, &p_dw_stream ) )
throw runtime_error( "CreateStreamFromKey() failed" );
UINT64 i_stream_size;
@@ -635,7 +633,7 @@ extern "C" int DWrite_GetFamily( vlc_font_select_t *fs, const char *psz_lcname,
/* Try to find an exact match first */
if( SUCCEEDED( p_dw_sys->p_dw_system_fonts->FindFamilyName( pwsz_family, &i_index, &b_exists ) ) && b_exists )
{
- if( FAILED( p_dw_sys->p_dw_system_fonts->GetFontFamily( i_index, p_dw_family.GetAddressOf() ) ) )
+ if( FAILED( p_dw_sys->p_dw_system_fonts->GetFontFamily( i_index, &p_dw_family ) ) )
{
msg_Err( fs->p_obj, "DWrite_GetFamily: GetFontFamily() failed" );
goto done;
@@ -671,13 +669,13 @@ extern "C" int DWrite_GetFamily( vlc_font_select_t *fs, const char *psz_lcname,
for( i_index = 0; i_index < i_count; ++i_index )
{
ComPtr< IDWriteFontFamily > p_cur_family;
- if( FAILED( p_dw_sys->p_dw_system_fonts->GetFontFamily( i_index, p_cur_family.GetAddressOf() ) ) )
+ if( FAILED( p_dw_sys->p_dw_system_fonts->GetFontFamily( i_index, &p_cur_family ) ) )
{
msg_Err( fs->p_obj, "DWrite_GetFamily: GetFontFamily() failed" );
continue;
}
- if( FAILED( p_cur_family->GetFamilyNames( p_names.GetAddressOf() ) ) )
+ if( FAILED( p_cur_family->GetFamilyNames( &p_names ) ) )
{
msg_Err( fs->p_obj, "DWrite_GetFamily: GetFamilyNames() failed" );
continue;
@@ -741,20 +739,20 @@ static char *DWrite_Fallback( vlc_font_select_t *fs, const char *psz_lcname,
if( p_dw_sys->p_dw_fallbacks->MapCharacters( p_ts.Get(), 0, i_text_length, p_dw_sys->p_dw_system_fonts.Get(), pwsz_family,
DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL,
- &i_mapped_length, p_dw_font.GetAddressOf(), &f_scale )
+ &i_mapped_length, &p_dw_font, &f_scale )
|| !p_dw_font )
{
msg_Warn( fs->p_obj, "DWrite_Fallback(): MapCharacters() failed" );
goto done;
}
- if( p_dw_font->GetFontFamily( p_dw_family.GetAddressOf() ) )
+ if( p_dw_font->GetFontFamily( &p_dw_family ) )
{
msg_Err( fs->p_obj, "DWrite_Fallback(): GetFontFamily() failed" );
goto done;
}
- if( p_dw_family->GetFamilyNames( p_names.GetAddressOf() ) )
+ if( p_dw_family->GetFamilyNames( &p_names ) )
{
msg_Err( fs->p_obj, "DWrite_Fallback(): GetFamilyNames() failed" );
goto done;
=====================================
modules/video_output/win32/d3d11_quad.cpp
=====================================
@@ -101,7 +101,7 @@ static bool AllocQuadVertices(vlc_object_t *o, d3d11_device_t *d3d_dev, d3d11_qu
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
- hr = d3d_dev->d3ddevice->CreateBuffer(&bd, NULL, quad->vertexBuffer.GetAddressOf());
+ hr = d3d_dev->d3ddevice->CreateBuffer(&bd, NULL, &quad->vertexBuffer);
if(FAILED(hr)) {
msg_Err(o, "Failed to create vertex buffer. (hr=%lX)", hr);
goto fail;
@@ -111,7 +111,7 @@ static bool AllocQuadVertices(vlc_object_t *o, d3d11_device_t *d3d_dev, d3d11_qu
bd.BindFlags = D3D11_BIND_INDEX_BUFFER;
bd.ByteWidth = sizeof(WORD) * quad->generic.indexCount;
- hr = d3d_dev->d3ddevice->CreateBuffer(&bd, NULL, quad->indexBuffer.GetAddressOf());
+ hr = d3d_dev->d3ddevice->CreateBuffer(&bd, NULL, &quad->indexBuffer);
if(FAILED(hr)) {
msg_Err(o, "Could not create the quad indices. (hr=0x%lX)", hr);
goto fail;
@@ -253,7 +253,7 @@ int D3D11_AllocateQuad(vlc_object_t *o, d3d11_device_t *d3d_dev,
constantDesc.ByteWidth = sizeof(PS_CONSTANT_BUFFER);
constantDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
constantDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
- hr = d3d_dev->d3ddevice->CreateBuffer(&constantDesc, NULL, quad->pPixelShaderConstants.GetAddressOf());
+ hr = d3d_dev->d3ddevice->CreateBuffer(&constantDesc, NULL, &quad->pPixelShaderConstants);
if(FAILED(hr)) {
msg_Err(o, "Could not create the pixel shader constant buffer. (hr=0x%lX)", hr);
goto error;
@@ -263,7 +263,7 @@ int D3D11_AllocateQuad(vlc_object_t *o, d3d11_device_t *d3d_dev,
{
static_assert((sizeof(VS_PROJECTION_CONST)%16)==0,"Constant buffers require 16-byte alignment");
constantDesc.ByteWidth = sizeof(VS_PROJECTION_CONST);
- hr = d3d_dev->d3ddevice->CreateBuffer(&constantDesc, NULL, quad->viewpointShaderConstant.GetAddressOf());
+ hr = d3d_dev->d3ddevice->CreateBuffer(&constantDesc, NULL, &quad->viewpointShaderConstant);
if(FAILED(hr)) {
msg_Err(o, "Could not create the vertex shader constant buffer. (hr=0x%lX)", hr);
goto error;
=====================================
modules/video_output/win32/d3d11_shaders.cpp
=====================================
@@ -60,14 +60,14 @@ HRESULT D3D11_SetQuadPixelShader(vlc_object_t *o, d3d11_device_t *d3d_dev,
sampDesc.MaxLOD = D3D11_FLOAT32_MAX;
HRESULT hr;
- hr = d3d_dev->d3ddevice->CreateSamplerState(&sampDesc, quad->SamplerStates[0].GetAddressOf());
+ hr = d3d_dev->d3ddevice->CreateSamplerState(&sampDesc, &quad->SamplerStates[0]);
if (FAILED(hr)) {
msg_Err(o, "Could not Create the D3d11 Sampler State. (hr=0x%lX)", hr);
return hr;
}
sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
- hr = d3d_dev->d3ddevice->CreateSamplerState(&sampDesc, quad->SamplerStates[1].GetAddressOf());
+ hr = d3d_dev->d3ddevice->CreateSamplerState(&sampDesc, &quad->SamplerStates[1]);
if (FAILED(hr)) {
msg_Err(o, "Could not Create the D3d11 Sampler State. (hr=0x%lX)", hr);
quad->SamplerStates[0].Reset();
@@ -76,7 +76,7 @@ HRESULT D3D11_SetQuadPixelShader(vlc_object_t *o, d3d11_device_t *d3d_dev,
hr = d3d_dev->d3ddevice->CreatePixelShader(
pPSBlob[0].buffer, pPSBlob[0].buf_size,
- NULL, quad->d3dpixelShader[0].GetAddressOf());
+ NULL, &quad->d3dpixelShader[0]);
D3D_ShaderBlobRelease(&pPSBlob[0]);
@@ -84,7 +84,7 @@ HRESULT D3D11_SetQuadPixelShader(vlc_object_t *o, d3d11_device_t *d3d_dev,
{
hr = d3d_dev->d3ddevice->CreatePixelShader(
pPSBlob[1].buffer, pPSBlob[1].buf_size,
- NULL, quad->d3dpixelShader[1].GetAddressOf());
+ NULL, &quad->d3dpixelShader[1]);
D3D_ShaderBlobRelease(&pPSBlob[1]);
}
@@ -104,7 +104,7 @@ HRESULT D3D11_CreateRenderTargets( d3d11_device_t *d3d_dev, ID3D11Resource *text
{
renderTargetViewDesc.Format = cfg->resourceFormat[i];
HRESULT hr = d3d_dev->d3ddevice->CreateRenderTargetView(texture,
- &renderTargetViewDesc, output[i].GetAddressOf());
+ &renderTargetViewDesc, &output[i]);
if (FAILED(hr))
{
return hr;
@@ -136,7 +136,7 @@ HRESULT (D3D11_CreateVertexShader)(vlc_object_t *obj, d3d_shader_blob *pVSBlob,
{
HRESULT hr;
hr = d3d_dev->d3ddevice->CreateVertexShader(pVSBlob->buffer, pVSBlob->buf_size,
- NULL, output->shader.GetAddressOf());
+ NULL, &output->shader);
if(FAILED(hr)) {
msg_Err(obj, "Failed to create the flat vertex shader. (hr=0x%lX)", hr);
@@ -150,7 +150,7 @@ HRESULT (D3D11_CreateVertexShader)(vlc_object_t *obj, d3d_shader_blob *pVSBlob,
};
hr = d3d_dev->d3ddevice->CreateInputLayout(layout, 2, pVSBlob->buffer,
- pVSBlob->buf_size, output->layout.GetAddressOf());
+ pVSBlob->buf_size, &output->layout);
if(FAILED(hr)) {
msg_Err(obj, "Failed to create the vertex input layout. (hr=0x%lX)", hr);
=====================================
modules/video_output/win32/d3d11_swapchain.cpp
=====================================
@@ -65,7 +65,7 @@ static bool UpdateSwapchain( d3d11_local_swapchain *display, const libvlc_video_
if ( display->swapchainTargetView[0].Get() ) {
ComPtr<ID3D11Resource> res;
- display->swapchainTargetView[0]->GetResource( res.GetAddressOf() );
+ display->swapchainTargetView[0]->GetResource( &res );
if ( res )
{
ComPtr<ID3D11Texture2D> res2d;
@@ -123,12 +123,12 @@ static bool UpdateSwapchain( d3d11_local_swapchain *display, const libvlc_video_
}
ComPtr<IDXGIDevice> pDXGIDevice;
- hr = display->d3d_dev->d3ddevice->QueryInterface(IID_GRAPHICS_PPV_ARGS(pDXGIDevice.GetAddressOf()));
+ hr = display->d3d_dev->d3ddevice->QueryInterface(IID_GRAPHICS_PPV_ARGS(&pDXGIDevice));
if (FAILED(hr)) {
return false;
}
ComPtr<IDXGIAdapter> dxgiadapter;
- hr = pDXGIDevice->GetAdapter(dxgiadapter.GetAddressOf());
+ hr = pDXGIDevice->GetAdapter(&dxgiadapter);
if (FAILED(hr)) {
return false;
}
@@ -137,7 +137,7 @@ static bool UpdateSwapchain( d3d11_local_swapchain *display, const libvlc_video_
return false;
ComPtr<ID3D11Resource> pBackBuffer;
- hr = DXGI_GetSwapChain1(display->sys)->GetBuffer( 0, IID_GRAPHICS_PPV_ARGS(pBackBuffer.GetAddressOf()) );
+ hr = DXGI_GetSwapChain1(display->sys)->GetBuffer( 0, IID_GRAPHICS_PPV_ARGS(&pBackBuffer) );
if ( FAILED( hr ) ) {
msg_Err( display->obj, "Could not get the backbuffer for the Swapchain. (hr=0x%lX)", hr );
return false;
=====================================
modules/video_output/win32/direct3d11.cpp
=====================================
@@ -1080,7 +1080,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
if (is_d3d11_opaque(fmt->i_chroma)) {
ComPtr<ID3D10Multithread> pMultithread;
- hr = sys->d3d_dev->d3ddevice->QueryInterface(IID_GRAPHICS_PPV_ARGS(pMultithread.GetAddressOf()));
+ hr = sys->d3d_dev->d3ddevice->QueryInterface(IID_GRAPHICS_PPV_ARGS(&pMultithread));
if (SUCCEEDED(hr))
pMultithread->SetMultithreadProtected(TRUE);
}
@@ -1093,13 +1093,13 @@ static HRESULT InitRenderFence(vout_display_sys_t *sys)
{
HRESULT hr;
ComPtr<ID3D11Device5> d3ddev5;
- hr = sys->d3d_dev->d3ddevice->QueryInterface(IID_GRAPHICS_PPV_ARGS(d3ddev5.GetAddressOf()));
+ hr = sys->d3d_dev->d3ddevice->QueryInterface(IID_GRAPHICS_PPV_ARGS(&d3ddev5));
if (FAILED(hr))
goto error;
- hr = d3ddev5->CreateFence(sys->renderFence, D3D11_FENCE_FLAG_NONE, IID_GRAPHICS_PPV_ARGS(sys->d3dRenderFence.GetAddressOf()));
+ hr = d3ddev5->CreateFence(sys->renderFence, D3D11_FENCE_FLAG_NONE, IID_GRAPHICS_PPV_ARGS(&sys->d3dRenderFence));
if (FAILED(hr))
goto error;
- hr = sys->d3d_dev->d3dcontext->QueryInterface(IID_GRAPHICS_PPV_ARGS(sys->d3dcontext4.GetAddressOf()));
+ hr = sys->d3d_dev->d3dcontext->QueryInterface(IID_GRAPHICS_PPV_ARGS(&sys->d3dcontext4));
if (FAILED(hr))
goto error;
sys->renderFinished = CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -1140,7 +1140,7 @@ static int Direct3D11CreateGenericResources(vout_display_t *vd)
spuBlendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; /* keep source intact */
spuBlendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO; /* discard */
- hr = sys->d3d_dev->d3ddevice->CreateBlendState(&spuBlendDesc, pSpuBlendState.GetAddressOf());
+ hr = sys->d3d_dev->d3ddevice->CreateBlendState(&spuBlendDesc, &pSpuBlendState);
if (FAILED(hr)) {
msg_Err(vd, "Could not create SPU blend state. (hr=0x%lX)", hr);
return VLC_EGENERIC;
@@ -1154,7 +1154,7 @@ static int Direct3D11CreateGenericResources(vout_display_t *vd)
D3D11_DEPTH_STENCIL_DESC stencilDesc = { };
ComPtr<ID3D11DepthStencilState> pDepthStencilState;
- hr = sys->d3d_dev->d3ddevice->CreateDepthStencilState(&stencilDesc, pDepthStencilState.GetAddressOf() );
+ hr = sys->d3d_dev->d3ddevice->CreateDepthStencilState(&stencilDesc, &pDepthStencilState );
if (SUCCEEDED(hr))
sys->d3d_dev->d3dcontext->OMSetDepthStencilState(pDepthStencilState.Get(), 0);
=====================================
modules/video_output/win32/dxgi_swapchain.cpp
=====================================
@@ -203,7 +203,7 @@ void DXGI_SelectSwapchainColorspace(dxgi_swapchain *display, const libvlc_video_
display->dxgiswapChain.As(&display->dxgiswapChain4);
#ifdef HAVE_DXGI1_6_H
- if (SUCCEEDED(display->dxgiswapChain->GetContainingOutput(dxgiOutput.GetAddressOf())))
+ if (SUCCEEDED(display->dxgiswapChain->GetContainingOutput(&dxgiOutput)))
{
ComPtr<IDXGIOutput6> dxgiOutput6;
if (SUCCEEDED(dxgiOutput.As(&dxgiOutput6)))
@@ -295,7 +295,7 @@ static void DXGI_CreateSwapchainHwnd(dxgi_swapchain *display,
FillSwapChainDesc(display, width, height, &scd);
ComPtr<IDXGIFactory2> dxgifactory;
- HRESULT hr = dxgiadapter->GetParent(IID_GRAPHICS_PPV_ARGS(dxgifactory.GetAddressOf()));
+ HRESULT hr = dxgiadapter->GetParent(IID_GRAPHICS_PPV_ARGS(&dxgifactory));
if (FAILED(hr)) {
msg_Err(display->obj, "Could not get the DXGI Factory. (hr=0x%lX)", hr);
return;
@@ -303,7 +303,7 @@ static void DXGI_CreateSwapchainHwnd(dxgi_swapchain *display,
hr = dxgifactory->CreateSwapChainForHwnd(pFactoryDevice,
display->swapchainSurface.hwnd, &scd,
- NULL, NULL, display->dxgiswapChain.GetAddressOf());
+ NULL, NULL, &display->dxgiswapChain);
if (hr == DXGI_ERROR_INVALID_CALL && scd.Format == DXGI_FORMAT_R10G10B10A2_UNORM)
{
@@ -311,7 +311,7 @@ static void DXGI_CreateSwapchainHwnd(dxgi_swapchain *display,
scd.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
hr = dxgifactory->CreateSwapChainForHwnd(pFactoryDevice,
display->swapchainSurface.hwnd, &scd,
- NULL, NULL, display->dxgiswapChain.GetAddressOf());
+ NULL, NULL, &display->dxgiswapChain);
}
if (FAILED(hr)) {
msg_Err(display->obj, "Could not create the SwapChain. (hr=0x%lX)", hr);
@@ -337,20 +337,20 @@ static void DXGI_CreateSwapchainDComp(dxgi_swapchain *display,
scd.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
ComPtr<IDXGIFactory2> dxgifactory;
- HRESULT hr = dxgiadapter->GetParent(IID_GRAPHICS_PPV_ARGS(dxgifactory.GetAddressOf()));
+ HRESULT hr = dxgiadapter->GetParent(IID_GRAPHICS_PPV_ARGS(&dxgifactory));
if (FAILED(hr)) {
msg_Err(display->obj, "Could not get the DXGI Factory. (hr=0x%lX)", hr);
return;
}
hr = dxgifactory->CreateSwapChainForComposition(pFactoryDevice,
- &scd, NULL, display->dxgiswapChain.GetAddressOf());
+ &scd, NULL, &display->dxgiswapChain);
if (hr == DXGI_ERROR_INVALID_CALL && scd.Format == DXGI_FORMAT_R10G10B10A2_UNORM)
{
msg_Warn(display->obj, "10 bits swapchain failed, try 8 bits");
scd.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
hr = dxgifactory->CreateSwapChainForComposition(pFactoryDevice,
- &scd, NULL, display->dxgiswapChain.GetAddressOf());
+ &scd, NULL, &display->dxgiswapChain);
}
if (SUCCEEDED(hr)) {
display->swapchainSurface.dcomp.visual->SetContent(display->dxgiswapChain.Get());
=====================================
modules/video_output/win32/sensors.cpp
=====================================
@@ -162,7 +162,7 @@ void *HookWindowsSensors(vout_display_t *vd, HWND hwnd)
return NULL;
ComPtr<ISensorCollection> pInclinometers;
- hr = pSensorManager->GetSensorsByType(SENSOR_TYPE_INCLINOMETER_3D, pInclinometers.GetAddressOf());
+ hr = pSensorManager->GetSensorsByType(SENSOR_TYPE_INCLINOMETER_3D, &pInclinometers);
if (FAILED(hr))
{
msg_Dbg(vd, "inclinometer not found. (hr=0x%lX)", hr);
@@ -175,7 +175,7 @@ void *HookWindowsSensors(vout_display_t *vd, HWND hwnd)
for (ULONG i=0; i<count; ++i)
{
ComPtr<ISensor> pSensor;
- hr = pInclinometers->GetAt(i, pSensor.GetAddressOf());
+ hr = pInclinometers->GetAt(i, &pSensor);
if (FAILED(hr))
continue;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a9406397ed0342b3dae17a31ed54e46b4fb86407...abe95feb552bdb276642603c299d0c40519918f3
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a9406397ed0342b3dae17a31ed54e46b4fb86407...abe95feb552bdb276642603c299d0c40519918f3
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list