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
b1de50f9
Commit
b1de50f9
authored
Aug 26, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converted PlayerControl.state to enum
Don't write CPP when you can express the same in C... macros vs enum is a good example for that.
parent
efde884a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
player.c
src/player.c
+4
-1
player.h
src/player.h
+7
-5
No files found.
src/player.c
View file @
b1de50f9
...
...
@@ -148,6 +148,9 @@ int playerPause(mpd_unused int fd)
int
playerSetPause
(
int
fd
,
int
pause_flag
)
{
switch
(
pc
.
state
)
{
case
PLAYER_STATE_STOP
:
break
;
case
PLAYER_STATE_PLAY
:
if
(
pause_flag
)
playerPause
(
fd
);
...
...
@@ -176,7 +179,7 @@ int getPlayerTotalTime(void)
return
(
int
)(
pc
.
totalTime
+
0
.
5
);
}
int
getPlayerState
(
void
)
enum
player_state
getPlayerState
(
void
)
{
return
pc
.
state
;
}
...
...
src/player.h
View file @
b1de50f9
...
...
@@ -24,9 +24,11 @@
#include "song.h"
#include "os_compat.h"
#define PLAYER_STATE_STOP 0
#define PLAYER_STATE_PAUSE 1
#define PLAYER_STATE_PLAY 2
enum
player_state
{
PLAYER_STATE_STOP
=
0
,
PLAYER_STATE_PAUSE
,
PLAYER_STATE_PLAY
};
enum
player_command
{
PLAYER_COMMAND_NONE
=
0
,
...
...
@@ -62,7 +64,7 @@ enum player_command {
typedef
struct
_PlayerControl
{
Notify
notify
;
volatile
enum
player_command
command
;
volatile
mpd_sint8
state
;
volatile
enum
player_state
state
;
volatile
mpd_sint8
error
;
volatile
mpd_uint16
bitRate
;
volatile
mpd_sint8
bits
;
...
...
@@ -99,7 +101,7 @@ int getPlayerElapsedTime(void);
unsigned
long
getPlayerBitRate
(
void
);
int
getPlayerState
(
void
);
enum
player_state
getPlayerState
(
void
);
void
clearPlayerError
(
void
);
...
...
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