summaryrefslogtreecommitdiff
path: root/server/libmplex_wrapper.cc
diff options
context:
space:
mode:
authordeva <deva>2006-07-20 17:53:17 +0000
committerdeva <deva>2006-07-20 17:53:17 +0000
commit7d39c063ea84b9b30dbe669ac4ae641a49506836 (patch)
treeef1ead10d1736e9ad7ffe139872c86fd2ee00901 /server/libmplex_wrapper.cc
parentc8df40b62cf30029a4acd1a57c8c54add54dda9b (diff)
Utilized the global info object.
Utilized the global info object. Utilized the global info object.
Diffstat (limited to 'server/libmplex_wrapper.cc')
-rw-r--r--server/libmplex_wrapper.cc71
1 files changed, 32 insertions, 39 deletions
diff --git a/server/libmplex_wrapper.cc b/server/libmplex_wrapper.cc
index 4164ffe..e026656 100644
--- a/server/libmplex_wrapper.cc
+++ b/server/libmplex_wrapper.cc
@@ -39,13 +39,15 @@
#include <mplex/outputstrm.hpp>
#include <mplex/multiplexor.hpp>
+#include "info.h"
+
/**
* FrameOutputStream - Wraps the File object
*/
class FrameOutputStream : public OutputStream
{
public:
- FrameOutputStream( Info *info, File *outputfile );
+ FrameOutputStream(File *outputfile );
int Open( );
void Close();
off_t SegmentSize( );
@@ -53,38 +55,36 @@ public:
void Write(uint8_t *data, unsigned int len);
private:
- Info *info;
off_t written;
File *file;
};
-FrameOutputStream::FrameOutputStream( Info *info, File *outputfile )
+FrameOutputStream::FrameOutputStream(File *outputfile )
{
- this->info = info;
file = outputfile;
written = 0;
- info->info("FrameOutputStream - constructor");
+ MIaV::info->info("FrameOutputStream - constructor");
}
int FrameOutputStream::Open()
{
- // info->info("FrameOutputStream::Open");
+ // MIaV::info->info("FrameOutputStream::Open");
// Nothing to do here!
return 0;
}
void FrameOutputStream::Close()
{
- // info->info("FrameOutputStream::Close");
+ // MIaV::info->info("FrameOutputStream::Close");
// Nothing to do here!
}
off_t FrameOutputStream::SegmentSize()
{
- // info->info("FrameOutputStream::SegmentSize - return: %d", written);
+ // MIaV::info->info("FrameOutputStream::SegmentSize - return: %d", written);
return written;
/*
@@ -97,7 +97,7 @@ off_t FrameOutputStream::SegmentSize()
void FrameOutputStream::NextSegment( )
{
- // info->info("FrameOutputStream::NextSegment");
+ // MIaV::info->info("FrameOutputStream::NextSegment");
// Nothing to do here!
/*
auto_ptr<char> prev_filename_buf( new char[strlen(cur_filename)+1] );
@@ -122,7 +122,7 @@ void FrameOutputStream::Write( uint8_t *buf, unsigned int len )
unsigned int write;
write = file->Write(buf, len);
written += write;
- // info->info("FrameOutputStream::Write - len: %d", len);
+ // MIaV::info->info("FrameOutputStream::Write - len: %d", len);
}
/**
@@ -132,7 +132,7 @@ void FrameOutputStream::Write( uint8_t *buf, unsigned int len )
class FrameInputStream : public IBitStream
{
public:
- FrameInputStream( Info *info, ThreadSafeQueuePriority *queue );
+ FrameInputStream(ThreadSafeQueuePriority *queue );
~FrameInputStream();
private:
@@ -140,24 +140,22 @@ private:
size_t ReadStreamBytes( uint8_t *buf, size_t size );
bool EndOfStream();
- Info *info;
ThreadSafeQueuePriority *queue;
bool seen_eof;
Frame *frame;
unsigned int read;
};
-FrameInputStream::FrameInputStream( Info *info, ThreadSafeQueuePriority *queue ) :
+FrameInputStream::FrameInputStream(ThreadSafeQueuePriority *queue ) :
IBitStream()
{
- this->info = info;
this->queue = queue;
seen_eof = false;
frame = NULL;
read = 0;
streamname = "MIaV Stream\0";
- // info->info("FrameInputStream - constructor", seen_eof);
+ // MIaV::info->info("FrameInputStream - constructor", seen_eof);
/*
if ((fileh = fopen(bs_filename, "rb")) == NULL)
@@ -184,11 +182,11 @@ FrameInputStream::FrameInputStream( Info *info, ThreadSafeQueuePriority *queue )
byteidx = 0;
if (!ReadIntoBuffer()) {
if (buffered==0) {
- info->error( "Unable to read from %s.", streamname);
+ MIaV:: info->error( "Unable to read from %s.", streamname);
}
}
- // info->info("FrameInputStream - leaving constructor", seen_eof);
+ // MIaV::info->info("FrameInputStream - leaving constructor", seen_eof);
}
@@ -198,7 +196,7 @@ FrameInputStream::FrameInputStream( Info *info, ThreadSafeQueuePriority *queue )
*/
FrameInputStream::~FrameInputStream()
{
- // info->info("FrameInputStream - destructor", seen_eof);
+ // MIaV::info->info("FrameInputStream - destructor", seen_eof);
// Nothing to do here!
/*
if (fileh)
@@ -219,13 +217,13 @@ Frame *FrameInputStream::getFrame()
bool FrameInputStream::EndOfStream()
{
- // info->info("FrameInputStream::EndOfStream - return: %d", seen_eof);
+ // MIaV::info->info("FrameInputStream::EndOfStream - return: %d", seen_eof);
return seen_eof;
}
size_t FrameInputStream::ReadStreamBytes( uint8_t *buf, size_t size )
{
- // info->info("FrameInputStream::ReadStreamBytes - size: %d", size);
+ // MIaV::info->info("FrameInputStream::ReadStreamBytes - size: %d", size);
unsigned int copied = 0;
while( copied < size ) {
@@ -251,7 +249,7 @@ size_t FrameInputStream::ReadStreamBytes( uint8_t *buf, size_t size )
unsigned int doread = (size - copied) < (frame->size - read) ?
size - copied : (frame->size - read);
- //info->info("Requested: %d. Read: %d. Doread: %d. In buffer %d", size, (*read), doread, (*frame)->size);
+ //MIaV::info->info("Requested: %d. Read: %d. Doread: %d. In buffer %d", size, (*read), doread, (*frame)->size);
memcpy(buf + copied, frame->data + read, doread);
read += doread;
@@ -272,8 +270,7 @@ size_t FrameInputStream::ReadStreamBytes( uint8_t *buf, size_t size )
class MIaVMultiplexJob : public MultiplexJob
{
public:
- MIaVMultiplexJob(Info *info,
- ThreadSafeQueuePriority *video_queue,
+ MIaVMultiplexJob(ThreadSafeQueuePriority *video_queue,
ThreadSafeQueuePriority *audio_queue);
private:
@@ -281,13 +278,11 @@ private:
bool ParseLpcmOpt( const char *optarg );
};
-MIaVMultiplexJob::MIaVMultiplexJob(Info *info,
- ThreadSafeQueuePriority *video_queue,
+MIaVMultiplexJob::MIaVMultiplexJob(ThreadSafeQueuePriority *video_queue,
ThreadSafeQueuePriority *audio_queue) :
MultiplexJob()
{
- // this->info = info;
- // info->info("MIaVMultiplexJob - constructor");
+ // MIaV::info->info("MIaVMultiplexJob - constructor");
outfile_pattern = "/tmp/aaargh.mpg"; // Output file... or something
verbose = 0; // Level of verbosity. 0 = quiet, 1 = normal 2 = verbose/debug
@@ -298,10 +293,10 @@ MIaVMultiplexJob::MIaVMultiplexJob(Info *info,
// Specifies decoder buffers size in kB. [ 20...2000]
if( ! ParseVideoOpt( "500" ) )
- info->error( "Illegal video decoder buffer size(s): %s", "500" );
+ MIaV::info->error( "Illegal video decoder buffer size(s): %s", "500" );
// --lpcm-params | -L samppersec:chan:bits [, samppersec:chan:bits]
- // if( ! ParseLpcmOpt( "48000:2:16" ) ) info->error( "Illegal LPCM option(s): %s", "48000:2:16" );
+ // if( ! ParseLpcmOpt( "48000:2:16" ) ) MIaV::info->error( "Illegal LPCM option(s): %s", "48000:2:16" );
data_rate = 0; //Specify data rate of output stream in kbit/sec (default 0=Compute from source streams)
// Convert from kbit/sec (user spec) to 50B/sec units...
@@ -334,12 +329,12 @@ MIaVMultiplexJob::MIaVMultiplexJob(Info *info,
// is encountered ithe input video
(void)mjpeg_default_handler_verbosity(verbose);
- info->info( "mplex version %s (%s %s)", VERSION,MPLEX_VER, MPLEX_DATE );
+ MIaV::info->info( "mplex version %s (%s %s)", VERSION,MPLEX_VER, MPLEX_DATE );
// Connect streams
vector<IBitStream *> inputs;
- if(video_queue) inputs.push_back( new FrameInputStream( info, video_queue ) );
- if(audio_queue) inputs.push_back( new FrameInputStream( info, audio_queue ) );
+ if(video_queue) inputs.push_back( new FrameInputStream(video_queue ) );
+ if(audio_queue) inputs.push_back( new FrameInputStream(audio_queue ) );
SetupInputStreams( inputs );
}
@@ -445,12 +440,10 @@ bool MIaVMultiplexJob::ParseVideoOpt( const char *optarg )
return true;
}
-LibMPlexWrapper::LibMPlexWrapper(Info *info,
- File *outputfile,
+LibMPlexWrapper::LibMPlexWrapper(File *outputfile,
ThreadSafeQueuePriority *video_queue,
ThreadSafeQueuePriority *audio_queue)
{
- this->info = info;
this->outputfile = outputfile;
this->video_queue = video_queue;
this->audio_queue = audio_queue;
@@ -463,11 +456,11 @@ LibMPlexWrapper::~LibMPlexWrapper()
void LibMPlexWrapper::multiplex()
{
- // info->info("MPLEX!");
+ // MIaV::info->info("MPLEX!");
// sleep(10);
- // info->info("The road goes ever on and on...");
- MIaVMultiplexJob job(info, video_queue, audio_queue);
- FrameOutputStream output( info, outputfile );
+ // MIaV::info->info("The road goes ever on and on...");
+ MIaVMultiplexJob job(video_queue, audio_queue);
+ FrameOutputStream output(outputfile );
Multiplexor mux(job, output);
mux.Multiplex();
}