6 |
andreas |
1 |
/*
|
|
|
2 |
* Copyright (C) 2015 by Andreas Theofilu <andreas@theosys.at>
|
|
|
3 |
*
|
|
|
4 |
* All rights reserved. No warranty, explicit or implicit, provided.
|
|
|
5 |
*
|
|
|
6 |
* NOTICE: All information contained herein is, and remains
|
|
|
7 |
* the property of Andreas Theofilu and his suppliers, if any.
|
|
|
8 |
* The intellectual and technical concepts contained
|
|
|
9 |
* herein are proprietary to Andreas Theofilu and its suppliers and
|
|
|
10 |
* may be covered by European and Foreign Patents, patents in process,
|
|
|
11 |
* and are protected by trade secret or copyright law.
|
|
|
12 |
* Dissemination of this information or reproduction of this material
|
|
|
13 |
* is strictly forbidden unless prior written permission is obtained
|
|
|
14 |
* from Andreas Theofilu.
|
|
|
15 |
*/
|
|
|
16 |
#ifndef __PLAY_H__
|
|
|
17 |
#define __PLAY_H__
|
|
|
18 |
|
7 |
andreas |
19 |
#define PLAY_NONE 0 /* Empty or no command */
|
|
|
20 |
#define PLAY_PLAY 1 /* Play a file */
|
|
|
21 |
#define PLAY_PAUSE 2 /* Pause currently playing file */
|
|
|
22 |
#define PLAY_STOP 3 /* Stop playing */
|
|
|
23 |
#define PLAY_PLAYPAUSE 4 /* Play or pause current playing file */
|
|
|
24 |
#define PLAY_FWD 5 /* Fast forward file */
|
|
|
25 |
#define PLAY_REW 6 /* Restart file from start */
|
|
|
26 |
#define PLAY_SKIP_FWD 7 /* Stop current file and play next in queue */
|
|
|
27 |
#define PLAY_SKIP_REW 8 /* Stop current file and play previous in queue */
|
8 |
andreas |
28 |
#define PLAY_STOP_NOW 9 /* Stops playing in every case immediately */
|
50 |
andreas |
29 |
#define PLAY_STACK 10 /* Stops playing what ever is currently playing and starts the file at the stack */
|
6 |
andreas |
30 |
|
7 |
andreas |
31 |
#define PLAY_STATUS_PLAY 1
|
|
|
32 |
#define PLAY_STATUS_PAUSE 2
|
|
|
33 |
#define PLAY_STATUS_STOP 3
|
|
|
34 |
#define PLAY_STATUS_FWD 4
|
|
|
35 |
#define PLAY_STATUS_REW 5
|
|
|
36 |
#define PLAY_STATUS_SKIPF 6
|
|
|
37 |
#define PLAY_STATUS_SKIPR 7
|
50 |
andreas |
38 |
#define PLAY_STATUS_STACK 8
|
|
|
39 |
#define PLAY_STATUS_STPLAY 9
|
6 |
andreas |
40 |
|
8 |
andreas |
41 |
#define NOWPLAY "/nowplaying.list"
|
|
|
42 |
|
6 |
andreas |
43 |
struct ST_PlayPars
|
|
|
44 |
{
|
|
|
45 |
int s1;
|
9 |
andreas |
46 |
char type[32];
|
|
|
47 |
char what[256];
|
6 |
andreas |
48 |
};
|
|
|
49 |
|
11 |
andreas |
50 |
typedef struct
|
|
|
51 |
{
|
|
|
52 |
int id;
|
|
|
53 |
char title[256];
|
|
|
54 |
char artist[256];
|
|
|
55 |
char album[256];
|
|
|
56 |
char genre[256];
|
|
|
57 |
char cover[512];
|
|
|
58 |
}ST_PLAYING;
|
|
|
59 |
|
|
|
60 |
typedef struct
|
|
|
61 |
{
|
|
|
62 |
int id; /* The uniqie id of the music file */
|
|
|
63 |
int played; /* TRUE = File was already played. This is used only when playing randomly. */
|
|
|
64 |
char path[512]; /* The full path to the music file */
|
32 |
andreas |
65 |
int fType; /* The file type of "path" */
|
11 |
andreas |
66 |
char title[256]; /* The title of the song */
|
|
|
67 |
char artist[256]; /* The artist of the song */
|
|
|
68 |
char album[256]; /* The name of the album */
|
|
|
69 |
char genre[256]; /* The genre the song belongs to */
|
|
|
70 |
char cover[512]; /* A path to an optional cover picture */
|
|
|
71 |
void *next; /* Pointer to the next element in the chain */
|
|
|
72 |
}QUEUE;
|
|
|
73 |
|
6 |
andreas |
74 |
extern int nextCommand;
|
7 |
andreas |
75 |
extern int playStatus;
|
|
|
76 |
extern int playerActive;
|
11 |
andreas |
77 |
extern int playerRepeat;
|
|
|
78 |
extern int playerRandom;
|
|
|
79 |
extern int queueTotal;
|
55 |
andreas |
80 |
extern int playQuiet;
|
11 |
andreas |
81 |
extern ST_PLAYING playCurrent;
|
50 |
andreas |
82 |
extern QUEUE *pqueue; /* The queue of files to play. */
|
|
|
83 |
extern QUEUE *qstack; /* A stack of files to play. Has precedence about the queue! */
|
6 |
andreas |
84 |
|
|
|
85 |
void *pthr_playfile(void *pV_data);
|
7 |
andreas |
86 |
void appendToQueue(int s1, char *type, char *what);
|
8 |
andreas |
87 |
int playlistToQueue(int uid, int del);
|
|
|
88 |
int QueueToPlaylist(int s1, char *user, char *playlist);
|
25 |
andreas |
89 |
int readQueue();
|
11 |
andreas |
90 |
int scanQueue(int fd);
|
29 |
andreas |
91 |
void freeQueue();
|
32 |
andreas |
92 |
int check_command(int s1);
|
50 |
andreas |
93 |
QUEUE *qstackAdd(int ID); /* add an entry to the stack */
|
|
|
94 |
void qstackDelete(int ID); /* remove an entry from the stack */
|
|
|
95 |
void qstackClear(); /* Delete the whole stack */
|
|
|
96 |
QUEUE *qstackNext(); /* Returns the next entry from the stack and removes it then */
|
6 |
andreas |
97 |
#endif
|