Initial revision 6759
[qball-mpd.git] / src / .svn / text-base / player.h.svn-base
blob17dcf16e0c7b2eef631679331d577aa2f33d3e9c
1 /* the Music Player Daemon (MPD)
2  * Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
3  * This project's homepage is: http://www.musicpd.org
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
19 #ifndef PLAYER_H
20 #define PLAYER_H
22 #include "../config.h"
24 #include "decode.h"
25 #include "mpd_types.h"
26 #include "song.h"
27 #include "metadataChunk.h"
29 #include <stdio.h>
30 #include <sys/param.h>
32 #define PLAYER_STATE_STOP       0
33 #define PLAYER_STATE_PAUSE      1
34 #define PLAYER_STATE_PLAY       2
36 #define PLAYER_ERROR_NOERROR            0
37 #define PLAYER_ERROR_FILE               1
38 #define PLAYER_ERROR_AUDIO              2
39 #define PLAYER_ERROR_SYSTEM             3
40 #define PLAYER_ERROR_UNKTYPE            4
41 #define PLAYER_ERROR_FILENOTFOUND       5
43 /* 0->1->2->3->5 regular playback
44  *        ->4->0 don't play queued song
45  */
46 #define PLAYER_QUEUE_BLANK      0
47 #define PLAYER_QUEUE_FULL       1
48 #define PLAYER_QUEUE_DECODE     2
49 #define PLAYER_QUEUE_PLAY       3
50 #define PLAYER_QUEUE_STOP       4
51 #define PLAYER_QUEUE_EMPTY      5
53 #define PLAYER_QUEUE_UNLOCKED   0
54 #define PLAYER_QUEUE_LOCKED     1
56 #define PLAYER_METADATA_STATE_READ      1
57 #define PLAYER_METADATA_STATE_WRITE     2
59 typedef struct _PlayerControl {
60         volatile mpd_sint8 wait;
61         volatile mpd_sint8 stop;
62         volatile mpd_sint8 play;
63         volatile mpd_sint8 pause;
64         volatile mpd_sint8 state;
65         volatile mpd_sint8 closeAudio;
66         volatile mpd_sint8 error;
67         volatile mpd_uint16 bitRate;
68         volatile mpd_sint8 bits;
69         volatile mpd_sint8 channels;
70         volatile mpd_uint32 sampleRate;
71         volatile float totalTime;
72         volatile float elapsedTime;
73         volatile float fileTime;
74         char utf8url[MAXPATHLEN + 1];
75         char currentUrl[MAXPATHLEN + 1];
76         char erroredUrl[MAXPATHLEN + 1];
77         volatile mpd_sint8 queueState;
78         volatile mpd_sint8 queueLockState;
79         volatile mpd_sint8 lockQueue;
80         volatile mpd_sint8 unlockQueue;
81         volatile mpd_sint8 seek;
82         volatile double seekWhere;
83         volatile float crossFade;
84         volatile mpd_uint16 softwareVolume;
85         volatile double totalPlayTime;
86         volatile int decode_pid;
87         volatile mpd_sint8 cycleLogFiles;
88         volatile mpd_sint8 metadataState;
89         MetadataChunk metadataChunk;
90         MetadataChunk fileMetadataChunk;
91 } PlayerControl;
93 void clearPlayerPid(void);
95 void player_sigChldHandler(int pid, int status);
97 int playerPlay(int fd, Song * song);
99 int playerSetPause(int fd, int pause);
101 int playerPause(int fd);
103 int playerStop(int fd);
105 void playerCloseAudio(void);
107 void playerKill(void);
109 int getPlayerTotalTime(void);
111 int getPlayerElapsedTime(void);
113 unsigned long getPlayerBitRate(void);
115 int getPlayerState(void);
117 void clearPlayerError(void);
119 char *getPlayerErrorStr(void);
121 int getPlayerError(void);
123 int playerInit(void);
125 int playerWait(int fd);
127 int queueSong(Song * song);
129 int getPlayerQueueState(void);
131 void setQueueState(int queueState);
133 void playerQueueLock(void);
135 void playerQueueUnlock(void);
137 int playerSeek(int fd, Song * song, float time);
139 void setPlayerCrossFade(float crossFadeInSeconds);
141 float getPlayerCrossFade(void);
143 void setPlayerSoftwareVolume(int volume);
145 double getPlayerTotalPlayTime(void);
147 unsigned int getPlayerSampleRate(void);
149 int getPlayerBits(void);
151 int getPlayerChannels(void);
153 void playerCycleLogFiles(void);
155 Song *playerCurrentDecodeSong(void);
157 #endif