summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordeva <deva>2005-10-08 15:18:10 +0000
committerdeva <deva>2005-10-08 15:18:10 +0000
commita8b1750ede6e942430bc25e0c9c90c8e4624b250 (patch)
tree4418e3b10f088183813ea8c764667300521d5f85 /src
parent8437a0c200ddbde70d64884f42dcff651749b066 (diff)
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/mov_encoder_writer.cc12
-rw-r--r--src/multicast.cc9
-rw-r--r--src/multicast.h2
-rw-r--r--src/multiplexer.cc2
4 files changed, 18 insertions, 7 deletions
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 <sys/param.h>
#include <arpa/inet.h>
-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;