Subversion Repositories mdb

Rev

Rev 50 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * Copyright (C) 2015 by Andreas Theofilu <andreas@theosys.at>
 *
 * All rights reserved. No warranty, explicit or implicit, provided.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Andreas Theofilu and his suppliers, if any.
 * The intellectual and technical concepts contained
 * herein are proprietary to Andreas Theofilu and its suppliers and
 * may be covered by European and Foreign Patents, patents in process,
 * and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Andreas Theofilu.
 */
#ifndef __PLAY_H__
#define __PLAY_H__

#define PLAY_NONE               0                /* Empty or no command */
#define PLAY_PLAY               1               /* Play a file */
#define PLAY_PAUSE              2               /* Pause currently playing file */
#define PLAY_STOP               3               /* Stop playing */
#define PLAY_PLAYPAUSE  4               /* Play or pause current playing file */
#define PLAY_FWD                5               /* Fast forward file */
#define PLAY_REW                6               /* Restart file from start */
#define PLAY_SKIP_FWD   7               /* Stop current file and play next in queue */
#define PLAY_SKIP_REW   8               /* Stop current file and play previous in queue */
#define PLAY_STOP_NOW   9               /* Stops playing in every case immediately */
#define PLAY_STACK              10              /* Stops playing what ever is currently playing and starts the file at the stack */

#define PLAY_STATUS_PLAY        1
#define PLAY_STATUS_PAUSE       2
#define PLAY_STATUS_STOP        3
#define PLAY_STATUS_FWD         4
#define PLAY_STATUS_REW         5
#define PLAY_STATUS_SKIPF       6
#define PLAY_STATUS_SKIPR       7
#define PLAY_STATUS_STACK       8
#define PLAY_STATUS_STPLAY      9

#define NOWPLAY                 "/nowplaying.list"

struct ST_PlayPars
{
        int s1;
        char type[32];
        char what[256];
};

typedef struct
{
        int id;
        char title[256];
        char artist[256];
        char album[256];
        char genre[256];
        char cover[512];
}ST_PLAYING;

typedef struct
{
        int id;                                 /* The uniqie id of the music file */
        int played;                             /* TRUE = File was already played. This is used only when playing randomly. */
        char path[512];                 /* The full path to the music file */
        int fType;                              /* The file type of "path" */
        char title[256];                /* The title of the song */
        char artist[256];               /* The artist of the song */
        char album[256];                /* The name of the album */
        char genre[256];                /* The genre the song belongs to */
        char cover[512];                /* A path to an optional cover picture */
        void *next;                             /* Pointer to the next element in the chain */
}QUEUE;

extern int nextCommand;
extern int playStatus;
extern int playerActive;
extern int playerRepeat;
extern int playerRandom;
extern int queueTotal;
extern int playQuiet;
extern ST_PLAYING playCurrent;
extern QUEUE *pqueue;           /* The queue of files to play. */
extern QUEUE *qstack;           /* A stack of files to play. Has precedence about the queue! */

void *pthr_playfile(void *pV_data);
void appendToQueue(int s1, char *type, char *what);
int playlistToQueue(int uid, int del);
int QueueToPlaylist(int s1, char *user, char *playlist);
int readQueue();
int scanQueue(int fd);
void freeQueue();
int check_command(int s1);
QUEUE *qstackAdd(int ID);               /* add an entry to the stack */
void qstackDelete(int ID);              /* remove an entry from the stack */
void qstackClear();                             /* Delete the whole stack */
QUEUE *qstackNext();                    /* Returns the next entry from the stack and removes it then */
#endif