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
b7ac3fab
Commit
b7ac3fab
authored
Apr 12, 2008
by
Max Kellermann
Committed by
Eric Wong
Apr 12, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use the notify API in the player
git-svn-id:
https://svn.musicpd.org/mpd/trunk@7282
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
701cf688
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
6 deletions
+10
-6
player.c
src/player.c
+8
-6
player.h
src/player.h
+1
-0
playerData.c
src/playerData.c
+1
-0
No files found.
src/player.c
View file @
b7ac3fab
...
@@ -33,9 +33,6 @@
...
@@ -33,9 +33,6 @@
#include "sig_handlers.h"
#include "sig_handlers.h"
#include "os_compat.h"
#include "os_compat.h"
static
pthread_cond_t
player_wakeup
=
PTHREAD_COND_INITIALIZER
;
static
pthread_mutex_t
player_wakeup_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_cond_t
main_wakeup
=
PTHREAD_COND_INITIALIZER
;
static
pthread_cond_t
main_wakeup
=
PTHREAD_COND_INITIALIZER
;
static
pthread_mutex_t
main_wakeup_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_mutex_t
main_wakeup_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
...
@@ -43,12 +40,14 @@ static void playerCloseAudio(void);
...
@@ -43,12 +40,14 @@ static void playerCloseAudio(void);
void
wakeup_player_nb
(
void
)
void
wakeup_player_nb
(
void
)
{
{
pthread_cond_signal
(
&
player_wakeup
);
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
notifySignal
(
&
pc
->
notify
);
}
}
static
void
wakeup_player
(
void
)
static
void
wakeup_player
(
void
)
{
{
pthread_cond_signal
(
&
player_wakeup
);
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
notifySignal
(
&
pc
->
notify
);
pthread_cond_wait
(
&
main_wakeup
,
&
main_wakeup_mutex
);
pthread_cond_wait
(
&
main_wakeup
,
&
main_wakeup_mutex
);
}
}
...
@@ -59,13 +58,16 @@ void wakeup_main_task(void)
...
@@ -59,13 +58,16 @@ void wakeup_main_task(void)
void
player_sleep
(
void
)
void
player_sleep
(
void
)
{
{
pthread_cond_wait
(
&
player_wakeup
,
&
player_wakeup_mutex
);
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
notifyWait
(
&
pc
->
notify
);
}
}
static
void
*
player_task
(
mpd_unused
void
*
unused
)
static
void
*
player_task
(
mpd_unused
void
*
unused
)
{
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
notifyEnter
(
&
pc
->
notify
);
while
(
1
)
{
while
(
1
)
{
if
(
pc
->
play
)
{
if
(
pc
->
play
)
{
decode
();
decode
();
...
...
src/player.h
View file @
b7ac3fab
...
@@ -51,6 +51,7 @@
...
@@ -51,6 +51,7 @@
#define PLAYER_QUEUE_LOCKED 1
#define PLAYER_QUEUE_LOCKED 1
typedef
struct
_PlayerControl
{
typedef
struct
_PlayerControl
{
Notify
notify
;
volatile
mpd_sint8
stop
;
volatile
mpd_sint8
stop
;
volatile
mpd_sint8
play
;
volatile
mpd_sint8
play
;
volatile
mpd_sint8
pause
;
volatile
mpd_sint8
pause
;
...
...
src/playerData.c
View file @
b7ac3fab
...
@@ -96,6 +96,7 @@ void initPlayerData(void)
...
@@ -96,6 +96,7 @@ void initPlayerData(void)
initOutputBuffer
(
&
(
playerData_pd
->
buffer
),
initOutputBuffer
(
&
(
playerData_pd
->
buffer
),
(
OutputBufferChunk
*
)(((
char
*
)
playerData_pd
)
+
sizeof
(
PlayerData
)));
(
OutputBufferChunk
*
)(((
char
*
)
playerData_pd
)
+
sizeof
(
PlayerData
)));
notifyInit
(
&
playerData_pd
->
playerControl
.
notify
);
playerData_pd
->
playerControl
.
stop
=
0
;
playerData_pd
->
playerControl
.
stop
=
0
;
playerData_pd
->
playerControl
.
pause
=
0
;
playerData_pd
->
playerControl
.
pause
=
0
;
playerData_pd
->
playerControl
.
play
=
0
;
playerData_pd
->
playerControl
.
play
=
0
;
...
...
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