[vlc-commits] [Git][videolan/vlc][master] use `COINIT_DISABLE_OLE1DDE` with `CoInitializeEx()`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Jun 27 14:41:37 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
ffb6cc69 by Fatih Uzunoglu at 2024-06-27T14:07:13+00:00
use `COINIT_DISABLE_OLE1DDE` with `CoInitializeEx()`
It appears that OLE 1.0 is not utilized, so it should
be beneficial to set this flag.
>From "Initializing the COM Library":
> ... it is a good idea to set the COINIT_DISABLE_OLE1DDE
> flag in the dwCoInit parameter. Setting this flag avoids
> some overhead associated with Object Linking and Embedding
> (OLE) 1.0, an obsolete technology.
- - - - -
12 changed files:
- modules/access/dshow/dshow.cpp
- modules/access/dtv/bdagraph.cpp
- modules/access/wasapi.c
- modules/audio_output/mmdevice.c
- modules/audio_output/winstore.c
- modules/codec/dmo/dmo.c
- modules/codec/mft.cpp
- modules/gui/qt/dialogs/preferences/simple_preferences.cpp
- modules/gui/qt/maininterface/mainctx_win32.cpp
- modules/text_renderer/sapi.cpp
- modules/video_chroma/d3d11_fmt.cpp
- src/win32/mta_holder.h
Changes:
=====================================
modules/access/dshow/dshow.cpp
=====================================
@@ -639,7 +639,7 @@ static int DemuxOpen( vlc_object_t *p_this )
return VLC_ENOMEM;
p_demux->p_sys = (demux_sys_t *)p_sys;
- ComContext ctx( COINIT_MULTITHREADED );
+ ComContext ctx( COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE );
if( vlc_mta_acquire( p_this ) == false )
{
@@ -739,7 +739,7 @@ static int AccessOpen( vlc_object_t *p_this )
if( !p_sys )
return VLC_ENOMEM;
- ComContext ctx( COINIT_MULTITHREADED );
+ ComContext ctx( COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE );
if( vlc_mta_acquire( p_this ) == false )
{
@@ -796,7 +796,7 @@ static void AccessClose( vlc_object_t *p_this )
stream_t *p_access = (stream_t *)p_this;
access_sys_t *p_sys = (access_sys_t *)p_access->p_sys;
- ComContext ctx( COINIT_MULTITHREADED );
+ ComContext ctx( COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE );
/* Stop capturing stuff */
p_sys->p_control->Stop();
@@ -812,7 +812,7 @@ static void DemuxClose( vlc_object_t *p_this )
demux_t *p_demux = (demux_t *)p_this;
access_sys_t *p_sys = (access_sys_t *)p_demux->p_sys;
- ComContext ctx( COINIT_MULTITHREADED );
+ ComContext ctx( COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE );
/* Stop capturing stuff */
p_sys->p_control->Stop();
@@ -1712,7 +1712,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, ComPtr<IBaseFilter> &p_filte
*****************************************************************************/
static block_t *ReadCompressed( stream_t *p_access, bool *eof )
{
- ComContext ctx( COINIT_MULTITHREADED );
+ ComContext ctx( COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE );
access_sys_t *p_sys = (access_sys_t *)p_access->p_sys;
/* There must be only 1 elementary stream to produce a valid stream
@@ -1759,7 +1759,7 @@ out:
****************************************************************************/
static int Demux( demux_t *p_demux )
{
- ComContext ctx( COINIT_MULTITHREADED );
+ ComContext ctx( COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE );
access_sys_t *p_sys = (access_sys_t *)p_demux->p_sys;
int i_found_samples;
@@ -1993,7 +1993,7 @@ static int FindDevices( const char *psz_name, char ***vp, char ***tp )
// Use STA as this most likely comes from a Qt thread, which is
// initialized as STA.
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
FindCaptureDevice( NULL, NULL, &list_devices, b_audio );
=====================================
modules/access/dtv/bdagraph.cpp
=====================================
@@ -154,7 +154,7 @@ dvb_device_t *dvb_open (vlc_object_t *obj)
void dvb_close (dvb_device_t *d)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
delete d->module;
delete d;
}
@@ -180,32 +180,32 @@ bool dvb_get_pid_state (const dvb_device_t *, uint16_t)
unsigned dvb_enum_systems (dvb_device_t *d)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
return d->module->EnumSystems( );
}
float dvb_get_signal_strength (dvb_device_t *d)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
return d->module->GetSignalStrength( );
}
float dvb_get_snr (dvb_device_t *d)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
return d->module->GetSignalNoiseRatio( );
}
int dvb_set_inversion (dvb_device_t *d, int inversion)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
d->inversion = inversion;
return d->module->SetInversion( d->inversion );
}
int dvb_tune (dvb_device_t *d)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
return d->module->SubmitTuneRequest ();
}
@@ -224,14 +224,14 @@ bool dvb_set_ca_pmt (dvb_device_t *, const en50221_capmt_info_t *)
int dvb_set_dvbc (dvb_device_t *d, uint32_t freq, const char *mod,
uint32_t srate, uint32_t /*fec*/)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
return d->module->SetDVBC (freq / 1000, mod, srate);
}
/* DVB-S */
int dvb_set_dvbs (dvb_device_t *d, uint64_t freq, uint32_t srate, uint32_t fec)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
d->frequency = freq / 1000;
d->srate = srate;
d->fec = fec;
@@ -249,7 +249,7 @@ int dvb_set_dvbs2 (dvb_device_t *, uint64_t /*freq*/, const char * /*mod*/,
int dvb_set_sec (dvb_device_t *d, uint64_t freq, char pol,
uint32_t lowf, uint32_t highf, uint32_t switchf)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
d->frequency = freq / 1000;
d->pol = pol;
d->lowf = lowf;
@@ -264,7 +264,7 @@ int dvb_set_dvbt (dvb_device_t *d, uint32_t freq, const char * /*mod*/,
uint32_t fec_hp, uint32_t fec_lp, uint32_t bandwidth,
int transmission, uint32_t guard, int hierarchy)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
return d->module->SetDVBT(freq / 1000, fec_hp, fec_lp,
bandwidth, transmission, guard, hierarchy);
}
@@ -274,7 +274,7 @@ int dvb_set_dvbt2 (dvb_device_t *d, uint32_t freq, const char * /*mod*/,
uint32_t fec, uint32_t bandwidth, int transmission,
uint32_t guard, uint8_t plp)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
return d->module->SetDVBT2(freq / 1000, fec,
bandwidth, transmission, guard, plp);
}
@@ -303,13 +303,13 @@ int dvb_set_isdbt (dvb_device_t *, uint32_t /*freq*/, uint32_t /*bandwidth*/,
/* ATSC */
int dvb_set_atsc (dvb_device_t *d, uint32_t freq, const char * /*mod*/)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
return d->module->SetATSC(freq / 1000);
}
int dvb_set_cqam (dvb_device_t *d, uint32_t freq, const char * /*mod*/)
{
- ComContext ctx( COINIT_APARTMENTTHREADED );
+ ComContext ctx( COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
return d->module->SetCQAM(freq / 1000);
}
=====================================
modules/access/wasapi.c
=====================================
@@ -314,7 +314,7 @@ static unsigned __stdcall Thread(void *data)
void *pv;
HRESULT hr;
- hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ hr = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
assert(SUCCEEDED(hr)); /* COM already allocated by parent thread */
SetEvent(sys->ready);
@@ -430,7 +430,7 @@ static int Open(vlc_object_t *obj)
goto error;
}
- hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ hr = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
if (unlikely(FAILED(hr))) {
msg_Err(demux, "cannot initialize COM (error 0x%lX)", hr);
goto error;
@@ -494,7 +494,7 @@ static void Close (vlc_object_t *obj)
demux_sys_t *sys = demux->p_sys;
HRESULT hr;
- hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ hr = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
assert(SUCCEEDED(hr));
SetEvent(sys->events[0]);
=====================================
modules/audio_output/mmdevice.c
=====================================
@@ -50,7 +50,7 @@ DEFINE_GUID (GUID_VLC_AUD_OUT, 0x4533f59d, 0x59ee, 0x00c6,
static int TryEnterMTA(vlc_object_t *obj)
{
- HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
if (unlikely(FAILED(hr)))
{
msg_Err (obj, "cannot initialize COM (error 0x%lX)", hr);
@@ -62,7 +62,7 @@ static int TryEnterMTA(vlc_object_t *obj)
static void EnterMTA(void)
{
- HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
if (unlikely(FAILED(hr)))
abort();
}
@@ -1462,7 +1462,7 @@ static int ReloadAudioDevices(char const *name, char ***values, char ***descs)
(void) name;
- hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ hr = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
if (FAILED(hr)) {
if (hr != RPC_E_CHANGED_MODE)
return -1;
=====================================
modules/audio_output/winstore.c
=====================================
@@ -43,7 +43,7 @@ DEFINE_GUID (GUID_VLC_AUD_OUT, 0x4533f59d, 0x59ee, 0x00c6,
static void EnterMTA(void)
{
- HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
if (unlikely(FAILED(hr)))
abort();
}
=====================================
modules/codec/dmo/dmo.c
=====================================
@@ -307,7 +307,7 @@ static int DecOpen( decoder_t *p_dec )
int i_ret = VLC_EGENERIC;
/* Initialize OLE/COM */
- if( FAILED(CoInitializeEx( NULL, COINIT_MULTITHREADED )) )
+ if( FAILED(CoInitializeEx( NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE )) )
vlc_assert_unreachable();
if( LoadDMO( VLC_OBJECT(p_dec), &hmsdmo_dll, &p_dmo, p_dec->fmt_in, false )
@@ -1371,7 +1371,7 @@ static int EncOpen( vlc_object_t *p_this )
HINSTANCE hmsdmo_dll = NULL;
/* Initialize OLE/COM */
- if( FAILED(CoInitializeEx( NULL, COINIT_MULTITHREADED )) )
+ if( FAILED(CoInitializeEx( NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE )) )
vlc_assert_unreachable();
if( LoadDMO( p_this, &hmsdmo_dll, &p_dmo, &p_enc->fmt_out, true )
=====================================
modules/codec/mft.cpp
=====================================
@@ -2302,7 +2302,7 @@ static int OpenMFTVideoEncoder(vlc_object_t *p_this)
{
encoder_t *p_enc = (encoder_t*)p_this;
- if( FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED)) )
+ if( FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE)) )
return VLC_EINVAL;
HRESULT hr = MFStartup(MF_VERSION, MFSTARTUP_NOSOCKET);
@@ -2451,7 +2451,7 @@ static int OpenMFTAudioEncoder(vlc_object_t *p_this)
{
encoder_t *p_enc = (encoder_t*)p_this;
- if( FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED)) )
+ if( FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE)) )
return VLC_EINVAL;
HRESULT hr = MFStartup(MF_VERSION, MFSTARTUP_NOSOCKET);
@@ -2591,7 +2591,7 @@ static int Open(vlc_object_t *p_this)
{
decoder_t *p_dec = (decoder_t *)p_this;
- if( FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED)) )
+ if( FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE)) )
return VLC_EINVAL;
HRESULT hr = MFStartup(MF_VERSION, MFSTARTUP_NOSOCKET);
=====================================
modules/gui/qt/dialogs/preferences/simple_preferences.cpp
=====================================
@@ -1433,7 +1433,7 @@ void SPrefsPanel::assoDialog()
{
HRESULT hr;
- hr = CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
+ hr = CoInitializeEx( NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
if( SUCCEEDED(hr) )
{
void *p;
=====================================
modules/gui/qt/maininterface/mainctx_win32.cpp
=====================================
@@ -580,7 +580,7 @@ void WinTaskbarWidget::createTaskBarButtons()
if (!winId)
return;
- HRESULT hr = CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
+ HRESULT hr = CoInitializeEx( NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
if( FAILED(hr) )
return;
=====================================
modules/text_renderer/sapi.cpp
=====================================
@@ -111,7 +111,7 @@ struct MTAGuard
MTAGuard()
{
- this->result_mta = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ this->result_mta = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
}
~MTAGuard()
=====================================
modules/video_chroma/d3d11_fmt.cpp
=====================================
@@ -188,7 +188,7 @@ static void D3D11_GetDriverVersion(vlc_object_t *obj, d3d11_device_t *d3d_dev)
d3d_dev->adapterDesc.SubSysId, d3d_dev->adapterDesc.Revision);
BSTR bVideoController = SysAllocString(lookup);
- hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ hr = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
if (FAILED(hr))
{
msg_Dbg(obj, "Unable to initialize COM library");
=====================================
src/win32/mta_holder.h
=====================================
@@ -43,7 +43,7 @@ static inline void* MtaMainLoop( void* opaque )
vlc_thread_set_name("vlc-mta");
vlc_mta_holder* p_mta = (vlc_mta_holder*)opaque;
- CoInitializeEx( NULL, COINIT_MULTITHREADED );
+ CoInitializeEx( NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE );
vlc_sem_post( &p_mta->ready_sem );
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ffb6cc6933c44cfc475aadfc553d21ca3100ee33
--
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ffb6cc6933c44cfc475aadfc553d21ca3100ee33
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