* * $Log$ * *
Definition in file player.c.
#include <cfg/os.h>
#include <cfg/clock.h>
#include <dev/board.h>
#include <sys/timer.h>
#include <sys/event.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "tlv320dac.h"
#include "receiver.h"
#include "mp3player.h"
Include dependency graph for player.c:
Go to the source code of this file.
Functions | |
PLAYERINFO * | PlayerCreate (PLAYERPLUGIN *plugin) |
Create a player instance. | |
static int | PlayerPlugInControl (PLAYERINFO *pip, u_int sst, u_int xst) |
Set player to a specified state. | |
u_int | PlayerStatus (PLAYERINFO *pip) |
Retrieve the current player status. | |
int | PlayerStop (PLAYERINFO *pip) |
Stop player. | |
int | PlayerStart (PLAYERINFO *pip, RECEIVERINFO *rip) |
Start playing a specified receiver. |
|
Create a player instance.
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;
|
|
Set player to a specified state.
Definition at line 92 of file player.c. 00094 { 00095 int retries = 10; 00096 00097 /* Loop until we got the status or give up on too many retires. */ 00098 while (pip->pi_status != xst) { 00099 pip->pi_status = sst; 00100 NutEventPost(&pip->pi_cmdevt); 00101 if (NutEventWait(&pip->pi_stsevt, 500)) { 00102 if (retries-- <= 0) { 00103 printf("No player control\n"); 00104 return -1; 00105 } 00106 } 00107 } 00108 return 0;
|
|
Retrieve the current player status.
Definition at line 118 of file player.c. 00120 { 00121 return pip->pi_status;
|
|
Stop player.
Definition at line 131 of file player.c. Referenced by CgiControl(). 00133 { 00134 printf("[PSTOP]"); 00135 return PlayerPlugInControl(pip, PSTAT_STOP, PSTAT_IDLE);
|
|
Start playing a specified receiver.
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);
|