Commit f74db532 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

aout: use aout_RequestRestart() where applicable

parent ad6442ae
...@@ -334,7 +334,16 @@ static inline void aout_RestartRequest(audio_output_t *aout, unsigned mode) ...@@ -334,7 +334,16 @@ static inline void aout_RestartRequest(audio_output_t *aout, unsigned mode)
aout->event.restart_request(aout, mode); aout->event.restart_request(aout, mode);
} }
VLC_API int aout_ChannelsRestart( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ); static inline int aout_ChannelsRestart (vlc_object_t *obj, const char *varname,
vlc_value_t oldval, vlc_value_t newval, void *data)
{
audio_output_t *aout = (audio_output_t *)obj;
(void)varname; (void)oldval; (void)newval; (void)data;
aout_RestartRequest (aout, AOUT_RESTART_OUTPUT);
return 0;
}
/* */ /* */
VLC_API vout_thread_t * aout_filter_RequestVout( filter_t *, vout_thread_t *p_vout, video_format_t *p_fmt ) VLC_USED; VLC_API vout_thread_t * aout_filter_RequestVout( filter_t *, vout_thread_t *p_vout, video_format_t *p_fmt ) VLC_USED;
......
...@@ -792,9 +792,8 @@ static int DeviceSelect (audio_output_t *aout, const char *id) ...@@ -792,9 +792,8 @@ static int DeviceSelect (audio_output_t *aout, const char *id)
var_Create (aout, "alsa-audio-device", VLC_VAR_STRING); var_Create (aout, "alsa-audio-device", VLC_VAR_STRING);
var_SetString (aout, "alsa-audio-device", id); var_SetString (aout, "alsa-audio-device", id);
vlc_value_t dummy; aout_RestartRequest (aout, AOUT_RESTART_OUTPUT);
return aout_ChannelsRestart (VLC_OBJECT(aout), "audio-device", return 0;
dummy, dummy, NULL);
} }
static int Open(vlc_object_t *obj) static int Open(vlc_object_t *obj)
......
...@@ -104,10 +104,7 @@ static int vlc_FromHR(audio_output_t *aout, HRESULT hr) ...@@ -104,10 +104,7 @@ static int vlc_FromHR(audio_output_t *aout, HRESULT hr)
{ {
/* Restart on unplug */ /* Restart on unplug */
if (unlikely(hr == AUDCLNT_E_DEVICE_INVALIDATED)) if (unlikely(hr == AUDCLNT_E_DEVICE_INVALIDATED))
{ aout_RestartRequest(aout, AOUT_RESTART_OUTPUT);
vlc_value_t d;
aout_ChannelsRestart(VLC_OBJECT(aout), "audio-device", d, d, NULL);
}
return SUCCEEDED(hr) ? 0 : -1; return SUCCEEDED(hr) ? 0 : -1;
} }
...@@ -652,11 +649,8 @@ static int DeviceSelect(audio_output_t *aout, const char *id) ...@@ -652,11 +649,8 @@ static int DeviceSelect(audio_output_t *aout, const char *id)
LeaveMTA(); LeaveMTA();
if (sys->stream != NULL) if (sys->stream != NULL)
{
vlc_value_t d;
/* Request restart of stream with the new device */ /* Request restart of stream with the new device */
aout_ChannelsRestart(VLC_OBJECT(aout), "audio-device", d, d, NULL); aout_RestartRequest(aout, AOUT_RESTART_OUTPUT);
}
return FAILED(hr) ? -1 : 0; return FAILED(hr) ? -1 : 0;
} }
......
...@@ -86,11 +86,10 @@ static int MuteSet (audio_output_t *, bool); ...@@ -86,11 +86,10 @@ static int MuteSet (audio_output_t *, bool);
static int DeviceChanged (vlc_object_t *obj, const char *varname, static int DeviceChanged (vlc_object_t *obj, const char *varname,
vlc_value_t prev, vlc_value_t cur, void *data) vlc_value_t prev, vlc_value_t cur, void *data)
{ {
aout_ChannelsRestart (obj, varname, prev, cur, data);
if (!var_Type (obj, "oss-audio-device")) if (!var_Type (obj, "oss-audio-device"))
var_Create (obj, "oss-audio-device", VLC_VAR_STRING); var_Create (obj, "oss-audio-device", VLC_VAR_STRING);
var_SetString (obj, "oss-audio-device", cur.psz_string); var_SetString (obj, "oss-audio-device", cur.psz_string);
aout_RestartRequest ((audio_output_t *)aout, AOUT_RESTART_OUTPUT);
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -315,8 +315,7 @@ static void stream_event_cb(pa_stream *s, const char *name, pa_proplist *pl, ...@@ -315,8 +315,7 @@ static void stream_event_cb(pa_stream *s, const char *name, pa_proplist *pl,
vlc_value_t dummy = { .i_int = 0 }; vlc_value_t dummy = { .i_int = 0 };
msg_Dbg (aout, "format lost"); msg_Dbg (aout, "format lost");
aout_ChannelsRestart (VLC_OBJECT(aout), "audio-device", aout_RestartRequest (aout, AOUT_RESTART_OUTPUT);
dummy, dummy, NULL);
} else } else
#endif #endif
msg_Warn (aout, "unhandled stream event \"%s\"", name); msg_Warn (aout, "unhandled stream event \"%s\"", name);
......
...@@ -169,16 +169,6 @@ void aout_RequestRestart (audio_output_t *aout, unsigned mode) ...@@ -169,16 +169,6 @@ void aout_RequestRestart (audio_output_t *aout, unsigned mode)
atomic_fetch_or (&owner->restart, mode); atomic_fetch_or (&owner->restart, mode);
} }
int aout_ChannelsRestart (vlc_object_t *obj, const char *varname,
vlc_value_t oldval, vlc_value_t newval, void *data)
{
audio_output_t *aout = (audio_output_t *)obj;
(void)oldval; (void)newval; (void)data;
aout_RequestRestart (aout, AOUT_RESTART_OUTPUT);
return 0;
}
/* /*
* Buffer management * Buffer management
*/ */
......
...@@ -3,7 +3,6 @@ AddMD5 ...@@ -3,7 +3,6 @@ AddMD5
aout_BitsPerSample aout_BitsPerSample
aout_ChannelExtract aout_ChannelExtract
aout_ChannelReorder aout_ChannelReorder
aout_ChannelsRestart
aout_CheckChannelExtraction aout_CheckChannelExtraction
aout_CheckChannelReorder aout_CheckChannelReorder
aout_filter_RequestVout aout_filter_RequestVout
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment