[vlc-commits] [Git][videolan/vlc][3.0.x] 24 commits: mmdevice: fix potential release on error/crash
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sun Apr 12 14:15:17 UTC 2026
Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
e609d10f by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: fix potential release on error/crash
It should have been in the backport of 2fa81b6f15f268e1aaeaf55d93f5bb628714d8cb.
- - - - -
276dcd91 by Steve Lhomme at 2026-04-12T14:01:12+00:00
windows modules: use a consistent format to log HRESULT
(cherry picked from commit 67ea55b05adfaef31a311f36c3c889fc7f220090) (edited)
edited:
- a change in mmdevice MMThread() was already done
- d3d11_surface has one less log in VLC 3
- d3d9_fmt/direct3d9 have some different logs
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
54d91e9a by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: mark calls that are leaking
Given the same variable is used to set a hardcoded value or acquired_device
(which seems to be free'd properly) it may require to flag the value to tell
if it should be free'd or not.
(cherry picked from commit aef7572d6902381c886e4904ecb5e965eb3b0d5b)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
357aaa53 by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: inline the only call to var_InheritWide()
And calling SetDisplayName on NULL returns an error so avoid doing it.
(cherry picked from commit 892810977b0a2a2f9f1b48fde74bdb200ddc07ca)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
3281285f by Rémi Denis-Courmont at 2026-04-12T14:01:12+00:00
mmdevice: fix error handling
(cherry picked from commit 87ea7ad173e71301bb10477079ce77b69fd706cb) (rebased)
rebased:
- ReloadAudioDevices() has more parameters in VLC 3
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
64286619 by Lyndon Brown at 2026-04-12T14:01:12+00:00
fix mis-spelling of overridden
a followup to !1044.
(cherry picked from commit 4d89ef900d94d429286d7c4197d846ba859c805f) (edited)
edited:
- VLC 3 doesn't have a misspelling in vlc_common.h, hxxx_helper.h, transcode/video.c
- VLC 3 has a misspelling in VLCHUDCheckboxCell.m
- cli.c is oldrc.c in VLC 3
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
1861d201 by Thomas Guillem at 2026-04-12T14:01:12+00:00
mmdevice: move mainloop in a new function
No functional changes.
(cherry picked from commit 46e37bd9786c8a43fb6b560eb3b23bc1c3ff36ed)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
c7098f3e by Thomas Guillem at 2026-04-12T14:01:12+00:00
mmdevice: report mute after setting it
Use the same behavior than for volume.
(cherry picked from commit e0373ddf2f9bfb01a62787fb9c8159c518518203)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
81b19aaa by Thomas Guillem at 2026-04-12T14:01:12+00:00
mmdevice: report volume and mute only when necessary
When volume or mute was changed, both volume and mute were reported.
(cherry picked from commit d5fe154f074c9dc5d9ff0bca63e1e744cc6c8429)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
4ece9121 by Steve Lhomme at 2026-04-12T14:01:12+00:00
audio_output: fix mmdevice.h include path
(cherry picked from commit b95dcf22bdee695b824da41317321dff694b9603) (rebased)
rebased:
- the code around in wasapi.c is slightly different
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
d8dd7444 by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: avoid using NULL as (wide) string format argument
IMMNotificationClient::OnDefaultDeviceChanged() can give a NULL pointer [^1].
[^1]: https://learn.microsoft.com/en-us/windows/win32/api/mmdeviceapi/nf-mmdeviceapi-immnotificationclient-ondefaultdevicechanged#parameters
(cherry picked from commit 8c9665b475a9a0f0b138fa3b5c87d896b4fce46d) (rebased)
rebased:
- VLC 3 uses critical sectionss
- VLC 3 have different parameters in aout_RestartRequest()
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
fa1c9aa7 by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: fix potential leak on exit
(cherry picked from commit f39b6c88e94d8aece77f5d29f29c30f0ab15e1e3) (rebased)
rebased:
- VLC 3 uses a critical sections
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
bb87f7ce by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: avoid setting acquired_device to a device we can't select
Try to use the default device instead.
(cherry picked from commit 507cd9c458239d7adfc8b96f9cac345ebf8031b7)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
fd58b990 by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: set the initialisation_status to FAILED when we don't have a device
The hr error is set and MMSession() will return that value.
(cherry picked from commit 5028d30faadbbbd174820d4885864f495f096b5c) (rebased)
rebased:
- VLC 3 uses WakeConditionVariable()
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
31218287 by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: use a single string pointer for the device name
We only care about the name before getting sys->dev and we keep it
in case of restart on the same device.
We also need a way to tell if sys->dev has been acquired or if we failed
to do so. NULL alone in sys->dev can't tell that.
In OnDefaultDeviceChange() we don't care if the device was acquired or not.
We only care if we are using the default device when it changes.
(cherry picked from commit e2a874bd9c09bc7f134bfa51d76f779a31442023) (edited)
edited:
- VLC 3 doesn't have the patch to implement nonblocking play
- VLC 3 uses critical sections
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
2f3cb064 by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: use NULL for the default device name
That's what the core uses.
(cherry picked from commit 847f7e105b1c97edc2e79e47ae2b1e660e5e21bd) (edited)
edited:
- VLC 3 doesn't have the patch to implement nonblocking play
- VLC 3 uses critical sections
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
45834a6c by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: merge initialisation_status and device_status
The initialization fails or succeeds if the device was properly acquired.
We don't need the initialisation_status only used for initialization.
(cherry picked from commit 019cfc364b44a9570adf4fa5ebfef98657a0bdd9) (rebased)
rebased:
- VLC 3 uses critical sections
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
afab4d20 by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: only log the device we are going to use
On error we log, which device name failed. "using default device" will be logged next.
(cherry picked from commit e197614bcecffc1e0e0dbf6d4b041337de25c8cb)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
029a537c by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: rename request_device_restart to default_device_changed
(cherry picked from commit 61c1715db23802e090389f345c5e271c7302b748) (rebased)
rebased:
- VLC 3 uses critical sections
- VLC 3 doesn't have the patch to implement nonblocking play
- VLC 3 has different parameters in aout_RestartRequest()
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
961bf6db by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: always log the default device change
(cherry picked from commit 5a666ee2df0070786cad7d1fdd1cd34242514c13) (rebased)
rebased:
- VLC 3 uses critical sections
- VLC 3 has different parameters in aout_RestartRequest()
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
27b3f395 by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: fix deadlock on exit when starting with no device
Fixes #29555
(cherry picked from commit 238c65785f47b7ae487baf0f7fabd738819e61b4) (edited)
edited:
- VLC 3 uses critical sections
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
38f97f3f by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: return directly on init failure
(cherry picked from commit e127fde35c13c5848e4cceff6b44c10db2851ffd) (rebased)
rebased:
- VLC 3 uses WakeConditionVariable()
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
77195af3 by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: distinguish between initial init failure and device not acquired
So we can keep the module around waiting for a new device.
(cherry picked from commit 84e6202e4d93b6d34263724328061d009e8c97b9) (rebased)
rebased:
- VLC 3 uses critical sections
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
607ed61a by Steve Lhomme at 2026-04-12T14:01:12+00:00
mmdevice: use a semaphore to signal the initial mmdevice queries are done
We don't need the lock for that.
However the semaphore will keep being signal after the initial phase as
we don't have a way in MMSession() to tell if DEVICE_PENDING means the initial
phase or a change of device.
(cherry picked from commit 9a63b3e461055694ea98942ee9696479903323c2) (edited)
edited:
- VLC 3 was using critical sections with SleepConditionVariableCS()
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
22 changed files:
- modules/access/dshow/dshow.cpp
- modules/access/dtv/bdagraph.cpp
- modules/access/wasapi.c
- modules/audio_output/directsound.c
- modules/audio_output/mmdevice.c
- modules/audio_output/wasapi.c
- modules/audio_output/winstore.c
- modules/codec/avcodec/d3d11va.c
- modules/codec/avcodec/dxva2.c
- modules/codec/subsusf.c
- modules/control/oldrc.c
- modules/gui/macosx/VLCHUDCheckboxCell.m
- modules/hw/d3d11/d3d11_deinterlace.c
- modules/hw/d3d11/d3d11_filters.c
- modules/hw/d3d11/d3d11_surface.c
- modules/hw/d3d9/dxa9.c
- modules/lua/libs/win.c
- modules/text_renderer/sapi.cpp
- modules/video_chroma/d3d11_fmt.c
- modules/video_chroma/d3d9_fmt.c
- modules/video_output/win32/common.c
- modules/video_output/win32/direct3d9.c
Changes:
=====================================
modules/access/dshow/dshow.cpp
=====================================
@@ -1241,7 +1241,7 @@ FindCaptureDevice( vlc_object_t *p_this, std::string *p_devicename,
IID_ICreateDevEnum, (void**)p_dev_enum.GetAddressOf() );
if( FAILED(hr) )
{
- msg_Err( p_this, "failed to create the device enumerator (0x%lx)", hr);
+ msg_Err( p_this, "failed to create the device enumerator (0x%lX)", hr);
return p_base_filter;
}
@@ -1255,7 +1255,7 @@ FindCaptureDevice( vlc_object_t *p_this, std::string *p_devicename,
p_class_enum.GetAddressOf(), 0 );
if( FAILED(hr) )
{
- msg_Err( p_this, "failed to create the class enumerator (0x%lx)", hr );
+ msg_Err( p_this, "failed to create the class enumerator (0x%lX)", hr );
return p_base_filter;
}
@@ -1319,7 +1319,7 @@ FindCaptureDevice( vlc_object_t *p_this, std::string *p_devicename,
if( FAILED(hr) )
{
msg_Err( p_this, "couldn't bind moniker to filter "
- "object (0x%lx)", hr );
+ "object (0x%lX)", hr );
return NULL;
}
return p_base_filter;
=====================================
modules/access/dtv/bdagraph.cpp
=====================================
@@ -3000,7 +3000,7 @@ HRESULT BDAGraph::Start()
hr = p_media_control->Run();
if( SUCCEEDED( hr ) )
{
- msg_Dbg( p_access, "Start: Graph started, hr=0x%lx", hr );
+ msg_Dbg( p_access, "Start: Graph started, hr=0x%lX", hr );
return S_OK;
}
@@ -3019,7 +3019,7 @@ HRESULT BDAGraph::Start()
msg_Dbg( p_access, "Start: got state" );
if( i_state == State_Running )
{
- msg_Dbg( p_access, "Graph started after a delay, hr=0x%lx", hr );
+ msg_Dbg( p_access, "Graph started after a delay, hr=0x%lX", hr );
return S_OK;
}
=====================================
modules/access/wasapi.c
=====================================
@@ -98,7 +98,7 @@ static IAudioClient *GetClient(demux_t *demux, bool *restrict loopbackp)
&IID_IMMDeviceEnumerator, &pv);
if (FAILED(hr))
{
- msg_Err(demux, "cannot create device enumerator (error 0x%lx)", hr);
+ msg_Err(demux, "cannot create device enumerator (error 0x%lX)", hr);
return NULL;
}
e = pv;
@@ -111,7 +111,7 @@ static IAudioClient *GetClient(demux_t *demux, bool *restrict loopbackp)
IMMDeviceEnumerator_Release(e);
if (FAILED(hr))
{
- msg_Err(demux, "cannot get default device (error 0x%lx)", hr);
+ msg_Err(demux, "cannot get default device (error 0x%lX)", hr);
return NULL;
}
@@ -119,7 +119,7 @@ static IAudioClient *GetClient(demux_t *demux, bool *restrict loopbackp)
*loopbackp = GetDeviceFlow(dev) == eRender;
IMMDevice_Release(dev);
if (FAILED(hr))
- msg_Err(demux, "cannot activate device (error 0x%lx)", hr);
+ msg_Err(demux, "cannot activate device (error 0x%lX)", hr);
return pv;
}
@@ -233,7 +233,7 @@ static es_out_id_t *CreateES(demux_t *demux, IAudioClient *client, bool loop,
hr = IAudioClient_GetMixFormat(client, &pwf);
if (FAILED(hr))
{
- msg_Err(demux, "cannot get mix format (error 0x%lx)", hr);
+ msg_Err(demux, "cannot get mix format (error 0x%lX)", hr);
return NULL;
}
@@ -265,7 +265,7 @@ static es_out_id_t *CreateES(demux_t *demux, IAudioClient *client, bool loop,
CoTaskMemFree(pwf);
if (FAILED(hr))
{
- msg_Err(demux, "cannot initialize audio client (error 0x%lx)", hr);
+ msg_Err(demux, "cannot initialize audio client (error 0x%lX)", hr);
return NULL;
}
return es_out_Add(demux->out, &fmt);
@@ -302,7 +302,7 @@ static unsigned __stdcall Thread(void *data)
hr = IAudioClient_GetService(sys->client, &IID_IAudioCaptureClient, &pv);
if (FAILED(hr))
{
- msg_Err(demux, "cannot get capture client (error 0x%lx)", hr);
+ msg_Err(demux, "cannot get capture client (error 0x%lX)", hr);
goto out;
}
capture = pv;
@@ -310,7 +310,7 @@ static unsigned __stdcall Thread(void *data)
hr = IAudioClient_Start(sys->client);
if (FAILED(hr))
{
- msg_Err(demux, "cannot start client (error 0x%lx)", hr);
+ msg_Err(demux, "cannot start client (error 0x%lX)", hr);
IAudioCaptureClient_Release(capture);
goto out;
}
@@ -410,7 +410,7 @@ static int Open(vlc_object_t *obj)
hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (unlikely(FAILED(hr))) {
- msg_Err(demux, "cannot initialize COM (error 0x%lx)", hr);
+ msg_Err(demux, "cannot initialize COM (error 0x%lX)", hr);
goto error;
}
@@ -428,7 +428,7 @@ static int Open(vlc_object_t *obj)
hr = IAudioClient_SetEventHandle(sys->client, sys->events[1]);
if (FAILED(hr)) {
- msg_Err(demux, "cannot set event handle (error 0x%lx)", hr);
+ msg_Err(demux, "cannot set event handle (error 0x%lX)", hr);
goto error;
}
=====================================
modules/audio_output/directsound.c
=====================================
@@ -287,7 +287,7 @@ static HRESULT Play( vlc_object_t *obj, aout_stream_sys_t *sys,
0, 0, DSBPLAY_LOOPING );
}
if( dsresult != DS_OK )
- msg_Err( obj, "cannot start playing buffer: (hr=0x%0lx)", dsresult );
+ msg_Err( obj, "cannot start playing buffer: (hr=0x%lX)", dsresult );
else
{
vlc_mutex_lock( &sys->lock );
=====================================
modules/audio_output/mmdevice.c
=====================================
@@ -48,7 +48,7 @@ DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd,
#include <vlc_aout.h>
#include <vlc_charset.h>
#include <vlc_modules.h>
-#include "audio_output/mmdevice.h"
+#include "mmdevice.h"
DEFINE_GUID (GUID_VLC_AUD_OUT, 0x4533f59d, 0x59ee, 0x00c6,
0xad, 0xb2, 0xc6, 0x8b, 0x50, 0x1a, 0x66, 0x55);
@@ -58,7 +58,7 @@ static int TryEnterMTA(vlc_object_t *obj)
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (unlikely(FAILED(hr)))
{
- msg_Err (obj, "cannot initialize COM (error 0x%lx)", hr);
+ msg_Err (obj, "cannot initialize COM (error 0x%lX)", hr);
return -1;
}
return 0;
@@ -77,13 +77,13 @@ static void LeaveMTA(void)
CoUninitialize();
}
-static wchar_t default_device[1] = L"";
static char default_device_b[1] = "";
-enum initialisation_status_t {
- INITIALISATION_PENDING,
- INITIALISATION_FAILED,
- INITIALISATION_SUCCEEDED,
+enum device_acquisition_status {
+ DEVICE_PENDING,
+ DEVICE_INITIALISATION_FAILED,
+ DEVICE_ACQUISITION_FAILED,
+ DEVICE_ACQUIRED,
};
struct aout_sys_t
@@ -102,15 +102,15 @@ struct aout_sys_t
unsigned ducks;
float gain; /**< Current software gain volume */
- wchar_t *requested_device; /**< Requested device identifier, NULL if none */
float requested_volume; /**< Requested volume, negative if none */
signed char requested_mute; /**< Requested mute, negative if none */
- wchar_t *acquired_device; /**< Acquired device identifier, NULL if none */
- bool request_device_restart;
+ enum device_acquisition_status device_status;
+ wchar_t *device_name; /**< device identifier to use, NULL if default */
+ bool default_device_changed;
+ vlc_sem_t init_passed;
CRITICAL_SECTION lock;
CONDITION_VARIABLE work;
CONDITION_VARIABLE ready;
- enum initialisation_status_t initialisation_status;
vlc_thread_t thread; /**< Thread for audio session control */
};
@@ -370,7 +370,7 @@ vlc_AudioSessionEvents_OnSessionDisconnected(IAudioSessionEvents *this,
msg_Err(aout, "session disconnected: %s", "session disconnected");
return S_OK;
case DisconnectReasonExclusiveModeOverride:
- msg_Err(aout, "session disconnected: %s", "stream overriden");
+ msg_Err(aout, "session disconnected: %s", "stream overridden");
return S_OK;
default:
msg_Warn(aout, "session disconnected: unknown reason %d", reason);
@@ -598,13 +598,13 @@ vlc_MMNotificationClient_OnDefaultDeviceChange(IMMNotificationClient *this,
return S_OK;
EnterCriticalSection(&sys->lock);
- if (sys->acquired_device == NULL || sys->acquired_device == default_device)
+ if (sys->device_name == NULL)
{
- msg_Dbg(aout, "default device changed: %ls", wid);
- sys->request_device_restart = true;
+ sys->default_device_changed = true;
aout_RestartRequest(aout, AOUT_RESTART_OUTPUT);
}
LeaveCriticalSection(&sys->lock);
+ msg_Dbg(aout, "default device changed: %ls", wid ? wid : L"(disabled)");
return S_OK;
}
@@ -747,12 +747,12 @@ static HRESULT DevicesEnum(IMMDeviceEnumerator *it,
static int DeviceRequestLocked(audio_output_t *aout)
{
aout_sys_t *sys = aout->sys;
- assert(sys->requested_device);
+ assert(sys->device_status == DEVICE_PENDING);
- sys->request_device_restart = false;
+ sys->default_device_changed = false;
WakeConditionVariable(&sys->work);
- while (sys->requested_device != NULL)
+ while (sys->device_status == DEVICE_PENDING)
SleepConditionVariableCS(&sys->ready, &sys->lock, INFINITE);
if (sys->stream != NULL && sys->dev != NULL)
@@ -764,16 +764,17 @@ static int DeviceRequestLocked(audio_output_t *aout)
static int DeviceSelectLocked(audio_output_t *aout, const char *id)
{
aout_sys_t *sys = aout->sys;
- assert(sys->requested_device == NULL);
+ assert(sys->device_status != DEVICE_PENDING);
+ sys->device_status = DEVICE_PENDING;
if (id != NULL && strcmp(id, default_device_b) != 0)
{
- sys->requested_device = ToWide(id);
- if (unlikely(sys->requested_device == NULL))
+ sys->device_name = ToWide(id); /* FIXME leak */
+ if (unlikely(sys->device_name == NULL))
return -1;
}
else
- sys->requested_device = default_device;
+ sys->device_name = NULL;
return DeviceRequestLocked(aout);
}
@@ -781,9 +782,8 @@ static int DeviceSelectLocked(audio_output_t *aout, const char *id)
static int DeviceRestartLocked(audio_output_t *aout)
{
aout_sys_t *sys = aout->sys;
- assert(sys->requested_device == NULL);
- sys->requested_device = sys->acquired_device ? sys->acquired_device
- : default_device;
+ assert(sys->device_status != DEVICE_PENDING);
+ sys->device_status = DEVICE_PENDING;
return DeviceRequestLocked(aout);
}
@@ -795,19 +795,72 @@ static int DeviceSelect(audio_output_t *aout, const char *id)
return ret;
}
-/*** Initialization / deinitialization **/
-static wchar_t *var_InheritWide(vlc_object_t *obj, const char *name)
+/**
+ * Main loop
+ *
+ * Adjust volume as long as device is unchanged
+ * */
+static void MMSessionMainloop(audio_output_t *aout, ISimpleAudioVolume *volume)
{
- char *v8 = var_InheritString(obj, name);
- if (v8 == NULL)
- return NULL;
+ aout_sys_t *sys = aout->sys;
+ HRESULT hr;
+
+ bool report_volume = true;
+ bool report_mute = true;
+
+ while (sys->device_status != DEVICE_PENDING)
+ {
+ if (volume != NULL)
+ {
+ if (sys->requested_volume >= 0.f)
+ {
+ hr = ISimpleAudioVolume_SetMasterVolume(volume, sys->requested_volume, NULL);
+ if (FAILED(hr))
+ msg_Err(aout, "cannot set master volume (error 0x%lX)",
+ hr);
+ report_volume = true;
+ sys->requested_volume = -1.f;
+ }
+
+ if (report_volume)
+ {
+ float level;
+ hr = ISimpleAudioVolume_GetMasterVolume(volume, &level);
+ if (SUCCEEDED(hr))
+ aout_VolumeReport(aout, cbrtf(level * sys->gain));
+ else
+ msg_Err(aout, "cannot get master volume (error 0x%lX)", hr);
+ report_volume = false;
+ }
+
+ if (sys->requested_mute >= 0)
+ {
+ BOOL mute = sys->requested_mute ? TRUE : FALSE;
+
+ hr = ISimpleAudioVolume_SetMute(volume, mute, NULL);
+ if (FAILED(hr))
+ msg_Err(aout, "cannot set mute (error 0x%lX)", hr);
+ report_mute = true;
+ sys->requested_mute = -1;
+ }
+
+ if (report_mute)
+ {
+ BOOL mute;
+ hr = ISimpleAudioVolume_GetMute(volume, &mute);
+ if (SUCCEEDED(hr))
+ aout_MuteReport(aout, mute != FALSE);
+ else
+ msg_Err(aout, "cannot get mute (error 0x%lX)", hr);
+ report_mute = false;
+ }
+ }
- wchar_t *v16 = ToWide(v8);
- free(v8);
- return v16;
+ SleepConditionVariableCS(&sys->work, &sys->lock, INFINITE);
+ }
}
-#define var_InheritWide(o,n) var_InheritWide(VLC_OBJECT(o),n)
+/*** Initialization / deinitialization **/
/** MMDevice audio output thread.
* This thread takes cares of the audio session control. Inconveniently enough,
* the audio session control interface must:
@@ -829,22 +882,25 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
void *pv;
HRESULT hr;
- assert(sys->requested_device != NULL);
+ assert(sys->device_status == DEVICE_PENDING);
assert(sys->dev == NULL);
/* Yes, it's perfectly valid to request the same device, see Start()
* comments. */
- if (sys->acquired_device != sys->requested_device
- && sys->acquired_device != default_device)
- free(sys->acquired_device);
- if (sys->requested_device != default_device) /* Device selected explicitly */
+ if (sys->device_name != NULL) /* Device selected explicitly */
{
- msg_Dbg(aout, "using selected device %ls", sys->requested_device);
- hr = IMMDeviceEnumerator_GetDevice(it, sys->requested_device, &sys->dev);
+ hr = IMMDeviceEnumerator_GetDevice(it, sys->device_name, &sys->dev);
if (FAILED(hr))
- msg_Err(aout, "cannot get selected device %ls (error 0x%lx)",
- sys->requested_device, hr);
- sys->acquired_device = sys->requested_device;
+ {
+ msg_Err(aout, "cannot get selected device %ls (error 0x%lX)",
+ sys->device_name, hr);
+ hr = AUDCLNT_E_DEVICE_INVALIDATED;
+ }
+ else
+ {
+ msg_Dbg(aout, "using selected device %ls", sys->device_name);
+ sys->device_status = DEVICE_ACQUIRED;
+ }
}
else
hr = AUDCLNT_E_DEVICE_INVALIDATED;
@@ -857,43 +913,44 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
eConsole, &sys->dev);
if (FAILED(hr))
{
- msg_Err(aout, "cannot get default device (error 0x%lx)", hr);
- sys->acquired_device = NULL;
+ msg_Err(aout, "cannot get default device (error 0x%lX)", hr);
+ sys->device_status = DEVICE_ACQUISITION_FAILED;
+ sys->device_name = NULL;
}
else
- sys->acquired_device = default_device;
+ {
+ sys->device_status = DEVICE_ACQUIRED;
+ sys->device_name = NULL;
+ }
}
- sys->requested_device = NULL;
- sys->initialisation_status = INITIALISATION_SUCCEEDED;
WakeConditionVariable(&sys->ready);
+ vlc_sem_post(&sys->init_passed);
- if (SUCCEEDED(hr))
- { /* Report actual device */
- LPWSTR wdevid;
+ if (FAILED(hr))
+ {
+ msg_Err(aout, "cannot get device identifier (error 0x%lX)", hr);
+ return hr;
+ }
- if (sys->acquired_device == default_device)
- aout_DeviceReport(aout, default_device_b);
- else
+ /* Report actual device */
+ if (sys->device_name == NULL)
+ aout_DeviceReport(aout, default_device_b);
+ else
+ {
+ LPWSTR wdevid;
+ hr = IMMDevice_GetId(sys->dev, &wdevid);
+ if (SUCCEEDED(hr))
{
- hr = IMMDevice_GetId(sys->dev, &wdevid);
- if (SUCCEEDED(hr))
+ char *id = FromWide(wdevid);
+ CoTaskMemFree(wdevid);
+ if (likely(id != NULL))
{
- char *id = FromWide(wdevid);
- CoTaskMemFree(wdevid);
- if (likely(id != NULL))
- {
- aout_DeviceReport(aout, id);
- free(id);
- }
+ aout_DeviceReport(aout, id);
+ free(id);
}
}
}
- else
- {
- msg_Err(aout, "cannot get device identifier (error 0x%lx)", hr);
- return hr;
- }
/* Create session manager (for controls even w/o active audio client) */
hr = IMMDevice_Activate(sys->dev, &IID_IAudioSessionManager,
@@ -908,20 +965,28 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
&control);
if (SUCCEEDED(hr))
{
- wchar_t *ua = var_InheritWide(aout, "user-agent");
- IAudioSessionControl_SetDisplayName(control, ua, NULL);
- free(ua);
+ char *ua = var_InheritString(aout, "user-agent");
+ if (ua != NULL)
+ {
+ wchar_t *wua = ToWide(ua);
+ if (likely(wua != NULL))
+ {
+ IAudioSessionControl_SetDisplayName(control, wua, NULL);
+ free(wua);
+ }
+ free(ua);
+ }
IAudioSessionControl_RegisterAudioSessionNotification(control,
&sys->session_events);
}
else
- msg_Err(aout, "cannot get session control (error 0x%lx)", hr);
+ msg_Err(aout, "cannot get session control (error 0x%lX)", hr);
hr = IAudioSessionManager_GetSimpleAudioVolume(manager, guid, FALSE,
&volume);
if (FAILED(hr))
- msg_Err(aout, "cannot get simple volume (error 0x%lx)", hr);
+ msg_Err(aout, "cannot get simple volume (error 0x%lX)", hr);
/* Try to get version 2 (Windows 7) of the manager & control */
wchar_t *siid = NULL;
@@ -958,7 +1023,7 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
}
else
{
- msg_Err(aout, "cannot activate session manager (error 0x%lx)", hr);
+ msg_Err(aout, "cannot activate session manager (error 0x%lX)", hr);
control = NULL;
volume = NULL;
}
@@ -975,56 +1040,13 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
msg_Dbg(aout, "volume from %+f dB to %+f dB with %f dB increments",
min, max, inc);
else
- msg_Err(aout, "cannot get volume range (error 0x%lx)", hr);
+ msg_Err(aout, "cannot get volume range (error 0x%lX)", hr);
}
else
- msg_Err(aout, "cannot activate endpoint volume (error %lx)", hr);
-
- /* Main loop (adjust volume as long as device is unchanged) */
- while (sys->requested_device == NULL)
- {
- if (volume != NULL)
- {
- float level;
-
- level = sys->requested_volume;
- if (level >= 0.f)
- {
- hr = ISimpleAudioVolume_SetMasterVolume(volume, level, NULL);
- if (FAILED(hr))
- msg_Err(aout, "cannot set master volume (error 0x%lx)",
- hr);
- }
- sys->requested_volume = -1.f;
-
- hr = ISimpleAudioVolume_GetMasterVolume(volume, &level);
- if (SUCCEEDED(hr))
- aout_VolumeReport(aout, cbrtf(level * sys->gain));
- else
- msg_Err(aout, "cannot get master volume (error 0x%lx)", hr);
-
- BOOL mute;
-
- hr = ISimpleAudioVolume_GetMute(volume, &mute);
- if (FAILED(hr))
- msg_Err(aout, "cannot get mute (error 0x%lx)", hr);
-
- if (sys->requested_mute >= 0)
- {
- mute = sys->requested_mute ? TRUE : FALSE;
+ msg_Err(aout, "cannot activate endpoint volume (error 0x%lX)", hr);
- hr = ISimpleAudioVolume_SetMute(volume, mute, NULL);
- if (FAILED(hr))
- msg_Err(aout, "cannot set mute (error 0x%lx)", hr);
- }
- sys->requested_mute = -1;
+ MMSessionMainloop(aout, volume);
- if (SUCCEEDED(hr))
- aout_MuteReport(aout, mute != FALSE);
- }
-
- SleepConditionVariableCS(&sys->work, &sys->lock, INFINITE);
- }
LeaveCriticalSection(&sys->lock);
if (endpoint != NULL)
@@ -1094,12 +1116,12 @@ static void *MMThread(void *data)
&sys->device_events);
hr = DevicesEnum(it, MMThread_DevicesEnum_Added, aout);
if (FAILED(hr))
- msg_Warn(aout, "cannot enumerate audio endpoints (error 0x%lx)", hr);
+ msg_Warn(aout, "cannot enumerate audio endpoints (error 0x%lX)", hr);
EnterCriticalSection(&sys->lock);
do
- if (sys->requested_device == NULL || FAILED(MMSession(aout, it)))
+ if (sys->device_status != DEVICE_PENDING || FAILED(MMSession(aout, it)))
SleepConditionVariableCS(&sys->work, &sys->lock, INFINITE);
while (sys->it != NULL);
@@ -1112,10 +1134,8 @@ static void *MMThread(void *data)
return NULL;
error:
- EnterCriticalSection(&sys->lock);
- sys->initialisation_status = INITIALISATION_FAILED;
- WakeConditionVariable(&sys->ready);
- LeaveCriticalSection(&sys->lock);
+ sys->device_status = DEVICE_INITIALISATION_FAILED;
+ vlc_sem_post(&sys->init_passed);
return NULL;
}
@@ -1184,7 +1204,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
EnterMTA();
EnterCriticalSection(&sys->lock);
- if ((sys->request_device_restart && DeviceRestartLocked(aout) != 0)
+ if ((sys->default_device_changed && DeviceRestartLocked(aout) != 0)
|| sys->dev == NULL)
{
/* Error if the device restart failed or if a request previously
@@ -1281,6 +1301,8 @@ static void Stop(audio_output_t *aout)
sys->stream = NULL;
}
+static void Close(vlc_object_t *);
+
static int Open(vlc_object_t *obj)
{
audio_output_t *aout = (audio_output_t *)obj;
@@ -1303,12 +1325,13 @@ static int Open(vlc_object_t *obj)
sys->gain = 1.f;
sys->requested_volume = -1.f;
sys->requested_mute = -1;
- sys->acquired_device = NULL;
- sys->request_device_restart = false;
+ sys->device_name = NULL;
+ sys->default_device_changed = false;
if (!var_CreateGetBool(aout, "volume-save"))
VolumeSetLocked(aout, var_InheritFloat(aout, "mmdevice-volume"));
+ vlc_sem_init(&sys->init_passed, 0);
InitializeCriticalSection(&sys->lock);
InitializeConditionVariable(&sys->work);
InitializeConditionVariable(&sys->ready);
@@ -1318,34 +1341,28 @@ static int Open(vlc_object_t *obj)
char *saved_device_b = var_InheritString(aout, "mmdevice-audio-device");
if (saved_device_b != NULL && strcmp(saved_device_b, default_device_b) != 0)
{
- sys->requested_device = ToWide(saved_device_b);
+ sys->device_name = ToWide(saved_device_b); /* FIXME leak */
free(saved_device_b);
- if (unlikely(sys->requested_device == NULL))
+ if (unlikely(sys->device_name == NULL))
goto error;
}
else
{
free(saved_device_b);
- sys->requested_device = default_device;
+ sys->device_name = NULL;
}
+ sys->device_status = DEVICE_PENDING;
- sys->initialisation_status = INITIALISATION_PENDING;
if (vlc_clone(&sys->thread, MMThread, aout, VLC_THREAD_PRIORITY_LOW))
- {
- IMMDeviceEnumerator_Release(sys->it);
goto error;
- }
- EnterCriticalSection(&sys->lock);
- while (sys->initialisation_status == INITIALISATION_PENDING)
- SleepConditionVariableCS(&sys->ready, &sys->lock, INFINITE);
- LeaveCriticalSection(&sys->lock);
+ vlc_sem_wait(&sys->init_passed);
- if (sys->initialisation_status == INITIALISATION_FAILED)
+ if (sys->device_status == DEVICE_INITIALISATION_FAILED)
{
- vlc_join(sys->thread, NULL);
- goto error;
+ Close(obj);
+ return VLC_EGENERIC;
}
aout->start = Start;
@@ -1372,11 +1389,16 @@ static void Close(vlc_object_t *obj)
aout_sys_t *sys = aout->sys;
EnterCriticalSection(&sys->lock);
- sys->requested_device = default_device; /* break out of MMSession() loop */
+ wchar_t *previous = sys->device_name;
+ sys->device_name = NULL;
+ sys->device_status = DEVICE_PENDING; /* break out of MMSession() loop */
sys->it = NULL; /* break out of MMThread() loop */
WakeConditionVariable(&sys->work);
LeaveCriticalSection(&sys->lock);
+ if (previous != NULL)
+ free(previous);
+
vlc_join(sys->thread, NULL);
DeleteCriticalSection(&sys->lock);
@@ -1422,14 +1444,23 @@ static void Reload_DevicesEnum_Added(void *data, LPCWSTR wid, IMMDevice *dev)
static int ReloadAudioDevices(vlc_object_t *this, char const *name,
char ***values, char ***descs)
{
+ bool in_mta = true;
+ HRESULT hr;
+
(void) name;
- bool in_mta = SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED));
+ hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ if (FAILED(hr)) {
+ if (hr != RPC_E_CHANGED_MODE)
+ return -1;
+
+ in_mta = false;
+ }
struct mm_list list = { .count = 0 };
void *it;
- HRESULT hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
- &IID_IMMDeviceEnumerator, &it);
+ hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
+ &IID_IMMDeviceEnumerator, &it);
if (FAILED(hr))
goto error;
=====================================
modules/audio_output/wasapi.c
=====================================
@@ -41,7 +41,7 @@
#include <vlc_plugin.h>
#include <audioclient.h>
-#include "audio_output/mmdevice.h"
+#include "mmdevice.h"
/* 00000092-0000-0010-8000-00aa00389b71 */
DEFINE_GUID(_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL,
@@ -118,7 +118,7 @@ static HRESULT TimeGet(aout_stream_t *s, vlc_tick_t *restrict delay)
hr = IAudioClient_GetService(sys->client, &IID_IAudioClock, &pv);
if (FAILED(hr))
{
- msg_Err(s, "cannot get clock (error 0x%lx)", hr);
+ msg_Err(s, "cannot get clock (error 0x%lX)", hr);
return hr;
}
@@ -130,7 +130,7 @@ static HRESULT TimeGet(aout_stream_t *s, vlc_tick_t *restrict delay)
IAudioClock_Release(clock);
if (FAILED(hr))
{
- msg_Err(s, "cannot get position (error 0x%lx)", hr);
+ msg_Err(s, "cannot get position (error 0x%lX)", hr);
return hr;
}
@@ -160,7 +160,7 @@ static HRESULT Play(aout_stream_t *s, block_t *block)
hr = IAudioClient_GetService(sys->client, &IID_IAudioRenderClient, &pv);
if (FAILED(hr))
{
- msg_Err(s, "cannot get render client (error 0x%lx)", hr);
+ msg_Err(s, "cannot get render client (error 0x%lX)", hr);
goto out;
}
@@ -171,7 +171,7 @@ static HRESULT Play(aout_stream_t *s, block_t *block)
hr = IAudioClient_GetCurrentPadding(sys->client, &frames);
if (FAILED(hr))
{
- msg_Err(s, "cannot get current padding (error 0x%lx)", hr);
+ msg_Err(s, "cannot get current padding (error 0x%lX)", hr);
break;
}
@@ -184,7 +184,7 @@ static HRESULT Play(aout_stream_t *s, block_t *block)
hr = IAudioRenderClient_GetBuffer(render, frames, &dst);
if (FAILED(hr))
{
- msg_Err(s, "cannot get buffer (error 0x%lx)", hr);
+ msg_Err(s, "cannot get buffer (error 0x%lX)", hr);
break;
}
@@ -194,7 +194,7 @@ static HRESULT Play(aout_stream_t *s, block_t *block)
hr = IAudioRenderClient_ReleaseBuffer(render, frames, 0);
if (FAILED(hr))
{
- msg_Err(s, "cannot release buffer (error 0x%lx)", hr);
+ msg_Err(s, "cannot release buffer (error 0x%lX)", hr);
break;
}
IAudioClient_Start(sys->client);
@@ -226,7 +226,7 @@ static HRESULT Pause(aout_stream_t *s, bool paused)
else
hr = IAudioClient_Start(sys->client);
if (FAILED(hr))
- msg_Warn(s, "cannot %s stream (error 0x%lx)",
+ msg_Warn(s, "cannot %s stream (error 0x%lX)",
paused ? "stop" : "start", hr);
return hr;
}
@@ -245,7 +245,7 @@ static HRESULT Flush(aout_stream_t *s)
sys->written = 0;
}
else
- msg_Warn(s, "cannot reset stream (error 0x%lx)", hr);
+ msg_Warn(s, "cannot reset stream (error 0x%lX)", hr);
return hr;
}
@@ -524,7 +524,7 @@ static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
HRESULT hr = aout_stream_Activate(s, &IID_IAudioClient, NULL, &pv);
if (FAILED(hr))
{
- msg_Err(s, "cannot activate client (error 0x%lx)", hr);
+ msg_Err(s, "cannot activate client (error 0x%lX)", hr);
goto error;
}
sys->client = pv;
@@ -586,13 +586,13 @@ static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
if (pfmt->i_format == VLC_CODEC_DTS && b_hdmi)
{
msg_Warn(s, "cannot negotiate DTS at 768khz IEC958 rate (HDMI), "
- "fallback to 48kHz (S/PDIF) (error 0x%lx)", hr);
+ "fallback to 48kHz (S/PDIF) (error 0x%lX)", hr);
IAudioClient_Release(sys->client);
free(sys);
var_SetBool(s->obj.parent, "dtshd", false);
return Start(s, pfmt, sid);
}
- msg_Err(s, "cannot negotiate audio format (error 0x%lx)%s", hr,
+ msg_Err(s, "cannot negotiate audio format (error 0x%lX)%s", hr,
hr == AUDCLNT_E_UNSUPPORTED_FORMAT
&& fmt.i_format == VLC_CODEC_SPDIFL ?
": digital pass-through not supported" : "");
@@ -628,14 +628,14 @@ static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
CoTaskMemFree(pwf_closest);
if (FAILED(hr))
{
- msg_Err(s, "cannot initialize audio client (error 0x%lx)", hr);
+ msg_Err(s, "cannot initialize audio client (error 0x%lX)", hr);
goto error;
}
hr = IAudioClient_GetBufferSize(sys->client, &sys->frames);
if (FAILED(hr))
{
- msg_Err(s, "cannot get buffer size (error 0x%lx)", hr);
+ msg_Err(s, "cannot get buffer size (error 0x%lX)", hr);
goto error;
}
msg_Dbg(s, "buffer size : %"PRIu32" frames", sys->frames);
=====================================
modules/audio_output/winstore.c
=====================================
@@ -33,7 +33,7 @@
#include <vlc_aout.h>
#include <vlc_charset.h> // ToWide
#include <vlc_modules.h>
-#include "audio_output/mmdevice.h"
+#include "mmdevice.h"
#include <audioclient.h>
#include <mmdeviceapi.h>
@@ -297,14 +297,14 @@ static int VolumeSet(audio_output_t *aout, float vol)
hr = IAudioClient_GetService(sys->client, &IID_ISimpleAudioVolume, &pc_AudioVolume);
if (FAILED(hr))
{
- msg_Err(aout, "cannot get volume service (error 0x%lx)", hr);
+ msg_Err(aout, "cannot get volume service (error 0x%lX)", hr);
goto done;
}
hr = ISimpleAudioVolume_SetMasterVolume(pc_AudioVolume, linear_vol, NULL);
if (FAILED(hr))
{
- msg_Err(aout, "cannot set volume (error 0x%lx)", hr);
+ msg_Err(aout, "cannot set volume (error 0x%lX)", hr);
goto done;
}
@@ -328,14 +328,14 @@ static int MuteSet(audio_output_t *aout, bool mute)
hr = IAudioClient_GetService(sys->client, &IID_ISimpleAudioVolume, &pc_AudioVolume);
if (FAILED(hr))
{
- msg_Err(aout, "cannot get volume service (error 0x%lx)", hr);
+ msg_Err(aout, "cannot get volume service (error 0x%lX)", hr);
goto done;
}
hr = ISimpleAudioVolume_SetMute(pc_AudioVolume, mute, NULL);
if (FAILED(hr))
{
- msg_Err(aout, "cannot set mute (error 0x%lx)", hr);
+ msg_Err(aout, "cannot set mute (error 0x%lX)", hr);
goto done;
}
=====================================
modules/codec/avcodec/d3d11va.c
=====================================
@@ -780,7 +780,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id,
&viewDesc,
&pic->p_sys->decoder );
if (FAILED(hr)) {
- msg_Warn(va, "CreateVideoDecoderOutputView %d failed. (hr=0x%0lx)", surface_idx, hr);
+ msg_Warn(va, "CreateVideoDecoderOutputView %d failed. (hr=0x%lX)", surface_idx, hr);
dx_sys->can_extern_pool = false;
break;
}
@@ -833,7 +833,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id,
ID3D11Texture2D *p_texture;
hr = ID3D11Device_CreateTexture2D( sys->d3d_dev.d3ddevice, &texDesc, NULL, &p_texture );
if (FAILED(hr)) {
- msg_Err(va, "CreateTexture2D %d failed. (hr=0x%0lx)", surface_count, hr);
+ msg_Err(va, "CreateTexture2D %d failed. (hr=0x%lX)", surface_count, hr);
return VLC_EGENERIC;
}
@@ -847,7 +847,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id,
&viewDesc,
&dx_sys->hw_surface[surface_idx] );
if (FAILED(hr)) {
- msg_Err(va, "CreateVideoDecoderOutputView %d failed. (hr=0x%0lx)", surface_idx, hr);
+ msg_Err(va, "CreateVideoDecoderOutputView %d failed. (hr=0x%lX)", surface_idx, hr);
ID3D11Texture2D_Release(p_texture);
return VLC_EGENERIC;
}
=====================================
modules/codec/avcodec/dxva2.c
=====================================
@@ -584,7 +584,7 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id,
sys->hw_surface,
NULL);
if (FAILED(hr)) {
- msg_Err(va, "IDirectXVideoAccelerationService_CreateSurface %d failed (hr=0x%0lx)", surface_count - 1, hr);
+ msg_Err(va, "IDirectXVideoAccelerationService_CreateSurface %d failed (hr=0x%lX)", surface_count - 1, hr);
return VLC_EGENERIC;
}
msg_Dbg(va, "IDirectXVideoAccelerationService_CreateSurface succeed with %d surfaces (%dx%d)",
@@ -602,7 +602,7 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id,
&tstCrash,
NULL);
if (FAILED(hr)) {
- msg_Err(va, "extra buffer impossible, avoid a crash (hr=0x%0lx)", hr);
+ msg_Err(va, "extra buffer impossible, avoid a crash (hr=0x%lX)", hr);
goto error;
}
IDirect3DSurface9_Release(tstCrash);
@@ -644,7 +644,7 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id,
&cfg_count,
&cfg_list);
if (FAILED(hr)) {
- msg_Err(va, "IDirectXVideoDecoderService_GetDecoderConfigurations failed. (hr=0x%0lx)", hr);
+ msg_Err(va, "IDirectXVideoDecoderService_GetDecoderConfigurations failed. (hr=0x%lX)", hr);
goto error;
}
msg_Dbg(va, "we got %d decoder configurations", cfg_count);
=====================================
modules/codec/subsusf.c
=====================================
@@ -438,7 +438,7 @@ static subpicture_region_t *CreateTextRegion( decoder_t *p_dec,
}
/* Set default or user align/magin.
- * Style overriden if no user value. */
+ * Style overridden if no user value. */
p_text_region->i_x = i_sys_align > 0 ? 20 : 0;
p_text_region->i_y = 10;
p_text_region->i_align = SUBPICTURE_ALIGN_BOTTOM |
=====================================
modules/control/oldrc.c
=====================================
@@ -1825,7 +1825,7 @@ static bool ReadWin32( intf_thread_t *p_intf, unsigned char *p_buffer, int *pi_s
nbBytes++;
}
assert( clz( (unsigned char)~(p_buffer[*pi_size]) ) == nbBytes + 1 );
- // The first utf8 byte will be overriden by a \0
+ // The first utf8 byte will be overridden by a \0
}
else
(*pi_size)--;
=====================================
modules/gui/macosx/VLCHUDCheckboxCell.m
=====================================
@@ -43,7 +43,7 @@
/* On 10.10+ we do not want custom drawing, therefore we swap out the implementation
* of the selectors below with their original implementations.
* Just calling super will not work, as the AppKit implementation for the NSButton
- * checkbox checks if the drawing related selectors below are overriden, and if
+ * checkbox checks if the drawing related selectors below are overridden, and if
* that is the case, will fall back to legacy drawing, without animation,
* without vibrancy and non-layer-based.
*/
=====================================
modules/hw/d3d11/d3d11_deinterlace.c
=====================================
@@ -503,7 +503,7 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
hr = ID3D11Device_CreateTexture2D( sys->d3d_dev.d3ddevice, &texDesc, NULL, &sys->outTexture );
if (FAILED(hr)) {
- msg_Err(filter, "CreateTexture2D failed. (hr=0x%0lx)", hr);
+ msg_Err(filter, "CreateTexture2D failed. (hr=0x%lX)", hr);
goto error;
}
=====================================
modules/hw/d3d11/d3d11_filters.c
=====================================
@@ -526,13 +526,13 @@ static int D3D11OpenAdjust(vlc_object_t *obj)
hr = ID3D11Device_CreateTexture2D( sys->d3d_dev.d3ddevice, &texDesc, NULL, &sys->out[0].texture );
if (FAILED(hr)) {
- msg_Err(filter, "CreateTexture2D failed. (hr=0x%0lx)", hr);
+ msg_Err(filter, "CreateTexture2D failed. (hr=0x%lX)", hr);
goto error;
}
hr = ID3D11Device_CreateTexture2D( sys->d3d_dev.d3ddevice, &texDesc, NULL, &sys->out[1].texture );
if (FAILED(hr)) {
ID3D11Texture2D_Release(sys->out[0].texture);
- msg_Err(filter, "CreateTexture2D failed. (hr=0x%0lx)", hr);
+ msg_Err(filter, "CreateTexture2D failed. (hr=0x%lX)", hr);
goto error;
}
=====================================
modules/hw/d3d11/d3d11_surface.c
=====================================
@@ -222,7 +222,7 @@ static int assert_staging(filter_t *p_filter, picture_sys_t *p_sys)
hr = ID3D11Device_CreateTexture2D( d3d_dev.d3ddevice, &texDesc, NULL, &sys->staging);
/* test if mapping the texture works ref #18746 */
if (SUCCEEDED(hr) && FAILED(hr = can_map(sys, p_sys->context)))
- msg_Dbg(p_filter, "can't map default staging texture (hr=0x%0lx)", hr);
+ msg_Dbg(p_filter, "can't map default staging texture (hr=0x%lX)", hr);
#if CAN_PROCESSOR
if (FAILED(hr)) {
/* failed with the this format, try a different one */
@@ -254,7 +254,7 @@ static int assert_staging(filter_t *p_filter, picture_sys_t *p_sys)
}
else
{
- msg_Dbg(p_filter, "can't create intermediate texture (hr=0x%0lx)", hr);
+ msg_Dbg(p_filter, "can't create intermediate texture (hr=0x%lX)", hr);
ID3D11Texture2D_Release(sys->staging);
sys->staging = NULL;
}
@@ -264,7 +264,7 @@ static int assert_staging(filter_t *p_filter, picture_sys_t *p_sys)
#endif
ID3D11Device_Release(d3d_dev.d3ddevice);
if (FAILED(hr)) {
- msg_Err(p_filter, "Failed to create a %s staging texture to extract surface pixels (hr=0x%0lx)", DxgiFormatToStr(texDesc.Format), hr );
+ msg_Err(p_filter, "Failed to create a %s staging texture to extract surface pixels (hr=0x%lX)", DxgiFormatToStr(texDesc.Format), hr );
return VLC_EGENERIC;
}
ok:
@@ -358,7 +358,7 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
HRESULT hr = ID3D11DeviceContext_Map(p_sys->context, sys->staging_resource,
0, D3D11_MAP_READ, 0, &lock);
if (FAILED(hr)) {
- msg_Err(p_filter, "Failed to map source surface. (hr=0x%0lx)", hr);
+ msg_Err(p_filter, "Failed to map source surface. (hr=0x%lX)", hr);
vlc_mutex_unlock(&sys->staging_lock);
return;
}
@@ -511,7 +511,7 @@ static void D3D11_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
HRESULT hr = ID3D11DeviceContext_Map(p_sys->context, sys->staging_resource,
0, D3D11_MAP_READ, 0, &lock);
if (FAILED(hr)) {
- msg_Err(p_filter, "Failed to map source surface. (hr=0x%0lx)", hr);
+ msg_Err(p_filter, "Failed to map source surface. (hr=0x%lX)", hr);
vlc_mutex_unlock(&sys->staging_lock);
return;
}
@@ -630,7 +630,7 @@ static void NV12_D3D11(filter_t *p_filter, picture_t *src, picture_t *dst)
HRESULT hr = ID3D11DeviceContext_Map(p_sys->context, sys->staging_pic->p_sys->resource[KNOWN_DXGI_INDEX],
0, D3D11_MAP_WRITE, 0, &lock);
if (FAILED(hr)) {
- msg_Err(p_filter, "Failed to map source surface. (hr=0x%0lx)", hr);
+ msg_Err(p_filter, "Failed to map source surface. (hr=0x%lX)", hr);
return;
}
@@ -804,7 +804,7 @@ int D3D11OpenCPUConverter( vlc_object_t *obj )
HRESULT hr = ID3D11Device_CreateTexture2D( d3d_dev.d3ddevice, &texDesc, NULL, &texture);
if (FAILED(hr)) {
- msg_Err(p_filter, "Failed to create a %s staging texture to extract surface pixels (hr=0x%0lx)", DxgiFormatToStr(texDesc.Format), hr );
+ msg_Err(p_filter, "Failed to create a %s staging texture to extract surface pixels (hr=0x%lX)", DxgiFormatToStr(texDesc.Format), hr );
goto done;
}
=====================================
modules/hw/d3d9/dxa9.c
=====================================
@@ -448,7 +448,7 @@ int D3D9OpenCPUConverter( vlc_object_t *obj )
&texture,
NULL);
if (FAILED(hr)) {
- msg_Err(p_filter, "Failed to create a %4.4s staging texture to extract surface pixels (hr=0x%0lx)", (char *)texDesc.Format, hr );
+ msg_Err(p_filter, "Failed to create a %4.4s staging texture to extract surface pixels (hr=0x%lX)", (char *)texDesc.Format, hr );
goto done;
}
res.p_sys->surface = texture;
=====================================
modules/lua/libs/win.c
=====================================
@@ -95,7 +95,7 @@ static bool ReadWin32( HANDLE *hConsoleIn, unsigned char *p_buffer, int *pi_size
nbBytes++;
}
assert( clz( (unsigned char)~(p_buffer[*pi_size]) ) == nbBytes + 1 );
- // The first utf8 byte will be overriden by a \0
+ // The first utf8 byte will be overridden by a \0
}
else
(*pi_size)--;
=====================================
modules/text_renderer/sapi.cpp
=====================================
@@ -74,7 +74,7 @@ static int TryEnterMTA(vlc_object_t *obj)
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (unlikely(FAILED(hr)))
{
- msg_Err (obj, "cannot initialize COM (error 0x%lx)", hr);
+ msg_Err (obj, "cannot initialize COM (error 0x%lX)", hr);
return -1;
}
return 0;
=====================================
modules/video_chroma/d3d11_fmt.c
=====================================
@@ -661,7 +661,7 @@ int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev,
hr = ID3D11Device_CreateTexture2D( d3d_dev->d3ddevice, &texDesc, NULL, &slicedTexture );
if (FAILED(hr)) {
- msg_Err(obj, "CreateTexture2D failed for the %d pool. (hr=0x%0lx)", pool_size, hr);
+ msg_Err(obj, "CreateTexture2D failed for the %d pool. (hr=0x%lX)", pool_size, hr);
goto error;
}
}
@@ -677,7 +677,7 @@ int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev,
texDesc.Width = fmt->i_width * p_chroma_desc->p[plane].w.num / p_chroma_desc->p[plane].w.den;
hr = ID3D11Device_CreateTexture2D( d3d_dev->d3ddevice, &texDesc, NULL, &textures[picture_count * D3D11_MAX_SHADER_VIEW + plane] );
if (FAILED(hr)) {
- msg_Err(obj, "CreateTexture2D failed for the %d pool. (hr=0x%0lx)", pool_size, hr);
+ msg_Err(obj, "CreateTexture2D failed for the %d pool. (hr=0x%lX)", pool_size, hr);
goto error;
}
}
=====================================
modules/video_chroma/d3d9_fmt.c
=====================================
@@ -67,10 +67,10 @@ HRESULT D3D9_CreateDevice(vlc_object_t *o, d3d9_handle_t *hd3d, HWND hwnd,
ZeroMemory(&out->caps, sizeof(out->caps));
hr = IDirect3D9_GetDeviceCaps(hd3d->obj, AdapterToUse, DeviceType, &out->caps);
if (FAILED(hr)) {
- msg_Err(o, "Could not read adapter capabilities. (hr=0x%0lx)", hr);
+ msg_Err(o, "Could not read adapter capabilities. (hr=0x%lX)", hr);
return hr;
}
- msg_Dbg(o, "D3D9 device caps 0x%0lX / 0x%0lX", out->caps.DevCaps, out->caps.DevCaps2);
+ msg_Dbg(o, "D3D9 device caps 0x%lX / 0x%lX", out->caps.DevCaps, out->caps.DevCaps2);
/* TODO: need to test device capabilities and select the right render function */
if (!(out->caps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES)) {
@@ -284,7 +284,7 @@ void Direct3D9UnlockSurface(picture_t *picture)
/* Unlock the Surface */
HRESULT hr = IDirect3DSurface9_UnlockRect(picture->p_sys->surface);
if (FAILED(hr)) {
- //msg_Dbg(vd, "Failed IDirect3DSurface9_UnlockRect: 0x%0lx", hr);
+ //msg_Dbg(vd, "Failed IDirect3DSurface9_UnlockRect: 0x%lX", hr);
}
}
@@ -331,7 +331,7 @@ picture_pool_t *Direct3D9CreatePicturePool(vlc_object_t *o,
&picsys->surface,
NULL);
if (FAILED(hr)) {
- msg_Err(o, "Failed to allocate surface %d (hr=0x%0lx)", picture_count, hr);
+ msg_Err(o, "Failed to allocate surface %d (hr=0x%0lX)", picture_count, hr);
free(picsys);
goto error;
}
=====================================
modules/video_output/win32/common.c
=====================================
@@ -548,7 +548,7 @@ static void CommonChangeThumbnailClip(vout_display_t *vd, bool show)
hr = taskbl->lpVtbl->SetThumbnailClip(taskbl, hroot,
show ? &video : NULL);
if ( hr != S_OK )
- msg_Err(vd, "SetThumbNailClip failed: 0x%0lx", hr);
+ msg_Err(vd, "SetThumbNailClip failed: 0x%lX", hr);
taskbl->lpVtbl->Release(taskbl);
}
=====================================
modules/video_output/win32/direct3d9.c
=====================================
@@ -412,7 +412,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
hr = IDirect3DDevice9_StretchRect( p_d3d9_dev->dev, pic_ctx->picsys.surface, &visibleSource, surface, &visibleSource, D3DTEXF_NONE);
if (FAILED(hr)) {
- msg_Err(vd, "Failed to copy the hw surface to the decoder surface (hr=0x%0lx)", hr );
+ msg_Err(vd, "Failed to copy the hw surface to the decoder surface (hr=0x%0lX)", hr );
}
}
}
@@ -476,7 +476,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
hr = IDirect3DDevice9_Present(p_d3d9_dev->dev, &src, &dst, NULL, NULL);
}
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DDevice9_Present: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DDevice9_Present: 0x%lX", hr);
}
/* XXX See Prepare() */
@@ -933,7 +933,7 @@ static int Direct3D9Reset(vout_display_t *vd)
hr = IDirect3DDevice9_Reset(p_d3d9_dev->dev, &p_d3d9_dev->pp);
}
if (FAILED(hr)) {
- msg_Err(vd, "IDirect3DDevice9_Reset failed! (hr=0x%0lx)", hr);
+ msg_Err(vd, "IDirect3DDevice9_Reset failed! (hr=0x%lX)", hr);
return VLC_EGENERIC;
}
@@ -1025,7 +1025,7 @@ static int Direct3D9CheckConversion(vout_display_t *vd,
}
if (!SUCCEEDED(hr)) {
if (D3DERR_NOTAVAILABLE != hr)
- msg_Err(vd, "Could not query adapter supported formats. (hr=0x%0lx)", hr);
+ msg_Err(vd, "Could not query adapter supported formats. (hr=0x%lX)", hr);
return VLC_EGENERIC;
}
return VLC_SUCCESS;
@@ -1139,7 +1139,7 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
&d3dtex,
NULL);
if (FAILED(hr)) {
- msg_Err(vd, "Failed to create texture. (hr=0x%lx)", hr);
+ msg_Err(vd, "Failed to create texture. (hr=0x%lX)", hr);
return VLC_EGENERIC;
}
@@ -1159,7 +1159,7 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
&d3dvtc,
NULL);
if (FAILED(hr)) {
- msg_Err(vd, "Failed to create vertex buffer. (hr=0x%lx)", hr);
+ msg_Err(vd, "Failed to create vertex buffer. (hr=0x%lX)", hr);
IDirect3DTexture9_Release(d3dtex);
return VLC_EGENERIC;
}
@@ -1293,7 +1293,7 @@ static int Direct3D9CompileShader(vout_display_t *vd, const char *shader_source,
"main", "ps_3_0", shader_flags, &compiled_shader, &error_msgs, NULL);
if (FAILED(hr)) {
- msg_Warn(vd, "D3DXCompileShader Error (hr=0x%0lx)", hr);
+ msg_Warn(vd, "D3DXCompileShader Error (hr=0x%lX)", hr);
if (error_msgs) {
msg_Warn(vd, "HLSL Compilation Error: %s", (char*)ID3DXBuffer_GetBufferPointer(error_msgs));
ID3DXBuffer_Release(error_msgs);
@@ -1311,7 +1311,7 @@ static int Direct3D9CompileShader(vout_display_t *vd, const char *shader_source,
ID3DXBuffer_Release(error_msgs);
if (FAILED(hr)) {
- msg_Warn(vd, "IDirect3DDevice9_CreatePixelShader error (hr=0x%0lx)", hr);
+ msg_Warn(vd, "IDirect3DDevice9_CreatePixelShader error (hr=0x%lX)", hr);
return VLC_EGENERIC;
}
return VLC_SUCCESS;
@@ -1545,7 +1545,7 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
LPDIRECT3DSURFACE9 destination;
hr = IDirect3DTexture9_GetSurfaceLevel(sys->d3dtex, 0, &destination);
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DTexture9_GetSurfaceLevel: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DTexture9_GetSurfaceLevel: 0x%lX", hr);
return VLC_EGENERIC;
}
@@ -1573,7 +1573,7 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
}
IDirect3DSurface9_Release(destination);
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DDevice9_StretchRect: source 0x%p 0x%0lx",
+ msg_Dbg(vd, "Failed IDirect3DDevice9_StretchRect: source 0x%p 0x%lX",
(LPVOID)source, hr);
return VLC_EGENERIC;
}
@@ -1642,7 +1642,7 @@ static void Direct3D9ImportSubpicture(vout_display_t *vd,
NULL);
if (FAILED(hr)) {
d3dr->texture = NULL;
- msg_Err(vd, "Failed to create %dx%d texture for OSD (hr=0x%0lx)",
+ msg_Err(vd, "Failed to create %dx%d texture for OSD (hr=0x%lX)",
d3dr->width, d3dr->height, hr);
continue;
}
@@ -1732,13 +1732,13 @@ static int Direct3D9RenderRegion(vout_display_t *vd,
void *vertex;
hr = IDirect3DVertexBuffer9_Lock(d3dvtc, 0, 0, &vertex, D3DLOCK_DISCARD);
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DVertexBuffer9_Lock: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DVertexBuffer9_Lock: 0x%lX", hr);
return -1;
}
memcpy(vertex, region->vertex, sizeof(region->vertex));
hr = IDirect3DVertexBuffer9_Unlock(d3dvtc);
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DVertexBuffer9_Unlock: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DVertexBuffer9_Unlock: 0x%lX", hr);
return -1;
}
@@ -1748,7 +1748,7 @@ static int Direct3D9RenderRegion(vout_display_t *vd,
// (blending) our texture with the diffuse color of the vertices.
hr = IDirect3DDevice9_SetTexture(d3ddev, 0, (LPDIRECT3DBASETEXTURE9)d3dtex);
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DDevice9_SetTexture: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DDevice9_SetTexture: 0x%lX", hr);
return -1;
}
@@ -1759,14 +1759,14 @@ static int Direct3D9RenderRegion(vout_display_t *vd,
float shader_data[4] = { region->width, region->height, 0, 0 };
hr = IDirect3DDevice9_SetPixelShaderConstantF(d3ddev, 0, shader_data, 1);
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DDevice9_SetPixelShaderConstantF: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DDevice9_SetPixelShaderConstantF: 0x%lX", hr);
return -1;
}
}
else /* Disable any existing pixel shader. */
hr = IDirect3DDevice9_SetPixelShader(d3ddev, NULL);
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DDevice9_SetPixelShader: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DDevice9_SetPixelShader: 0x%lX", hr);
return -1;
}
}
@@ -1774,21 +1774,21 @@ static int Direct3D9RenderRegion(vout_display_t *vd,
// Render the vertex buffer contents
hr = IDirect3DDevice9_SetStreamSource(d3ddev, 0, d3dvtc, 0, sizeof(CUSTOMVERTEX));
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DDevice9_SetStreamSource: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DDevice9_SetStreamSource: 0x%lX", hr);
return -1;
}
// we use FVF instead of vertex shader
hr = IDirect3DDevice9_SetFVF(d3ddev, D3DFVF_CUSTOMVERTEX);
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DDevice9_SetFVF: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DDevice9_SetFVF: 0x%lX", hr);
return -1;
}
// draw rectangle
hr = IDirect3DDevice9_DrawPrimitive(d3ddev, D3DPT_TRIANGLEFAN, 0, 2);
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DDevice9_DrawPrimitive: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DDevice9_DrawPrimitive: 0x%lX", hr);
return -1;
}
return 0;
@@ -1814,7 +1814,7 @@ static void Direct3D9RenderScene(vout_display_t *vd,
hr = IDirect3DDevice9_Clear(d3ddev, 0, NULL, D3DCLEAR_TARGET,
D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DDevice9_Clear: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DDevice9_Clear: 0x%lX", hr);
return;
}
sys->clear_scene = false;
@@ -1823,7 +1823,7 @@ static void Direct3D9RenderScene(vout_display_t *vd,
// Begin the scene
hr = IDirect3DDevice9_BeginScene(d3ddev);
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DDevice9_BeginScene: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DDevice9_BeginScene: 0x%lX", hr);
return;
}
@@ -1842,7 +1842,7 @@ static void Direct3D9RenderScene(vout_display_t *vd,
// End the scene
hr = IDirect3DDevice9_EndScene(d3ddev);
if (FAILED(hr)) {
- msg_Dbg(vd, "Failed IDirect3DDevice9_EndScene: 0x%0lx", hr);
+ msg_Dbg(vd, "Failed IDirect3DDevice9_EndScene: 0x%lX", hr);
return;
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ea82edcc10c2daad60fa4be8013eac25b7ed8f0f...607ed61a466042b9be43d142b55eaf3608afb139
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ea82edcc10c2daad60fa4be8013eac25b7ed8f0f...607ed61a466042b9be43d142b55eaf3608afb139
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list