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
4f2ac7ec
Commit
4f2ac7ec
authored
Feb 26, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oss: moved code from oss_open() to oss_setup()
Eliminate one label and a bunch of gotos.
parent
749d6c77
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
13 deletions
+26
-13
oss_plugin.c
src/output/oss_plugin.c
+26
-13
No files found.
src/output/oss_plugin.c
View file @
4f2ac7ec
...
...
@@ -469,23 +469,20 @@ oss_close(struct oss_data *od)
od
->
fd
=
-
1
;
}
/**
* Sets up the OSS device which was opened before.
*/
static
bool
oss_
open
(
struct
oss_data
*
od
)
oss_
setup
(
struct
oss_data
*
od
)
{
int
tmp
;
if
((
od
->
fd
=
open
(
od
->
device
,
O_WRONLY
))
<
0
)
{
g_warning
(
"Error opening OSS device
\"
%s
\"
: %s
\n
"
,
od
->
device
,
strerror
(
errno
));
goto
fail
;
}
tmp
=
od
->
audio_format
.
channels
;
if
(
oss_set_param
(
od
,
SNDCTL_DSP_CHANNELS
,
&
tmp
))
{
g_warning
(
"OSS device
\"
%s
\"
does not support %u channels: %s
\n
"
,
od
->
device
,
od
->
audio_format
.
channels
,
strerror
(
errno
));
goto
fail
;
return
false
;
}
od
->
audio_format
.
channels
=
tmp
;
...
...
@@ -494,7 +491,7 @@ oss_open(struct oss_data *od)
g_warning
(
"OSS device
\"
%s
\"
does not support %u Hz audio: %s
\n
"
,
od
->
device
,
od
->
audio_format
.
sample_rate
,
strerror
(
errno
));
goto
fail
;
return
false
;
}
od
->
audio_format
.
sample_rate
=
tmp
;
...
...
@@ -516,14 +513,30 @@ oss_open(struct oss_data *od)
if
(
oss_set_param
(
od
,
SNDCTL_DSP_SAMPLESIZE
,
&
tmp
))
{
g_warning
(
"OSS device
\"
%s
\"
does not support %u bit audio: %s
\n
"
,
od
->
device
,
tmp
,
strerror
(
errno
));
goto
fail
;
return
false
;
}
return
true
;
}
fail:
oss_close
(
od
);
return
false
;
static
bool
oss_open
(
struct
oss_data
*
od
)
{
bool
success
;
if
((
od
->
fd
=
open
(
od
->
device
,
O_WRONLY
))
<
0
)
{
g_warning
(
"Error opening OSS device
\"
%s
\"
: %s
\n
"
,
od
->
device
,
strerror
(
errno
));
return
false
;
}
success
=
oss_setup
(
od
);
if
(
!
success
)
{
oss_close
(
od
);
return
false
;
}
return
true
;
}
static
bool
...
...
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