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

aout: remove old aout_(Volume|Mute)(Get|Set)() functions

And remove the other instance of find-input-callback.
parent 7dba440e
......@@ -224,6 +224,11 @@ VLC_API void aout_FormatPrint(vlc_object_t *, const char *,
#define aout_FormatPrint(o, t, f) aout_FormatPrint(VLC_OBJECT(o), t, f)
VLC_API const char * aout_FormatPrintChannels( const audio_sample_format_t * ) VLC_USED;
VLC_API float aout_VolumeGet (audio_output_t *);
VLC_API int aout_VolumeSet (audio_output_t *, float);
VLC_API int aout_MuteGet (audio_output_t *);
VLC_API int aout_MuteSet (audio_output_t *, bool);
/**
* Report change of configured audio volume to the core and UI.
*/
......
/*****************************************************************************
* vlc_aout_intf.h : audio output control
*****************************************************************************
* Copyright (C) 2002-2011 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_AOUT_INTF_H
#define VLC_AOUT_INTF_H 1
/**
* \file
* This file defines functions, structures and macros for audio output object
*/
#define AOUT_VOLUME_DEFAULT 256
#define AOUT_VOLUME_MAX 512
VLC_API float aout_VolumeGet( vlc_object_t * );
#define aout_VolumeGet(a) aout_VolumeGet(VLC_OBJECT(a))
VLC_API int aout_VolumeSet( vlc_object_t *, float );
#define aout_VolumeSet(a, b) aout_VolumeSet(VLC_OBJECT(a), b)
VLC_API int aout_MuteSet( vlc_object_t *, bool );
#define aout_MuteSet(a, b) aout_MuteSet(VLC_OBJECT(a), b)
VLC_API int aout_MuteGet( vlc_object_t * );
#define aout_MuteGet(a) aout_MuteGet(VLC_OBJECT(a))
#endif /* _VLC_AOUT_H */
......@@ -35,7 +35,6 @@
#include <vlc_common.h>
#include <vlc_input.h>
#include <vlc_aout_intf.h>
#include <vlc_aout.h>
#include <vlc_modules.h>
......@@ -256,18 +255,39 @@ void libvlc_audio_toggle_mute( libvlc_media_player_t *mp )
int libvlc_audio_get_mute( libvlc_media_player_t *mp )
{
return aout_MuteGet( mp );
int mute = -1;
audio_output_t *aout = GetAOut( mp );
if( aout != NULL )
{
mute = aout_MuteGet( aout );
vlc_object_release( aout );
}
return mute;
}
void libvlc_audio_set_mute( libvlc_media_player_t *mp, int mute )
{
aout_MuteSet( VLC_OBJECT(mp), mute != 0 );
audio_output_t *aout = GetAOut( mp );
if( aout != NULL )
{
mute = aout_MuteSet( aout, mute );
vlc_object_release( aout );
}
}
int libvlc_audio_get_volume( libvlc_media_player_t *mp )
{
float vol = aout_VolumeGet( mp );
return ( vol >= 0.f ) ? lroundf( vol * 100.f ) : -1;
int volume = -1;
audio_output_t *aout = GetAOut( mp );
if( aout != NULL )
{
float vol = aout_VolumeGet( aout );
vlc_object_release( aout );
volume = lroundf( vol * 100.f );
}
return volume;
}
int libvlc_audio_set_volume( libvlc_media_player_t *mp, int volume )
......@@ -278,8 +298,15 @@ int libvlc_audio_set_volume( libvlc_media_player_t *mp, int volume )
libvlc_printerr( "Volume out of range" );
return -1;
}
aout_VolumeSet (mp, vol);
return 0;
int ret = -1;
audio_output_t *aout = GetAOut( mp );
if( aout != NULL )
{
ret = aout_VolumeSet( aout, vol );
vlc_object_release( aout );
}
return ret;
}
/*****************************************************************************
......
......@@ -357,13 +357,6 @@ static int snapshot_was_taken(vlc_object_t *p_this, char const *psz_cmd,
return VLC_SUCCESS;
}
static input_thread_t *find_input (vlc_object_t *obj)
{
libvlc_media_player_t *mp = (libvlc_media_player_t *)obj;
return libvlc_get_input_thread (mp);
}
/* */
static void libvlc_media_player_destroy( libvlc_media_player_t * );
......@@ -466,8 +459,6 @@ libvlc_media_player_new( libvlc_instance_t *instance )
var_Create (mp, "aout", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
var_Create (mp, "mute", VLC_VAR_BOOL);
var_Create (mp, "volume", VLC_VAR_FLOAT);
var_Create (mp, "find-input-callback", VLC_VAR_ADDRESS);
var_SetAddress (mp, "find-input-callback", find_input);
var_Create (mp, "corks", VLC_VAR_INTEGER);
var_Create (mp, "amem-data", VLC_VAR_ADDRESS);
var_Create (mp, "amem-setup", VLC_VAR_ADDRESS);
......
......@@ -67,7 +67,6 @@ src/audio_output/common.c
src/audio_output/dec.c
src/audio_output/filters.c
src/audio_output/input.c
src/audio_output/intf.c
src/audio_output/output.c
src/config/chain.c
src/config/cmdline.c
......
......@@ -24,7 +24,6 @@ pluginsincludedir = $(pkgincludedir)/plugins
pluginsinclude_HEADERS = \
../include/vlc_access.h \
../include/vlc_aout.h \
../include/vlc_aout_intf.h \
../include/vlc_aout_volume.h \
../include/vlc_arrays.h \
../include/vlc_art_finder.h \
......@@ -412,7 +411,6 @@ SOURCES_libvlc_common = \
audio_output/input.c \
audio_output/output.c \
audio_output/volume.c \
audio_output/intf.c \
osd/osd.c \
osd/osd_text.c \
network/getaddrinfo.c \
......
......@@ -139,10 +139,6 @@ void aout_volume_Delete(aout_volume_t *);
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 );
......
/*****************************************************************************
* intf.c : audio output API towards the interface modules
*****************************************************************************
* Copyright (C) 2002-2007 VLC authors and VideoLAN
* $Id$
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_aout_intf.h>
#include <stdio.h>
#include <stdlib.h> /* calloc(), malloc(), free() */
#include <string.h>
#include <math.h>
#include <vlc_aout.h>
#include "aout_internal.h"
#include <vlc_playlist.h>
static audio_output_t *findAout (vlc_object_t *obj)
{
input_thread_t *(*pf_find_input) (vlc_object_t *);
pf_find_input = var_GetAddress (obj, "find-input-callback");
if (unlikely(pf_find_input == NULL))
return NULL;
input_thread_t *p_input = pf_find_input (obj);
if (p_input == NULL)
return NULL;
audio_output_t *p_aout = input_GetAout (p_input);
vlc_object_release (p_input);
return p_aout;
}
#define findAout(o) findAout(VLC_OBJECT(o))
#undef aout_VolumeGet
/**
* Gets the volume of the output device (independent of mute).
* \return Current audio volume (0 = silent, 1 = nominal),
* or a strictly negative value if undefined.
*/
float aout_VolumeGet (vlc_object_t *obj)
{
audio_output_t *aout = findAout (obj);
if (aout == NULL)
return -1.f;
float volume = aout_OutputVolumeGet (aout);
vlc_object_release (aout);
return volume;
}
#undef aout_VolumeSet
/**
* Sets the volume of the output device.
* \note The mute status is not changed.
*/
int aout_VolumeSet (vlc_object_t *obj, float vol)
{
int ret = -1;
audio_output_t *aout = findAout (obj);
if (aout != NULL)
{
ret = aout_OutputVolumeSet (aout, vol);
vlc_object_release (aout);
}
return ret;
}
#undef aout_MuteGet
/**
* Gets the output mute status.
* \return 0 if not muted, 1 if muted, -1 if undefined.
*/
int aout_MuteGet (vlc_object_t *obj)
{
audio_output_t *aout = findAout (obj);
if (aout == NULL)
return -1.f;
bool mute = aout_OutputMuteGet (aout);
vlc_object_release (aout);
return mute;
}
#undef aout_MuteSet
/**
* Sets mute status.
*/
int aout_MuteSet (vlc_object_t *obj, bool mute)
{
int ret = -1;
audio_output_t *aout = findAout (obj);
if (aout != NULL)
{
ret = aout_OutputMuteSet (aout, mute);
vlc_object_release (aout);
if (ret == 0)
var_SetBool (obj, "mute", mute);
}
return ret;
}
......@@ -255,7 +255,7 @@ static void aout_Destructor (vlc_object_t *obj)
* \return Current audio volume (0. = silent, 1. = nominal),
* or a strictly negative value if undefined.
*/
float aout_OutputVolumeGet (audio_output_t *aout)
float aout_VolumeGet (audio_output_t *aout)
{
return var_GetFloat (aout, "volume");
}
......@@ -265,7 +265,7 @@ float aout_OutputVolumeGet (audio_output_t *aout)
* \note The mute status is not changed.
* \return 0 on success, -1 on failure.
*/
int aout_OutputVolumeSet (audio_output_t *aout, float vol)
int aout_VolumeSet (audio_output_t *aout, float vol)
{
int ret = -1;
......@@ -280,7 +280,7 @@ int aout_OutputVolumeSet (audio_output_t *aout, float vol)
* 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)
int aout_MuteGet (audio_output_t *aout)
{
return var_InheritBool (aout, "mute");
}
......@@ -289,7 +289,7 @@ int aout_OutputMuteGet (audio_output_t *aout)
* Sets the audio output stream mute flag.
* \return 0 on success, -1 on failure.
*/
int aout_OutputMuteSet (audio_output_t *aout, bool mute)
int aout_MuteSet (audio_output_t *aout, bool mute)
{
int ret = -1;
......
......@@ -47,7 +47,7 @@ float playlist_VolumeGet (playlist_t *pl)
audio_output_t *aout = findAout (pl);
if (aout != NULL)
{
volume = aout_OutputVolumeGet (aout);
volume = aout_VolumeGet (aout);
vlc_object_release (aout);
}
return volume;
......@@ -60,7 +60,7 @@ int playlist_VolumeSet (playlist_t *pl, float vol)
audio_output_t *aout = findAout (pl);
if (aout != NULL)
{
ret = aout_OutputVolumeSet (aout, vol);
ret = aout_VolumeSet (aout, vol);
vlc_object_release (aout);
}
return ret;
......@@ -80,7 +80,7 @@ int playlist_VolumeUp (playlist_t *pl, int value, float *volp)
audio_output_t *aout = findAout (pl);
if (aout != NULL)
{
float vol = aout_OutputVolumeGet (aout);
float vol = aout_VolumeGet (aout);
if (vol >= 0.)
{
vol += value / (float)AOUT_VOLUME_DEFAULT;
......@@ -90,7 +90,7 @@ int playlist_VolumeUp (playlist_t *pl, int value, float *volp)
vol = 2.;
if (volp != NULL)
*volp = vol;
ret = aout_OutputVolumeSet (aout, vol);
ret = aout_VolumeSet (aout, vol);
}
vlc_object_release (aout);
}
......@@ -104,7 +104,7 @@ int playlist_MuteGet (playlist_t *pl)
audio_output_t *aout = findAout (pl);
if (aout != NULL)
{
mute = aout_OutputMuteGet (aout);
mute = aout_MuteGet (aout);
vlc_object_release (aout);
}
return mute;
......@@ -117,7 +117,7 @@ int playlist_MuteSet (playlist_t *pl, bool mute)
audio_output_t *aout = findAout (pl);
if (aout != NULL)
{
ret = aout_OutputMuteSet (aout, mute);
ret = aout_MuteSet (aout, mute);
vlc_object_release (aout);
if (ret == 0)
var_SetBool (pl, "mute", mute);
......
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