Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
5242303a
Commit
5242303a
authored
Jul 19, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sndio: implement volume setting and reporting
parent
a8ca319f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
2 deletions
+50
-2
modules/audio_output/sndio.c
modules/audio_output/sndio.c
+50
-2
No files found.
modules/audio_output/sndio.c
View file @
5242303a
...
...
@@ -22,6 +22,7 @@
# include "config.h"
#endif
#include <math.h>
#include <assert.h>
#include <vlc_common.h>
...
...
@@ -44,10 +45,15 @@ vlc_module_end ()
static
void
Play
(
audio_output_t
*
,
block_t
*
);
static
void
Pause
(
audio_output_t
*
,
bool
,
mtime_t
);
static
int
VolumeSet
(
audio_output_t
*
,
float
);
static
int
MuteSet
(
audio_output_t
*
,
bool
);
static
void
VolumeChanged
(
void
*
,
unsigned
);
struct
aout_sys_t
{
struct
sio_hdl
*
hdl
;
unsigned
volume
;
bool
mute
;
};
/** Initializes an sndio playback stream */
...
...
@@ -149,7 +155,16 @@ static int Open (vlc_object_t *obj)
aout
->
pf_play
=
Play
;
aout
->
pf_pause
=
Pause
;
aout
->
pf_flush
=
NULL
;
/* sndio sucks! */
/* TODO: sio_setvol()/sio_onvol() */
if
(
sio_onvol
(
sys
->
hdl
,
VolumeChanged
,
aout
))
{
aout
->
volume_set
=
VolumeSet
;
aout
->
mute_set
=
MuteSet
;
}
else
{
aout
->
volume_set
=
NULL
;
aout
->
mute_set
=
NULL
;
}
sio_start
(
sys
->
hdl
);
return
VLC_SUCCESS
;
...
...
@@ -202,3 +217,36 @@ static void Pause (audio_output_t *aout, bool pause, mtime_t date)
sio_start
(
sys
->
hdl
);
(
void
)
date
;
}
static
void
VolumeChanged
(
void
*
arg
,
unsigned
volume
)
{
audio_output_t
*
aout
=
arg
;
float
fvol
=
(
float
)
volume
/
(
float
)
SIO_MAXVOL
;
aout_VolumeReport
(
aout
,
fvol
);
aout_MuteReport
(
aout
,
volume
==
0
);
if
(
volume
)
/* remember last non-zero volume to unmute later */
aout
->
sys
->
volume
=
volume
;
}
static
int
VolumeSet
(
audio_output_t
*
aout
,
float
fvol
)
{
aout_sys_t
*
sys
=
aout
->
sys
;
unsigned
volume
=
lroundf
(
fvol
*
SIO_MAXVOL
);
if
(
!
sys
->
mute
&&
!
sio_setvol
(
sys
->
hdl
,
volume
))
return
-
1
;
sys
->
volume
=
volume
;
return
0
;
}
static
int
MuteSet
(
audio_output_t
*
aout
,
bool
mute
)
{
aout_sys_t
*
sys
=
aout
->
sys
;
if
(
!
sio_setvol
(
sys
->
hdl
,
mute
?
0
:
sys
->
volume
))
return
-
1
;
sys
->
mute
=
mute
;
return
0
;
}
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