Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
38331417
Commit
38331417
authored
Sep 01, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OSS: remove volume/mute code (fixes #10408)
(cherry picked from commit a14188589fbbbfc404be45a80db90d6e1725de4e)
parent
f2bbb58b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
98 deletions
+2
-98
modules/audio_output/oss.c
modules/audio_output/oss.c
+2
-98
No files found.
modules/audio_output/oss.c
View file @
38331417
...
...
@@ -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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment