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
19131f1e
Commit
19131f1e
authored
Nov 14, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
volume: moved code to oss_mixer_find()
parent
eb199ca2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
volume.c
src/volume.c
+23
-14
No files found.
src/volume.c
View file @
19131f1e
...
...
@@ -87,6 +87,27 @@ static void closeOssMixer(void)
volume_ossFd
=
-
1
;
}
static
int
oss_find_mixer
(
const
char
*
name
)
{
const
char
*
labels
[
SOUND_MIXER_NRDEVICES
]
=
SOUND_DEVICE_LABELS
;
for
(
unsigned
i
=
0
;
i
<
SOUND_MIXER_NRDEVICES
;
i
++
)
{
ssize_t
len
=
strlen
(
labels
[
i
]);
char
*
duplicated
=
alloca
(
len
+
1
);
/* eliminate spaces at the end */
memcpy
(
duplicated
,
labels
[
i
],
len
+
1
);
len
-=
2
;
while
(
len
>=
0
&&
duplicated
[
len
]
==
' '
)
duplicated
[
len
--
]
=
'\0'
;
if
(
strcasecmp
(
duplicated
,
name
)
==
0
)
return
i
;
}
return
-
1
;
}
static
int
prepOssMixer
(
const
char
*
device
)
{
ConfigParam
*
param
;
...
...
@@ -97,7 +118,6 @@ static int prepOssMixer(const char *device)
}
if
((
param
=
getConfigParam
(
CONF_MIXER_CONTROL
)))
{
const
char
*
labels
[
SOUND_MIXER_NRDEVICES
]
=
SOUND_DEVICE_LABELS
;
int
i
;
int
devmask
=
0
;
...
...
@@ -107,20 +127,9 @@ static int prepOssMixer(const char *device)
return
-
1
;
}
for
(
i
=
0
;
i
<
SOUND_MIXER_NRDEVICES
;
i
++
)
{
ssize_t
len
=
strlen
(
labels
[
i
]);
char
*
duplicated
=
alloca
(
len
+
1
);
/* eliminate spaces at the end */
memcpy
(
duplicated
,
labels
[
i
],
len
+
1
);
len
-=
2
;
while
(
len
>=
0
&&
duplicated
[
len
]
==
' '
)
duplicated
[
len
--
]
=
'\0'
;
if
(
strcasecmp
(
duplicated
,
param
->
value
)
==
0
)
break
;
}
i
=
oss_find_mixer
(
param
->
value
);
if
(
i
>=
SOUND_MIXER_NRDEVICES
)
{
if
(
i
<
0
)
{
WARNING
(
"mixer control
\"
%s
\"
not found at line %i
\n
"
,
param
->
value
,
param
->
line
);
closeOssMixer
();
...
...
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