}
aout_owner_t *owner = aout_owner(p_aout);
-#ifdef RECYCLE
- /* Calling decoder is responsible for serializing aout_DecNew() and
- * aout_DecDelete(). So no need to lock to _read_ those properties. */
- if (owner->module != NULL) /* <- output exists */
- { /* Check if we can recycle the existing output and pipelines */
- if (AOUT_FMTS_IDENTICAL(&owner->input_format, p_format))
- return 0;
-
- /* TODO? If the new input format is closer to the output format than
- * the old input format was, then the output could be recycled. The
- * input pipeline however would need to be restarted. */
-
- /* No recycling: delete everything and restart from scratch */
- aout_Shutdown (p_aout);
- }
-#endif
int ret = 0;
/* TODO: reduce lock scope depending on decoder's real need */
aout_lock( p_aout );
- assert (owner->module == NULL);
- /* Create the audio output stream */
- var_Destroy( p_aout, "audio-device" );
var_Destroy( p_aout, "stereo-mode" );
+ /* Create the audio output stream */
owner->input_format = *p_format;
vlc_atomic_set (&owner->restart, 0);
owner->volume = aout_volume_New (p_aout, p_replay_gain);
/**
* Stops all plugins involved in the audio output.
*/
-void aout_Shutdown (audio_output_t *p_aout)
+void aout_DecDelete (audio_output_t *p_aout)
{
aout_owner_t *owner = aout_owner (p_aout);
aout_input_t *input;
aout_InputDelete (p_aout, input);
owner->input = NULL;
- if (likely(owner->module != NULL))
- {
- aout_OutputDelete( p_aout );
- aout_volume_Delete (owner->volume);
- }
- var_Destroy( p_aout, "audio-device" );
+ aout_OutputDelete( p_aout );
+ aout_volume_Delete (owner->volume);
+
var_Destroy( p_aout, "stereo-mode" );
aout_unlock( p_aout );
free (input);
}
-/**
- * Stops the decoded audio input.
- * @note Due to output recycling, this function is esssentially a stub.
- */
-void aout_DecDelete (audio_output_t *aout)
-{
-#ifdef RECYCLE
- (void) aout;
-#else
- aout_Shutdown (aout);
-#endif
-}
-
#define AOUT_RESTART_OUTPUT 1
#define AOUT_RESTART_INPUT 2
static void aout_CheckRestart (audio_output_t *aout)
assert (restart & AOUT_RESTART_INPUT);
- const aout_request_vout_t request_vout = owner->input->request_vout;
+ const aout_request_vout_t request_vout = owner->request_vout;
if (likely(owner->input != NULL))
aout_InputDelete (aout, owner->input);
* Marks the audio output for restart, to update any parameter of the output
* plug-in (e.g. output device or channel mapping).
*/
-void aout_RequestRestart (audio_output_t *aout)
+static void aout_RequestRestart (audio_output_t *aout)
{
aout_owner_t *owner = aout_owner (aout);
vlc_atomic_set (&owner->restart, AOUT_RESTART_OUTPUT|AOUT_RESTART_INPUT);
}
+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;
+
+ if (!strcmp (varname, "audio-device"))
+ {
+ /* This is supposed to be a significant change and supposes
+ * rebuilding the channel choices. */
+ var_Destroy (aout, "stereo-mode");
+ }
+ aout_RequestRestart (aout);
+ return 0;
+}
+
/**
* This function will safely mark aout input to be restarted as soon as
* possible to take configuration changes into account