Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
c666cf1c
Commit
c666cf1c
authored
Sep 16, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/pulse: move code to _setup_stream()
parent
2be245b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
15 deletions
+36
-15
pulse_output_plugin.c
src/output/pulse_output_plugin.c
+36
-15
No files found.
src/output/pulse_output_plugin.c
View file @
c666cf1c
...
...
@@ -496,6 +496,41 @@ pulse_output_stream_write_cb(G_GNUC_UNUSED pa_stream *stream, size_t nbytes,
pa_threaded_mainloop_signal
(
po
->
mainloop
,
0
);
}
/**
* Create, set up and connect a context.
*
* Caller must lock the main loop.
*
* @return true on success, false on error
*/
static
bool
pulse_output_setup_stream
(
struct
pulse_output
*
po
,
const
pa_sample_spec
*
ss
,
GError
**
error_r
)
{
assert
(
po
!=
NULL
);
assert
(
po
->
context
!=
NULL
);
po
->
stream
=
pa_stream_new
(
po
->
context
,
po
->
name
,
ss
,
NULL
);
if
(
po
->
stream
==
NULL
)
{
g_set_error
(
error_r
,
pulse_output_quark
(),
0
,
"pa_stream_new() has failed: %s"
,
pa_strerror
(
pa_context_errno
(
po
->
context
)));
return
false
;
}
#if PA_CHECK_VERSION(0,9,8)
pa_stream_set_suspended_callback
(
po
->
stream
,
pulse_output_stream_suspended_cb
,
po
);
#endif
pa_stream_set_state_callback
(
po
->
stream
,
pulse_output_stream_state_cb
,
po
);
pa_stream_set_write_callback
(
po
->
stream
,
pulse_output_stream_write_cb
,
po
);
return
true
;
}
static
bool
pulse_output_open
(
void
*
data
,
struct
audio_format
*
audio_format
,
GError
**
error_r
)
...
...
@@ -540,25 +575,11 @@ pulse_output_open(void *data, struct audio_format *audio_format,
/* create a stream .. */
po
->
stream
=
pa_stream_new
(
po
->
context
,
po
->
name
,
&
ss
,
NULL
);
if
(
po
->
stream
==
NULL
)
{
g_set_error
(
error_r
,
pulse_output_quark
(),
0
,
"pa_stream_new() has failed: %s"
,
pa_strerror
(
pa_context_errno
(
po
->
context
)));
if
(
!
pulse_output_setup_stream
(
po
,
&
ss
,
error_r
))
{
pa_threaded_mainloop_unlock
(
po
->
mainloop
);
return
false
;
}
#if PA_CHECK_VERSION(0,9,8)
pa_stream_set_suspended_callback
(
po
->
stream
,
pulse_output_stream_suspended_cb
,
po
);
#endif
pa_stream_set_state_callback
(
po
->
stream
,
pulse_output_stream_state_cb
,
po
);
pa_stream_set_write_callback
(
po
->
stream
,
pulse_output_stream_write_cb
,
po
);
/* .. and connect it (asynchronously) */
error
=
pa_stream_connect_playback
(
po
->
stream
,
po
->
sink
,
...
...
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