Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

player.h File Reference

#include <sys/socket.h>
#include <hxmp3/mp3dec.h>
#include <hxmp3/hermite.h>
#include "receiver.h"

Include dependency graph for player.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _PLAYERPLUGIN
 Player plug-in reference structure. More...
struct  _PLAYERINFO
 Player information structure. More...

Player Types

#define PLAYER_TYPE_MP3   1
 Player accepts MP3 encoded audio data.

Defines

#define PSTAT_IDLE   0
#define PSTAT_START   1
#define PSTAT_RUNNING   2
#define PSTAT_STOP   3

Typedefs

typedef _PLAYERINFO PLAYERINFO
 Player information structure type.
typedef _PLAYERPLUGIN PLAYERPLUGIN
 Player plug-in reference structure.

Functions

__BEGIN_DECLS PLAYERINFOPlayerCreate (PLAYERPLUGIN *ppp)
 Create a player instance.
int PlayerStart (PLAYERINFO *pip, RECEIVERINFO *rip)
 Start playing a specified receiver.
int PlayerStop (PLAYERINFO *pip)
 Stop player.
u_int PlayerStatus (PLAYERINFO *pip)
 Retrieve the current player status.


Define Documentation

#define PSTAT_IDLE   0
 

Definition at line 51 of file player.h.

#define PSTAT_START   1
 

Definition at line 52 of file player.h.

#define PSTAT_RUNNING   2
 

Definition at line 53 of file player.h.

#define PSTAT_STOP   3
 

Definition at line 54 of file player.h.

#define PLAYER_TYPE_MP3   1
 

Player accepts MP3 encoded audio data.

Definition at line 59 of file player.h.


Typedef Documentation

typedef struct _PLAYERINFO PLAYERINFO
 

Player information structure type.

Definition at line 65 of file player.h.

typedef struct _PLAYERPLUGIN PLAYERPLUGIN
 

Player plug-in reference structure.

A variable with this structure is provided by the plug-in.


Function Documentation

__BEGIN_DECLS PLAYERINFO* PlayerCreate PLAYERPLUGIN plugin  ) 
 

Create a player instance.

Parameters:
plugin Pointer to a player plug-in.
Returns:
On success, the pointer to a PLAYERINFO structure is returned. A NULL pointer indicates an error.

Definition at line 66 of file player.c.

00068 {
00069     PLAYERINFO *pip;
00070 
00071     /* Allocate and initialize the player info structure. */
00072     if ((pip = malloc(sizeof(PLAYERINFO))) != NULL) {
00073         memset(pip, 0, sizeof(PLAYERINFO));
00074         /* Associate a new player plug-in instance. */
00075         if ((*plugin->pp_create) (pip)) {
00076             free(pip);
00077             pip = NULL;
00078         }
00079     }
00080     return pip;

int PlayerStart PLAYERINFO pip,
RECEIVERINFO rip
 

Start playing a specified receiver.

Parameters:
pip Player to start. Pointer to a player info structure, obtained by a previous call to PlayerCreate().
rip Receiver to play.
Returns:
0 on success, -1 otherwise.

Definition at line 146 of file player.c.

00148 {
00149     if (PlayerStop(pip)) {
00150         return -1;
00151     }
00152     printf("[PSTART]");
00153     pip->pi_rcvr = rip;
00154 
00155     return PlayerPlugInControl(pip, PSTAT_START, PSTAT_RUNNING);

int PlayerStop PLAYERINFO pip  ) 
 

Stop player.

Parameters:
pip Player to stop. Pointer to a player info structure, obtained by a previous call to PlayerCreate().
Returns:
0 on success, -1 otherwise.

Definition at line 131 of file player.c.

Referenced by CgiControl().

00133 {
00134     printf("[PSTOP]");
00135     return PlayerPlugInControl(pip, PSTAT_STOP, PSTAT_IDLE);

u_int PlayerStatus PLAYERINFO pip  ) 
 

Retrieve the current player status.

Parameters:
pip Pointer to a player info structure, obtained by a previous call to PlayerCreate().
Returns:
Player status.

Definition at line 118 of file player.c.

00120 {
00121     return pip->pi_status;


Generated on Fri Feb 23 17:28:55 2007 for SAM Internet Radio by  doxygen 1.4.4