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
d4d838c8
Commit
d4d838c8
authored
Sep 18, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/roar: move code to roar_cancel_locked() and others
Wrap the locking code.
parent
c61a889c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
25 deletions
+41
-25
roar_output_plugin.c
src/output/roar_output_plugin.c
+41
-25
No files found.
src/output/roar_output_plugin.c
View file @
d4d838c8
...
...
@@ -55,39 +55,49 @@ roar_output_quark(void)
return
g_quark_from_static_string
(
"roar_output"
);
}
int
roar_output_get_volume
(
struct
roar
*
roar
)
static
int
roar_output_get_volume
_locked
(
struct
roar
*
roar
)
{
g_mutex_lock
(
roar
->
lock
);
if
(
roar
->
vss
&&
roar
->
alive
)
{
if
(
roar
->
vss
==
NULL
||
!
roar
->
alive
)
return
0
;
float
l
,
r
;
int
error
;
roar_vs_volume_get
(
roar
->
vss
,
&
l
,
&
r
,
&
error
);
g_mutex_unlock
(
roar
->
lock
);
return
(
l
+
r
)
*
50
;
}
else
{
g_mutex_unlock
(
roar
->
lock
);
return
0
;
}
}
bool
roar_output_
set_volume
(
struct
roar
*
roar
,
unsigned
volume
)
int
roar_output_
get_volume
(
struct
roar
*
roar
)
{
g_mutex_lock
(
roar
->
lock
);
if
(
roar
->
vss
&&
roar
->
alive
)
{
int
volume
=
roar_output_get_volume_locked
(
roar
);
g_mutex_unlock
(
roar
->
lock
);
return
volume
;
}
static
bool
roar_output_set_volume_locked
(
struct
roar
*
roar
,
unsigned
volume
)
{
assert
(
volume
<=
100
);
if
(
roar
->
vss
==
NULL
||
!
roar
->
alive
)
return
false
;
int
error
;
float
level
=
volume
/
100
.
0
;
roar_vs_volume_mono
(
roar
->
vss
,
level
,
&
error
);
g_mutex_unlock
(
roar
->
lock
);
return
true
;
}
else
{
}
bool
roar_output_set_volume
(
struct
roar
*
roar
,
unsigned
volume
)
{
g_mutex_lock
(
roar
->
lock
);
bool
success
=
roar_output_set_volume_locked
(
roar
,
volume
);
g_mutex_unlock
(
roar
->
lock
);
return
false
;
}
return
success
;
}
static
void
...
...
@@ -207,27 +217,33 @@ roar_close(void *data)
}
static
void
roar_cancel
(
void
*
data
)
roar_cancel
_locked
(
struct
roar
*
self
)
{
roar_t
*
self
=
data
;
if
(
self
->
vss
==
NULL
)
return
;
g_mutex_lock
(
self
->
lock
);
if
(
self
->
vss
!=
NULL
)
{
roar_vs_t
*
vss
=
self
->
vss
;
self
->
vss
=
NULL
;
roar_vs_close
(
vss
,
ROAR_VS_TRUE
,
&
(
self
->
err
));
self
->
alive
=
false
;
vss
=
roar_vs_new_from_con
(
&
(
self
->
con
),
&
(
self
->
err
));
if
(
vss
)
{
if
(
vss
==
NULL
)
return
;
roar_vs_stream
(
vss
,
&
(
self
->
info
),
ROAR_DIR_PLAY
,
&
(
self
->
err
));
roar_vs_role
(
vss
,
self
->
role
,
&
(
self
->
err
));
self
->
vss
=
vss
;
self
->
alive
=
true
;
}
}
}
static
void
roar_cancel
(
void
*
data
)
{
roar_t
*
self
=
data
;
g_mutex_lock
(
self
->
lock
);
roar_cancel_locked
(
self
);
g_mutex_unlock
(
self
->
lock
);
}
...
...
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