[vlc-commits] OSS: remove volume/mute code (fixes #10408)
Rémi Denis-Courmont
git at videolan.org
Mon Sep 1 22:40:47 CEST 2014
vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Sep 1 23:39:18 2014 +0300| [3833141778f9091cf5181028308d3421d4818ad0] | committer: Rémi Denis-Courmont
OSS: remove volume/mute code (fixes #10408)
(cherry picked from commit a14188589fbbbfc404be45a80db90d6e1725de4e)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=3833141778f9091cf5181028308d3421d4818ad0
---
modules/audio_output/oss.c | 100 +-------------------------------------------
1 file changed, 2 insertions(+), 98 deletions(-)
diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c
index 40713d6..1afd03d 100644
--- a/modules/audio_output/oss.c
+++ b/modules/audio_output/oss.c
@@ -49,10 +49,6 @@
#include <vlc_cpu.h>
#include <vlc_aout.h>
-#if !defined (__FreeBSD__) && !defined (__FreeBSD_kernel__)
-# define USE_SOFTVOL
-#endif
-
#define A52_FRAME_NB 1536
struct aout_sys_t
@@ -60,19 +56,12 @@ struct aout_sys_t
int fd;
audio_sample_format_t format;
bool starting;
-#ifndef USE_SOFTVOL
- bool mute;
- uint8_t level;
-#else
bool soft_mute;
float soft_gain;
-#endif
char *device;
};
-#ifdef USE_SOFTVOL
-# include "volume.h"
-#endif
+#include "volume.h"
static int Open (vlc_object_t *);
static void Close (vlc_object_t *);
@@ -87,9 +76,7 @@ vlc_module_begin ()
set_subcategory( SUBCAT_AUDIO_AOUT )
add_string ("oss-audio-device", "",
AUDIO_DEV_TEXT, AUDIO_DEV_LONGTEXT, false)
-#ifdef USE_SOFTVOL
add_sw_gain ()
-#endif
set_capability( "audio output", 100 )
set_callbacks (Open, Close)
vlc_module_end ()
@@ -98,9 +85,6 @@ static int TimeGet (audio_output_t *, mtime_t *);
static void Play (audio_output_t *, block_t *);
static void Pause (audio_output_t *, bool, mtime_t);
static void Flush (audio_output_t *, bool);
-#ifndef USE_SOFTVOL
-static int VolumeSync (audio_output_t *);
-#endif
static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
{
@@ -248,11 +232,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
vlc_strerror_c(errno));
sys->fd = fd;
-#ifndef USE_SOFTVOL
- VolumeSync (aout);
-#else
aout_SoftVolumeStart (aout);
-#endif
sys->starting = true;
sys->format = *fmt;
return VLC_SUCCESS;
@@ -297,11 +277,6 @@ static void Play (audio_output_t *aout, block_t *block)
msg_Err (aout, "cannot write samples: %s", vlc_strerror_c(errno));
}
block_Release (block);
-
-#ifndef USE_SOFTVOL
- /* Dumb OSS cannot send any kind of events for this... */
- VolumeSync (aout);
-#endif
}
/**
@@ -329,25 +304,6 @@ static void Flush (audio_output_t *aout, bool wait)
ioctl (fd, SNDCTL_DSP_HALT, NULL);
}
-#ifndef USE_SOFTVOL
-static int VolumeSync (audio_output_t *aout)
-{
- aout_sys_t *sys = aout->sys;
- int fd = sys->fd;
-
- int level;
- if (ioctl (fd, SNDCTL_DSP_GETPLAYVOL, &level) < 0)
- return -1;
-
- sys->mute = !level;
- if (level) /* try to keep last volume before mute */
- sys->level = level;
- aout_MuteReport (aout, !level);
- aout_VolumeReport (aout, (float)(level & 0xFF) / 100.f);
- return 0;
-}
-#endif
-
/**
* Releases the audio output device.
*/
@@ -361,50 +317,6 @@ static void Stop (audio_output_t *aout)
sys->fd = -1;
}
-#ifndef USE_SOFTVOL
-static int VolumeSet (audio_output_t *aout, float vol)
-{
- aout_sys_t *sys = aout->sys;
- int fd = sys->fd;
- if (fd == -1)
- return -1;
-
- int level = lroundf (vol * 100.f);
- if (level > 0xFF)
- level = 0xFFFF;
- else
- level |= level << 8;
- if (!sys->mute && ioctl (fd, SNDCTL_DSP_SETPLAYVOL, &level) < 0)
- {
- msg_Err (aout, "cannot set volume: %s", vlc_strerror_c(errno));
- return -1;
- }
-
- sys->level = level;
- aout_VolumeReport (aout, (float)(level & 0xFF) / 100.f);
- return 0;
-}
-
-static int MuteSet (audio_output_t *aout, bool mute)
-{
- aout_sys_t *sys = aout->sys;
- int fd = sys->fd;
- if (fd == -1)
- return -1;
-
- int level = mute ? 0 : (sys->level | (sys->level << 8));
- if (ioctl (fd, SNDCTL_DSP_SETPLAYVOL, &level) < 0)
- {
- msg_Err (aout, "cannot mute: %s", vlc_strerror_c(errno));
- return -1;
- }
-
- sys->mute = mute;
- aout_MuteReport (aout, mute);
- return 0;
-}
-#endif
-
static int DevicesEnum (audio_output_t *aout)
{
int fd = vlc_open ("/dev/dsp", O_WRONLY);
@@ -476,22 +388,14 @@ static int Open (vlc_object_t *obj)
return VLC_ENOMEM;
sys->fd = -1;
-#ifndef USE_SOFTVOL
- sys->level = 100;
- sys->mute = false;
-#endif
sys->device = var_InheritString (aout, "oss-audio-device");
aout->sys = sys;
aout->start = Start;
aout->stop = Stop;
- aout->volume_set = VolumeSet;
- aout->mute_set = MuteSet;
aout->device_select = DeviceSelect;
-
-#ifdef USE_SOFTVOL
aout_SoftVolumeInit (aout);
-#endif
+
DevicesEnum (aout);
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list