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

aout: add event to request pipeline reinitialization

parent 92b8418f
......@@ -205,6 +205,7 @@ struct audio_output
void (*policy_report)(audio_output_t *, bool);
void (*device_report)(audio_output_t *, const char *);
int (*gain_request)(audio_output_t *, float);
void (*restart_request)(audio_output_t *, unsigned);
} event;
};
......@@ -219,6 +220,10 @@ static const uint32_t pi_vlc_chan_order_wg4[] =
AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0
};
#define AOUT_RESTART_FILTERS 1
#define AOUT_RESTART_OUTPUT 2
#define AOUT_RESTART_DECODER 4
/*****************************************************************************
* Prototypes
*****************************************************************************/
......@@ -324,6 +329,11 @@ static inline int aout_GainRequest(audio_output_t *aout, float gain)
return aout->event.gain_request(aout, gain);
}
static inline void aout_RestartRequest(audio_output_t *aout, unsigned mode)
{
aout->event.restart_request(aout, mode);
}
VLC_API int aout_ChannelsRestart( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * );
/* */
......
......@@ -143,8 +143,12 @@ int aout_DecGetResetLost(audio_output_t *);
void aout_DecChangePause(audio_output_t *, bool b_paused, mtime_t i_date);
void aout_DecFlush(audio_output_t *);
bool aout_DecIsEmpty(audio_output_t *);
void aout_RequestRestart (audio_output_t *, unsigned);
void aout_InputRequestRestart(audio_output_t *);
static inline void aout_InputRequestRestart(audio_output_t *aout)
{
aout_RequestRestart(aout, AOUT_RESTART_FILTERS);
}
/* Audio output locking */
static inline void aout_lock( audio_output_t *p_aout )
......
......@@ -121,8 +121,6 @@ void aout_DecDelete (audio_output_t *aout)
var_Destroy (aout, "stereo-mode");
}
#define AOUT_RESTART_OUTPUT 1
#define AOUT_RESTART_INPUT 2
static int aout_CheckReady (audio_output_t *aout)
{
aout_owner_t *owner = aout_owner (aout);
......@@ -165,12 +163,10 @@ static int aout_CheckReady (audio_output_t *aout)
* Marks the audio output for restart, to update any parameter of the output
* plug-in (e.g. output device or channel mapping).
*/
static void aout_RequestRestart (audio_output_t *aout)
void aout_RequestRestart (audio_output_t *aout, unsigned mode)
{
aout_owner_t *owner = aout_owner (aout);
/* NOTE: restarting output requires restarting input. */
atomic_fetch_or (&owner->restart, AOUT_RESTART_OUTPUT);
atomic_fetch_or (&owner->restart, mode);
}
int aout_ChannelsRestart (vlc_object_t *obj, const char *varname,
......@@ -185,22 +181,10 @@ int aout_ChannelsRestart (vlc_object_t *obj, const char *varname,
* rebuilding the channel choices. */
var_Destroy (aout, "stereo-mode");
}
aout_RequestRestart (aout);
aout_RequestRestart (aout, AOUT_RESTART_OUTPUT);
return 0;
}
/**
* This function will safely mark aout input to be restarted as soon as
* possible to take configuration changes into account
*/
void aout_InputRequestRestart (audio_output_t *aout)
{
aout_owner_t *owner = aout_owner (aout);
atomic_fetch_or (&owner->restart, AOUT_RESTART_INPUT);
}
/*
* Buffer management
*/
......
......@@ -103,6 +103,11 @@ static void aout_DeviceNotify (audio_output_t *aout, const char *id)
free (tmp);
}
static void aout_RestartNotify (audio_output_t *aout, unsigned mode)
{
aout_RequestRestart (aout, mode);
}
static int aout_GainNotify (audio_output_t *aout, float gain)
{
aout_owner_t *owner = aout_owner (aout);
......@@ -146,6 +151,7 @@ audio_output_t *aout_New (vlc_object_t *parent)
aout->event.device_report = aout_DeviceNotify;
aout->event.policy_report = aout_PolicyNotify;
aout->event.gain_request = aout_GainNotify;
aout->event.restart_request = aout_RestartNotify;
/* Audio output module initialization */
aout->start = NULL;
......
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