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
e1881378
Commit
e1881378
authored
Jul 22, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: clean up device change a little bit
parent
cdc0b155
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
25 deletions
+21
-25
modules/audio_output/alsa.c
modules/audio_output/alsa.c
+21
-25
No files found.
modules/audio_output/alsa.c
View file @
e1881378
...
...
@@ -149,23 +149,17 @@ static void DumpDeviceStatus (vlc_object_t *obj, snd_pcm_t *pcm)
}
#define DumpDeviceStatus(o, p) DumpDeviceStatus(VLC_OBJECT(o), p)
/**
* Initializes list of devices.
*/
static
void
Probe
(
vlc_object_t
*
obj
,
const
char
*
dev
)
static
int
DeviceChanged
(
vlc_object_t
*
obj
,
const
char
*
varname
,
vlc_value_t
prev
,
vlc_value_t
cur
,
void
*
data
)
{
vlc_value_t
text
;
var_Create
(
obj
,
"audio-device"
,
VLC_VAR_STRING
|
VLC_VAR_HASCHOICE
);
text
.
psz_string
=
_
(
"Audio Device"
);
var_Change
(
obj
,
"audio-device"
,
VLC_VAR_SETTEXT
,
&
text
,
NULL
);
GetDevices
(
obj
,
NULL
,
dev
);
aout_ChannelsRestart
(
obj
,
varname
,
prev
,
cur
,
data
);
var_AddCallback
(
obj
,
"audio-device"
,
aout_ChannelsRestart
,
NULL
);
if
(
!
var_Type
(
obj
,
"alsa-audio-device"
))
var_Create
(
obj
,
"alsa-audio-device"
,
VLC_VAR_STRING
);
var_SetString
(
obj
,
"alsa-audio-device"
,
cur
.
psz_string
);
return
VLC_SUCCESS
;
}
static
void
Play
(
audio_output_t
*
,
block_t
*
);
static
void
Pause
(
audio_output_t
*
,
bool
,
mtime_t
);
static
void
PauseDummy
(
audio_output_t
*
,
bool
,
mtime_t
);
...
...
@@ -546,7 +540,18 @@ static int Open (vlc_object_t *obj)
}
aout
->
pf_flush
=
Flush
;
Probe
(
obj
,
device
);
/* Setup audio-device choices */
{
vlc_value_t
text
;
var_Create
(
obj
,
"audio-device"
,
VLC_VAR_STRING
|
VLC_VAR_HASCHOICE
);
text
.
psz_string
=
_
(
"Audio Device"
);
var_Change
(
obj
,
"audio-device"
,
VLC_VAR_SETTEXT
,
&
text
,
NULL
);
GetDevices
(
obj
,
NULL
,
device
);
}
var_AddCallback
(
obj
,
"audio-device"
,
DeviceChanged
,
NULL
);
free
(
device
);
return
0
;
...
...
@@ -686,18 +691,9 @@ static void Close (vlc_object_t *obj)
aout_sys_t
*
sys
=
aout
->
sys
;
snd_pcm_t
*
pcm
=
aout
->
sys
->
pcm
;
/* FIXME: ugly hack so selected ALSA device survives restart */
char
*
device
=
var_InheritString
(
obj
,
"audio-device"
);
if
(
device
!=
NULL
)
{
if
(
!
var_Type
(
obj
,
"alsa-audio-device"
))
var_Create
(
obj
,
"alsa-audio-device"
,
VLC_VAR_STRING
);
var_SetString
(
obj
,
"alsa-audio-device"
,
device
);
free
(
device
);
}
var_DelCallback
(
obj
,
"audio-device"
,
aout_ChannelsRestart
,
NULL
);
var_DelCallback
(
obj
,
"audio-device"
,
DeviceChanged
,
NULL
);
var_Destroy
(
obj
,
"audio-device"
);
snd_pcm_drop
(
pcm
);
snd_pcm_close
(
pcm
);
free
(
sys
);
...
...
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