From 5e05f47d61ebad8aee6c3831912b21ad5dcc36e3 Mon Sep 17 00:00:00 2001 From: "B. Bogart" Date: Sat, 13 Aug 2005 01:16:59 +0000 Subject: Initial commit of readanysf~ 0.13.1 for August svn path=/trunk/externals/august/readanysf~/; revision=3426 --- include/InputStream.h | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 include/InputStream.h (limited to 'include/InputStream.h') diff --git a/include/InputStream.h b/include/InputStream.h new file mode 100644 index 0000000..704fed1 --- /dev/null +++ b/include/InputStream.h @@ -0,0 +1,83 @@ +#ifndef _INPUTSTREAM_H_ +#define _INPUTSTREAM_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "Input.h" +#include "Fifo.h" + +#include +#include +#include + + +#include +#include +#include +#include +#include +#ifdef UNIX +#include +#include +#include +#include +#include +#define SOCKET_ERROR -1 +#else +#include +#endif + +using namespace std; + +class InputStream : public Input { + public: + InputStream (); + virtual ~InputStream(); + + virtual int Open( const char *pathname ); + virtual int Close(); + virtual int Read( void *buf, unsigned int count ); + + virtual long SeekSet ( long offset ); + virtual long SeekCur ( long offset ); + virtual long SeekEnd ( long offset ); + virtual float get_cachesize(); + virtual bool get_recover( ) { return recover; } + + pthread_mutex_t *get_mutex() { return &mut;} + pthread_cond_t *get_condition(){ return &cond;} + + void set_threaded( bool b ) { threaded = b;} + + Fifo * get_fifo() { return infifo;} + bool get_quit() { return quit;} + + int socket_connect ( ); + + private: + //int socket_connect (string hostname, string mountpoint, int portno); + //int socket_connect (char *hostname, char *mountpoint, int portno); + // connects to socket and checks for ice or shout + // returns type of stream(ogg, mp3) or -1 for failure + + string ParseHttp( string str, string parse ); // parse x-audio* vars from icecast + int SetUrl (const char *url); // breaks http://server:port/mount down to hostname,port,mountpoint + // return 1 for success, 0 for failure + + int get_line( char * str, int sock, int maxget); + + Fifo *infifo; // fifo for thread buffering + string hostname; // hostname of URL + string mountpoint; // mountpoint for Icecast URL + int port; // port number URL + bool threaded; // if thread is running or not, true if running + bool quit; // if we should quit thread or not + + pthread_mutex_t mut; + pthread_cond_t cond; + pthread_t childthread; + +}; +#endif -- cgit v1.2.1