removed external command-line encoder support
replaced it with a shared-object support for lame with the possibility of static linkage
This commit is contained in:
parent
8ded05826f
commit
030f4f38be
|
@ -1,6 +1,4 @@
|
||||||
o make FIFO pipes in /tmp with valid temp filenames
|
|
||||||
o change Ref to follow inheritance
|
o change Ref to follow inheritance
|
||||||
o add "extra encoder options" option into config file
|
|
||||||
o make a master config file, and a small one
|
o make a master config file, and a small one
|
||||||
o add support for shared object lame
|
o add support for shared object lame
|
||||||
o add support for VBR encoding
|
o add support for VBR encoding
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
dnl acinclude.m4. Change *this* file to add new or change macros.
|
||||||
|
dnl When changes have been made, delete aclocal.m4 and run
|
||||||
|
dnl "aclocal".
|
||||||
|
dnl
|
||||||
|
dnl DO NOT change aclocal.m4 !
|
||||||
|
dnl
|
||||||
|
|
||||||
|
dnl * LA_SEARCH_FILE(variable, filename, PATH)
|
||||||
|
dnl * Search "filename" in the specified "PATH", "variable" will
|
||||||
|
dnl * contain the full pathname or the empty string
|
||||||
|
dnl * PATH is space-separated list of directories.
|
||||||
|
dnl * by Florian Bomers
|
||||||
|
|
||||||
|
AC_DEFUN(LA_SEARCH_FILE,[
|
||||||
|
$1=
|
||||||
|
dnl hack: eliminate line feeds in $2
|
||||||
|
for FILE in $2; do
|
||||||
|
for DIR in $3; do
|
||||||
|
dnl use PATH in order
|
||||||
|
if test ".$1"="." && test -f "$DIR/$FILE"; then
|
||||||
|
$1=$DIR
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl * LA_SEARCH_LIB(lib-variable, include-variable, lib-filename, header-filename, prefix)
|
||||||
|
dnl * looks for "lib-filename" and "header-filename" in the area of "prefix".
|
||||||
|
dnl * if found, "lib-variable" and "include-variable" are set to the
|
||||||
|
dnl * respective paths.
|
||||||
|
dnl * prefix is a single path
|
||||||
|
dnl * libs are searched in prefix, prefix/lib, prefix/.., prefix/../lib
|
||||||
|
dnl * headers are searched in prefix, prefix/include, prefix/.., prefix/../include
|
||||||
|
dnl *
|
||||||
|
dnl * If one of them is not found, both "lib-variable", "include-variable" are
|
||||||
|
dnl * set to the empty string.
|
||||||
|
dnl *
|
||||||
|
dnl * TODO: assert function call to verify lib
|
||||||
|
dnl *
|
||||||
|
dnl * by Florian Bomers
|
||||||
|
|
||||||
|
AC_DEFUN(LA_SEARCH_LIB,[
|
||||||
|
dnl look for lib
|
||||||
|
LA_SEARCH_FILE($1, $3, $5 $5/lib $5/.. $5/../lib)
|
||||||
|
dnl look for header.
|
||||||
|
LA_SEARCH_FILE($2, $4, $5 $5/include $5/.. $5/../include)
|
||||||
|
if test ".$1" = "." || test ".$2" = "."; then
|
||||||
|
$1=
|
||||||
|
$2=
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
|
|
@ -75,3 +75,6 @@
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#undef VERSION
|
#undef VERSION
|
||||||
|
|
||||||
|
/* build with lame library calls */
|
||||||
|
#undef HAVE_LAME_LIB
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_INIT(src/DarkIce.cpp)
|
AC_INIT(src/DarkIce.cpp)
|
||||||
AM_INIT_AUTOMAKE(darkice, 0.3.1)
|
AM_INIT_AUTOMAKE(darkice, 0.4)
|
||||||
|
|
||||||
AM_CONFIG_HEADER(configure.h)
|
AM_CONFIG_HEADER(configure.h)
|
||||||
|
|
||||||
|
@ -17,4 +17,34 @@ AC_HEADER_SYS_WAIT()
|
||||||
AC_TYPE_PID_T()
|
AC_TYPE_PID_T()
|
||||||
AC_TYPE_SIZE_T()
|
AC_TYPE_SIZE_T()
|
||||||
|
|
||||||
|
AC_SUBST(LAME_INCFLAGS)
|
||||||
|
AC_SUBST(LAME_LDFLAGS)
|
||||||
|
AC_SUBST(LINK_STATIC)
|
||||||
|
|
||||||
|
dnl checkin for lame library
|
||||||
|
AC_MSG_CHECKING(lame library)
|
||||||
|
WARNING=
|
||||||
|
AC_ARG_WITH(lame-prefix,
|
||||||
|
[ --with-lame-prefix=DIR Alternate location for lame],
|
||||||
|
CONFIG_LAME_PREFIX="${withval}", CONFIG_LAME_PREFIX="/usr/local")
|
||||||
|
if test "x${CONFIG_LAME_PREFIX}" != "x" ; then
|
||||||
|
# look for lame lib. This overrides any standard location
|
||||||
|
LA_SEARCH_LIB(LAME_LIB_LOC, LAME_INC_LOC, libmp3lame.a, lame/lame.h, ${CONFIG_LAME_PREFIX})
|
||||||
|
if test "x${LAME_LIB_LOC}" != "x" ; then
|
||||||
|
AC_DEFINE(HAVE_LAME_LIB, 1, build with lame library calls)
|
||||||
|
LAME_INCFLAGS="-I${LAME_INC_LOC}"
|
||||||
|
LAME_LDFLAGS="-L${LAME_LIB_LOC} -lmp3lame"
|
||||||
|
AC_MSG_RESULT( "lame found at ${LAME_LIB_LOC}")
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR( "lame library not found")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_ARG_ENABLE( static,
|
||||||
|
[ --enable-static link everything into the executable statically],
|
||||||
|
LINK_STATIC="--static", LINK_STATIC="")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AC_OUTPUT(Makefile src/Makefile)
|
AC_OUTPUT(Makefile src/Makefile)
|
||||||
|
|
||||||
|
|
|
@ -313,7 +313,7 @@ Connector :: transfer ( unsigned long bytes,
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Open the source and all the sinks if needed
|
* Close the source and all the sinks if needed
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
Connector :: close ( void ) throw ( Exception )
|
Connector :: close ( void ) throw ( Exception )
|
||||||
|
@ -333,6 +333,11 @@ Connector :: close ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.6 2001/08/26 20:44:30 darkeye
|
||||||
|
removed external command-line encoder support
|
||||||
|
replaced it with a shared-object support for lame with the possibility
|
||||||
|
of static linkage
|
||||||
|
|
||||||
Revision 1.5 2001/08/26 08:43:13 darkeye
|
Revision 1.5 2001/08/26 08:43:13 darkeye
|
||||||
added support for unlimited time encoding
|
added support for unlimited time encoding
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,8 @@ class Connector : public virtual Referable, public virtual Reporter
|
||||||
* rest of the Sinks. If no Sinks remain, or an error is encountered
|
* rest of the Sinks. If no Sinks remain, or an error is encountered
|
||||||
* with the Source, the function returns prematurely.
|
* with the Source, the function returns prematurely.
|
||||||
*
|
*
|
||||||
* @param bytes the amount of data to transfer, in bytes
|
* @param bytes the amount of data to transfer, in bytes.
|
||||||
|
* If 0, transfer forever.
|
||||||
* @param bufSize the size of the buffer to use for transfering.
|
* @param bufSize the size of the buffer to use for transfering.
|
||||||
* This amount of data is read from the Source and
|
* This amount of data is read from the Source and
|
||||||
* written to each Sink on each turn.
|
* written to each Sink on each turn.
|
||||||
|
@ -258,6 +259,11 @@ class Connector : public virtual Referable, public virtual Reporter
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.5 2001/08/26 20:44:30 darkeye
|
||||||
|
removed external command-line encoder support
|
||||||
|
replaced it with a shared-object support for lame with the possibility
|
||||||
|
of static linkage
|
||||||
|
|
||||||
Revision 1.4 2000/11/15 18:37:37 darkeye
|
Revision 1.4 2000/11/15 18:37:37 darkeye
|
||||||
changed the transferable number of bytes to unsigned long
|
changed the transferable number of bytes to unsigned long
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,6 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
unsigned int bitsPerSample;
|
unsigned int bitsPerSample;
|
||||||
unsigned int channel;
|
unsigned int channel;
|
||||||
const char * device;
|
const char * device;
|
||||||
unsigned int u;
|
|
||||||
|
|
||||||
// the [general] section
|
// the [general] section
|
||||||
if ( !(cs = config.get( "general")) ) {
|
if ( !(cs = config.get( "general")) ) {
|
||||||
|
@ -151,16 +150,27 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
channel );
|
channel );
|
||||||
encConnector = new Connector( dsp.get());
|
encConnector = new Connector( dsp.get());
|
||||||
|
|
||||||
|
configLameLib( config, bufferSecs);
|
||||||
|
}
|
||||||
|
|
||||||
// look for lame encoder output streams, sections [lame0], [lame1], etc.
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Look for the lame library outputs from the config file.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
DarkIce :: configLameLib ( const Config & config,
|
||||||
|
unsigned int bufferSecs )
|
||||||
|
throw ( Exception )
|
||||||
|
{
|
||||||
|
// look for lame encoder output streams, sections [lamelib0], [lamelib1]...
|
||||||
char lame[] = "lame ";
|
char lame[] = "lame ";
|
||||||
size_t lameLen = Util::strLen( lame);
|
size_t lameLen = Util::strLen( lame);
|
||||||
char * pipeOutExt = ".out";
|
unsigned int u;
|
||||||
size_t pipeOutExtLen = Util::strLen( pipeOutExt);
|
|
||||||
char * pipeInExt = ".in";
|
|
||||||
size_t pipeInExtLen = Util::strLen( pipeInExt);
|
|
||||||
|
|
||||||
for ( u = 0; u < maxOutput; ++u ) {
|
for ( u = 0; u < maxOutput; ++u ) {
|
||||||
|
const ConfigSection * cs;
|
||||||
|
const char * str;
|
||||||
|
|
||||||
// ugly hack to change the section name to "lame0", "lame1", etc.
|
// ugly hack to change the section name to "lame0", "lame1", etc.
|
||||||
lame[lameLen-1] = '0' + u;
|
lame[lameLen-1] = '0' + u;
|
||||||
|
|
||||||
|
@ -168,7 +178,6 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * encoder = 0;
|
|
||||||
unsigned int bitrate = 0;
|
unsigned int bitrate = 0;
|
||||||
const char * server = 0;
|
const char * server = 0;
|
||||||
unsigned int port = 0;
|
unsigned int port = 0;
|
||||||
|
@ -183,7 +192,6 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
unsigned int lowpass = 0;
|
unsigned int lowpass = 0;
|
||||||
unsigned int highpass = 0;
|
unsigned int highpass = 0;
|
||||||
|
|
||||||
encoder = cs->getForSure( "encoder", " missing in section ", lame);
|
|
||||||
str = cs->getForSure( "bitrate", " missing in section ", lame);
|
str = cs->getForSure( "bitrate", " missing in section ", lame);
|
||||||
bitrate = Util::strToL( str);
|
bitrate = Util::strToL( str);
|
||||||
server = cs->getForSure( "server", " missing in section ", lame);
|
server = cs->getForSure( "server", " missing in section ", lame);
|
||||||
|
@ -203,62 +211,18 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
str = cs->get( "highpass");
|
str = cs->get( "highpass");
|
||||||
highpass = str ? Util::strToL( str) : 0;
|
highpass = str ? Util::strToL( str) : 0;
|
||||||
|
|
||||||
// generate the pipe names
|
|
||||||
char pipeOutName[lameLen + pipeOutExtLen + 1];
|
|
||||||
char pipeInName[lameLen + pipeInExtLen + 1];
|
|
||||||
|
|
||||||
Util::strCpy( pipeOutName, lame);
|
|
||||||
Util::strCat( pipeOutName, pipeOutExt);
|
|
||||||
Util::strCpy( pipeInName, lame);
|
|
||||||
Util::strCat( pipeInName, pipeInExt);
|
|
||||||
|
|
||||||
// go on and create the things
|
// go on and create the things
|
||||||
|
|
||||||
outputs[u].pid = 0;
|
|
||||||
|
|
||||||
// the pipes
|
|
||||||
outputs[u].encOutPipe = new PipeSource( pipeOutName);
|
|
||||||
outputs[u].encInPipe = new PipeSink( pipeInName);
|
|
||||||
|
|
||||||
if ( !outputs[u].encOutPipe->exists() ) {
|
|
||||||
if ( !outputs[u].encOutPipe->create() ) {
|
|
||||||
throw Exception( __FILE__, __LINE__,
|
|
||||||
"can't create out pipe ",
|
|
||||||
pipeOutName );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !outputs[u].encInPipe->exists() ) {
|
|
||||||
if ( !outputs[u].encInPipe->create() ) {
|
|
||||||
throw Exception( __FILE__, __LINE__,
|
|
||||||
"can't create in pipe",
|
|
||||||
pipeInName );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// encoder related stuff
|
// encoder related stuff
|
||||||
unsigned int bs = bufferSecs *
|
unsigned int bs = bufferSecs *
|
||||||
(bitsPerSample / 8) * channel * sampleRate;
|
(dsp->getBitsPerSample() / 8) *
|
||||||
outputs[u].encIn = new BufferedSink( outputs[u].encInPipe.get(),
|
dsp->getChannel() *
|
||||||
bs,
|
dsp->getSampleRate();
|
||||||
(bitsPerSample / 8) * channel );
|
|
||||||
reportEvent( 6, "using buffer size", bs);
|
reportEvent( 6, "using buffer size", bs);
|
||||||
|
|
||||||
encConnector->attach( outputs[u].encIn.get());
|
|
||||||
outputs[u].encoder = new LameEncoder( encoder,
|
|
||||||
outputs[u].encInPipe->getFileName(),
|
|
||||||
dsp.get(),
|
|
||||||
outputs[u].encOutPipe->getFileName(),
|
|
||||||
bitrate,
|
|
||||||
sampleRate,
|
|
||||||
channel,
|
|
||||||
lowpass,
|
|
||||||
highpass );
|
|
||||||
|
|
||||||
|
|
||||||
// streaming related stuff
|
// streaming related stuff
|
||||||
outputs[u].socket = new TcpSocket( server, port);
|
lameLibOuts[u].socket = new TcpSocket( server, port);
|
||||||
outputs[u].ice = new IceCast( outputs[u].socket.get(),
|
lameLibOuts[u].ice = new IceCast( lameLibOuts[u].socket.get(),
|
||||||
password,
|
password,
|
||||||
mountPoint,
|
mountPoint,
|
||||||
remoteDumpFile,
|
remoteDumpFile,
|
||||||
|
@ -268,11 +232,19 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
genre,
|
genre,
|
||||||
bitrate,
|
bitrate,
|
||||||
isPublic );
|
isPublic );
|
||||||
outputs[u].shoutConnector = new Connector( outputs[u].encOutPipe.get(),
|
|
||||||
outputs[u].ice.get());
|
lameLibOuts[u].encoder = new LameLibEncoder( lameLibOuts[u].ice.get(),
|
||||||
|
dsp.get(),
|
||||||
|
bitrate,
|
||||||
|
dsp->getSampleRate(),
|
||||||
|
dsp->getChannel(),
|
||||||
|
lowpass,
|
||||||
|
highpass );
|
||||||
|
|
||||||
|
encConnector->attach( lameLibOuts[u].encoder.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
noOutputs = u;
|
noLameLibOuts = u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -366,15 +338,8 @@ bool
|
||||||
DarkIce :: encode ( void ) throw ( Exception )
|
DarkIce :: encode ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
unsigned int u;
|
|
||||||
unsigned long bytes;
|
unsigned long bytes;
|
||||||
|
|
||||||
for ( u = 0; u < noOutputs; ++u ) {
|
|
||||||
outputs[u].encoder->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
sleep( 1 );
|
|
||||||
|
|
||||||
if ( !encConnector->open() ) {
|
if ( !encConnector->open() ) {
|
||||||
throw Exception( __FILE__, __LINE__, "can't open connector");
|
throw Exception( __FILE__, __LINE__, "can't open connector");
|
||||||
}
|
}
|
||||||
|
@ -390,38 +355,6 @@ DarkIce :: encode ( void ) throw ( Exception )
|
||||||
|
|
||||||
encConnector->close();
|
encConnector->close();
|
||||||
|
|
||||||
for ( u = 0; u < noOutputs; ++u ) {
|
|
||||||
outputs[u].encoder->stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Run the encoder
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
bool
|
|
||||||
DarkIce :: shout ( unsigned int ix ) throw ( Exception )
|
|
||||||
{
|
|
||||||
unsigned int len;
|
|
||||||
unsigned long bytes;
|
|
||||||
|
|
||||||
if ( ix >= noOutputs ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !outputs[ix].shoutConnector->open() ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "can't open connector");
|
|
||||||
}
|
|
||||||
|
|
||||||
bytes = outputs[ix].encoder->getOutBitrate() * (1024UL / 8UL) * duration;
|
|
||||||
len = outputs[ix].shoutConnector->transfer ( bytes, 4096, 10, 0 );
|
|
||||||
|
|
||||||
reportEvent( 1, len, "bytes transfered to stream", ix);
|
|
||||||
|
|
||||||
outputs[ix].shoutConnector->close();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,46 +365,12 @@ DarkIce :: shout ( unsigned int ix ) throw ( Exception )
|
||||||
int
|
int
|
||||||
DarkIce :: run ( void ) throw ( Exception )
|
DarkIce :: run ( void ) throw ( Exception )
|
||||||
{
|
{
|
||||||
unsigned int u;
|
|
||||||
|
|
||||||
for ( u = 0; u < noOutputs; ++u ) {
|
|
||||||
outputs[u].pid = fork();
|
|
||||||
|
|
||||||
if ( outputs[u].pid == -1 ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "fork error", errno);
|
|
||||||
|
|
||||||
} else if ( outputs[u].pid == 0 ) {
|
|
||||||
// this is the child
|
|
||||||
|
|
||||||
sleep ( 1 );
|
|
||||||
|
|
||||||
reportEvent( 3, "shouting", u);
|
|
||||||
shout( u);
|
|
||||||
reportEvent( 3, "shouting ends", u);
|
|
||||||
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is the parent
|
|
||||||
|
|
||||||
reportEvent( 3, "encoding");
|
reportEvent( 3, "encoding");
|
||||||
setRealTimeScheduling();
|
setRealTimeScheduling();
|
||||||
encode();
|
encode();
|
||||||
setOriginalScheduling();
|
setOriginalScheduling();
|
||||||
reportEvent( 3, "encoding ends");
|
reportEvent( 3, "encoding ends");
|
||||||
|
|
||||||
for ( u = 0; u < noOutputs; ++u ) {
|
|
||||||
int status;
|
|
||||||
|
|
||||||
waitpid( outputs[u].pid, &status, 0);
|
|
||||||
|
|
||||||
if ( !WIFEXITED(status) ) {
|
|
||||||
throw Exception( __FILE__, __LINE__,
|
|
||||||
"child exited abnormally", WEXITSTATUS(status));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,6 +380,11 @@ DarkIce :: run ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.13 2001/08/26 20:44:30 darkeye
|
||||||
|
removed external command-line encoder support
|
||||||
|
replaced it with a shared-object support for lame with the possibility
|
||||||
|
of static linkage
|
||||||
|
|
||||||
Revision 1.12 2000/12/20 12:36:47 darkeye
|
Revision 1.12 2000/12/20 12:36:47 darkeye
|
||||||
added POSIX real-time scheduling
|
added POSIX real-time scheduling
|
||||||
|
|
||||||
|
|
|
@ -53,11 +53,9 @@
|
||||||
#include "Exception.h"
|
#include "Exception.h"
|
||||||
#include "Ref.h"
|
#include "Ref.h"
|
||||||
#include "OssDspSource.h"
|
#include "OssDspSource.h"
|
||||||
#include "PipeSink.h"
|
|
||||||
#include "BufferedSink.h"
|
#include "BufferedSink.h"
|
||||||
#include "Connector.h"
|
#include "Connector.h"
|
||||||
#include "LameEncoder.h"
|
#include "LameLibEncoder.h"
|
||||||
#include "PipeSource.h"
|
|
||||||
#include "TcpSocket.h"
|
#include "TcpSocket.h"
|
||||||
#include "IceCast.h"
|
#include "IceCast.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
@ -87,18 +85,23 @@ class DarkIce : public virtual Referable, public virtual Reporter
|
||||||
static const unsigned int maxOutput = 8;
|
static const unsigned int maxOutput = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type describing each output.
|
* Type describing each lame library output.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Ref<PipeSink> encInPipe;
|
Ref<LameLibEncoder> encoder;
|
||||||
Ref<BufferedSink> encIn;
|
|
||||||
Ref<LameEncoder> encoder;
|
|
||||||
Ref<PipeSource> encOutPipe;
|
|
||||||
Ref<TcpSocket> socket;
|
Ref<TcpSocket> socket;
|
||||||
Ref<IceCast> ice;
|
Ref<IceCast> ice;
|
||||||
Ref<Connector> shoutConnector;
|
} LameLibOutput;
|
||||||
pid_t pid;
|
|
||||||
} Output;
|
/**
|
||||||
|
* The lame library outputs.
|
||||||
|
*/
|
||||||
|
LameLibOutput lameLibOuts[maxOutput];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of lame library outputs.
|
||||||
|
*/
|
||||||
|
unsigned int noLameLibOuts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duration of playing, in seconds.
|
* Duration of playing, in seconds.
|
||||||
|
@ -115,16 +118,6 @@ class DarkIce : public virtual Referable, public virtual Reporter
|
||||||
*/
|
*/
|
||||||
Ref<Connector> encConnector;
|
Ref<Connector> encConnector;
|
||||||
|
|
||||||
/**
|
|
||||||
* The outputs.
|
|
||||||
*/
|
|
||||||
Output outputs[maxOutput];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Number of outputs.
|
|
||||||
*/
|
|
||||||
unsigned int noOutputs;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Original scheduling policy
|
* Original scheduling policy
|
||||||
*/
|
*/
|
||||||
|
@ -145,6 +138,18 @@ class DarkIce : public virtual Referable, public virtual Reporter
|
||||||
void
|
void
|
||||||
init ( const Config & config ) throw ( Exception );
|
init ( const Config & config ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Look for the lame library outputs from the config file.
|
||||||
|
* Called from init()
|
||||||
|
*
|
||||||
|
* @param config the config Object to read initialization
|
||||||
|
* information from.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
configLameLib ( const Config & config,
|
||||||
|
unsigned int bufferSecs ) throw ( Exception );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set POSIX real-time scheduling for the encoding process,
|
* Set POSIX real-time scheduling for the encoding process,
|
||||||
* if user permissions enable it.
|
* if user permissions enable it.
|
||||||
|
@ -264,6 +269,11 @@ class DarkIce : public virtual Referable, public virtual Reporter
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.8 2001/08/26 20:44:30 darkeye
|
||||||
|
removed external command-line encoder support
|
||||||
|
replaced it with a shared-object support for lame with the possibility
|
||||||
|
of static linkage
|
||||||
|
|
||||||
Revision 1.7 2000/12/20 12:36:47 darkeye
|
Revision 1.7 2000/12/20 12:36:47 darkeye
|
||||||
added POSIX real-time scheduling
|
added POSIX real-time scheduling
|
||||||
|
|
||||||
|
|
|
@ -1,218 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
|
||||||
|
|
||||||
Tyrell DarkIce
|
|
||||||
|
|
||||||
File : ExternalEncoder.cpp
|
|
||||||
Version : $Revision$
|
|
||||||
Author : $Author$
|
|
||||||
Location : $Source$
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "configure.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#else
|
|
||||||
#error need sys/types.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#else
|
|
||||||
#error need unistd.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SIGNAL_H
|
|
||||||
#include <signal.h>
|
|
||||||
#else
|
|
||||||
#error need signal.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ERRNO_H
|
|
||||||
#include <errno.h>
|
|
||||||
#else
|
|
||||||
#error need errno.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "Exception.h"
|
|
||||||
#include "Util.h"
|
|
||||||
#include "ExternalEncoder.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* =================================================== local data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================ local constants & macros */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* File identity
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
static const char fileid[] = "$Id$";
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* File identity
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
#define ARG_LEN 64
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================= module code */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Initialize the class
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
ExternalEncoder :: init ( const char * encoderName,
|
|
||||||
const char * inFileName,
|
|
||||||
const char * outFileName ) throw ( Exception )
|
|
||||||
{
|
|
||||||
unsigned int u;
|
|
||||||
|
|
||||||
for ( u = 0; u < numCmdArgs; ++u ) {
|
|
||||||
cmdArgs[u] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->encoderName = Util::strDup( encoderName);
|
|
||||||
this->inFileName = Util::strDup( inFileName);
|
|
||||||
this->outFileName = Util::strDup( outFileName);
|
|
||||||
this->child = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* De-initialize the class
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
ExternalEncoder :: strip ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
unsigned int u;
|
|
||||||
|
|
||||||
if ( isRunning() ) {
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( u = 0; u < numCmdArgs; ++u ) {
|
|
||||||
if ( cmdArgs[u] ) {
|
|
||||||
delete[] cmdArgs[u];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delete[] encoderName;
|
|
||||||
delete[] inFileName;
|
|
||||||
delete[] outFileName;
|
|
||||||
child = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Set the nth command line argument
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
ExternalEncoder :: setArg ( const char * str,
|
|
||||||
unsigned int index ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( index >= numCmdArgs ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "index >= numCmdArgs", index);
|
|
||||||
}
|
|
||||||
|
|
||||||
cmdArgs[index] = str ? Util::strDup( str) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Start the encoding
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
bool
|
|
||||||
ExternalEncoder :: start ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
pid_t pid;
|
|
||||||
|
|
||||||
if ( isRunning() ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
pid = fork();
|
|
||||||
|
|
||||||
if ( pid == -1 ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "fork error");
|
|
||||||
} else if ( pid == 0 ) {
|
|
||||||
reportEvent( 5, "child process", getpid(), "started");
|
|
||||||
|
|
||||||
makeArgs();
|
|
||||||
execvp( getEncoderName(), cmdArgs);
|
|
||||||
|
|
||||||
throw Exception( __FILE__, __LINE__, "exec returned");
|
|
||||||
} else {
|
|
||||||
child = pid;
|
|
||||||
reportEvent( 5, "parent", getpid(), "started child process", child);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* End the encoding
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
ExternalEncoder :: stop ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( !isRunning() ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( kill( child, SIGHUP) == -1 ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "kill", errno);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$Source$
|
|
||||||
|
|
||||||
$Log$
|
|
||||||
Revision 1.4 2000/11/18 11:13:27 darkeye
|
|
||||||
removed direct reference to cout, except from main.cpp
|
|
||||||
all class use the Reporter interface to report events
|
|
||||||
|
|
||||||
Revision 1.3 2000/11/12 14:54:50 darkeye
|
|
||||||
added kdoc-style documentation comments
|
|
||||||
|
|
||||||
Revision 1.2 2000/11/05 14:08:27 darkeye
|
|
||||||
changed builting to an automake / autoconf environment
|
|
||||||
|
|
||||||
Revision 1.1.1.1 2000/11/05 10:05:50 darkeye
|
|
||||||
initial version
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -1,382 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
|
||||||
|
|
||||||
Tyrell DarkIce
|
|
||||||
|
|
||||||
File : ExternalEncoder.h
|
|
||||||
Version : $Revision$
|
|
||||||
Author : $Author$
|
|
||||||
Location : $ExternalEncoder$
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
#ifndef EXTERNAL_ENCODER_H
|
|
||||||
#define EXTERNAL_ENCODER_H
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#error This is a C++ include file
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "configure.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#else
|
|
||||||
#error need sys/types.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "Exception.h"
|
|
||||||
#include "Reporter.h"
|
|
||||||
#include "AudioEncoder.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================================ constants */
|
|
||||||
|
|
||||||
|
|
||||||
/* =================================================================== macros */
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================================== data types */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A class representing an external audio encoder which is invoked
|
|
||||||
* with a frok() and an exec() call
|
|
||||||
*
|
|
||||||
* @author $Author$
|
|
||||||
* @version $Revision$
|
|
||||||
*/
|
|
||||||
class ExternalEncoder : public AudioEncoder, public virtual Reporter
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the encoder (the command to invoke the encoder with).
|
|
||||||
*/
|
|
||||||
char * encoderName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Input file parameter for the encoder.
|
|
||||||
*/
|
|
||||||
char * inFileName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Output file parameter for the encoder.
|
|
||||||
*/
|
|
||||||
char * outFileName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maximum number of command line arguments.
|
|
||||||
*/
|
|
||||||
static const unsigned int numCmdArgs = 64;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of command line arguments.
|
|
||||||
*/
|
|
||||||
char * cmdArgs[numCmdArgs];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process ID of the encoder process.
|
|
||||||
*/
|
|
||||||
pid_t child;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the object.
|
|
||||||
*
|
|
||||||
* @param encoderName name of the encoder.
|
|
||||||
* @param inFileName input file parameter for the encoder.
|
|
||||||
* @param outFileName output file parameter for the encoder.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
init ( const char * encoderName,
|
|
||||||
const char * inFileName,
|
|
||||||
const char * outFileName ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* De-initialize the object.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
strip ( void ) throw ( Exception );
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor. Always throws an Exception.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
ExternalEncoder ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
throw Exception( __FILE__, __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a command line argument in the argument array.
|
|
||||||
*
|
|
||||||
* @param str the argument to set.
|
|
||||||
* @param index the place in the array to set the argument.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
setArg ( const char * str,
|
|
||||||
unsigned int index ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fill in the list of command line arguments. Puts a 0
|
|
||||||
* as the last in the list of args.
|
|
||||||
*
|
|
||||||
* @return the number of arguments filled.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual unsigned int
|
|
||||||
makeArgs ( void ) throw ( Exception ) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param encoderName name of the encoder.
|
|
||||||
* (the command to invoke the encoder with)
|
|
||||||
* @param inFileName input file parameter for the encoder.
|
|
||||||
* @param inSampleRate sample rate of the input.
|
|
||||||
* @param inBitsPerSample number of bits per sample of the input.
|
|
||||||
* @param inChannel number of channels of the input.
|
|
||||||
* @param outFileName output file parameter for the encoder.
|
|
||||||
* @param outBitrate bit rate of the output (bits/sec).
|
|
||||||
* @param outSampleRate sample rate of the output.
|
|
||||||
* If 0, inSampleRate is used.
|
|
||||||
* @param outChannel number of channels of the output.
|
|
||||||
* If 0, inChannel is used.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
ExternalEncoder ( const char * encoderName,
|
|
||||||
const char * inFileName,
|
|
||||||
unsigned int inSampleRate,
|
|
||||||
unsigned int inBitsPerSample,
|
|
||||||
unsigned int inChannel,
|
|
||||||
const char * outFileName,
|
|
||||||
unsigned int outBitrate,
|
|
||||||
unsigned int outSampleRate = 0,
|
|
||||||
unsigned int outChannel = 0 )
|
|
||||||
throw ( Exception )
|
|
||||||
|
|
||||||
: AudioEncoder ( inSampleRate,
|
|
||||||
inBitsPerSample,
|
|
||||||
inChannel,
|
|
||||||
outBitrate,
|
|
||||||
outSampleRate,
|
|
||||||
outChannel )
|
|
||||||
{
|
|
||||||
init ( encoderName, inFileName, outFileName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param encoderName name of the encoder.
|
|
||||||
* (the command to invoke the encoder with)
|
|
||||||
* @param inFileName input file parameter for the encoder.
|
|
||||||
* @param as get input sample rate, bits per sample and channels
|
|
||||||
* from this AudioSource.
|
|
||||||
* @param outFileName output file parameter for the encoder.
|
|
||||||
* @param outBitrate bit rate of the output (bits/sec).
|
|
||||||
* @param outSampleRate sample rate of the output.
|
|
||||||
* If 0, input sample rate is used.
|
|
||||||
* @param outChannel number of channels of the output.
|
|
||||||
* If 0, input channel is used.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
ExternalEncoder ( const char * encoderName,
|
|
||||||
const char * inFileName,
|
|
||||||
const AudioSource * as,
|
|
||||||
const char * outFileName,
|
|
||||||
unsigned int outBitrate,
|
|
||||||
unsigned int outSampleRate = 0,
|
|
||||||
unsigned int outChannel = 0 )
|
|
||||||
throw ( Exception )
|
|
||||||
|
|
||||||
: AudioEncoder ( as,
|
|
||||||
outBitrate,
|
|
||||||
outSampleRate,
|
|
||||||
outChannel )
|
|
||||||
{
|
|
||||||
init ( encoderName, inFileName, outFileName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy constructor.
|
|
||||||
*
|
|
||||||
* @param encoder the ExternalEncoder to copy.
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
ExternalEncoder ( const ExternalEncoder & encoder )
|
|
||||||
throw ( Exception )
|
|
||||||
: AudioEncoder( encoder )
|
|
||||||
{
|
|
||||||
init( encoder.encoderName,
|
|
||||||
encoder.inFileName,
|
|
||||||
encoder.outFileName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline virtual
|
|
||||||
~ExternalEncoder ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
strip();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assignment operator.
|
|
||||||
*
|
|
||||||
* @param encoder the ExternalEncoder to assign this to.
|
|
||||||
* @return a reference to this ExternalEncoder.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline virtual ExternalEncoder &
|
|
||||||
operator= ( const ExternalEncoder & encoder ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( this != &encoder ) {
|
|
||||||
strip();
|
|
||||||
AudioEncoder::operator=( encoder);
|
|
||||||
init( encoder.encoderName,
|
|
||||||
encoder.inFileName,
|
|
||||||
encoder.outFileName );
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of the encoder
|
|
||||||
* (the command to invoke the encoder with).
|
|
||||||
*
|
|
||||||
* @return the name of the encoder.
|
|
||||||
*/
|
|
||||||
const char *
|
|
||||||
getEncoderName ( void ) const throw ()
|
|
||||||
{
|
|
||||||
return encoderName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the input file parameter for the encoder.
|
|
||||||
*
|
|
||||||
* @return the input file parameter for the encoder.
|
|
||||||
*/
|
|
||||||
const char *
|
|
||||||
getInFileName ( void ) const throw ()
|
|
||||||
{
|
|
||||||
return inFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the output file parameter for the encoder.
|
|
||||||
*
|
|
||||||
* @return the output file parameter for the encoder.
|
|
||||||
*/
|
|
||||||
const char *
|
|
||||||
getOutFileName ( void ) const throw ()
|
|
||||||
{
|
|
||||||
return outFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check wether encoding is in progress.
|
|
||||||
*
|
|
||||||
* @return true if encoding is in progress, false otherwise.
|
|
||||||
*/
|
|
||||||
inline virtual bool
|
|
||||||
isRunning ( void ) const throw ()
|
|
||||||
{
|
|
||||||
return child != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start encoding. This function returns as soon as possible,
|
|
||||||
* with encoding started as a separate process in the
|
|
||||||
* background.
|
|
||||||
*
|
|
||||||
* @return true if encoding has started, false otherwise.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual bool
|
|
||||||
start ( void ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop encoding. Stops the encoding running in the background.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual void
|
|
||||||
stop ( void ) throw ( Exception );
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================= external data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ====================================================== function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* EXTERNAL_ENCODER_H */
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$Source$
|
|
||||||
|
|
||||||
$Log$
|
|
||||||
Revision 1.5 2000/11/18 11:13:27 darkeye
|
|
||||||
removed direct reference to cout, except from main.cpp
|
|
||||||
all class use the Reporter interface to report events
|
|
||||||
|
|
||||||
Revision 1.4 2000/11/12 14:54:50 darkeye
|
|
||||||
added kdoc-style documentation comments
|
|
||||||
|
|
||||||
Revision 1.3 2000/11/05 17:37:24 darkeye
|
|
||||||
removed clone() functions
|
|
||||||
|
|
||||||
Revision 1.2 2000/11/05 14:08:27 darkeye
|
|
||||||
changed builting to an automake / autoconf environment
|
|
||||||
|
|
||||||
Revision 1.1.1.1 2000/11/05 10:05:50 darkeye
|
|
||||||
initial version
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -1,320 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
|
||||||
|
|
||||||
Tyrell DarkIce
|
|
||||||
|
|
||||||
File : FileSink.cpp
|
|
||||||
Version : $Revision$
|
|
||||||
Author : $Author$
|
|
||||||
Location : $Source$
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "configure.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#else
|
|
||||||
#error need unistd.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
|
||||||
#else
|
|
||||||
#error need stdlib.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#else
|
|
||||||
#error need sys/types.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ERRNO_H
|
|
||||||
#include <errno.h>
|
|
||||||
#else
|
|
||||||
#error need errno.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_STAT_H
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#else
|
|
||||||
#error need sys/stat.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
|
||||||
#include <fcntl.h>
|
|
||||||
#else
|
|
||||||
#error need fcntl.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TIME_H
|
|
||||||
#include <sys/time.h>
|
|
||||||
#else
|
|
||||||
#error need sys/time.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "Util.h"
|
|
||||||
#include "Exception.h"
|
|
||||||
#include "FileSink.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* =================================================== local data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================ local constants & macros */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* File identity
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
static const char fileid[] = "$Id$";
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================= module code */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Initialize the object
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
FileSink :: init ( const char * name ) throw ( Exception )
|
|
||||||
{
|
|
||||||
fileName = Util::strDup( name);
|
|
||||||
fileDescriptor = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* De-initialize the object
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
FileSink :: strip ( void) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( isOpen() ) {
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
delete[] fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Copy Constructor
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
FileSink :: FileSink ( const FileSink & fs ) throw ( Exception )
|
|
||||||
: Sink( fs )
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
init( fs.fileName);
|
|
||||||
|
|
||||||
if ( (fd = fs.fileDescriptor ? dup( fs.fileDescriptor) : 0) == -1 ) {
|
|
||||||
strip();
|
|
||||||
throw Exception( __FILE__, __LINE__, "dup failure");
|
|
||||||
}
|
|
||||||
|
|
||||||
fileDescriptor = fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Assignment operator
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
FileSink &
|
|
||||||
FileSink :: operator= ( const FileSink & fs ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( this != &fs ) {
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
/* first strip */
|
|
||||||
strip();
|
|
||||||
|
|
||||||
|
|
||||||
/* then build up */
|
|
||||||
Sink::operator=( fs );
|
|
||||||
|
|
||||||
init( fs.fileName);
|
|
||||||
|
|
||||||
if ( (fd = fs.fileDescriptor ? dup( fs.fileDescriptor) : 0) == -1 ) {
|
|
||||||
strip();
|
|
||||||
throw Exception( __FILE__, __LINE__, "dup failure");
|
|
||||||
}
|
|
||||||
|
|
||||||
fileDescriptor = fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Check wether a file exists
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
bool
|
|
||||||
FileSink :: exists ( void ) const throw ()
|
|
||||||
{
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
if ( stat( (const char*)fileName, &st) == -1 ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Create a file, truncate if already exists
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
bool
|
|
||||||
FileSink :: create ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
if ( isOpen() ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (fd = ::creat( fileName, S_IRUSR | S_IWUSR)) == -1 ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "creat error", errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
::close( fd);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Open the file
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
bool
|
|
||||||
FileSink :: open ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( isOpen() ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (fileDescriptor = ::open( fileName, O_WRONLY | O_TRUNC, 0)) == -1 ) {
|
|
||||||
fileDescriptor = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Check wether read() would return anything
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
bool
|
|
||||||
FileSink :: canWrite ( unsigned int sec,
|
|
||||||
unsigned int usec ) throw ( Exception )
|
|
||||||
{
|
|
||||||
fd_set fdset;
|
|
||||||
struct timeval tv;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if ( !isOpen() ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
FD_ZERO( &fdset);
|
|
||||||
FD_SET( fileDescriptor, &fdset);
|
|
||||||
tv.tv_sec = sec;
|
|
||||||
tv.tv_usec = usec;
|
|
||||||
|
|
||||||
ret = select( fileDescriptor + 1, NULL, &fdset, NULL, &tv);
|
|
||||||
|
|
||||||
if ( ret == -1 ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "select error");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Read from the audio source
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
unsigned int
|
|
||||||
FileSink :: write ( const void * buf,
|
|
||||||
unsigned int len ) throw ( Exception )
|
|
||||||
{
|
|
||||||
ssize_t ret;
|
|
||||||
|
|
||||||
if ( !isOpen() ) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ::write( fileDescriptor, buf, len);
|
|
||||||
|
|
||||||
if ( ret == -1 ) {
|
|
||||||
if ( errno == EAGAIN ) {
|
|
||||||
ret = 0;
|
|
||||||
} else {
|
|
||||||
throw Exception( __FILE__, __LINE__, "write error", errno);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Close the audio source
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
FileSink :: close ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( !isOpen() ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
flush();
|
|
||||||
::close( fileDescriptor);
|
|
||||||
fileDescriptor = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$Source$
|
|
||||||
|
|
||||||
$Log$
|
|
||||||
Revision 1.3 2000/11/11 12:33:13 darkeye
|
|
||||||
added kdoc-style documentation
|
|
||||||
|
|
||||||
Revision 1.2 2000/11/05 14:08:27 darkeye
|
|
||||||
changed builting to an automake / autoconf environment
|
|
||||||
|
|
||||||
Revision 1.1.1.1 2000/11/05 10:05:51 darkeye
|
|
||||||
initial version
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -1,264 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
|
||||||
|
|
||||||
Tyrell DarkIce
|
|
||||||
|
|
||||||
File : FileSink.h
|
|
||||||
Version : $Revision$
|
|
||||||
Author : $Author$
|
|
||||||
Location : $Source$
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
#ifndef FILE_SINK_H
|
|
||||||
#define FILE_SINK_H
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#error This is a C++ include file
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#include "Sink.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================================ constants */
|
|
||||||
|
|
||||||
|
|
||||||
/* =================================================================== macros */
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================================== data types */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* File data output
|
|
||||||
*
|
|
||||||
* @author $Author$
|
|
||||||
* @version $Revision$
|
|
||||||
*/
|
|
||||||
class FileSink : public Sink
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the file represented by the FileSink.
|
|
||||||
*/
|
|
||||||
char * fileName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the object.
|
|
||||||
*
|
|
||||||
* @param name name of the file to be represented by the object.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
init ( const char * name ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* De-initialize the object.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
strip ( void ) throw ( Exception );
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Low-level file descriptor for the file represented by this object.
|
|
||||||
*/
|
|
||||||
int fileDescriptor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor. Always throws an Exception.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
FileSink ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
throw Exception( __FILE__, __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor by a file name.
|
|
||||||
*
|
|
||||||
* @param name name of the file to be represented by the object.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
FileSink( const char * name ) throw ( Exception )
|
|
||||||
{
|
|
||||||
init( name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy constructor.
|
|
||||||
*
|
|
||||||
* @param fsink the FileSink to copy.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
FileSink( const FileSink & fsink ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline virtual
|
|
||||||
~FileSink( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
strip();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assignment operator.
|
|
||||||
*
|
|
||||||
* @param fs the FileSink to assign to this object.
|
|
||||||
* @return a reference to this object.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual FileSink &
|
|
||||||
operator= ( const FileSink & fs ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the file name this FileSink represents.
|
|
||||||
*
|
|
||||||
* @return the file name this FileSink represents.
|
|
||||||
*/
|
|
||||||
inline const char *
|
|
||||||
getFileName ( void ) const throw ()
|
|
||||||
{
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check for the existence of the file this FileSink represents.
|
|
||||||
*
|
|
||||||
* @return true if the file exists, false otherwise.
|
|
||||||
*/
|
|
||||||
virtual bool
|
|
||||||
exists ( void ) const throw ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the file.
|
|
||||||
*
|
|
||||||
* @return true if creation was successful, false otherwise.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual bool
|
|
||||||
create ( void ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Open the file. Truncates the file.
|
|
||||||
*
|
|
||||||
* @return true if opening was successful, false otherwise.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual bool
|
|
||||||
open ( void ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the FileSink is open.
|
|
||||||
*
|
|
||||||
* @return true if the FileSink is open, false otherwise.
|
|
||||||
*/
|
|
||||||
inline virtual bool
|
|
||||||
isOpen ( void ) const throw ()
|
|
||||||
{
|
|
||||||
return fileDescriptor != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the FileSink is ready to accept data.
|
|
||||||
* Blocks until the specified time for data to be available.
|
|
||||||
*
|
|
||||||
* @param sec the maximum seconds to block.
|
|
||||||
* @param usec micro seconds to block after the full seconds.
|
|
||||||
* @return true if the Sink is ready to accept data, false otherwise.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual bool
|
|
||||||
canWrite ( unsigned int sec,
|
|
||||||
unsigned int usec ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write data to the FileSink.
|
|
||||||
*
|
|
||||||
* @param buf the data to write.
|
|
||||||
* @param len number of bytes to write from buf.
|
|
||||||
* @return the number of bytes written (may be less than len).
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual unsigned int
|
|
||||||
write ( const void * buf,
|
|
||||||
unsigned int len ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a no-op in this FileSink.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline virtual void
|
|
||||||
flush ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Close the FileSink.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual void
|
|
||||||
close ( void ) throw ( Exception );
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================= external data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ====================================================== function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FILE_SINK_H */
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$Source$
|
|
||||||
|
|
||||||
$Log$
|
|
||||||
Revision 1.3 2000/11/11 12:33:13 darkeye
|
|
||||||
added kdoc-style documentation
|
|
||||||
|
|
||||||
Revision 1.2 2000/11/05 17:37:24 darkeye
|
|
||||||
removed clone() functions
|
|
||||||
|
|
||||||
Revision 1.1.1.1 2000/11/05 10:05:51 darkeye
|
|
||||||
initial version
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -1,270 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
|
||||||
|
|
||||||
Tyrell DarkIce
|
|
||||||
|
|
||||||
File : FileSource.cpp
|
|
||||||
Version : $Revision$
|
|
||||||
Author : $Author$
|
|
||||||
Location : $Source$
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "configure.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#else
|
|
||||||
#error need unistd.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#else
|
|
||||||
#error need sys/types.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_STAT_H
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#else
|
|
||||||
#error need sys/stat.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
|
||||||
#include <fcntl.h>
|
|
||||||
#else
|
|
||||||
#error need fcntl.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TIME_H
|
|
||||||
#include <sys/time.h>
|
|
||||||
#else
|
|
||||||
#error need sys/time.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "Exception.h"
|
|
||||||
#include "Util.h"
|
|
||||||
#include "FileSource.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* =================================================== local data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================ local constants & macros */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* File identity
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
static const char fileid[] = "$Id$";
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================= module code */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Initialize the object
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
FileSource :: init ( const char * name ) throw ( Exception )
|
|
||||||
{
|
|
||||||
fileName = Util::strDup( name);
|
|
||||||
fileDescriptor = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* De-initialize the object
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
FileSource :: strip ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( isOpen() ) {
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
delete[] fileName;
|
|
||||||
fileDescriptor = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Copy Constructor
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
FileSource :: FileSource ( const FileSource & fs ) throw ( Exception )
|
|
||||||
{
|
|
||||||
init( fs.fileName);
|
|
||||||
|
|
||||||
fileDescriptor = fs.fileDescriptor ? dup( fs.fileDescriptor) : 0;
|
|
||||||
|
|
||||||
if ( fileDescriptor == -1 ) {
|
|
||||||
strip();
|
|
||||||
throw Exception( __FILE__, __LINE__, "dup failure");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Assignment operator
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
FileSource &
|
|
||||||
FileSource :: operator= ( const FileSource & fs ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( this != &fs ) {
|
|
||||||
init( fs.fileName);
|
|
||||||
|
|
||||||
fileDescriptor = fs.fileDescriptor ? dup( fs.fileDescriptor) : 0;
|
|
||||||
|
|
||||||
if ( fileDescriptor == -1 ) {
|
|
||||||
strip();
|
|
||||||
throw Exception( __FILE__, __LINE__, "dup failure");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Check wether a file exists
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
bool
|
|
||||||
FileSource :: exists ( void ) const throw ()
|
|
||||||
{
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
if ( stat( (const char*)fileName, &st) == -1 ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Open the source
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
bool
|
|
||||||
FileSource :: open ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( isOpen() ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (fileDescriptor = ::open( fileName, O_RDONLY)) == -1 ) {
|
|
||||||
fileDescriptor = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Check wether read() would return anything
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
bool
|
|
||||||
FileSource :: canRead ( unsigned int sec,
|
|
||||||
unsigned int usec ) throw ( Exception )
|
|
||||||
{
|
|
||||||
fd_set fdset;
|
|
||||||
struct timeval tv;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if ( !isOpen() ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
FD_ZERO( &fdset);
|
|
||||||
FD_SET( fileDescriptor, &fdset);
|
|
||||||
tv.tv_sec = sec;
|
|
||||||
tv.tv_usec = usec;
|
|
||||||
|
|
||||||
ret = select( fileDescriptor + 1, &fdset, NULL, NULL, &tv);
|
|
||||||
|
|
||||||
if ( ret == -1 ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "select error");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Read from the audio source
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
unsigned int
|
|
||||||
FileSource :: read ( void * buf,
|
|
||||||
unsigned int len ) throw ( Exception )
|
|
||||||
{
|
|
||||||
ssize_t ret;
|
|
||||||
|
|
||||||
if ( !isOpen() ) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ::read( fileDescriptor, buf, len);
|
|
||||||
|
|
||||||
if ( ret == -1 ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "read error");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Close the audio source
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
void
|
|
||||||
FileSource :: close ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( !isOpen() ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
::close( fileDescriptor);
|
|
||||||
fileDescriptor = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$Source$
|
|
||||||
|
|
||||||
$Log$
|
|
||||||
Revision 1.3 2000/11/12 13:31:40 darkeye
|
|
||||||
added kdoc-style documentation comments
|
|
||||||
|
|
||||||
Revision 1.2 2000/11/05 14:08:27 darkeye
|
|
||||||
changed builting to an automake / autoconf environment
|
|
||||||
|
|
||||||
Revision 1.1.1.1 2000/11/05 10:05:51 darkeye
|
|
||||||
initial version
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -1,243 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
|
||||||
|
|
||||||
Tyrell DarkIce
|
|
||||||
|
|
||||||
File : FileSource.h
|
|
||||||
Version : $Revision$
|
|
||||||
Author : $Author$
|
|
||||||
Location : $Source$
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
#ifndef FILE_SOURCE_H
|
|
||||||
#define FILE_SOURCE_H
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#error This is a C++ include file
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#include "Source.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================================ constants */
|
|
||||||
|
|
||||||
|
|
||||||
/* =================================================================== macros */
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================================== data types */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A data source based on a file
|
|
||||||
*
|
|
||||||
* @author $Author$
|
|
||||||
* @version $Revision$
|
|
||||||
*/
|
|
||||||
class FileSource : public Source
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the file represented by the FileSource.
|
|
||||||
*/
|
|
||||||
char * fileName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the object.
|
|
||||||
*
|
|
||||||
* @param name name of the file to be represented by the object.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
init ( const char * name ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* De-initialize the object.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
strip ( void ) throw ( Exception );
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Low-level file descriptor for the file represented by this object.
|
|
||||||
*/
|
|
||||||
int fileDescriptor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor. Always throws an Exception.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
FileSource ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
throw Exception( __FILE__, __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor by a file name.
|
|
||||||
*
|
|
||||||
* @param name name of the file to be represented by the object.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
FileSource ( const char * name ) throw ( Exception )
|
|
||||||
{
|
|
||||||
init( name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy constructor.
|
|
||||||
*
|
|
||||||
* @param fs the FileSource to copy.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
FileSource ( const FileSource & fs ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
~FileSource ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
strip();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assignment operator.
|
|
||||||
*
|
|
||||||
* @param fs the FileSource to assign to this object.
|
|
||||||
* @return a reference to this object.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline virtual FileSource &
|
|
||||||
operator= ( const FileSource & fs ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the file name this FileSource represents.
|
|
||||||
*
|
|
||||||
* @return the file name this FileSource represents.
|
|
||||||
*/
|
|
||||||
inline virtual const char *
|
|
||||||
getFileName ( void ) const throw ()
|
|
||||||
{
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check for the existence of the file this FileSource represents.
|
|
||||||
*
|
|
||||||
* @return true if the file exists, false otherwise.
|
|
||||||
*/
|
|
||||||
virtual bool
|
|
||||||
exists ( void ) const throw ();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Open the file.
|
|
||||||
*
|
|
||||||
* @return true if opening was successful, false otherwise.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual bool
|
|
||||||
open ( void ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the FileSource is open.
|
|
||||||
*
|
|
||||||
* @return true if the FileSource is open, false otherwise.
|
|
||||||
*/
|
|
||||||
inline virtual bool
|
|
||||||
isOpen ( void ) const throw ()
|
|
||||||
{
|
|
||||||
return fileDescriptor != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the FileSource has data available.
|
|
||||||
* Blocks until the specified time for data to be available.
|
|
||||||
*
|
|
||||||
* @param sec the maximum seconds to block.
|
|
||||||
* @param usec micro seconds to block after the full seconds.
|
|
||||||
* @return true if the FileSource has data to be read,
|
|
||||||
* false otherwise.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual bool
|
|
||||||
canRead ( unsigned int sec,
|
|
||||||
unsigned int usec ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read from the FileSource.
|
|
||||||
*
|
|
||||||
* @param buf the buffer to read into.
|
|
||||||
* @param len the number of bytes to read into buf
|
|
||||||
* @return the number of bytes read (may be less than len).
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual unsigned int
|
|
||||||
read ( void * buf,
|
|
||||||
unsigned int len ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Close the FileSource.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual void
|
|
||||||
close ( void ) throw ( Exception );
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================= external data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ====================================================== function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FILE_SOURCE_H */
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$Source$
|
|
||||||
|
|
||||||
$Log$
|
|
||||||
Revision 1.2 2000/11/12 13:31:40 darkeye
|
|
||||||
added kdoc-style documentation comments
|
|
||||||
|
|
||||||
Revision 1.1.1.1 2000/11/05 10:05:51 darkeye
|
|
||||||
initial version
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -1,160 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
|
||||||
|
|
||||||
Tyrell DarkIce
|
|
||||||
|
|
||||||
File : LameEncoder.cpp
|
|
||||||
Version : $Revision$
|
|
||||||
Author : $Author$
|
|
||||||
Location : $Source$
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "configure.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STDIO_H
|
|
||||||
#include <stdio.h>
|
|
||||||
#else
|
|
||||||
#error need stdio.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "Exception.h"
|
|
||||||
#include "LameEncoder.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* =================================================== local data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================ local constants & macros */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* File identity
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
static const char fileid[] = "$Id$";
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* File identity
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
#define ARG_LEN 64
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================= module code */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Initialize command line parameters
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
unsigned int
|
|
||||||
LameEncoder :: makeArgs ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
unsigned int u;
|
|
||||||
char str[ARG_LEN];
|
|
||||||
|
|
||||||
u = 0;
|
|
||||||
|
|
||||||
setArg( getEncoderName(), u++); // name of the command
|
|
||||||
setArg( "-S", u++); // make it silent
|
|
||||||
setArg( "-r", u++); // input is raw PCM
|
|
||||||
setArg( "-x", u++); // input is little endian
|
|
||||||
setArg( "-h", u++); // high quality
|
|
||||||
|
|
||||||
/* set input sample rate */
|
|
||||||
if ( snprintf( str, ARG_LEN, "%.3f",
|
|
||||||
((double)getInSampleRate()) / 1000.0 ) == -1 ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "snprintf overflow");
|
|
||||||
}
|
|
||||||
setArg( "-s", u++);
|
|
||||||
setArg( str, u++);
|
|
||||||
|
|
||||||
/* set stereo / mono */
|
|
||||||
setArg( "-m", u++);
|
|
||||||
setArg( getOutChannel() == 1 ? "m" : "j", u++);
|
|
||||||
|
|
||||||
/* set output bitrate */
|
|
||||||
if ( snprintf( str, ARG_LEN, "%d", getOutBitrate()) == -1 ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "snprintf overflow");
|
|
||||||
}
|
|
||||||
setArg( "-b", u++);
|
|
||||||
setArg( str, u++);
|
|
||||||
|
|
||||||
/* set output sample rate */
|
|
||||||
if ( snprintf( str, ARG_LEN, "%.3f",
|
|
||||||
((double)getOutSampleRate()) / 1000.0 ) == -1 ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "snprintf overflow");
|
|
||||||
}
|
|
||||||
setArg( "--resample", u++);
|
|
||||||
setArg( str, u++);
|
|
||||||
|
|
||||||
/* set lowpass filter if needed */
|
|
||||||
if ( lowpass ) {
|
|
||||||
if ( snprintf( str, ARG_LEN, "%.3f",
|
|
||||||
((double)getLowpass()) / 1000.0 ) == -1 ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "snprintf overflow");
|
|
||||||
}
|
|
||||||
setArg( "--lowpass", u++);
|
|
||||||
setArg( str, u++);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set highpass filter if needed */
|
|
||||||
if ( highpass ) {
|
|
||||||
if ( snprintf( str, ARG_LEN, "%.3f",
|
|
||||||
((double)getHighpass()) / 1000.0 ) == -1 ) {
|
|
||||||
throw Exception( __FILE__, __LINE__, "snprintf overflow");
|
|
||||||
}
|
|
||||||
setArg( "--highpass", u++);
|
|
||||||
setArg( str, u++);
|
|
||||||
}
|
|
||||||
|
|
||||||
setArg( getInFileName(), u++); // input file
|
|
||||||
setArg( getOutFileName(), u++); // output file
|
|
||||||
|
|
||||||
setArg( 0, u++); // terminating zero
|
|
||||||
|
|
||||||
|
|
||||||
return u;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$Source$
|
|
||||||
|
|
||||||
$Log$
|
|
||||||
Revision 1.3 2000/11/12 14:54:50 darkeye
|
|
||||||
added kdoc-style documentation comments
|
|
||||||
|
|
||||||
Revision 1.2 2000/11/05 14:08:28 darkeye
|
|
||||||
changed builting to an automake / autoconf environment
|
|
||||||
|
|
||||||
Revision 1.1.1.1 2000/11/05 10:05:52 darkeye
|
|
||||||
initial version
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -1,362 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
|
||||||
|
|
||||||
Tyrell DarkIce
|
|
||||||
|
|
||||||
File : LameEncoder.h
|
|
||||||
Version : $Revision$
|
|
||||||
Author : $Author$
|
|
||||||
Location : $LameEncoder$
|
|
||||||
|
|
||||||
Abstract :
|
|
||||||
|
|
||||||
A class representing the lame mp3 encoder
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
||||||
USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
#ifndef LAME_ENCODER_H
|
|
||||||
#define LAME_ENCODER_H
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#error This is a C++ include file
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#include "Exception.h"
|
|
||||||
#include "ExternalEncoder.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================================ constants */
|
|
||||||
|
|
||||||
|
|
||||||
/* =================================================================== macros */
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================================== data types */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A class representing the lame mp3 encoder
|
|
||||||
*
|
|
||||||
* @author $Author$
|
|
||||||
* @version $Revision$
|
|
||||||
*/
|
|
||||||
class LameEncoder : public ExternalEncoder
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Highpass filter. Sound frequency in Hz, from where up the
|
|
||||||
* input is cut.
|
|
||||||
*/
|
|
||||||
unsigned int lowpass;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lowpass filter. Sound frequency in Hz, from where down the
|
|
||||||
* input is cut.
|
|
||||||
*/
|
|
||||||
unsigned int highpass;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fill in the list of command line arguments. Puts a 0
|
|
||||||
* as the last in the list of args.
|
|
||||||
*
|
|
||||||
* @return the number of arguments filled.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual unsigned int
|
|
||||||
makeArgs ( void ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor. Always throws an Exception.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
LameEncoder ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
throw Exception( __FILE__, __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the object.
|
|
||||||
*
|
|
||||||
* @param lowpass lowpass filter range.
|
|
||||||
* @param highpass highpass filter range.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline void
|
|
||||||
init ( unsigned int lowpass,
|
|
||||||
unsigned int highpass ) throw ( Exception )
|
|
||||||
{
|
|
||||||
this->lowpass = lowpass;
|
|
||||||
this->highpass = highpass;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* De-initialize the object.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline void
|
|
||||||
strip ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param encoderName name of the encoder.
|
|
||||||
* (the command to invoke the encoder with)
|
|
||||||
* @param inFileName input file parameter for the encoder.
|
|
||||||
* @param inSampleRate sample rate of the input.
|
|
||||||
* @param inBitsPerSample number of bits per sample of the input.
|
|
||||||
* @param inChannel number of channels of the input.
|
|
||||||
* @param outFileName output file parameter for the encoder.
|
|
||||||
* @param outBitrate bit rate of the output (bits/sec).
|
|
||||||
* @param outSampleRate sample rate of the output.
|
|
||||||
* If 0, inSampleRate is used.
|
|
||||||
* @param outChannel number of channels of the output.
|
|
||||||
* If 0, inChannel is used.
|
|
||||||
* @param lowpass frequency threshold for the lowpass filter.
|
|
||||||
* Input above this frequency is cut.
|
|
||||||
* If 0, lame's default values are used,
|
|
||||||
* which depends on the out sample rate.
|
|
||||||
* @param highpass frequency threshold for the highpass filter.
|
|
||||||
* Input below this frequency is cut.
|
|
||||||
* If 0, lame's default values are used,
|
|
||||||
* which depends on the out sample rate.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
LameEncoder ( const char * encoderName,
|
|
||||||
const char * inFileName,
|
|
||||||
unsigned int inSampleRate,
|
|
||||||
unsigned int inBitsPerSample,
|
|
||||||
unsigned int inChannel,
|
|
||||||
const char * outFileName,
|
|
||||||
unsigned int outBitrate,
|
|
||||||
unsigned int outSampleRate = 0,
|
|
||||||
unsigned int outChannel = 0,
|
|
||||||
unsigned int lowpass = 0,
|
|
||||||
unsigned int highpass = 0 )
|
|
||||||
throw ( Exception )
|
|
||||||
|
|
||||||
: ExternalEncoder ( encoderName,
|
|
||||||
inFileName,
|
|
||||||
inSampleRate,
|
|
||||||
inBitsPerSample,
|
|
||||||
inChannel,
|
|
||||||
outFileName,
|
|
||||||
outBitrate,
|
|
||||||
outSampleRate,
|
|
||||||
outChannel )
|
|
||||||
{
|
|
||||||
init( lowpass, highpass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param encoderName name of the encoder.
|
|
||||||
* (the command to invoke the encoder with)
|
|
||||||
* @param inFileName input file parameter for the encoder.
|
|
||||||
* @param as get input sample rate, bits per sample and channels
|
|
||||||
* from this AudioSource.
|
|
||||||
* @param outFileName output file parameter for the encoder.
|
|
||||||
* @param outBitrate bit rate of the output (bits/sec).
|
|
||||||
* @param outSampleRate sample rate of the output.
|
|
||||||
* If 0, inSampleRate is used.
|
|
||||||
* @param outChannel number of channels of the output.
|
|
||||||
* If 0, inChannel is used.
|
|
||||||
* @param lowpass frequency threshold for the lowpass filter.
|
|
||||||
* Input above this frequency is cut.
|
|
||||||
* If 0, lame's default values are used,
|
|
||||||
* which depends on the out sample rate.
|
|
||||||
* @param highpass frequency threshold for the highpass filter.
|
|
||||||
* Input below this frequency is cut.
|
|
||||||
* If 0, lame's default values are used,
|
|
||||||
* which depends on the out sample rate.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
LameEncoder ( const char * encoderName,
|
|
||||||
const char * inFileName,
|
|
||||||
const AudioSource * as,
|
|
||||||
const char * outFileName,
|
|
||||||
unsigned int outBitrate,
|
|
||||||
unsigned int outSampleRate = 0,
|
|
||||||
unsigned int outChannel = 0,
|
|
||||||
unsigned int lowpass = 0,
|
|
||||||
unsigned int highpass = 0 )
|
|
||||||
throw ( Exception )
|
|
||||||
|
|
||||||
: ExternalEncoder ( encoderName,
|
|
||||||
inFileName,
|
|
||||||
as,
|
|
||||||
outFileName,
|
|
||||||
outBitrate,
|
|
||||||
outSampleRate,
|
|
||||||
outChannel )
|
|
||||||
{
|
|
||||||
init( lowpass, highpass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy constructor.
|
|
||||||
*
|
|
||||||
* @param encoder the LameEncoder to copy.
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
LameEncoder ( const LameEncoder & encoder ) throw ( Exception )
|
|
||||||
: ExternalEncoder( encoder )
|
|
||||||
{
|
|
||||||
init( encoder.lowpass, encoder.highpass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline virtual
|
|
||||||
~LameEncoder ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
strip();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assignment operator.
|
|
||||||
*
|
|
||||||
* @param encoder the LameEncoder to assign this to.
|
|
||||||
* @return a reference to this LameEncoder.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline virtual LameEncoder &
|
|
||||||
operator= ( const LameEncoder & encoder ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( this != &encoder ) {
|
|
||||||
strip();
|
|
||||||
ExternalEncoder::operator=( encoder);
|
|
||||||
init( encoder.lowpass, encoder.highpass);
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the lowpass filter threshold. Sound frequency in Hz,
|
|
||||||
* from where up the input is cut.
|
|
||||||
*
|
|
||||||
* @return the lowpass filter threshold.
|
|
||||||
*/
|
|
||||||
inline unsigned int
|
|
||||||
getLowpass ( void ) const throw ()
|
|
||||||
{
|
|
||||||
return lowpass;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the lowpass filter threshold. Sound frequency in Hz,
|
|
||||||
* from where up the input is cut.
|
|
||||||
* Can be only set if encoding is not in progress.
|
|
||||||
*
|
|
||||||
* @param lowpass the lowpass filter threshold.
|
|
||||||
* @return if setting is successful.
|
|
||||||
*/
|
|
||||||
inline bool
|
|
||||||
setLowpass ( unsigned int lowpass ) throw ()
|
|
||||||
{
|
|
||||||
if ( isRunning() ) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
this->lowpass = lowpass;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the highpass filter threshold. Sound frequency in Hz,
|
|
||||||
* from where down the input is cut.
|
|
||||||
*
|
|
||||||
* @return the highpass filter threshold.
|
|
||||||
*/
|
|
||||||
inline unsigned int
|
|
||||||
getHighpass ( void ) const throw ()
|
|
||||||
{
|
|
||||||
return highpass;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the highpass filter threshold. Sound frequency in Hz,
|
|
||||||
* from where down the input is cut.
|
|
||||||
* Can be only set if encoding is not in progress.
|
|
||||||
*
|
|
||||||
* @param highpass the highpass filter threshold.
|
|
||||||
* @return if setting is successful.
|
|
||||||
*/
|
|
||||||
inline bool
|
|
||||||
setHighpass ( unsigned int highpass ) throw ()
|
|
||||||
{
|
|
||||||
if ( isRunning() ) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
this->highpass = highpass;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================= external data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ====================================================== function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* LAME_ENCODER_H */
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$Source$
|
|
||||||
|
|
||||||
$Log$
|
|
||||||
Revision 1.3 2000/11/12 14:54:50 darkeye
|
|
||||||
added kdoc-style documentation comments
|
|
||||||
|
|
||||||
Revision 1.2 2000/11/05 17:37:24 darkeye
|
|
||||||
removed clone() functions
|
|
||||||
|
|
||||||
Revision 1.1.1.1 2000/11/05 10:05:52 darkeye
|
|
||||||
initial version
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -0,0 +1,312 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
||||||
|
|
||||||
|
Tyrell DarkIce
|
||||||
|
|
||||||
|
File : LameLibEncoder.cpp
|
||||||
|
Version : $Revision$
|
||||||
|
Author : $Author$
|
||||||
|
Location : $RCSFile$
|
||||||
|
|
||||||
|
Copyright notice:
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
#include <string.h>
|
||||||
|
#else
|
||||||
|
#error need string.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LAME_LIB
|
||||||
|
#include <lame/lame.h>
|
||||||
|
#else
|
||||||
|
#error need lame/lame.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "Exception.h"
|
||||||
|
#include "Util.h"
|
||||||
|
#include "LameLibEncoder.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* File identity
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
static const char fileid[] = "$Id$";
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Open an encoding session
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
bool
|
||||||
|
LameLibEncoder :: open ( void )
|
||||||
|
throw ( Exception )
|
||||||
|
{
|
||||||
|
if ( isOpen() ) {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
lameGlobalFlags = lame_init();
|
||||||
|
|
||||||
|
// ugly lame returns -1 in a pointer on allocation errors
|
||||||
|
if ( !lameGlobalFlags || ((int)lameGlobalFlags) == -1 ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib init error",
|
||||||
|
(int) lameGlobalFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 0 > lame_set_num_channels( lameGlobalFlags, getInChannel()) ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib setting channels error",
|
||||||
|
getInChannel() );
|
||||||
|
}
|
||||||
|
|
||||||
|
reportEvent( 5,
|
||||||
|
"set lame channels",
|
||||||
|
lame_get_num_channels( lameGlobalFlags));
|
||||||
|
|
||||||
|
if ( 0 > lame_set_in_samplerate( lameGlobalFlags, getInSampleRate()) ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib setting input sample rate error",
|
||||||
|
getInSampleRate() );
|
||||||
|
}
|
||||||
|
|
||||||
|
reportEvent( 5,
|
||||||
|
"set lame in sample rate",
|
||||||
|
lame_get_in_samplerate( lameGlobalFlags));
|
||||||
|
|
||||||
|
if ( 0 > lame_set_out_samplerate( lameGlobalFlags, getOutSampleRate()) ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib setting output sample rate error",
|
||||||
|
getOutSampleRate() );
|
||||||
|
}
|
||||||
|
|
||||||
|
reportEvent( 5,
|
||||||
|
"set lame out sample rate",
|
||||||
|
lame_get_out_samplerate( lameGlobalFlags));
|
||||||
|
|
||||||
|
if ( 0 > lame_set_brate( lameGlobalFlags, getOutBitrate()) ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib setting output bit rate error",
|
||||||
|
getOutBitrate() );
|
||||||
|
}
|
||||||
|
|
||||||
|
reportEvent( 5, "set lame bit rate", lame_get_brate( lameGlobalFlags));
|
||||||
|
|
||||||
|
if ( lowpass ) {
|
||||||
|
if ( 0 > lame_set_lowpassfreq( lameGlobalFlags, lowpass) ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib setting lowpass frequency error",
|
||||||
|
lowpass );
|
||||||
|
}
|
||||||
|
|
||||||
|
reportEvent( 5,
|
||||||
|
"set lame lowpass frequency",
|
||||||
|
lame_get_lowpassfreq( lameGlobalFlags));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( highpass ) {
|
||||||
|
if ( 0 > lame_set_highpassfreq( lameGlobalFlags, highpass) ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib setting highpass frequency error",
|
||||||
|
lowpass );
|
||||||
|
}
|
||||||
|
|
||||||
|
reportEvent( 5,
|
||||||
|
"set lame highpass frequency",
|
||||||
|
lame_get_highpassfreq( lameGlobalFlags));
|
||||||
|
}
|
||||||
|
|
||||||
|
// not configurable lame settings
|
||||||
|
|
||||||
|
if ( 0 > lame_set_quality( lameGlobalFlags, 2) ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib setting quality error",
|
||||||
|
2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
reportEvent( 5, "set lame quality", lame_get_quality( lameGlobalFlags));
|
||||||
|
|
||||||
|
if ( 0 > lame_set_mode( lameGlobalFlags, JOINT_STEREO) ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib setting mode error",
|
||||||
|
JOINT_STEREO );
|
||||||
|
}
|
||||||
|
|
||||||
|
reportEvent( 5, "set lame mode", lame_get_mode( lameGlobalFlags));
|
||||||
|
|
||||||
|
if ( 0 > lame_set_exp_nspsytune( lameGlobalFlags, 1) ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib setting psycho acoustic model error");
|
||||||
|
}
|
||||||
|
|
||||||
|
reportEvent( 5,
|
||||||
|
"set lame psycho acoustic model",
|
||||||
|
lame_get_exp_nspsytune( lameGlobalFlags));
|
||||||
|
|
||||||
|
if ( 0 > lame_set_error_protection( lameGlobalFlags, 1) ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib setting error protection error",
|
||||||
|
1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
reportEvent( 5,
|
||||||
|
"set lame error protection",
|
||||||
|
lame_get_error_protection( lameGlobalFlags));
|
||||||
|
|
||||||
|
// let lame init its own params based on our settings
|
||||||
|
if ( 0 > lame_init_params( lameGlobalFlags) ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib initializing params error" );
|
||||||
|
}
|
||||||
|
|
||||||
|
lame_print_config( lameGlobalFlags);
|
||||||
|
|
||||||
|
// open the underlying sink
|
||||||
|
if ( !sink->open() ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"lame lib opening underlying sink error");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Write data to the encoder
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
unsigned int
|
||||||
|
LameLibEncoder :: write ( const void * buf,
|
||||||
|
unsigned int len ) throw ( Exception )
|
||||||
|
{
|
||||||
|
if ( !isOpen() ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char * b = (unsigned char*) buf;
|
||||||
|
unsigned int processed = len - (len % 4);
|
||||||
|
unsigned int nSamples = processed / 4;
|
||||||
|
short int leftBuffer[nSamples];
|
||||||
|
short int rightBuffer[nSamples];
|
||||||
|
unsigned int i, j;
|
||||||
|
|
||||||
|
for ( i = 0, j = 0; i < processed; ) {
|
||||||
|
unsigned short int value;
|
||||||
|
|
||||||
|
value = b[i++];
|
||||||
|
value += b[i++] << 8;
|
||||||
|
leftBuffer[j] = (short int) value;
|
||||||
|
|
||||||
|
value = b[i++];
|
||||||
|
value += b[i++] << 8;
|
||||||
|
rightBuffer[j] = (short int) value;
|
||||||
|
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
|
||||||
|
// data chunk size estimate according to lame documentation
|
||||||
|
unsigned int mp3Size = (unsigned int) (1.25 * nSamples + 7200);
|
||||||
|
unsigned char mp3Buf[mp3Size];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = lame_encode_buffer( lameGlobalFlags,
|
||||||
|
leftBuffer,
|
||||||
|
rightBuffer,
|
||||||
|
nSamples,
|
||||||
|
mp3Buf,
|
||||||
|
mp3Size );
|
||||||
|
|
||||||
|
if ( ret < 0 ) {
|
||||||
|
reportEvent( 3, "lame encoding error", ret);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sink->write( mp3Buf, ret);
|
||||||
|
|
||||||
|
return processed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Flush the data from the encoder
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
LameLibEncoder :: flush ( void )
|
||||||
|
throw ( Exception )
|
||||||
|
{
|
||||||
|
if ( !isOpen() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// data chunk size estimate according to lame documentation
|
||||||
|
unsigned int mp3Size = 7200;
|
||||||
|
unsigned char mp3Buf[mp3Size];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = lame_encode_flush( lameGlobalFlags, mp3Buf, mp3Size );
|
||||||
|
|
||||||
|
sink->write( mp3Buf, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Close the encoding session
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
LameLibEncoder :: close ( void ) throw ( Exception )
|
||||||
|
{
|
||||||
|
if ( isOpen() ) {
|
||||||
|
flush();
|
||||||
|
lame_close( lameGlobalFlags);
|
||||||
|
lameGlobalFlags = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$Source$
|
||||||
|
|
||||||
|
$Log$
|
||||||
|
Revision 1.1 2001/08/26 20:44:30 darkeye
|
||||||
|
removed external command-line encoder support
|
||||||
|
replaced it with a shared-object support for lame with the possibility
|
||||||
|
of static linkage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -0,0 +1,437 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
||||||
|
|
||||||
|
Tyrell DarkIce
|
||||||
|
|
||||||
|
File : LameLibEncoder.h
|
||||||
|
Version : $Revision$
|
||||||
|
Author : $Author$
|
||||||
|
Location : $RCSFile$
|
||||||
|
|
||||||
|
Copyright notice:
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LAME_LIB_ENCODER_H
|
||||||
|
#define LAME_LIB_ENCODER_H
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LAME_LIB
|
||||||
|
#include <lame/lame.h>
|
||||||
|
#else
|
||||||
|
#error need lame/lame.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "Ref.h"
|
||||||
|
#include "Exception.h"
|
||||||
|
#include "Reporter.h"
|
||||||
|
#include "AudioEncoder.h"
|
||||||
|
#include "Sink.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class representing the lame encoder linked as a shared object or as
|
||||||
|
* a static library.
|
||||||
|
*
|
||||||
|
* @author $Author$
|
||||||
|
* @version $Revision$
|
||||||
|
*/
|
||||||
|
class LameLibEncoder : public AudioEncoder, public virtual Reporter,
|
||||||
|
public Sink
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lame library global flags
|
||||||
|
*/
|
||||||
|
lame_global_flags * lameGlobalFlags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Sink to dump mp3 data to
|
||||||
|
*/
|
||||||
|
Ref<Sink> sink;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Highpass filter. Sound frequency in Hz, from where up the
|
||||||
|
* input is cut.
|
||||||
|
*/
|
||||||
|
unsigned int lowpass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lowpass filter. Sound frequency in Hz, from where down the
|
||||||
|
* input is cut.
|
||||||
|
*/
|
||||||
|
unsigned int highpass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the object.
|
||||||
|
*
|
||||||
|
* @param sink the sink to send mp3 output to
|
||||||
|
* @param lowpass frequency threshold for the lowpass filter.
|
||||||
|
* Input above this frequency is cut.
|
||||||
|
* If 0, lame's default values are used,
|
||||||
|
* which depends on the out sample rate.
|
||||||
|
* @param highpass frequency threshold for the highpass filter.
|
||||||
|
* Input below this frequency is cut.
|
||||||
|
* If 0, lame's default values are used,
|
||||||
|
* which depends on the out sample rate.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
inline void
|
||||||
|
init ( Sink * sink,
|
||||||
|
unsigned int lowpass,
|
||||||
|
unsigned int highpass ) throw ( Exception )
|
||||||
|
{
|
||||||
|
this->sink = sink;
|
||||||
|
this->lowpass = lowpass;
|
||||||
|
this->highpass = highpass;
|
||||||
|
|
||||||
|
if ( getInBitsPerSample() != 16 ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"only 16 bits per sample supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( getOutSampleRate() != getInSampleRate() ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"different in and out sample rate not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( getInChannel() != getOutChannel() ) {
|
||||||
|
throw Exception( __FILE__, __LINE__,
|
||||||
|
"different in and out channels not supported");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* De-initialize the object.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
inline void
|
||||||
|
strip ( void ) throw ( Exception )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor. Always throws an Exception.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
inline
|
||||||
|
LameLibEncoder ( void ) throw ( Exception )
|
||||||
|
{
|
||||||
|
throw Exception( __FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param sink the sink to send mp3 output to
|
||||||
|
* @param inSampleRate sample rate of the input.
|
||||||
|
* @param inBitsPerSample number of bits per sample of the input.
|
||||||
|
* @param inChannel number of channels of the input.
|
||||||
|
* @param outBitrate bit rate of the output (bits/sec).
|
||||||
|
* @param outSampleRate sample rate of the output.
|
||||||
|
* If 0, inSampleRate is used.
|
||||||
|
* @param outChannel number of channels of the output.
|
||||||
|
* If 0, inChannel is used.
|
||||||
|
* @param lowpass frequency threshold for the lowpass filter.
|
||||||
|
* Input above this frequency is cut.
|
||||||
|
* If 0, lame's default values are used,
|
||||||
|
* which depends on the out sample rate.
|
||||||
|
* @param highpass frequency threshold for the highpass filter.
|
||||||
|
* Input below this frequency is cut.
|
||||||
|
* If 0, lame's default values are used,
|
||||||
|
* which depends on the out sample rate.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
inline
|
||||||
|
LameLibEncoder ( Sink * sink,
|
||||||
|
unsigned int inSampleRate,
|
||||||
|
unsigned int inBitsPerSample,
|
||||||
|
unsigned int inChannel,
|
||||||
|
unsigned int outBitrate,
|
||||||
|
unsigned int outSampleRate = 0,
|
||||||
|
unsigned int outChannel = 0,
|
||||||
|
unsigned int lowpass = 0,
|
||||||
|
unsigned int highpass = 0 )
|
||||||
|
throw ( Exception )
|
||||||
|
|
||||||
|
: AudioEncoder ( inSampleRate,
|
||||||
|
inBitsPerSample,
|
||||||
|
inChannel,
|
||||||
|
outBitrate,
|
||||||
|
outSampleRate,
|
||||||
|
outChannel )
|
||||||
|
{
|
||||||
|
init( sink, lowpass, highpass );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param sink the sink to send mp3 output to
|
||||||
|
* @param as get input sample rate, bits per sample and channels
|
||||||
|
* from this AudioSource.
|
||||||
|
* @param outBitrate bit rate of the output (bits/sec).
|
||||||
|
* @param outSampleRate sample rate of the output.
|
||||||
|
* If 0, input sample rate is used.
|
||||||
|
* @param outChannel number of channels of the output.
|
||||||
|
* If 0, input channel is used.
|
||||||
|
* @param lowpass frequency threshold for the lowpass filter.
|
||||||
|
* Input above this frequency is cut.
|
||||||
|
* If 0, lame's default values are used,
|
||||||
|
* which depends on the out sample rate.
|
||||||
|
* @param highpass frequency threshold for the highpass filter.
|
||||||
|
* Input below this frequency is cut.
|
||||||
|
* If 0, lame's default values are used,
|
||||||
|
* which depends on the out sample rate.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
inline
|
||||||
|
LameLibEncoder ( Sink * sink,
|
||||||
|
const AudioSource * as,
|
||||||
|
unsigned int outBitrate,
|
||||||
|
unsigned int outSampleRate = 0,
|
||||||
|
unsigned int outChannel = 0,
|
||||||
|
unsigned int lowpass = 0,
|
||||||
|
unsigned int highpass = 0 )
|
||||||
|
throw ( Exception )
|
||||||
|
|
||||||
|
: AudioEncoder ( as,
|
||||||
|
outBitrate,
|
||||||
|
outSampleRate,
|
||||||
|
outChannel )
|
||||||
|
{
|
||||||
|
init( sink, lowpass, highpass );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy constructor.
|
||||||
|
*
|
||||||
|
* @param encoder the LameLibEncoder to copy.
|
||||||
|
*/
|
||||||
|
inline
|
||||||
|
LameLibEncoder ( const LameLibEncoder & encoder )
|
||||||
|
throw ( Exception )
|
||||||
|
: AudioEncoder( encoder )
|
||||||
|
{
|
||||||
|
init( encoder.sink.get(), encoder.lowpass, encoder.highpass );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
inline virtual
|
||||||
|
~LameLibEncoder ( void ) throw ( Exception )
|
||||||
|
{
|
||||||
|
if ( isOpen() ) {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
strip();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assignment operator.
|
||||||
|
*
|
||||||
|
* @param encoder the LameLibEncoder to assign this to.
|
||||||
|
* @return a reference to this LameLibEncoder.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
inline virtual LameLibEncoder &
|
||||||
|
operator= ( const LameLibEncoder & encoder ) throw ( Exception )
|
||||||
|
{
|
||||||
|
if ( this != &encoder ) {
|
||||||
|
strip();
|
||||||
|
AudioEncoder::operator=( encoder);
|
||||||
|
init( encoder.sink.get(), encoder.lowpass, encoder.highpass );
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the version string of the underlying lame library.
|
||||||
|
*
|
||||||
|
* @return the version string of the underlying lame library.
|
||||||
|
*/
|
||||||
|
inline const char *
|
||||||
|
getLameVersion( void )
|
||||||
|
{
|
||||||
|
return get_lame_version();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check wether encoding is in progress.
|
||||||
|
*
|
||||||
|
* @return true if encoding is in progress, false otherwise.
|
||||||
|
*/
|
||||||
|
inline virtual bool
|
||||||
|
isRunning ( void ) const throw ()
|
||||||
|
{
|
||||||
|
return isOpen();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start encoding. This function returns as soon as possible,
|
||||||
|
* with encoding started in the background.
|
||||||
|
*
|
||||||
|
* @return true if encoding has started, false otherwise.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
inline virtual bool
|
||||||
|
start ( void ) throw ( Exception )
|
||||||
|
{
|
||||||
|
return open();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop encoding. Stops the encoding running in the background.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
inline virtual void
|
||||||
|
stop ( void ) throw ( Exception )
|
||||||
|
{
|
||||||
|
return close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open an encoding session.
|
||||||
|
*
|
||||||
|
* @return true if opening was successfull, false otherwise.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
virtual bool
|
||||||
|
open ( void ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the encoding session is open.
|
||||||
|
*
|
||||||
|
* @return true if the encoding session is open, false otherwise.
|
||||||
|
*/
|
||||||
|
inline virtual bool
|
||||||
|
isOpen ( void ) const throw ()
|
||||||
|
{
|
||||||
|
return lameGlobalFlags != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the encoder is ready to accept data.
|
||||||
|
*
|
||||||
|
* @param sec the maximum seconds to block.
|
||||||
|
* @param usec micro seconds to block after the full seconds.
|
||||||
|
* @return true if the encoder is ready to accept data,
|
||||||
|
* false otherwise.
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
inline virtual bool
|
||||||
|
canWrite ( unsigned int sec,
|
||||||
|
unsigned int usec ) throw ( Exception )
|
||||||
|
{
|
||||||
|
if ( !isOpen() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write data to the encoder.
|
||||||
|
* Buf is expected to be a sequence of big-endian 16 bit values,
|
||||||
|
* with left and right channels interleaved. Len is the number of
|
||||||
|
* bytes, must be a multiple of 4.
|
||||||
|
*
|
||||||
|
* @param buf the data to write.
|
||||||
|
* @param len number of bytes to write from buf.
|
||||||
|
* @return the number of bytes written (may be less than len).
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
virtual unsigned int
|
||||||
|
write ( const void * buf,
|
||||||
|
unsigned int len ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flush all data that was written to the encoder to the underlying
|
||||||
|
* connection.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
flush ( void ) throw ( Exception );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the encoding session.
|
||||||
|
*
|
||||||
|
* @exception Exception
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
close ( void ) throw ( Exception );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* LAME_LIB_ENCODER_H */
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$Sourc$
|
||||||
|
|
||||||
|
$Log$
|
||||||
|
Revision 1.1 2001/08/26 20:44:30 darkeye
|
||||||
|
removed external command-line encoder support
|
||||||
|
replaced it with a shared-object support for lame with the possibility
|
||||||
|
of static linkage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
bin_PROGRAMS = darkice
|
bin_PROGRAMS = darkice
|
||||||
INCLUDES = -I../stl
|
INCLUDES = -I../stl @LAME_INCFLAGS@
|
||||||
CXXFLAGS = -g -Wall
|
CXXFLAGS = -g -Wall
|
||||||
|
LDADD = @LAME_LDFLAGS@ @LINK_STATIC@
|
||||||
|
|
||||||
darkice_SOURCES = AudioEncoder.h\
|
darkice_SOURCES = AudioEncoder.h\
|
||||||
AudioSource.h\
|
AudioSource.h\
|
||||||
|
@ -14,22 +15,12 @@ darkice_SOURCES = AudioEncoder.h\
|
||||||
DarkIce.h\
|
DarkIce.h\
|
||||||
Exception.cpp\
|
Exception.cpp\
|
||||||
Exception.h\
|
Exception.h\
|
||||||
ExternalEncoder.cpp\
|
|
||||||
ExternalEncoder.h\
|
|
||||||
FileSink.cpp\
|
|
||||||
FileSink.h\
|
|
||||||
FileSource.cpp\
|
|
||||||
FileSource.h\
|
|
||||||
IceCast.cpp\
|
IceCast.cpp\
|
||||||
IceCast.h\
|
IceCast.h\
|
||||||
LameEncoder.cpp\
|
LameLibEncoder.cpp\
|
||||||
LameEncoder.h\
|
LameLibEncoder.h\
|
||||||
OssDspSource.cpp\
|
OssDspSource.cpp\
|
||||||
OssDspSource.h\
|
OssDspSource.h\
|
||||||
PipeSink.cpp\
|
|
||||||
PipeSink.h\
|
|
||||||
PipeSource.cpp\
|
|
||||||
PipeSource.h\
|
|
||||||
Ref.h\
|
Ref.h\
|
||||||
Referable.h\
|
Referable.h\
|
||||||
Sink.h\
|
Sink.h\
|
||||||
|
|
|
@ -1,144 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
|
||||||
|
|
||||||
Tyrell DarkIce
|
|
||||||
|
|
||||||
File : PipeSink.cpp
|
|
||||||
Version : $Revision$
|
|
||||||
Author : $Author$
|
|
||||||
Location : $Source$
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "configure.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_STAT_H
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#else
|
|
||||||
#error need sys/stat.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
|
||||||
#include <fcntl.h>
|
|
||||||
#else
|
|
||||||
#error need fcntl.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#else
|
|
||||||
#error need sys/types.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ERRNO_H
|
|
||||||
#include <errno.h>
|
|
||||||
#else
|
|
||||||
#error need errno.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "Exception.h"
|
|
||||||
#include "PipeSink.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* =================================================== local data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================ local constants & macros */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* File identity
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
static const char fileid[] = "$Id$";
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================= module code */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Create a pipe
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
bool
|
|
||||||
PipeSink :: create ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( isOpen() ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( mkfifo( getFileName(), S_IRUSR | S_IWUSR) == -1 ) {
|
|
||||||
if ( errno == EEXIST ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
throw Exception( __FILE__, __LINE__, "mkfifo error", errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Open the file
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
bool
|
|
||||||
PipeSink :: open ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( isOpen() ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (fileDescriptor = ::open( getFileName(), O_WRONLY, 0)) == -1 ) {
|
|
||||||
fileDescriptor = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$Source$
|
|
||||||
|
|
||||||
$Log$
|
|
||||||
Revision 1.5 2000/11/17 15:50:48 darkeye
|
|
||||||
added -Wall flag to compiler and eleminated new warnings
|
|
||||||
|
|
||||||
Revision 1.4 2000/11/11 12:33:13 darkeye
|
|
||||||
added kdoc-style documentation
|
|
||||||
|
|
||||||
Revision 1.3 2000/11/10 20:10:46 darkeye
|
|
||||||
changed from non-blocking to blocking
|
|
||||||
|
|
||||||
Revision 1.2 2000/11/05 14:08:28 darkeye
|
|
||||||
changed builting to an automake / autoconf environment
|
|
||||||
|
|
||||||
Revision 1.1.1.1 2000/11/05 10:05:53 darkeye
|
|
||||||
initial version
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -1,174 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
|
||||||
|
|
||||||
Tyrell DarkIce
|
|
||||||
|
|
||||||
File : PipeSink.h
|
|
||||||
Version : $Revision$
|
|
||||||
Author : $Author$
|
|
||||||
Location : $Source$
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
#ifndef PIPE_SINK_H
|
|
||||||
#define PIPE_SINK_H
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#error This is a C++ include file
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#include "FileSink.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================================ constants */
|
|
||||||
|
|
||||||
|
|
||||||
/* =================================================================== macros */
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================================== data types */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FIFO pipe data output
|
|
||||||
*
|
|
||||||
* @author $Author$
|
|
||||||
* @version $Revision$
|
|
||||||
*/
|
|
||||||
class PipeSink : public FileSink
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor. Always throws an Exception.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
PipeSink ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
throw Exception( __FILE__, __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor by a pipe name.
|
|
||||||
*
|
|
||||||
* @param name name of the pipe to be represented by the object.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
PipeSink ( const char * name ) throw ( Exception )
|
|
||||||
: FileSink( name )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy constructor.
|
|
||||||
*
|
|
||||||
* @param fsink the PipeSink to copy.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
PipeSink ( const PipeSink & ps ) throw ( Exception )
|
|
||||||
: FileSink( ps )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assignment operator.
|
|
||||||
*
|
|
||||||
* @param ps the PipeSink to assign to this object.
|
|
||||||
* @return a reference to this object.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline virtual PipeSink &
|
|
||||||
operator= ( const PipeSink & ps ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( this != &ps ) {
|
|
||||||
FileSink::operator=( ps );
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual inline
|
|
||||||
~PipeSink( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the pipe.
|
|
||||||
*
|
|
||||||
* @return true if creation was successful, false otherwise.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual bool
|
|
||||||
create ( void ) throw ( Exception );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Open the pipe.
|
|
||||||
*
|
|
||||||
* @return true if opening was successful, false otherwise.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual bool
|
|
||||||
open ( void ) throw ( Exception );
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================= external data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ====================================================== function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* PIPE_SINK_H */
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$Source$
|
|
||||||
|
|
||||||
$Log$
|
|
||||||
Revision 1.3 2000/11/11 12:33:13 darkeye
|
|
||||||
added kdoc-style documentation
|
|
||||||
|
|
||||||
Revision 1.2 2000/11/05 17:37:24 darkeye
|
|
||||||
removed clone() functions
|
|
||||||
|
|
||||||
Revision 1.1.1.1 2000/11/05 10:05:53 darkeye
|
|
||||||
initial version
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -1,122 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
|
||||||
|
|
||||||
Tyrell DarkIce
|
|
||||||
|
|
||||||
File : PipeSource.cpp
|
|
||||||
Version : $Revision$
|
|
||||||
Author : $Author$
|
|
||||||
Location : $Source$
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "configure.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_STAT_H
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#else
|
|
||||||
#error need sys/stat.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
|
||||||
#include <fcntl.h>
|
|
||||||
#else
|
|
||||||
#error need fcntl.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#else
|
|
||||||
#error need sys/types.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ERRNO_H
|
|
||||||
#include <errno.h>
|
|
||||||
#else
|
|
||||||
#error need errno.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "Exception.h"
|
|
||||||
#include "PipeSource.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* =================================================== local data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================ local constants & macros */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* File identity
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
static const char fileid[] = "$Id$";
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================= module code */
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Create a pipe
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
bool
|
|
||||||
PipeSource :: create ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( isOpen() ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( mkfifo( getFileName(), S_IRUSR | S_IWUSR) == -1 ) {
|
|
||||||
if ( errno == EEXIST ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
throw Exception( __FILE__, __LINE__, "mkfifo error", errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$Source$
|
|
||||||
|
|
||||||
$Log$
|
|
||||||
Revision 1.4 2000/11/17 15:50:48 darkeye
|
|
||||||
added -Wall flag to compiler and eleminated new warnings
|
|
||||||
|
|
||||||
Revision 1.3 2000/11/12 13:31:40 darkeye
|
|
||||||
added kdoc-style documentation comments
|
|
||||||
|
|
||||||
Revision 1.2 2000/11/05 14:08:28 darkeye
|
|
||||||
changed builting to an automake / autoconf environment
|
|
||||||
|
|
||||||
Revision 1.1.1.1 2000/11/05 10:05:53 darkeye
|
|
||||||
initial version
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -1,169 +0,0 @@
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2000 Tyrell Corporation. All rights reserved.
|
|
||||||
|
|
||||||
Tyrell DarkIce
|
|
||||||
|
|
||||||
File : PipeSource.h
|
|
||||||
Version : $Revision$
|
|
||||||
Author : $Author$
|
|
||||||
Location : $Source$
|
|
||||||
|
|
||||||
Abstract :
|
|
||||||
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
||||||
USA.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
#ifndef PIPE_SOURCE_H
|
|
||||||
#define PIPE_SOURCE_H
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#error This is a C++ include file
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================ include files */
|
|
||||||
|
|
||||||
#include "FileSource.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================================ constants */
|
|
||||||
|
|
||||||
|
|
||||||
/* =================================================================== macros */
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================================== data types */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FIFO pipe data input
|
|
||||||
*
|
|
||||||
* @author $Author$
|
|
||||||
* @version $Revision$
|
|
||||||
*/
|
|
||||||
class PipeSource : public FileSource
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor. Always throws an Exception.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
PipeSource ( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
throw Exception( __FILE__, __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor by a file name.
|
|
||||||
*
|
|
||||||
* @param name name of the file to be represented by the object.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
PipeSource ( const char * name ) throw ( Exception )
|
|
||||||
: FileSource( name )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy constructor.
|
|
||||||
*
|
|
||||||
* @param ps the PipeSource to copy.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline
|
|
||||||
PipeSource ( const PipeSource & ps ) throw ( Exception )
|
|
||||||
: FileSource( ps )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assignment operator.
|
|
||||||
*
|
|
||||||
* @param ps the PipeSource to assign to this object.
|
|
||||||
* @return a reference to this object.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
inline virtual PipeSource &
|
|
||||||
operator= ( const PipeSource & ps ) throw ( Exception )
|
|
||||||
{
|
|
||||||
if ( this != &ps ) {
|
|
||||||
FileSource::operator=( ps );
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor.
|
|
||||||
*
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual inline
|
|
||||||
~PipeSource( void ) throw ( Exception )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the pipe.
|
|
||||||
*
|
|
||||||
* @return true if creation was successful, false otherwise.
|
|
||||||
* @exception Exception
|
|
||||||
*/
|
|
||||||
virtual bool
|
|
||||||
create ( void ) throw ( Exception );
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* ================================================= external data structures */
|
|
||||||
|
|
||||||
|
|
||||||
/* ====================================================== function prototypes */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* PIPE_SOURCE_H */
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$Source$
|
|
||||||
|
|
||||||
$Log$
|
|
||||||
Revision 1.3 2000/11/12 13:31:40 darkeye
|
|
||||||
added kdoc-style documentation comments
|
|
||||||
|
|
||||||
Revision 1.2 2000/11/05 17:37:24 darkeye
|
|
||||||
removed clone() functions
|
|
||||||
|
|
||||||
Revision 1.1.1.1 2000/11/05 10:05:53 darkeye
|
|
||||||
initial version
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -3,5 +3,6 @@
|
||||||
# Update the automake / autoconf configuration
|
# Update the automake / autoconf configuration
|
||||||
#
|
#
|
||||||
|
|
||||||
automake && aclocal && autoconf && ./configure
|
rm config.* configure configure.h aclocal.m4
|
||||||
|
autoheader && automake && aclocal && autoconf && ./configure
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue