1 /*****************************************************************************
2 * intf.c : audio output API towards the interface modules
3 *****************************************************************************
4 * Copyright (C) 2002-2007 VLC authors and VideoLAN
7 * Authors: Christophe Massiot <massiot@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
32 #include <vlc_common.h>
33 #include <vlc_aout_intf.h>
36 #include <stdlib.h> /* calloc(), malloc(), free() */
41 #include "aout_internal.h"
43 #include <vlc_playlist.h>
45 static audio_output_t *findAout (vlc_object_t *obj)
47 input_thread_t *(*pf_find_input) (vlc_object_t *);
49 pf_find_input = var_GetAddress (obj, "find-input-callback");
50 if (unlikely(pf_find_input == NULL))
53 input_thread_t *p_input = pf_find_input (obj);
57 audio_output_t *p_aout = input_GetAout (p_input);
58 vlc_object_release (p_input);
61 #define findAout(o) findAout(VLC_OBJECT(o))
65 * Gets the volume of the output device (independent of mute).
66 * \return Current audio volume (0 = silent, 1 = nominal),
67 * or a strictly negative value if undefined.
69 float aout_VolumeGet (vlc_object_t *obj)
71 audio_output_t *aout = findAout (obj);
75 float volume = aout_OutputVolumeGet (aout);
76 vlc_object_release (aout);
82 * Sets the volume of the output device.
83 * \note The mute status is not changed.
85 int aout_VolumeSet (vlc_object_t *obj, float vol)
89 audio_output_t *aout = findAout (obj);
92 ret = aout_OutputVolumeSet (aout, vol);
93 vlc_object_release (aout);
100 * Gets the output mute status.
101 * \return 0 if not muted, 1 if muted, -1 if undefined.
103 int aout_MuteGet (vlc_object_t *obj)
105 audio_output_t *aout = findAout (obj);
109 bool mute = aout_OutputMuteGet (aout);
110 vlc_object_release (aout);
118 int aout_MuteSet (vlc_object_t *obj, bool mute)
122 audio_output_t *aout = findAout (obj);
125 ret = aout_OutputMuteSet (aout, mute);
126 vlc_object_release (aout);
128 var_SetBool (obj, "mute", mute);