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

receiver.h File Reference


Detailed Description

Audio data receiver.

 *
 * $Log$
 *
 * 

Definition in file receiver.h.

#include <sys/socket.h>
#include "config.h"
#include "station.h"

Include dependency graph for receiver.h:

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

Go to the source code of this file.

Data Structures

struct  _RECEIVERPLUGIN
 Receiver plug-in reference structure. More...
struct  _RECEIVERINFO
 Receiver information structure. More...

Receiver Status

#define RSTAT_IDLE   0
 Receiver is idle.
#define RSTAT_START   1
 Request to start receiver.
#define RSTAT_RUNNING   2
 Receiver is running.
#define RSTAT_STOP   3
 Request to stop receiver.

Receiver Protocol Types

#define RECEIVER_TYPE_SHOUTCAST   1
 Receiver is connected to a SHOUTcast server.

Typedefs

typedef _RECEIVERINFO RECEIVERINFO
 Receiver information structure type.
typedef _RECEIVERPLUGIN RECEIVERPLUGIN
 Receiver plug-in reference structure.

Functions

__BEGIN_DECLS RECEIVERINFOReceiverCreate (RECEIVERPLUGIN *plugin)
 Create stream receiver instance with the specified plug-in.
int ReceiverStart (RECEIVERINFO *rip, STATIONINFO *sip)
 Start receiving a specified station.
int ReceiverStop (RECEIVERINFO *rip)
 Stop receiver.
u_int ReceiverStatus (RECEIVERINFO *rip)
 Retrieve the current receiver status.


Define Documentation

#define RSTAT_IDLE   0
 

Receiver is idle.

Definition at line 53 of file receiver.h.

#define RSTAT_START   1
 

Request to start receiver.

Definition at line 55 of file receiver.h.

#define RSTAT_RUNNING   2
 

Receiver is running.

Definition at line 57 of file receiver.h.

#define RSTAT_STOP   3
 

Request to stop receiver.

Definition at line 59 of file receiver.h.

#define RECEIVER_TYPE_SHOUTCAST   1
 

Receiver is connected to a SHOUTcast server.

Definition at line 65 of file receiver.h.


Typedef Documentation

typedef struct _RECEIVERINFO RECEIVERINFO
 

Receiver information structure type.

Definition at line 71 of file receiver.h.

typedef struct _RECEIVERPLUGIN RECEIVERPLUGIN
 

Receiver plug-in reference structure.

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


Function Documentation

__BEGIN_DECLS RECEIVERINFO* ReceiverCreate RECEIVERPLUGIN plugin  ) 
 

Create stream receiver instance with the specified plug-in.

Parameters:
plugin Pointer to a receiver plug-in.
Returns:
Pointer to the receiver info structure or NULL, if the creation failed.

Definition at line 82 of file receiver.c.

00084 {
00085     RECEIVERINFO *rip;
00086 
00087     /* Allocate and initialize the receiver info structure. */
00088     if ((rip = malloc(sizeof(RECEIVERINFO))) != NULL) {
00089         memset(rip, 0, sizeof(RECEIVERINFO));
00090         rip->ri_rpp = plugin;
00091         /* Associate a new player plug-in instance. */
00092         if ((*plugin->rp_create) (rip)) {
00093             free(rip);
00094             rip = NULL;
00095         }
00096     }
00097     return rip;

int ReceiverStart RECEIVERINFO rip,
STATIONINFO sip
 

Start receiving a specified station.

Parameters:
rip Receiver to start.
sip Station to receive.
Returns:
0 on success, -1 otherwise.

Definition at line 157 of file receiver.c.

00159 {
00160     /* Make sure that the receiver is not running. */
00161     if (ReceiverStop(rip)) {
00162         return -1;
00163     }
00164     printf("[RSTART]");
00165     rip->ri_sip = sip;
00166     rip->ri_wpos = 0;
00167     rip->ri_rpos = 0;
00168     rip->ri_avail = 0;
00169 
00170     if ((*rip->ri_rpp->rp_setup)(rip)) {
00171         return -1;
00172     }
00173     return ReceiverPlugInControl(rip, RSTAT_START, RSTAT_RUNNING);

int ReceiverStop RECEIVERINFO rip  ) 
 

Stop receiver.

Parameters:
rip Receiver to stop.
Returns:
0 on success, -1 otherwise.

Definition at line 143 of file receiver.c.

Referenced by CgiControl().

00145 {
00146     printf("[RSTOP]");
00147     return ReceiverPlugInControl(rip, RSTAT_STOP, RSTAT_IDLE);

u_int ReceiverStatus RECEIVERINFO rip  ) 
 

Retrieve the current receiver status.

Parameters:
rip Pointer to the receiver information structure.
Returns:
Receiver status.

Definition at line 131 of file receiver.c.

00133 {
00134     return rip->ri_status;


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