From a8b1750ede6e942430bc25e0c9c90c8e4624b250 Mon Sep 17 00:00:00 2001 From: deva Date: Sat, 8 Oct 2005 15:18:10 +0000 Subject: *** empty log message *** --- src/mov_encoder_writer.cc | 12 ++++++++++-- src/multicast.cc | 9 ++++++--- src/multicast.h | 2 +- src/multiplexer.cc | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mov_encoder_writer.cc b/src/mov_encoder_writer.cc index 572a81e..7f3bfec 100644 --- a/src/mov_encoder_writer.cc +++ b/src/mov_encoder_writer.cc @@ -81,7 +81,15 @@ MovEncoderWriter::MovEncoderWriter(const char* cpr, file = new File(fname, "mpg", info); - multicast = new Multicast(info); + if(config->readBool("server_multicast")) { + string *addr = config->readString("server_multicast_addr"); + int port = config->readInt("server_multicast_port"); + info->info("Enabling multicast %s : %d", addr->c_str(), port); + multicast = new Multicast(info, (char*)addr->c_str(), port); + } else { + info->info("Disabling multicast"); + multicast = NULL; + } video_queue = video_q; audio_queue = audio_q; @@ -93,7 +101,7 @@ MovEncoderWriter::~MovEncoderWriter() { info->info("~MovEncoderWriter"); delete file; - delete multicast; + if(multicast) delete multicast; } diff --git a/src/multicast.cc b/src/multicast.cc index b64bfde..80be2ce 100644 --- a/src/multicast.cc +++ b/src/multicast.cc @@ -33,7 +33,7 @@ #include #include -Multicast::Multicast(Info *i) +Multicast::Multicast(Info *i, char *addr, int port) { /* Multicast adresses: @@ -42,11 +42,14 @@ Multicast::Multicast(Info *i) 224.0.0.5 OSPF routers 224.0.0.6 OSPF designated routers 224.0.0.12 DHCP server/relay agent +server_multicast = true +server_multicast_addr = "224.0.0.1" +server_multicast_port = 1234 */ // Multicast to all systems on this subnet - char addr[] = "224.0.0.1"; - int port = 1234; + // char addr[] = "224.0.0.1"; + // int port = 1234; info = i; if(!UDPOpen(addr, port)) info->error("Error creating socket %s:%d", addr, port); diff --git a/src/multicast.h b/src/multicast.h index 50727a5..0f83e87 100644 --- a/src/multicast.h +++ b/src/multicast.h @@ -32,7 +32,7 @@ class Multicast { public: - Multicast(Info *info); + Multicast(Info *i, char *addr, int port); ~Multicast(); void Write(void* buf, int size); diff --git a/src/multiplexer.cc b/src/multiplexer.cc index eafcc8b..69e727a 100644 --- a/src/multiplexer.cc +++ b/src/multiplexer.cc @@ -103,7 +103,7 @@ int Multiplexer::Write(void* data, int size) { int ret; - multicast->Write(data, size); + if(multicast) multicast->Write(data, size); ret = file->Write(data, size); return ret; -- cgit v1.2.3