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
3baeddbc
Commit
3baeddbc
authored
Jan 29, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jack: fail if jack_get_ports() returns NULL
When jack_get_ports() returns NULL, we cannot have any ports to connect to, and the device cannot play anything.
parent
5bcf415a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
19 deletions
+23
-19
jack_plugin.c
src/output/jack_plugin.c
+23
-19
No files found.
src/output/jack_plugin.c
View file @
3baeddbc
...
...
@@ -214,8 +214,6 @@ mpd_jack_test_default_device(void)
static
int
mpd_jack_connect
(
struct
jack_data
*
jd
,
struct
audio_format
*
audio_format
)
{
const
char
**
jports
;
jd
->
audio_format
=
audio_format
;
jd
->
ringbuffer
[
0
]
=
jack_ringbuffer_create
(
jd
->
ringbuffer_size
);
...
...
@@ -253,10 +251,18 @@ mpd_jack_connect(struct jack_data *jd, struct audio_format *audio_format)
return
-
1
;
}
/* hay que buscar que hay */
if
(
!
jd
->
output_ports
[
1
]
&&
(
jports
=
jack_get_ports
(
jd
->
client
,
NULL
,
NULL
,
JackPortIsPhysical
|
JackPortIsInput
)))
{
if
(
jd
->
output_ports
[
1
]
==
NULL
)
{
/* no output ports were configured - ask libjack for
defaults */
const
char
**
jports
;
jports
=
jack_get_ports
(
jd
->
client
,
NULL
,
NULL
,
JackPortIsPhysical
|
JackPortIsInput
);
if
(
jports
==
NULL
)
{
g_warning
(
"no ports found"
);
return
-
1
;
}
jd
->
output_ports
[
0
]
=
g_strdup
(
jports
[
0
]);
jd
->
output_ports
[
1
]
=
g_strdup
(
jports
[
1
]
!=
NULL
?
jports
[
1
]
:
jports
[
0
]);
...
...
@@ -265,19 +271,17 @@ mpd_jack_connect(struct jack_data *jd, struct audio_format *audio_format)
free
(
jports
);
}
if
(
jd
->
output_ports
[
1
]
)
{
if
(
(
jack_connect
(
jd
->
client
,
jack_port_name
(
jd
->
ports
[
0
]),
jd
->
output_ports
[
0
]))
!=
0
)
{
g_warning
(
"%s is not a valid Jack Client / Port"
,
jd
->
output_ports
[
0
]);
return
-
1
;
}
if
(
(
jack_connect
(
jd
->
client
,
jack_port_name
(
jd
->
ports
[
0
]),
jd
->
output_ports
[
1
]))
!=
0
)
{
g_warning
(
"%s is not a valid Jack Client / Port"
,
jd
->
output_ports
[
1
]);
return
-
1
;
}
if
(
(
jack_connect
(
jd
->
client
,
jack_port_name
(
jd
->
ports
[
0
]),
jd
->
output_ports
[
0
]))
!=
0
)
{
g_warning
(
"%s is not a valid Jack Client / Port"
,
jd
->
output_ports
[
0
]);
return
-
1
;
}
if
(
(
jack_connect
(
jd
->
client
,
jack_port_name
(
jd
->
ports
[
0
]),
jd
->
output_ports
[
1
]))
!=
0
)
{
g_warning
(
"%s is not a valid Jack Client / Port"
,
jd
->
output_ports
[
1
]);
return
-
1
;
}
return
1
;
...
...
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