summaryrefslogtreecommitdiff
path: root/server
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
parentc8df40b62cf30029a4acd1a57c8c54add54dda9b (diff)
Utilized the global info object.
Utilized the global info object. Utilized the global info object.
Diffstat (limited to 'server')
-rw-r--r--server/audio_encoder.cc18
-rw-r--r--server/audio_encoder.h5
-rw-r--r--server/img_encoder.cc13
-rw-r--r--server/img_encoder.h3
-rw-r--r--server/info_console.cc5
-rw-r--r--server/info_console.h12
-rw-r--r--server/libfame_wrapper.cc16
-rw-r--r--server/libfame_wrapper.h5
-rw-r--r--server/liblame_wrapper.cc29
-rw-r--r--server/liblame_wrapper.h5
-rw-r--r--server/libmplex_wrapper.cc71
-rw-r--r--server/libmplex_wrapper.h5
-rw-r--r--server/miav_daemon.cc25
-rw-r--r--server/mov_encoder.cc17
-rw-r--r--server/mov_encoder.h7
-rw-r--r--server/mov_encoder_thread.cc43
-rw-r--r--server/mov_encoder_thread.h6
-rw-r--r--server/mov_encoder_writer.cc32
-rw-r--r--server/mov_encoder_writer.h5
-rw-r--r--server/multicast.cc20
-rw-r--r--server/multicast.h5
-rw-r--r--server/multicast_configuration.cc10
-rw-r--r--server/multicast_configuration.h2
-rw-r--r--server/multiplexer.cc37
-rw-r--r--server/multiplexer.h4
-rw-r--r--server/server.cc25
-rw-r--r--server/server.h5
-rw-r--r--server/server_status.cc8
-rw-r--r--server/server_status.h5
29 files changed, 190 insertions, 253 deletions
diff --git a/server/audio_encoder.cc b/server/audio_encoder.cc
index 6e412c3..02538f2 100644
--- a/server/audio_encoder.cc
+++ b/server/audio_encoder.cc
@@ -28,14 +28,14 @@
#include "audio_encoder.h"
#include "util.h"
+#include "info.h"
+
#include "liblame_wrapper.h"
AudioEncoder::AudioEncoder(ThreadSafeQueuePriority *audio_input_queue,
- ThreadSafeQueuePriority *audio_output_queue,
- Info *i)
+ ThreadSafeQueuePriority *audio_output_queue)
{
- info = i;
- info->info("AudioEncoder");
+ MIaV::info->info("AudioEncoder");
running = true;
@@ -49,7 +49,7 @@ AudioEncoder::~AudioEncoder()
void AudioEncoder::thread_main()
{
- info->info("AudioEncoder::run");
+ MIaV::info->info("AudioEncoder::run");
// Run with slightly lower priority than MovEncoderWriter
nice(1);
@@ -57,16 +57,16 @@ void AudioEncoder::thread_main()
Frame *in_frame = NULL;
Frame *out_frame = NULL;
- LibLAMEWrapper lame(info);
+ LibLAMEWrapper lame;
while(running) {
in_frame = input_queue->pop();
- if(in_frame == NULL) info->error("AudioEncoder: in_frame == NULL!");
+ if(in_frame == NULL) MIaV::info->error("AudioEncoder: in_frame == NULL!");
// Check for end of stream
if(in_frame->endOfFrameStream == true) {
- info->info("endOfFrameStream in AudioEncoder");
+ MIaV::info->info("endOfFrameStream in AudioEncoder");
running = false;
out_frame = lame.close();
} else {
@@ -82,7 +82,7 @@ void AudioEncoder::thread_main()
output_queue->push(out_frame);
}
- info->info("AudioEncoder::stop");
+ MIaV::info->info("AudioEncoder::stop");
}
diff --git a/server/audio_encoder.h b/server/audio_encoder.h
index 9d86178..7844c0d 100644
--- a/server/audio_encoder.h
+++ b/server/audio_encoder.h
@@ -41,8 +41,7 @@
class AudioEncoder : public Thread {
public:
AudioEncoder(ThreadSafeQueuePriority *audio_input_queue,
- ThreadSafeQueuePriority *audio_output_queue,
- Info *info);
+ ThreadSafeQueuePriority *audio_output_queue);
~AudioEncoder();
void thread_main();
@@ -50,8 +49,6 @@ public:
volatile bool running;
private:
- Info *info;
-
ThreadSafeQueuePriority *input_queue;
ThreadSafeQueuePriority *output_queue;
};
diff --git a/server/img_encoder.cc b/server/img_encoder.cc
index 2ed0113..df44686 100644
--- a/server/img_encoder.cc
+++ b/server/img_encoder.cc
@@ -35,6 +35,9 @@
#include "img_encoder.h"
#include <stdio.h>
+#include "miav_config.h"
+#include "info.h"
+
extern "C" {
#include <jpeglib.h>
}
@@ -45,13 +48,11 @@ extern "C" {
#include <libdv/dv.h>
#include <libdv/dv_types.h>
-ImgEncoder::ImgEncoder(const char* cpr, Info *i)
+ImgEncoder::ImgEncoder(const char* cpr)
{
- info = i;
-
// Create path and filename
char fname[256];
- string *server_root;
+ std::string *server_root;
char birthmonth[3];
char date[32];
char encrypted_cpr[32];
@@ -90,7 +91,7 @@ ImgEncoder::ImgEncoder(const char* cpr, Info *i)
sprintf(fname, "%s/%s/%s/%s-%s-", server_root->c_str(), birthmonth, encrypted_cpr, cpr, date);
- file = new File(fname, "jpg", info);
+ file = new File(fname, "jpg");
}
@@ -155,7 +156,7 @@ void ImgEncoder::writeJPEGFile(int quality, unsigned char *rgb, int image_width,
// Release JPEG compression object
jpeg_destroy_compress(&cinfo);
- info->info("JPEG buffersize: %d", buffersize);
+ MIaV::info->info("JPEG buffersize: %d", buffersize);
file->Write(jpeg_output_buffer, buffersize);
delete jpeg_output_buffer;
}
diff --git a/server/img_encoder.h b/server/img_encoder.h
index 9745a8f..c9b8885 100644
--- a/server/img_encoder.h
+++ b/server/img_encoder.h
@@ -51,7 +51,7 @@
class ImgEncoder {
public:
- ImgEncoder(const char* cpr, Info *info);
+ ImgEncoder(const char* cpr);
~ImgEncoder();
void encode(Frame *frame, int quality);
void writeJPEGFile(int quality,
@@ -61,7 +61,6 @@ public:
private:
File *file;
- Info *info;
void getRGB(Frame *frame, unsigned char *rgb);
};
diff --git a/server/info_console.cc b/server/info_console.cc
index ce406fb..da99b7a 100644
--- a/server/info_console.cc
+++ b/server/info_console.cc
@@ -32,10 +32,9 @@
#include <stdio.h>
#include <stdarg.h>
-InfoConsole::InfoConsole(MiavConfig *c): Info()
+InfoConsole::InfoConsole(): Info()
{
- this->config = c;
- log_filename = *(this->config->readString("server_log_file"));
+ log_filename = *(MIaV::config->readString("server_log_file"));
}
InfoConsole::~InfoConsole()
diff --git a/server/info_console.h b/server/info_console.h
index 2adcad6..c3c4899 100644
--- a/server/info_console.h
+++ b/server/info_console.h
@@ -30,24 +30,14 @@
#include "info.h"
-#include "miav_config.h"
-
-#include <pthread.h>
-#include <semaphore.h>
-
-#include <string>
-using namespace std;
-
class InfoConsole: public Info {
public:
- InfoConsole(MiavConfig *config);
+ InfoConsole();
~InfoConsole();
void error(char* fmt, ...);
void warn(char* fmt, ...);
void info(char* fmt, ...);
-
-private:
};
#endif/*__MIAV_INFO_CONSOLE_H__*/
diff --git a/server/libfame_wrapper.cc b/server/libfame_wrapper.cc
index e1d3660..c5df05c 100644
--- a/server/libfame_wrapper.cc
+++ b/server/libfame_wrapper.cc
@@ -30,12 +30,12 @@
#include <errno.h>
#include "miav_config.h"
+#include "info.h"
+
#include "frame.h"
-LibFAMEWrapper::LibFAMEWrapper(Info *i)
+LibFAMEWrapper::LibFAMEWrapper()
{
- info = i;
-
// FIXME: Hmmm... should this be detected somewhere?!
int w = 720;
int h = 576;
@@ -65,7 +65,7 @@ LibFAMEWrapper::LibFAMEWrapper(Info *i)
// can then be used for subsequent library calls.)
fame_context = fame_open();
if(!fame_context) {
- info->error("Unable to open FAME context, due to the following error: %s", strerror(errno));
+ MIaV::info->error("Unable to open FAME context, due to the following error: %s", strerror(errno));
return;
}
@@ -135,7 +135,7 @@ LibFAMEWrapper::LibFAMEWrapper(Info *i)
if(strcmp(MIaV::config->readString("encoding_codec")->c_str(), "mpeg4") == 0) {
- info->info("Using mpeg4 compression.");
+ MIaV::info->info("Using mpeg4 compression.");
fame_object_t *object;
object = fame_get_object(fame_context, "profile/mpeg4/simple");
@@ -143,7 +143,7 @@ LibFAMEWrapper::LibFAMEWrapper(Info *i)
} else if(strcmp(MIaV::config->readString("encoding_codec")->c_str(), "mpeg1") == 0) {
- info->info("Using mpeg1 compression.");
+ MIaV::info->info("Using mpeg1 compression.");
fame_object_t *object;
object = fame_get_object(fame_context, "profile/mpeg1");
@@ -151,7 +151,7 @@ LibFAMEWrapper::LibFAMEWrapper(Info *i)
} else if(strcmp(MIaV::config->readString("encoding_codec")->c_str(), "mpeg1") == 0) {
} else {
- info->info("Using default (mpeg1) compression.");
+ MIaV::info->info("Using default (mpeg1) compression.");
}
fame_init(fame_context, &fame_par, fame_buffer, FAME_BUFFER_SIZE);
@@ -246,7 +246,7 @@ Frame *LibFAMEWrapper::encode(Frame *dvframe)
// fame_end_frame(fame_context, &stats);
/*
- info->info("frame_number: %d, coding: %c, target_bits: %d, actual_bits: %d, spatial_activity: %d, quant_scale: %f",
+ MIaV::info->info("frame_number: %d, coding: %c, target_bits: %d, actual_bits: %d, spatial_activity: %d, quant_scale: %f",
stats.frame_number,
stats.coding,
stats.target_bits,
diff --git a/server/libfame_wrapper.h b/server/libfame_wrapper.h
index bf9e7b9..db75880 100644
--- a/server/libfame_wrapper.h
+++ b/server/libfame_wrapper.h
@@ -36,14 +36,13 @@
#include <libdv/dv_types.h>
#include "frame.h"
-#include "info.h"
// size specifies the length of the buffer.
#define FAME_BUFFER_SIZE (1024*1024) // FIXME: One size fits all...
class LibFAMEWrapper {
public:
- LibFAMEWrapper(Info *info);
+ LibFAMEWrapper();
~LibFAMEWrapper();
Frame *encode(Frame *dvframe);
@@ -52,8 +51,6 @@ private:
unsigned long long calc_bitrate;
unsigned int frame_number;
- Info* info;
-
// libFAME encoder
// unsigned char *fame_buffer;
fame_parameters_t fame_par;
diff --git a/server/liblame_wrapper.cc b/server/liblame_wrapper.cc
index 137ac6a..9bac35b 100644
--- a/server/liblame_wrapper.cc
+++ b/server/liblame_wrapper.cc
@@ -27,14 +27,13 @@
#include <config.h>
#include "liblame_wrapper.h"
#include "miav_config.h"
+#include "info.h"
-LibLAMEWrapper::LibLAMEWrapper(Info *i)
+LibLAMEWrapper::LibLAMEWrapper()
{
- info = i;
-
// Init library.
if( (gfp = lame_init()) == NULL) {
- info->error("LAME initialization failed (due to malloc failure!)");
+ MIaV::info->error("LAME initialization failed (due to malloc failure!)");
return;
}
@@ -72,7 +71,7 @@ LibLAMEWrapper::LibLAMEWrapper(Info *i)
if (lame_init_params(gfp) < 0) {
- info->error("LAME parameter initialization failed.");
+ MIaV::info->error("LAME parameter initialization failed.");
return;
}
@@ -193,24 +192,24 @@ Frame *LibLAMEWrapper::encode(Frame *dvframe)
val = lame_encode_buffer(gfp, buffer_l, buffer_r, nsamples, mp3buf, mp3buf_size);
// val = lame_encode_mp3_frame(gfp, buffer_l, buffer_r, mp3buf, mp3buf_size);
- // info->info("Framenr: %d", lame_get_frameNum(gfp));
+ // MIaV::info->info("Framenr: %d", lame_get_frameNum(gfp));
if(val < 0) {
switch(val) {
case -1: // mp3buf was too small
- info->error("Lame encoding failed, mp3buf was too small.");
+ MIaV::info->error("Lame encoding failed, mp3buf was too small.");
break;
case -2: // malloc() problem
- info->error("Lame encoding failed, due to malloc() problem.");
+ MIaV::info->error("Lame encoding failed, due to malloc() problem.");
break;
case -3: // lame_init_params() not called
- info->error("Lame encoding failed, lame_init_params() not called.");
+ MIaV::info->error("Lame encoding failed, lame_init_params() not called.");
break;
case -4: // psycho acoustic problems
- info->error("Lame encoding failed, due to psycho acoustic problems.");
+ MIaV::info->error("Lame encoding failed, due to psycho acoustic problems.");
break;
default:
- info->error("Lame encoding failed, due to unknown error.");
+ MIaV::info->error("Lame encoding failed, due to unknown error.");
break;
}
}
@@ -241,7 +240,7 @@ Frame *LibLAMEWrapper::encode(Frame *dvframe)
mp3buf_size - val); // number of valid octets in this stream
*/
- // info->info("VAL: %d - FLUSH_SZ: %d - TOTAL: %d", val, flush_sz, (val + flush_sz));
+ // MIaV::info->info("VAL: %d - FLUSH_SZ: %d - TOTAL: %d", val, flush_sz, (val + flush_sz));
audio_frame->size = val + flush_sz;
@@ -251,7 +250,7 @@ Frame *LibLAMEWrapper::encode(Frame *dvframe)
// lame_bitrate_kbps(gfp, bitrate_kbps);
lame_bitrate_hist(gfp, bitrate_kbps);
// 32 40 48 56 64 80 96 112 128 160 192 224 256 320
- info->info("%d %d %d %d %d %d %d %d %d %d %d %d %d %d",
+ MIaV::info->info("%d %d %d %d %d %d %d %d %d %d %d %d %d %d",
bitrate_kbps[0],
bitrate_kbps[1],
bitrate_kbps[2],
@@ -272,14 +271,14 @@ Frame *LibLAMEWrapper::encode(Frame *dvframe)
calc_bitrate += audio_frame->size;//lame_get_framesize(gfp);
frame_number ++;//= 1;//lame_get_frameNum(gfp);
- // info->info("lame_get_frameNum(gfp) %d ?= frame_number %d", lame_get_frameNum(gfp), frame_number);
+ // MIaV::info->info("lame_get_frameNum(gfp) %d ?= frame_number %d", lame_get_frameNum(gfp), frame_number);
// }
// Bits pr. second
// 25 * 7 frames pr.second (it seems!)
audio_frame->bitrate = (unsigned int)((double)calc_bitrate / (double)(frame_number)) * 25;
/*
- info->info("Audio size: %d, bitrate: %.4f",
+ MIaV::info->info("Audio size: %d, bitrate: %.4f",
audio_frame->bitrate,
(float)(config->readInt("mp3_bitrate") * 1000)/(float)(audio_frame->bitrate));
*/
diff --git a/server/liblame_wrapper.h b/server/liblame_wrapper.h
index 43518c8..a4c56c5 100644
--- a/server/liblame_wrapper.h
+++ b/server/liblame_wrapper.h
@@ -36,7 +36,6 @@
#include <lame/lame.h>
#include "frame.h"
-#include "info.h"
#define AUDIO_BUFFER_SIZE DV_AUDIO_MAX_SAMPLES
@@ -47,7 +46,7 @@
class LibLAMEWrapper {
public:
- LibLAMEWrapper(Info *info);
+ LibLAMEWrapper();
~LibLAMEWrapper();
Frame *encode(Frame *dvframe);
@@ -58,8 +57,6 @@ private:
unsigned long long calc_bitrate;
int frame_number;
- Info *info;
-
// LAME stuff
lame_global_flags *gfp;
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();
}
diff --git a/server/libmplex_wrapper.h b/server/libmplex_wrapper.h
index 1be71a1..60c80fe 100644
--- a/server/libmplex_wrapper.h
+++ b/server/libmplex_wrapper.h
@@ -30,14 +30,12 @@
#ifdef WITH_LIBMPLEX
-#include "info.h"
#include "file.h"
#include "threadsafe_queue_priority.h"
class LibMPlexWrapper {
public:
- LibMPlexWrapper(Info *info,
- File *outputfile,
+ LibMPlexWrapper(File *outputfile,
ThreadSafeQueuePriority *video_queue,
ThreadSafeQueuePriority *audio_queue);
~LibMPlexWrapper();
@@ -45,7 +43,6 @@ public:
void multiplex();
private:
- Info *info;
File *outputfile;
ThreadSafeQueuePriority *video_queue;
ThreadSafeQueuePriority *audio_queue;
diff --git a/server/miav_daemon.cc b/server/miav_daemon.cc
index 06c6c3e..8fc7144 100644
--- a/server/miav_daemon.cc
+++ b/server/miav_daemon.cc
@@ -3,7 +3,7 @@
* miav_daemon.cc
*
* Thu Jun 9 11:14:19 CEST 2005
- * Copyright 2005 Bent Bisballe
+ * Copyright 2005 Bent Bisballe Nyeng
* deva@aasimon.org
****************************************************************************/
@@ -47,20 +47,21 @@ int MiavDaemon::daemon_main()
MiavConfig config(ETC"/miav.conf");
MIaV::initConfig(&config);
- InfoConsole info(&config);
-
+ InfoConsole info;
+ MIaV::initInfo(&info);
+
int port = MIaV::config->readInt("server_port");
pid_t childpid; // variable to store the child's pid
signal(SIGCLD, SIG_IGN); // Ved SIGCHILD til IGNORE maa wait/waitpid ikke kaldes
// (ellers kommer der kernel-brok)
- info.info("Starting MIaV server v. %s", VERSION);
- info.info("Listening on port %d", port);
- Socket *socket = new Socket(port, &info);
+ MIaV::info->info("Starting MIaV server v. %s", VERSION);
+ MIaV::info->info("Listening on port %d", port);
+ Socket *socket = new Socket(port);
if(socket->hasError()) {
- info.error("Listening socket has errors, quitting.");
+ MIaV::info->error("Listening socket has errors, quitting.");
delete socket;
return 1;
}
@@ -69,19 +70,19 @@ int MiavDaemon::daemon_main()
Socket *csocket = new Socket(socket->slisten());
if(socket->hasError()) {
- info.error("Server socket has errors, quitting.");
+ MIaV::info->error("Server socket has errors, quitting.");
delete csocket;
break;
}
if(csocket->hasError()) {
- info.error("Child socket has errors, quitting.");
+ MIaV::info->error("Child socket has errors, quitting.");
delete csocket;
break;
}
if(!csocket->isConnected()) {
- info.error("Child socket is not connected, quitting.");
+ MIaV::info->error("Child socket is not connected, quitting.");
delete csocket;
break;
}
@@ -90,11 +91,11 @@ int MiavDaemon::daemon_main()
switch(childpid) {
case -1: // fork() returns -1 on failure
- info.log("Fork error: %s", strerror(errno));
+ MIaV::info->log("Fork error: %s", strerror(errno));
exit(1);
case 0: // fork() returns 0 to the child process
delete socket; // Close listen socket.
- newConnection(csocket, &info);
+ newConnection(csocket);
delete csocket; // Close communication socket.
exit(0);
diff --git a/server/mov_encoder.cc b/server/mov_encoder.cc
index e9049a6..15135df 100644
--- a/server/mov_encoder.cc
+++ b/server/mov_encoder.cc
@@ -40,17 +40,16 @@
#include <unistd.h>
#include "miav_config.h"
+#include "info.h"
#include "libfame_wrapper.h"
MovEncoder::MovEncoder(volatile bool *r, sem_t *r_sem,
ThreadSafeQueueFIFO *in,
ThreadSafeQueuePriority *video_out,
- ThreadSafeQueuePriority *audio_out,
- Info *i)
+ ThreadSafeQueuePriority *audio_out)
{
- info = i;
- info->info("MovEncoder");
+ MIaV::info->info("MovEncoder");
running = r;
@@ -64,14 +63,14 @@ MovEncoder::MovEncoder(volatile bool *r, sem_t *r_sem,
MovEncoder::~MovEncoder()
{
- info->info("~MovEncoder");
+ MIaV::info->info("~MovEncoder");
}
// this runs in a thread
void MovEncoder::thread_main()
{
- info->info("MovEncoder::run");
+ MIaV::info->info("MovEncoder::run");
// Run with slightly lower priority than MovEncoderWriter AND AudioEncoder
nice(2);
@@ -81,7 +80,7 @@ void MovEncoder::thread_main()
Frame *out_v_frame;
Frame *out_a_frame;
- LibFAMEWrapper fame(info);
+ LibFAMEWrapper fame;
// Process until running == false and the queue is empty
while(*running) {
@@ -94,7 +93,7 @@ void MovEncoder::thread_main()
// Check for end of stream
if(in_frame->endOfFrameStream == true) {
- info->info("endOfFrameStream in MovEncoder");
+ MIaV::info->info("endOfFrameStream in MovEncoder");
// Signal to stop running
*running = false;
@@ -127,7 +126,7 @@ void MovEncoder::thread_main()
}
}
- info->info("MovEncoder::stop");
+ MIaV::info->info("MovEncoder::stop");
}
diff --git a/server/mov_encoder.h b/server/mov_encoder.h
index 8910f4b..9b99959 100644
--- a/server/mov_encoder.h
+++ b/server/mov_encoder.h
@@ -46,8 +46,6 @@ using namespace std;
#include "thread.h"
#include <pthread.h>
-#include "info.h"
-
#include "threadsafe_queue_priority.h"
#include "threadsafe_queue_fifo.h"
@@ -56,8 +54,7 @@ public:
MovEncoder(volatile bool *r, sem_t *r_sem,
ThreadSafeQueueFIFO *in,
ThreadSafeQueuePriority *video_out,
- ThreadSafeQueuePriority *audio_out,
- Info *info);
+ ThreadSafeQueuePriority *audio_out);
~MovEncoder();
void thread_main();
@@ -65,8 +62,6 @@ public:
volatile bool *running;
private:
- Info *info;
-
// Input queue
ThreadSafeQueueFIFO *inputqueue;
diff --git a/server/mov_encoder_thread.cc b/server/mov_encoder_thread.cc
index c0b8b27..63bc3c6 100644
--- a/server/mov_encoder_thread.cc
+++ b/server/mov_encoder_thread.cc
@@ -28,11 +28,11 @@
#include "mov_encoder_thread.h"
#include <errno.h>
#include "miav_config.h"
+#include "info.h"
-MovEncoderThread::MovEncoderThread(const char *clientip, const char *cpr, Info *i)
+MovEncoderThread::MovEncoderThread(const char *clientip, const char *cpr)
{
- info = i;
- info->info("MovEncoderThread");
+ MIaV::info->info("MovEncoderThread");
// Queue
inputqueue = new ThreadSafeQueueFIFO();
@@ -40,19 +40,19 @@ MovEncoderThread::MovEncoderThread(const char *clientip, const char *cpr, Info *
// Initialize read semaphore
sem_init(&read_sem, 0, 0);
- video_output_queue = new ThreadSafeQueuePriority(info);
- audio_input_queue = new ThreadSafeQueuePriority(info);
- audio_output_queue = new ThreadSafeQueuePriority(info);
+ video_output_queue = new ThreadSafeQueuePriority();
+ audio_input_queue = new ThreadSafeQueuePriority();
+ audio_output_queue = new ThreadSafeQueuePriority();
- info->info("video_output_queue: 0x%x", video_output_queue);
- info->info("audio_input_queue: 0x%x", audio_input_queue);
- info->info("audio_output_queue: 0x%x", audio_output_queue);
+ MIaV::info->info("video_output_queue: 0x%x", video_output_queue);
+ MIaV::info->info("audio_input_queue: 0x%x", audio_input_queue);
+ MIaV::info->info("audio_output_queue: 0x%x", audio_output_queue);
block = new FrameVector();
num_frames_in_block = MIaV::config->readString("frame_sequence")->length();
- info->info("Frame sequence length %d", num_frames_in_block);
+ MIaV::info->info("Frame sequence length %d", num_frames_in_block);
threads = MIaV::config->readInt("encoding_threads");
@@ -65,23 +65,20 @@ MovEncoderThread::MovEncoderThread(const char *clientip, const char *cpr, Info *
MovEncoder *movenc = new MovEncoder(&movencodersrunning, &read_sem,
inputqueue,
video_output_queue,
- audio_input_queue,
- info);
+ audio_input_queue);
movenc->run();
encs.push_back(movenc);
}
// Create the audio encoder
audioenc = new AudioEncoder(audio_input_queue,
- audio_output_queue,
- info);
+ audio_output_queue);
audioenc->run();
// Create the multiplexer
writer = new MovEncoderWriter(clientip, cpr,
video_output_queue,
- audio_output_queue,
- info);
+ audio_output_queue);
writer->run();
frame_number = 0;
@@ -90,39 +87,39 @@ MovEncoderThread::MovEncoderThread(const char *clientip, const char *cpr, Info *
//#include <unistd.h>
MovEncoderThread::~MovEncoderThread()
{
- info->info("~MovEncoderThread");
+ MIaV::info->info("~MovEncoderThread");
// First we destroy the movie encoders
for(int cnt = 0; cnt < threads; cnt++) {
encs[cnt]->wait_stop(); // Wait for it to stop
delete encs[cnt]; // Delete it
}
- info->info("Deleted the movie encoders");
+ MIaV::info->info("Deleted the movie encoders");
// Then we destroy the audio encoder
audioenc->wait_stop(); // Wait for it to stop.
delete audioenc; // delete the audio encoder
- info->info("Deleted the audio encoder");
+ MIaV::info->info("Deleted the audio encoder");
// Finally we destroy the writer.
writer->wait_stop(); // Wait for it to stop.
delete writer; // delete the writer (end thereby close the file)
- info->info("Deleted the writer");
+ MIaV::info->info("Deleted the writer");
// Destroy the semaphore.
sem_destroy(&read_sem);
- info->info("~MovEncoderThread::done");
+ MIaV::info->info("~MovEncoderThread::done");
}
static int output = 0;
void MovEncoderThread::encode(Frame* frame)
{
if(output % 250 == 0) // 25 * 24
- info->info("inputqueue: %d\tvideo_outputqueue: %d\taudio_inputqueue: %d\taudio_outputqueue: %d.",
+ MIaV::info->info("inputqueue: %d\tvideo_outputqueue: %d\taudio_inputqueue: %d\taudio_outputqueue: %d.",
inputqueue->size(),
video_output_queue->size(),
audio_input_queue->size(),
@@ -130,7 +127,7 @@ void MovEncoderThread::encode(Frame* frame)
output++;
if(frame == NULL) {
- info->info("MovEncoderThread::encode - NULL frame detected.");
+ MIaV::info->info("MovEncoderThread::encode - NULL frame detected.");
// Terminate
return;
}
diff --git a/server/mov_encoder_thread.h b/server/mov_encoder_thread.h
index feea8e2..1af803d 100644
--- a/server/mov_encoder_thread.h
+++ b/server/mov_encoder_thread.h
@@ -45,14 +45,12 @@ using namespace std;
#include "audio_encoder.h"
#include "mov_encoder_writer.h"
-#include "info.h"
-
// For savestate_n
#include "package.h"
class MovEncoderThread {
public:
- MovEncoderThread(const char *clientip, const char *cpr, Info *info);
+ MovEncoderThread(const char *clientip, const char *cpr);
~MovEncoderThread();
void encode(Frame* frame);
@@ -60,8 +58,6 @@ public:
void setSaveState(n_savestate savestate);
private:
- Info *info;
-
// FrameVectorQueue *inputqueue;
ThreadSafeQueueFIFO *inputqueue;
FrameVector *block;
diff --git a/server/mov_encoder_writer.cc b/server/mov_encoder_writer.cc
index d3eb0ef..a8eb190 100644
--- a/server/mov_encoder_writer.cc
+++ b/server/mov_encoder_writer.cc
@@ -41,6 +41,7 @@
using namespace std;
#include "miav_config.h"
+#include "info.h"
#include <time.h>
@@ -51,11 +52,9 @@ using namespace std;
MovEncoderWriter::MovEncoderWriter(const char *clientip, const char* cpr,
ThreadSafeQueuePriority *video_q,
- ThreadSafeQueuePriority *audio_q,
- Info *i)
+ ThreadSafeQueuePriority *audio_q)
{
- info = i;
- info->info("MovEncoderWriter");
+ MIaV::info->info("MovEncoderWriter");
// Create path and filename
char fname[256];
@@ -82,13 +81,13 @@ MovEncoderWriter::MovEncoderWriter(const char *clientip, const char* cpr,
sprintf(fname, "%s/%s/%s/%s-%s-", server_root->c_str(), birthmonth, cpr, cpr, date);
- file = new File(fname, "mpg", info);
+ file = new File(fname, "mpg");
- MulticastConfiguration mcconfig(info, ETC"/multicast.conf");
+ MulticastConfiguration mcconfig(ETC"/multicast.conf");
mcastconf_t mcclientconf = mcconfig.getConf((char*)clientip);
- info->info("Client: %s - Enabled: %s - Addr: %s - Port: %d - WithAudio: %s",
+ MIaV::info->info("Client: %s - Enabled: %s - Addr: %s - Port: %d - WithAudio: %s",
mcclientconf.client.c_str(),
mcclientconf.enabled?"Yes\0":"No\0",
mcclientconf.addr.c_str(),
@@ -97,8 +96,7 @@ MovEncoderWriter::MovEncoderWriter(const char *clientip, const char* cpr,
multicast = NULL;
- if(mcclientconf.enabled) multicast = new Multicast(info,
- mcclientconf);
+ if(mcclientconf.enabled) multicast = new Multicast(mcclientconf);
video_queue = video_q;
audio_queue = audio_q;
@@ -108,30 +106,24 @@ MovEncoderWriter::MovEncoderWriter(const char *clientip, const char* cpr,
MovEncoderWriter::~MovEncoderWriter()
{
- info->info("~MovEncoderWriter");
+ MIaV::info->info("~MovEncoderWriter");
delete file;
if(multicast) delete multicast;
}
void MovEncoderWriter::thread_main()
{
- info->info("MovEncoderWriter::run");
+ MIaV::info->info("MovEncoderWriter::run");
#ifdef WITH_LIBMPLEX
- LibMPlexWrapper mplex(info,
- file,
- video_queue,
- audio_queue);
+ LibMPlexWrapper mplex(file, video_queue, audio_queue);
mplex.multiplex();
#else/*WITH_LIBMPLEX*/
- Multiplexer multiplexer(file, multicast,
- info, &running,
- video_queue,
- audio_queue);
+ Multiplexer multiplexer(file, multicast, &running, video_queue, audio_queue);
multiplexer.multiplex();
#endif/*WITH_LIBMPLEX*/
- info->info("MovEncoderWriter::stop");
+ MIaV::info->info("MovEncoderWriter::stop");
}
void MovEncoderWriter::setSaveState(n_savestate savestate)
diff --git a/server/mov_encoder_writer.h b/server/mov_encoder_writer.h
index ba9ff16..88e8bdf 100644
--- a/server/mov_encoder_writer.h
+++ b/server/mov_encoder_writer.h
@@ -49,8 +49,7 @@ class MovEncoderWriter : public Thread {
public:
MovEncoderWriter(const char *clientip, const char* cpr,
ThreadSafeQueuePriority *video_queue,
- ThreadSafeQueuePriority *audio_queue,
- Info *info);
+ ThreadSafeQueuePriority *audio_queue);
~MovEncoderWriter();
void thread_main();
@@ -60,8 +59,6 @@ public:
volatile bool running;
private:
- Info *info;
-
File *file;
Multicast *multicast;
diff --git a/server/multicast.cc b/server/multicast.cc
index dd12c27..2bb6df1 100644
--- a/server/multicast.cc
+++ b/server/multicast.cc
@@ -30,6 +30,7 @@
#include "multicast_configuration.h"
#include "miav_config.h"
+#include "info.h"
#include <sys/socket.h>
#include <netinet/in.h>
@@ -46,16 +47,15 @@
#include <errno.h>
-Multicast::Multicast(Info *i, mcastconf_t &mcclientconf)
+Multicast::Multicast(mcastconf_t &mcclientconf)
{
- info = i;
udp_buffer = NULL;
multicast_audio = mcclientconf.with_audio;
// Open connection socket
if(!UDPOpen(mcclientconf.addr.c_str(), mcclientconf.port))
- info->error("Error creating socket %s:%d",
+ MIaV::info->error("Error creating socket %s:%d",
mcclientconf.addr.c_str(),
mcclientconf.port);
@@ -69,10 +69,10 @@ Multicast::Multicast(Info *i, mcastconf_t &mcclientconf)
if(udp_buffer_size < 1) udp_buffer_size = 1;
udp_buffer = new char[udp_buffer_size];
udp_buffer_pointer = udp_buffer;
- info->info("UDP packet buffer size %db", udp_buffer_size);
+ MIaV::info->info("UDP packet buffer size %db", udp_buffer_size);
//} else {
- // info->error("Error getting MTU size from socket: %s", strerror(errno));
+ // MIaV::info->error("Error getting MTU size from socket: %s", strerror(errno));
// return;
//}
}
@@ -86,7 +86,7 @@ int Multicast::Write(void* buf, int size)
{
if(!udp_buffer) return 0; // no buffer to write in... better break out!
- // info->info("To send: %d", size);
+ // MIaV::info->info("To send: %d", size);
char *p = (char*)buf;
int left = udp_buffer_size - (udp_buffer_pointer - udp_buffer);
@@ -102,10 +102,10 @@ int Multicast::Write(void* buf, int size)
p+=to_copy;
size-=to_copy;
- // info->info("Copied %d - %d to go", to_copy, size);
+ // MIaV::info->info("Copied %d - %d to go", to_copy, size);
if(left == 0) {
- // info->info("Sending full packet");
+ // MIaV::info->info("Sending full packet");
write(sock, udp_buffer, udp_buffer_size);
left = udp_buffer_size;
udp_buffer_pointer = udp_buffer;
@@ -117,10 +117,10 @@ int Multicast::Write(void* buf, int size)
bool Multicast::is_address_multicast(unsigned long address)
{
if((address & 255) >= 224 && (address & 255) <= 239) {
- info->info("Address is multicast.");
+ MIaV::info->info("Address is multicast.");
return true;
}
- info->info("Address is NOT multicast.");
+ MIaV::info->info("Address is NOT multicast.");
return false;
}
diff --git a/server/multicast.h b/server/multicast.h
index 08df3e1..d4fa784 100644
--- a/server/multicast.h
+++ b/server/multicast.h
@@ -29,11 +29,10 @@
#define __MIAV_MULTICAST_H__
#include "multicast_configuration.h"
-#include "info.h"
class Multicast {
public:
- Multicast(Info *i, mcastconf_t &mcclientconf);
+ Multicast(mcastconf_t &mcclientconf);
~Multicast();
int Write(void* buf, int size);
@@ -41,8 +40,6 @@ public:
bool multicast_audio;
private:
- Info *info;
-
bool is_address_multicast(unsigned long address);
bool UDPOpen(const char *address, int port);
int sock;
diff --git a/server/multicast_configuration.cc b/server/multicast_configuration.cc
index f4e7414..03b4a79 100644
--- a/server/multicast_configuration.cc
+++ b/server/multicast_configuration.cc
@@ -27,7 +27,9 @@
#include "config.h"
#include "multicast_configuration.h"
-MulticastConfiguration::MulticastConfiguration(Info *info, char *file)
+#include "info.h"
+
+MulticastConfiguration::MulticastConfiguration(char *file)
: MiavConfig(file)
{
mcastconf_t conf;
@@ -77,14 +79,14 @@ MulticastConfiguration::MulticastConfiguration(Info *info, char *file)
if(!global) confs.push_back(conf);
// Show the configuration in the log file .
- info->info("Global - Enabled: %s - Addr: %s - Port: %d - WithAudio: %s",
+ MIaV::info->info("Global - Enabled: %s - Addr: %s - Port: %d - WithAudio: %s",
global_conf.enabled?"Yes\0":"No\0",
global_conf.addr.c_str(),
global_conf.port,
global_conf.with_audio?"Yes\0":"No\0");
for(unsigned int cnt = 0; cnt < confs.size(); cnt++) {
- info->info("Client: %s - Enabled: %s - Addr: %s - Port: %d - WithAudio: %s",
+ MIaV::info->info("Client: %s - Enabled: %s - Addr: %s - Port: %d - WithAudio: %s",
confs[cnt].client.c_str(),
confs[cnt].enabled?"Yes\0":"No\0",
confs[cnt].addr.c_str(),
@@ -92,7 +94,7 @@ MulticastConfiguration::MulticastConfiguration(Info *info, char *file)
confs[cnt].with_audio?"Yes\0":"No\0");
}
- info->info("Chosing:");
+ MIaV::info->info("Chosing:");
}
MulticastConfiguration::~MulticastConfiguration()
diff --git a/server/multicast_configuration.h b/server/multicast_configuration.h
index 3fa7ef1..9ff320a 100644
--- a/server/multicast_configuration.h
+++ b/server/multicast_configuration.h
@@ -43,7 +43,7 @@ typedef struct {
class MulticastConfiguration : private MiavConfig {
public:
- MulticastConfiguration(Info *info, char *file);
+ MulticastConfiguration(char *file);
~MulticastConfiguration();
mcastconf_t &getConf(char *client);
diff --git a/server/multiplexer.cc b/server/multiplexer.cc
index 7a8b095..0bce694 100644
--- a/server/multiplexer.cc
+++ b/server/multiplexer.cc
@@ -28,6 +28,8 @@
#include "config.h"
#include "multiplexer.h"
+#include "info.h"
+
#include <netinet/in.h>
#include <math.h>
@@ -68,14 +70,13 @@ static double picture_rate_index[16] = {
RESERVED, RESERVED, RESERVED, RESERVED, RESERVED, RESERVED, RESERVED
};
*/
-Multiplexer::Multiplexer(File *f, Multicast *m, Info *i, volatile bool *r,
+Multiplexer::Multiplexer(File *f, Multicast *m, volatile bool *r,
ThreadSafeQueuePriority *video_q,
ThreadSafeQueuePriority *audio_q)
{
running = r;
file = f;
multicast = m;
- info = i;
frame[TYPE_VIDEO] = NULL;
written[TYPE_VIDEO] = 0.0;
@@ -204,7 +205,7 @@ int Multiplexer::Write(unsigned short int val)
Frame *Multiplexer::getFrame(StreamType type)
{
- // info->info("Get %s Frame", type==TYPE_AUDIO?"Audio\0":"Video\0");
+ // MIaV::info->info("Get %s Frame", type==TYPE_AUDIO?"Audio\0":"Video\0");
read[type] = 0;
@@ -234,7 +235,7 @@ int Multiplexer::read_stream(char *buf, unsigned int size, StreamType type)
// check for end of stream
if( frame[type]->endOfFrameStream == true) {
- info->info("endOfFrameStream in Multiplexer %s-stream.", type==TYPE_VIDEO?"video\0":"audio\0");
+ MIaV::info->info("endOfFrameStream in Multiplexer %s-stream.", type==TYPE_VIDEO?"video\0":"audio\0");
return copied;
}
@@ -244,7 +245,7 @@ int Multiplexer::read_stream(char *buf, unsigned int size, StreamType type)
unsigned int doread = (size - copied) < (frame[type]->size - read[type]) ?
size - copied : (frame[type]->size - read[type]);
- //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[type]->data + read[type], doread);
read[type] += doread;
@@ -260,7 +261,7 @@ bool Multiplexer::packet(StreamType type)
char buf[PACKET_SIZE];
// Write data
- // info->info("\t\t[%sPacket]", type==TYPE_AUDIO?"Audio\0":"Video\0");
+ // MIaV::info->info("\t\t[%sPacket]", type==TYPE_AUDIO?"Audio\0":"Video\0");
unsigned short int framesize = read_stream(buf, PACKET_SIZE, type);
@@ -298,7 +299,7 @@ bool Multiplexer::packet(StreamType type)
*/
bool Multiplexer::packet()
{
- //info->info("\t\tWritten[A]: %f, Written[V]: %f", written[TYPE_AUDIO], written[TYPE_VIDEO]);
+ //MIaV::info->info("\t\tWritten[A]: %f, Written[V]: %f", written[TYPE_AUDIO], written[TYPE_VIDEO]);
StreamType type;
/*
@@ -344,7 +345,7 @@ bool Multiplexer::packet()
*/
void Multiplexer::system_header()
{
- // info->info("\t\t[System Header]");
+ // MIaV::info->info("\t\t[System Header]");
// system_header_start_code (32 bits)
Write((void*)ISO11172_1::system_header_start_code, SIZEOF(ISO11172_1::system_header_start_code));
@@ -386,7 +387,7 @@ void Multiplexer::system_header()
*/
bool Multiplexer::pack()
{
- // info->info("\t[Pack");
+ // MIaV::info->info("\t[Pack");
Write((void*)ISO11172_1::pack_start_code, SIZEOF(ISO11172_1::pack_start_code));
@@ -431,7 +432,7 @@ bool Multiplexer::pack()
header.system_clock_reference2 = TIMECODE29_15(SCR);
header.system_clock_reference3 = TIMECODE14_0(SCR);
/*
- info->info("timecode All: %lld, 1: %lld, 2: %lld, 3: %lld",
+ MIaV::info->info("timecode All: %lld, 1: %lld, 2: %lld, 3: %lld",
SCR,
(unsigned long long int)header.system_clock_reference1,
(unsigned long long int)header.system_clock_reference2,
@@ -447,7 +448,7 @@ bool Multiplexer::pack()
for(int cnt = 0; cnt < PACKETS_PER_PACK; cnt++)
if(!packet()) return false;
- // info->info("\t]");
+ // MIaV::info->info("\t]");
return true;
}
@@ -457,18 +458,18 @@ bool Multiplexer::pack()
*/
void Multiplexer::iso11172_stream()
{
- // info->info("[iso11172_stream");
+ // MIaV::info->info("[iso11172_stream");
while(pack());
- // info->info("]");
- // info->info("[iso11172_end_code]");
+ // MIaV::info->info("]");
+ // MIaV::info->info("[iso11172_end_code]");
Write((void*)ISO11172_1::end_code, SIZEOF(ISO11172_1::end_code));
/*
- info->info("false && false = %d", false && false);
- info->info("true && false = %d", true && false);
- info->info("true && true = %d", true && true);
+ MIaV::info->info("false && false = %d", false && false);
+ MIaV::info->info("true && false = %d", true && false);
+ MIaV::info->info("true && true = %d", true && true);
*/
}
@@ -482,7 +483,7 @@ void Multiplexer::multiplex()
char buf[1024];
do {
frmsz = read_stream(buf, sizeof(buf), BYPASS);
- info->info("Wrote %d bytes", frmsz);
+ MIaV::info->info("Wrote %d bytes", frmsz);
Write(buf, frmsz);
} while(frmsz == sizeof(buf));
return;
diff --git a/server/multiplexer.h b/server/multiplexer.h
index 9959009..521795d 100644
--- a/server/multiplexer.h
+++ b/server/multiplexer.h
@@ -34,7 +34,6 @@
#include "file.h"
#include "multicast.h"
-#include "info.h"
#include "frame.h"
#include "threadsafe_queue_priority.h"
@@ -69,7 +68,7 @@ typedef enum {
class Multiplexer {
public:
- Multiplexer(File *file, Multicast *m, Info *info, volatile bool *running,
+ Multiplexer(File *file, Multicast *m, volatile bool *running,
ThreadSafeQueuePriority *video_queue,
ThreadSafeQueuePriority *audio_queue);
~Multiplexer();
@@ -122,7 +121,6 @@ private:
File *file;
Multicast *multicast;
- Info *info;
volatile bool *running;
// Audio Header
diff --git a/server/server.cc b/server/server.cc
index e306cf1..9af22d9 100644
--- a/server/server.cc
+++ b/server/server.cc
@@ -46,6 +46,7 @@
#include <arpa/inet.h>
#include "miav_config.h"
+#include "info.h"
#include "mov_encoder_thread.h"
#include "img_encoder.h"
@@ -54,12 +55,12 @@
#include "dv.h"
-void newConnection(Socket *socket, Info *info)
+void newConnection(Socket *socket)
{
char cpr[256];
char clientip[64];
bool hasCpr = false;
- ServerStatus status(info);
+ ServerStatus status;
n_savestate savestate = LATER;
n_header h;
@@ -69,17 +70,17 @@ void newConnection(Socket *socket, Info *info)
frame = new Frame(NULL, DVPACKAGE_SIZE);
- info->info("CONNECTION OPENED");
- info->info("New connection (%s)", inet_ntoa(socket->socketaddr.sin_addr));
+ MIaV::info->info("CONNECTION OPENED");
+ MIaV::info->info("New connection (%s)", inet_ntoa(socket->socketaddr.sin_addr));
sprintf(clientip, "%s", inet_ntoa(socket->socketaddr.sin_addr));
- Network network = Network(socket, info);
+ Network network = Network(socket);
while(int ret = network.recvPackage(&h, frame->data, frame->size)) {
status.checkPoint();
if(ret == -1) {
- info->error("A network error ocurred, terminating session");
+ MIaV::info->error("A network error ocurred, terminating session");
break;
}
@@ -92,17 +93,17 @@ void newConnection(Socket *socket, Info *info)
if(h.header.h_data.snapshot) {
if(freeze_frame) {
- ImgEncoder(cpr, info).encode(freeze_frame, 100);
+ ImgEncoder(cpr).encode(freeze_frame, 100);
delete freeze_frame;
freeze_frame = NULL;
} else {
- ImgEncoder(cpr, info).encode(frame, 100);
+ ImgEncoder(cpr).encode(frame, 100);
}
}
if(h.header.h_data.savestate != NO_CHANGE) {
savestate = h.header.h_data.savestate;
- info->info("GOT SAVESTATE FROM NETWORK: %d", savestate );
+ MIaV::info->info("GOT SAVESTATE FROM NETWORK: %d", savestate );
}
if(h.header.h_data.freeze) {
@@ -114,14 +115,14 @@ void newConnection(Socket *socket, Info *info)
// This one must be last!
if(h.header.h_data.record) {
// if(!enc) enc = newMovEncoder(cpr);
- if(!enc) enc = new MovEncoderThread(clientip, cpr, info);
+ if(!enc) enc = new MovEncoderThread(clientip, cpr);
enc->encode(frame);
}
frame = new Frame(NULL, DVPACKAGE_SIZE);
}
- info->info("Closing connection...");
+ MIaV::info->info("Closing connection...");
// No encoder exists, if this is a pure snapshot (image) connection.
if(enc) {
@@ -132,5 +133,5 @@ void newConnection(Socket *socket, Info *info)
delete enc;
}
- info->info("CONNECTION CLOSED");
+ MIaV::info->info("CONNECTION CLOSED");
}
diff --git a/server/server.h b/server/server.h
index 7126a75..ca352c7 100644
--- a/server/server.h
+++ b/server/server.h
@@ -29,9 +29,6 @@
#include "socket.h"
-#include "info.h"
-
-void newConnection(Socket *s, Info* info);
-
+void newConnection(Socket *s);
#endif/*__SERVER_H__*/
diff --git a/server/server_status.cc b/server/server_status.cc
index 7f4714e..88bd35c 100644
--- a/server/server_status.cc
+++ b/server/server_status.cc
@@ -26,13 +26,11 @@
*/
#include <config.h>
#include "server_status.h"
-
+#include "info.h"
#include <stdio.h>
-ServerStatus::ServerStatus(Info *i)
+ServerStatus::ServerStatus()
{
- info = i;
-
gettimeofday(&oldtime, NULL);
for(int cnt = 0; cnt < BUFFERSIZE; cnt++) {
@@ -67,7 +65,7 @@ void ServerStatus::checkPoint()
for(int cnt = 0; cnt < BUFFERSIZE; cnt++) {
total += (double)frametime[cnt];
}
- info->info("Status - fps: %f", 1000000.0 / (total / (double)BUFFERSIZE));
+ MIaV::info->info("Status - fps: %f", 1000000.0 / (total / (double)BUFFERSIZE));
}
}
diff --git a/server/server_status.h b/server/server_status.h
index 5a7cb6c..82ec8ec 100644
--- a/server/server_status.h
+++ b/server/server_status.h
@@ -28,8 +28,6 @@
#ifndef __MIAV_SERVER_STATUS_H__
#define __MIAV_SERVER_STATUS_H__
-#include "info.h"
-
#include <sys/time.h>
// How many steps to do avarage calculation over.
@@ -40,14 +38,13 @@
class ServerStatus {
public:
- ServerStatus(Info *info);
+ ServerStatus();
~ServerStatus();
void checkPoint();
private:
long long interval;
- Info *info;
unsigned int frametime[BUFFERSIZE];
struct timeval time;
struct timeval oldtime;