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
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)
...
@@ -612,26 +612,20 @@ static int MuteSet(audio_output_t *aout, bool mute)
return
0
;
return
0
;
}
}
static
int
StreamMove
(
vlc_object_t
*
obj
,
const
char
*
varname
,
vlc_value_t
old
,
static
int
StreamMove
(
audio_output_t
*
aout
,
const
char
*
name
)
vlc_value_t
val
,
void
*
userdata
)
{
{
audio_output_t
*
aout
=
(
audio_output_t
*
)
obj
;
aout_sys_t
*
sys
=
aout
->
sys
;
aout_sys_t
*
sys
=
aout
->
sys
;
pa_stream
*
s
=
userdata
;
pa_operation
*
op
;
pa_operation
*
op
;
uint32_t
idx
=
pa_stream_get_index
(
s
);
uint32_t
idx
=
pa_stream_get_index
(
sys
->
stream
);
uint32_t
sink_idx
=
val
.
i_int
;
(
void
)
varname
;
(
void
)
old
;
pa_threaded_mainloop_lock
(
sys
->
mainloop
);
pa_threaded_mainloop_lock
(
sys
->
mainloop
);
op
=
pa_context_move_sink_input_by_
index
(
sys
->
context
,
idx
,
sink_idx
,
op
=
pa_context_move_sink_input_by_
name
(
sys
->
context
,
idx
,
name
,
NULL
,
NULL
);
NULL
,
NULL
);
if
(
likely
(
op
!=
NULL
))
{
if
(
likely
(
op
!=
NULL
))
{
pa_operation_unref
(
op
);
pa_operation_unref
(
op
);
msg_Dbg
(
aout
,
"moving to sink %
"
PRIu32
,
sink_idx
);
msg_Dbg
(
aout
,
"moving to sink %
s"
,
name
);
}
else
}
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
);
pa_threaded_mainloop_unlock
(
sys
->
mainloop
);
return
(
op
!=
NULL
)
?
VLC_SUCCESS
:
VLC_EGENERIC
;
return
(
op
!=
NULL
)
?
VLC_SUCCESS
:
VLC_EGENERIC
;
...
@@ -863,13 +857,11 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
...
@@ -863,13 +857,11 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
stream_buffer_attr_cb
(
s
,
aout
);
stream_buffer_attr_cb
(
s
,
aout
);
stream_moved_cb
(
s
,
aout
);
stream_moved_cb
(
s
,
aout
);
pa_threaded_mainloop_unlock
(
sys
->
mainloop
);
pa_threaded_mainloop_unlock
(
sys
->
mainloop
);
var_AddCallback
(
aout
,
"audio-device"
,
StreamMove
,
s
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
fail:
fail:
pa_threaded_mainloop_unlock
(
sys
->
mainloop
);
pa_threaded_mainloop_unlock
(
sys
->
mainloop
);
var_AddCallback
(
aout
,
"audio-device"
,
StreamMove
,
s
);
Stop
(
aout
);
Stop
(
aout
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -882,9 +874,6 @@ static void Stop(audio_output_t *aout)
...
@@ -882,9 +874,6 @@ static void Stop(audio_output_t *aout)
aout_sys_t
*
sys
=
aout
->
sys
;
aout_sys_t
*
sys
=
aout
->
sys
;
pa_stream
*
s
=
sys
->
stream
;
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
);
pa_threaded_mainloop_lock
(
sys
->
mainloop
);
if
(
unlikely
(
sys
->
trigger
!=
NULL
))
if
(
unlikely
(
sys
->
trigger
!=
NULL
))
vlc_pa_rttime_free
(
sys
->
mainloop
,
sys
->
trigger
);
vlc_pa_rttime_free
(
sys
->
mainloop
,
sys
->
trigger
);
...
@@ -938,6 +927,7 @@ static int Open(vlc_object_t *obj)
...
@@ -938,6 +927,7 @@ static int Open(vlc_object_t *obj)
aout
->
flush
=
Flush
;
aout
->
flush
=
Flush
;
aout
->
volume_set
=
VolumeSet
;
aout
->
volume_set
=
VolumeSet
;
aout
->
mute_set
=
MuteSet
;
aout
->
mute_set
=
MuteSet
;
aout
->
device_select
=
StreamMove
;
/* Devices (sinks) */
/* Devices (sinks) */
var_Create
(
aout
,
"audio-device"
,
VLC_VAR_INTEGER
|
VLC_VAR_HASCHOICE
);
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