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
d6bbd83e
Commit
d6bbd83e
authored
Jan 15, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PulseAudio: implement output device change
parent
bb8ba064
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
17 deletions
+7
-17
modules/audio_output/pulse.c
modules/audio_output/pulse.c
+7
-17
No files found.
modules/audio_output/pulse.c
View file @
d6bbd83e
...
...
@@ -612,26 +612,20 @@ static int MuteSet(audio_output_t *aout, bool mute)
return
0
;
}
static
int
StreamMove
(
vlc_object_t
*
obj
,
const
char
*
varname
,
vlc_value_t
old
,
vlc_value_t
val
,
void
*
userdata
)
static
int
StreamMove
(
audio_output_t
*
aout
,
const
char
*
name
)
{
audio_output_t
*
aout
=
(
audio_output_t
*
)
obj
;
aout_sys_t
*
sys
=
aout
->
sys
;
pa_stream
*
s
=
userdata
;
pa_operation
*
op
;
uint32_t
idx
=
pa_stream_get_index
(
s
);
uint32_t
sink_idx
=
val
.
i_int
;
(
void
)
varname
;
(
void
)
old
;
uint32_t
idx
=
pa_stream_get_index
(
sys
->
stream
);
pa_threaded_mainloop_lock
(
sys
->
mainloop
);
op
=
pa_context_move_sink_input_by_
index
(
sys
->
context
,
idx
,
sink_idx
,
NULL
,
NULL
);
op
=
pa_context_move_sink_input_by_
name
(
sys
->
context
,
idx
,
name
,
NULL
,
NULL
);
if
(
likely
(
op
!=
NULL
))
{
pa_operation_unref
(
op
);
msg_Dbg
(
aout
,
"moving to sink %
"
PRIu32
,
sink_idx
);
msg_Dbg
(
aout
,
"moving to sink %
s"
,
name
);
}
else
vlc_pa_error
(
obj
,
"cannot move sink
"
,
sys
->
context
);
vlc_pa_error
(
aout
,
"cannot move sink input
"
,
sys
->
context
);
pa_threaded_mainloop_unlock
(
sys
->
mainloop
);
return
(
op
!=
NULL
)
?
VLC_SUCCESS
:
VLC_EGENERIC
;
...
...
@@ -863,13 +857,11 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
stream_buffer_attr_cb
(
s
,
aout
);
stream_moved_cb
(
s
,
aout
);
pa_threaded_mainloop_unlock
(
sys
->
mainloop
);
var_AddCallback
(
aout
,
"audio-device"
,
StreamMove
,
s
);
return
VLC_SUCCESS
;
fail:
pa_threaded_mainloop_unlock
(
sys
->
mainloop
);
var_AddCallback
(
aout
,
"audio-device"
,
StreamMove
,
s
);
Stop
(
aout
);
return
VLC_EGENERIC
;
}
...
...
@@ -882,9 +874,6 @@ static void Stop(audio_output_t *aout)
aout_sys_t
*
sys
=
aout
->
sys
;
pa_stream
*
s
=
sys
->
stream
;
/* The callback takes mainloop lock, so it CANNOT be held here! */
var_DelCallback
(
aout
,
"audio-device"
,
StreamMove
,
s
);
pa_threaded_mainloop_lock
(
sys
->
mainloop
);
if
(
unlikely
(
sys
->
trigger
!=
NULL
))
vlc_pa_rttime_free
(
sys
->
mainloop
,
sys
->
trigger
);
...
...
@@ -938,6 +927,7 @@ static int Open(vlc_object_t *obj)
aout
->
flush
=
Flush
;
aout
->
volume_set
=
VolumeSet
;
aout
->
mute_set
=
MuteSet
;
aout
->
device_select
=
StreamMove
;
/* Devices (sinks) */
var_Create
(
aout
,
"audio-device"
,
VLC_VAR_INTEGER
|
VLC_VAR_HASCHOICE
);
...
...
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