Commit e1eb563f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

aout: move volume/mute code to output.c

parent 848f8d62
......@@ -136,6 +136,14 @@ void aout_volume_Delete(aout_volume_t *);
/* From output.c : */
audio_output_t *aout_New (vlc_object_t *);
#define aout_New(a) aout_New(VLC_OBJECT(a))
void aout_Destroy (audio_output_t *);
float aout_OutputVolumeGet (audio_output_t *);
int aout_OutputVolumeSet (audio_output_t *, float);
int aout_OutputMuteGet (audio_output_t *);
int aout_OutputMuteSet (audio_output_t *, bool);
int aout_OutputNew( audio_output_t * p_aout,
const audio_sample_format_t * p_format );
void aout_OutputPlay( audio_output_t * p_aout, block_t * p_buffer );
......@@ -145,10 +153,6 @@ void aout_OutputDelete( audio_output_t * p_aout );
/* From common.c : */
audio_output_t *aout_New (vlc_object_t *);
#define aout_New(a) aout_New(VLC_OBJECT(a))
void aout_Destroy (audio_output_t *);
void aout_FormatsPrint(vlc_object_t *, const char *,
const audio_sample_format_t *,
const audio_sample_format_t *);
......
......@@ -72,7 +72,7 @@ float aout_VolumeGet (vlc_object_t *obj)
if (aout == NULL)
return -1.f;
float volume = var_GetFloat (aout, "volume");
float volume = aout_OutputVolumeGet (aout);
vlc_object_release (aout);
return volume;
}
......@@ -89,10 +89,7 @@ int aout_VolumeSet (vlc_object_t *obj, float vol)
audio_output_t *aout = findAout (obj);
if (aout != NULL)
{
aout_lock (aout);
if (aout->volume_set != NULL)
ret = aout->volume_set (aout, vol);
aout_unlock (aout);
ret = aout_OutputVolumeSet (aout, vol);
vlc_object_release (aout);
}
return ret;
......@@ -134,7 +131,7 @@ int aout_MuteGet (vlc_object_t *obj)
if (aout == NULL)
return -1.f;
bool mute = var_InheritBool (aout, "mute");
bool mute = aout_OutputMuteGet (aout);
vlc_object_release (aout);
return mute;
}
......@@ -150,15 +147,11 @@ int aout_MuteSet (vlc_object_t *obj, bool mute)
audio_output_t *aout = findAout (obj);
if (aout != NULL)
{
aout_lock (aout);
if (aout->mute_set != NULL)
ret = aout->mute_set (aout, mute);
aout_unlock (aout);
ret = aout_OutputMuteSet (aout, mute);
vlc_object_release (aout);
if (ret == 0)
var_SetBool (obj, "mute", mute);
}
if (ret == 0)
var_SetBool (obj, "mute", mute);
return ret;
}
......
......@@ -250,6 +250,56 @@ static void aout_Destructor (vlc_object_t *obj)
vlc_mutex_destroy (&owner->lock);
}
/**
* Gets the volume of the audio output stream (independent of mute).
* \return Current audio volume (0. = silent, 1. = nominal),
* or a strictly negative value if undefined.
*/
float aout_OutputVolumeGet (audio_output_t *aout)
{
return var_GetFloat (aout, "volume");
}
/**
* Sets the volume of the audio output stream.
* \note The mute status is not changed.
* \return 0 on success, -1 on failure.
*/
int aout_OutputVolumeSet (audio_output_t *aout, float vol)
{
int ret = -1;
aout_lock (aout);
if (aout->volume_set != NULL)
ret = aout->volume_set (aout, vol);
aout_unlock (aout);
return ret;
}
/**
* Gets the audio output stream mute flag.
* \return 0 if not muted, 1 if muted, -1 if undefined.
*/
int aout_OutputMuteGet (audio_output_t *aout)
{
return var_InheritBool (aout, "mute");
}
/**
* Sets the audio output stream mute flag.
* \return 0 on success, -1 on failure.
*/
int aout_OutputMuteSet (audio_output_t *aout, bool mute)
{
int ret = -1;
aout_lock (aout);
if (aout->mute_set != NULL)
ret = aout->mute_set (aout, mute);
aout_unlock (aout);
return ret;
}
/**
* Starts an audio output stream.
* \param fmtp audio output stream format [IN/OUT]
......
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