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
da917bba
Commit
da917bba
authored
Apr 14, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PulseAudio: adapt to hotplug event
parent
28789103
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
35 deletions
+8
-35
modules/audio_output/pulse.c
modules/audio_output/pulse.c
+8
-35
No files found.
modules/audio_output/pulse.c
View file @
da917bba
...
@@ -59,7 +59,6 @@ vlc_module_end ()
...
@@ -59,7 +59,6 @@ vlc_module_end ()
struct
sink
struct
sink
{
{
struct
sink
*
next
;
struct
sink
*
next
;
char
*
description
;
uint32_t
index
;
uint32_t
index
;
char
name
[
1
];
char
name
[
1
];
};
};
...
@@ -93,8 +92,9 @@ static void sink_add_cb(pa_context *ctx, const pa_sink_info *i, int eol,
...
@@ -93,8 +92,9 @@ static void sink_add_cb(pa_context *ctx, const pa_sink_info *i, int eol,
return
;
return
;
(
void
)
ctx
;
(
void
)
ctx
;
msg_Dbg
(
aout
,
"
listing sink %s (%"
PRIu32
"): %s"
,
i
->
name
,
i
->
index
,
msg_Dbg
(
aout
,
"
adding sink %"
PRIu32
": %s (%s)"
,
i
->
index
,
i
->
name
,
i
->
description
);
i
->
description
);
aout_HotplugReport
(
aout
,
i
->
name
,
i
->
description
);
size_t
namelen
=
strlen
(
i
->
name
);
size_t
namelen
=
strlen
(
i
->
name
);
struct
sink
*
sink
=
malloc
(
sizeof
(
*
sink
)
+
namelen
);
struct
sink
*
sink
=
malloc
(
sizeof
(
*
sink
)
+
namelen
);
...
@@ -103,7 +103,6 @@ static void sink_add_cb(pa_context *ctx, const pa_sink_info *i, int eol,
...
@@ -103,7 +103,6 @@ static void sink_add_cb(pa_context *ctx, const pa_sink_info *i, int eol,
sink
->
next
=
sys
->
sinks
;
sink
->
next
=
sys
->
sinks
;
sink
->
index
=
i
->
index
;
sink
->
index
=
i
->
index
;
sink
->
description
=
strdup
(
i
->
description
);
memcpy
(
sink
->
name
,
i
->
name
,
namelen
+
1
);
memcpy
(
sink
->
name
,
i
->
name
,
namelen
+
1
);
sys
->
sinks
=
sink
;
sys
->
sinks
=
sink
;
}
}
...
@@ -112,18 +111,14 @@ static void sink_mod_cb(pa_context *ctx, const pa_sink_info *i, int eol,
...
@@ -112,18 +111,14 @@ static void sink_mod_cb(pa_context *ctx, const pa_sink_info *i, int eol,
void
*
userdata
)
void
*
userdata
)
{
{
audio_output_t
*
aout
=
userdata
;
audio_output_t
*
aout
=
userdata
;
aout_sys_t
*
sys
=
aout
->
sys
;
if
(
eol
)
if
(
eol
)
return
;
return
;
(
void
)
ctx
;
(
void
)
ctx
;
for
(
struct
sink
*
sink
=
sys
->
sinks
;
sink
!=
NULL
;
sink
=
sink
->
next
)
msg_Dbg
(
aout
,
"changing sink %"
PRIu32
": %s (%s)"
,
i
->
index
,
i
->
name
,
if
(
sink
->
index
==
i
->
index
)
i
->
description
);
{
aout_HotplugReport
(
aout
,
i
->
name
,
i
->
description
);
free
(
sink
->
description
);
sink
->
description
=
strdup
(
i
->
description
);
}
}
}
static
void
sink_del
(
uint32_t
index
,
audio_output_t
*
aout
)
static
void
sink_del
(
uint32_t
index
,
audio_output_t
*
aout
)
...
@@ -131,11 +126,13 @@ static void sink_del(uint32_t index, audio_output_t *aout)
...
@@ -131,11 +126,13 @@ static void sink_del(uint32_t index, audio_output_t *aout)
aout_sys_t
*
sys
=
aout
->
sys
;
aout_sys_t
*
sys
=
aout
->
sys
;
struct
sink
**
pp
=
&
sys
->
sinks
,
*
sink
;
struct
sink
**
pp
=
&
sys
->
sinks
,
*
sink
;
msg_Dbg
(
aout
,
"removing sink %"
PRIu32
,
index
);
while
((
sink
=
*
pp
)
!=
NULL
)
while
((
sink
=
*
pp
)
!=
NULL
)
if
(
sink
->
index
==
index
)
if
(
sink
->
index
==
index
)
{
{
*
pp
=
sink
->
next
;
*
pp
=
sink
->
next
;
free
(
sink
->
description
);
aout_HotplugReport
(
aout
,
sink
->
name
,
NULL
);
free
(
sink
);
free
(
sink
);
}
}
else
else
...
@@ -663,28 +660,6 @@ static int MuteSet(audio_output_t *aout, bool mute)
...
@@ -663,28 +660,6 @@ static int MuteSet(audio_output_t *aout, bool mute)
return
0
;
return
0
;
}
}
static
int
SinksList
(
audio_output_t
*
aout
,
char
***
namesp
,
char
***
descsp
)
{
aout_sys_t
*
sys
=
aout
->
sys
;
char
**
names
,
**
descs
;
unsigned
n
=
0
;
pa_threaded_mainloop_lock
(
sys
->
mainloop
);
for
(
struct
sink
*
sink
=
sys
->
sinks
;
sink
!=
NULL
;
sink
=
sink
->
next
)
n
++
;
*
namesp
=
names
=
xmalloc
(
sizeof
(
*
names
)
*
n
);
*
descsp
=
descs
=
xmalloc
(
sizeof
(
*
descs
)
*
n
);
for
(
struct
sink
*
sink
=
sys
->
sinks
;
sink
!=
NULL
;
sink
=
sink
->
next
)
{
*
(
names
++
)
=
strdup
(
sink
->
name
);
*
(
descs
++
)
=
strdup
(
sink
->
description
);
}
pa_threaded_mainloop_unlock
(
sys
->
mainloop
);
return
n
;
}
static
int
StreamMove
(
audio_output_t
*
aout
,
const
char
*
name
)
static
int
StreamMove
(
audio_output_t
*
aout
,
const
char
*
name
)
{
{
aout_sys_t
*
sys
=
aout
->
sys
;
aout_sys_t
*
sys
=
aout
->
sys
;
...
@@ -1017,7 +992,6 @@ static int Open(vlc_object_t *obj)
...
@@ -1017,7 +992,6 @@ 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_enum
=
SinksList
;
aout
->
device_select
=
StreamMove
;
aout
->
device_select
=
StreamMove
;
pa_threaded_mainloop_lock
(
sys
->
mainloop
);
pa_threaded_mainloop_lock
(
sys
->
mainloop
);
...
@@ -1052,7 +1026,6 @@ static void Close(vlc_object_t *obj)
...
@@ -1052,7 +1026,6 @@ static void Close(vlc_object_t *obj)
for
(
struct
sink
*
sink
=
sys
->
sinks
,
*
next
;
sink
!=
NULL
;
sink
=
next
)
for
(
struct
sink
*
sink
=
sys
->
sinks
,
*
next
;
sink
!=
NULL
;
sink
=
next
)
{
{
next
=
sink
->
next
;
next
=
sink
->
next
;
free
(
sink
->
description
);
free
(
sink
);
free
(
sink
);
}
}
free
(
sys
->
sink_force
);
free
(
sys
->
sink_force
);
...
...
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