Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

DarkIce.h

Go to the documentation of this file.
00001 /*------------------------------------------------------------------------------
00002 
00003    Copyright (c) 2000 Tyrell Corporation. All rights reserved.
00004 
00005    Tyrell DarkIce
00006 
00007    File     : DarkIce.h
00008    Version  : $Revision: 1.16 $
00009    Author   : $Author: darkeye $
00010    Location : $Source: /cvsroot/darkice/darkice/src/DarkIce.h,v $
00011    
00012    Copyright notice:
00013 
00014     This program is free software; you can redistribute it and/or
00015     modify it under the terms of the GNU General Public License  
00016     as published by the Free Software Foundation; either version 2
00017     of the License, or (at your option) any later version.
00018    
00019     This program is distributed in the hope that it will be useful,
00020     but WITHOUT ANY WARRANTY; without even the implied warranty of 
00021     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
00022     GNU General Public License for more details.
00023    
00024     You should have received a copy of the GNU General Public License
00025     along with this program; if not, write to the Free Software
00026     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00027 
00028 ------------------------------------------------------------------------------*/
00029 #ifndef DARK_ICE_H
00030 #define DARK_ICE_H
00031 
00032 #ifndef __cplusplus
00033 #error This is a C++ include file
00034 #endif
00035 
00036 
00037 /* ============================================================ include files */
00038 
00039 #ifdef HAVE_CONFIG_H
00040 #include "config.h"
00041 #endif
00042 
00043 #ifdef HAVE_UNISTD_H
00044 #include <unistd.h>
00045 #else
00046 #error need unistd.h
00047 #endif
00048 
00049 #include <iostream>
00050 
00051 #include "Referable.h"
00052 #include "Reporter.h"
00053 #include "Exception.h"
00054 #include "Ref.h"
00055 #include "AudioSource.h"
00056 #include "BufferedSink.h"
00057 #include "Connector.h"
00058 #include "AudioEncoder.h"
00059 #include "TcpSocket.h"
00060 #include "CastSink.h"
00061 #include "DarkIceConfig.h"
00062 
00063 
00064 /* ================================================================ constants */
00065 
00066 
00067 /* =================================================================== macros */
00068 
00069 
00070 /* =============================================================== data types */
00071 
00078 class DarkIce : public virtual Referable, public virtual Reporter
00079 {
00080     private:
00081 
00086         static const unsigned int       maxOutput = 4 * 7;
00087         
00091         typedef struct {
00092             Ref<AudioEncoder>       encoder;
00093             Ref<TcpSocket>          socket;
00094             Ref<CastSink>           server;
00095         } Output;
00096 
00100         Output                  audioOuts[maxOutput];
00101 
00105         unsigned int            noAudioOuts;
00106 
00110         unsigned int            duration;
00111 
00115         Ref<AudioSource>        dsp;
00116 
00120         Ref<Connector>          encConnector;
00121 
00125         int                     enableRealTime;
00126 
00130         int                     origSchedPolicy;
00131 
00135         int                     origSchedPriority;
00136 
00144         void
00145         init (  const Config   & config )            throw ( Exception );
00146 
00156         void
00157         configIceCast (  const Config   & config,
00158                          unsigned int     bufferSecs  )     throw ( Exception );
00159 
00169         void
00170         configIceCast2 (  const Config   & config,
00171                           unsigned int     bufferSecs  )    throw ( Exception );
00172 
00182         void
00183         configShoutCast (   const Config   & config,
00184                             unsigned int     bufferSecs )   throw ( Exception );
00185 
00194         void
00195         configFileCast  (   const Config   & config )
00196                                                             throw ( Exception );
00197 
00204         void
00205         setRealTimeScheduling ( void )              throw ( Exception );
00206 
00213         void
00214         setOriginalScheduling ( void )              throw ( Exception );
00215 
00223         bool
00224         encode ( void )                             throw ( Exception );
00225 
00233         bool
00234         shout ( unsigned int )                      throw ( Exception );
00235 
00236 
00237     protected:
00238 
00244         inline
00245         DarkIce ( void )                            throw ( Exception )
00246         {
00247             throw Exception( __FILE__, __LINE__);
00248         }
00249 
00250 
00251     public:
00252 
00260         inline
00261         DarkIce (   const Config  & config )       throw ( Exception )
00262         {
00263             init( config);
00264         }
00265 
00271         inline virtual
00272         ~DarkIce ( void )                           throw ( Exception )
00273         {
00274         }
00275 
00276 /* TODO
00277 
00278         inline
00279         DarkIce ( const DarkIce   & di )            throw ( Exception )
00280         {
00281         }
00282 
00283 
00284         inline DarkIce &
00285         operator= ( const DarkIce   * di )          throw ( Exception )
00286         {
00287         }
00288 */
00289 
00296         virtual int
00297         run ( void )                                throw ( Exception );
00298 
00299 };
00300 
00301 
00302 /* ================================================= external data structures */
00303 
00304 
00305 /* ====================================================== function prototypes */
00306 
00307 
00308 
00309 #endif  /* DARK_ICE_H */
00310 
00311 
00312 /*------------------------------------------------------------------------------
00313  
00314   $Source: /cvsroot/darkice/darkice/src/DarkIce.h,v $
00315 
00316   $Log: DarkIce.h,v $
00317   Revision 1.16  2006/01/25 22:47:15  darkeye
00318   added mpeg2 support, thanks to Nicholas J Humfrey
00319 
00320   Revision 1.15  2005/04/04 08:36:17  darkeye
00321   commited changes to enable Jack support
00322   thanks to Nicholas J. Humfrey, njh@ecs.soton.ac.uk
00323 
00324   Revision 1.14  2002/05/28 12:35:41  darkeye
00325   code cleanup: compiles under gcc-c++ 3.1, using -pedantic option
00326 
00327   Revision 1.13  2002/02/28 09:49:25  darkeye
00328   added possibility to save the encoded stream to a local file only
00329   (no streaming server needed)
00330 
00331   Revision 1.12  2001/09/14 19:31:06  darkeye
00332   added IceCast2 / vorbis support
00333 
00334   Revision 1.11  2001/09/11 15:05:21  darkeye
00335   added Solaris support
00336 
00337   Revision 1.10  2001/09/09 11:27:31  darkeye
00338   added support for ShoutCast servers
00339 
00340   Revision 1.9  2001/08/30 17:25:56  darkeye
00341   renamed configure.h to config.h
00342 
00343   Revision 1.8  2001/08/26 20:44:30  darkeye
00344   removed external command-line encoder support
00345   replaced it with a shared-object support for lame with the possibility
00346   of static linkage
00347 
00348   Revision 1.7  2000/12/20 12:36:47  darkeye
00349   added POSIX real-time scheduling
00350 
00351   Revision 1.6  2000/11/15 18:08:43  darkeye
00352   added multiple verbosity-level event reporting and verbosity command
00353   line option
00354 
00355   Revision 1.5  2000/11/13 19:38:55  darkeye
00356   moved command line parameter parsing from DarkIce.cpp to main.cpp
00357 
00358   Revision 1.4  2000/11/13 18:46:50  darkeye
00359   added kdoc-style documentation comments
00360 
00361   Revision 1.3  2000/11/10 20:16:21  darkeye
00362   first real tests with multiple streaming
00363 
00364   Revision 1.2  2000/11/09 22:09:46  darkeye
00365   added multiple outputs
00366   added configuration reading
00367   added command line processing
00368 
00369   Revision 1.1.1.1  2000/11/05 10:05:50  darkeye
00370   initial version
00371 
00372   
00373 ------------------------------------------------------------------------------*/
00374 

Generated on Fri May 19 15:36:48 2006 for DarkIce by  doxygen 1.4.4