|
Packit Service |
102f81 |
/* -*- c-basic-offset: 8; -*- */
|
|
Packit Service |
102f81 |
/* shout.h: Private libshout data structures and declarations
|
|
Packit Service |
102f81 |
*
|
|
Packit Service |
102f81 |
* $Id: shout_private.h 8144 2004-10-30 01:24:47Z brendan $
|
|
Packit Service |
102f81 |
*/
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
#ifndef __LIBSHOUT_SHOUT_PRIVATE_H__
|
|
Packit Service |
102f81 |
#define __LIBSHOUT_SHOUT_PRIVATE_H__
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
#ifdef HAVE_CONFIG_H
|
|
Packit Service |
102f81 |
# include "config.h"
|
|
Packit Service |
102f81 |
#endif
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
#include <shout/shout.h>
|
|
Packit Service |
102f81 |
#include <net/sock.h>
|
|
Packit Service |
102f81 |
#include <timing/timing.h>
|
|
Packit Service |
102f81 |
#include "util.h"
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
#include <sys/types.h>
|
|
Packit Service |
102f81 |
#ifdef HAVE_STDINT_H
|
|
Packit Service |
102f81 |
# include <stdint.h>
|
|
Packit Service |
102f81 |
#elif defined (HAVE_INTTYPES_H)
|
|
Packit Service |
102f81 |
# include <inttypes.h>
|
|
Packit Service |
102f81 |
#endif
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
#define LIBSHOUT_DEFAULT_HOST "localhost"
|
|
Packit Service |
102f81 |
#define LIBSHOUT_DEFAULT_PORT 8000
|
|
Packit Service |
102f81 |
#define LIBSHOUT_DEFAULT_FORMAT SHOUT_FORMAT_OGG
|
|
Packit Service |
102f81 |
#define LIBSHOUT_DEFAULT_PROTOCOL SHOUT_PROTOCOL_HTTP
|
|
Packit Service |
102f81 |
#define LIBSHOUT_DEFAULT_USER "source"
|
|
Packit Service |
102f81 |
#define LIBSHOUT_DEFAULT_USERAGENT "libshout/" VERSION
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
#define SHOUT_BUFSIZE 4096
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
typedef struct _shout_buf {
|
|
Packit Service |
102f81 |
unsigned char data[SHOUT_BUFSIZE];
|
|
Packit Service |
102f81 |
unsigned int len;
|
|
Packit Service |
102f81 |
unsigned int pos;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
struct _shout_buf *prev;
|
|
Packit Service |
102f81 |
struct _shout_buf *next;
|
|
Packit Service |
102f81 |
} shout_buf_t;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
typedef struct {
|
|
Packit Service |
102f81 |
shout_buf_t *head;
|
|
Packit Service |
102f81 |
size_t len;
|
|
Packit Service |
102f81 |
} shout_queue_t;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
typedef enum {
|
|
Packit Service |
102f81 |
SHOUT_STATE_UNCONNECTED = 0,
|
|
Packit Service |
102f81 |
SHOUT_STATE_CONNECT_PENDING,
|
|
Packit Service |
102f81 |
SHOUT_STATE_REQ_PENDING,
|
|
Packit Service |
102f81 |
SHOUT_STATE_RESP_PENDING,
|
|
Packit Service |
102f81 |
SHOUT_STATE_CONNECTED
|
|
Packit Service |
102f81 |
} shout_state_e;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
struct shout {
|
|
Packit Service |
102f81 |
/* hostname or IP of icecast server */
|
|
Packit Service |
102f81 |
char *host;
|
|
Packit Service |
102f81 |
/* port of the icecast server */
|
|
Packit Service |
102f81 |
int port;
|
|
Packit Service |
102f81 |
/* login password for the server */
|
|
Packit Service |
102f81 |
char *password;
|
|
Packit Service |
102f81 |
/* server protocol to use */
|
|
Packit Service |
102f81 |
unsigned int protocol;
|
|
Packit Service |
102f81 |
/* type of data being sent */
|
|
Packit Service |
102f81 |
unsigned int format;
|
|
Packit Service |
102f81 |
/* audio encoding parameters */
|
|
Packit Service |
102f81 |
util_dict *audio_info;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
/* user-agent to use when doing HTTP login */
|
|
Packit Service |
102f81 |
char *useragent;
|
|
Packit Service |
102f81 |
/* mountpoint for this stream */
|
|
Packit Service |
102f81 |
char *mount;
|
|
Packit Service |
102f81 |
/* name of the stream */
|
|
Packit Service |
102f81 |
char *name;
|
|
Packit Service |
102f81 |
/* homepage of the stream */
|
|
Packit Service |
102f81 |
char *url;
|
|
Packit Service |
102f81 |
/* genre of the stream */
|
|
Packit Service |
102f81 |
char *genre;
|
|
Packit Service |
102f81 |
/* description of the stream */
|
|
Packit Service |
102f81 |
char *description;
|
|
Packit Service |
102f81 |
/* icecast 1.x dumpfile */
|
|
Packit Service |
102f81 |
char *dumpfile;
|
|
Packit Service |
102f81 |
/* username to use for HTTP auth. */
|
|
Packit Service |
102f81 |
char *user;
|
|
Packit Service |
102f81 |
/* is this stream private? */
|
|
Packit Service |
102f81 |
int public;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
/* socket the connection is on */
|
|
Packit Service |
102f81 |
sock_t socket;
|
|
Packit Service |
102f81 |
shout_state_e state;
|
|
Packit Service |
102f81 |
int nonblocking;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
void *format_data;
|
|
Packit Service |
102f81 |
int (*send)(shout_t* self, const unsigned char* buff, size_t len);
|
|
Packit Service |
102f81 |
void (*close)(shout_t* self);
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
shout_queue_t rqueue;
|
|
Packit Service |
102f81 |
shout_queue_t wqueue;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
/* start of this period's timeclock */
|
|
Packit Service |
102f81 |
uint64_t starttime;
|
|
Packit Service |
102f81 |
/* amout of data we've sent (in milliseconds) */
|
|
Packit Service |
102f81 |
uint64_t senttime;
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
int error;
|
|
Packit Service |
102f81 |
};
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
int shout_open_ogg(shout_t *self);
|
|
Packit Service |
102f81 |
int shout_open_mp3(shout_t *self);
|
|
Packit Service |
102f81 |
|
|
Packit Service |
102f81 |
#endif /* __LIBSHOUT_SHOUT_PRIVATE_H__ */
|