summaryrefslogtreecommitdiffstats
path: root/src/DabMux.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/DabMux.cpp')
-rw-r--r--src/DabMux.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index f3edd39..4e10287 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -74,8 +74,7 @@ typedef DWORD32 uint32_t;
# include <sys/times.h>
# include <sys/resource.h>
-# include <linux/if_packet.h>
-# include <linux/netdevice.h>
+# include <net/if_packet.h>
#endif
#ifdef _WIN32
@@ -119,11 +118,12 @@ typedef DWORD32 uint32_t;
#include "ParserConfigfile.h"
#include "StatsServer.h"
#include "Log.h"
+#include "RemoteControl.h"
using namespace std;
/* Global stats server */
-StatsServer global_stats(12720); //TODO define port
+StatsServer* global_stats;
static unsigned char Padding_FIB[] = {
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -288,6 +288,8 @@ int main(int argc, char *argv[])
vector<dabOutput*>::iterator output;
dabProtection* protection = NULL;
+ BaseRemoteController* rc;
+
unsigned int currentFrame;
int returnCode = 0;
int result;
@@ -312,6 +314,8 @@ int main(int argc, char *argv[])
bool enableTist = false;
unsigned timestamp = 0;
+ int statsserverport = 0;
+
unsigned long time_seconds = 0;
struct timeval mnsc_time;
@@ -337,7 +341,7 @@ int main(int argc, char *argv[])
string conf_file = argv[2];
parse_configfile(conf_file, outputs, ensemble, &enableTist, &FICL,
- &factumAnalyzer, &limit);
+ &factumAnalyzer, &limit, rc, &statsserverport);
printSubchannels(ensemble->subchannels);
cerr << endl;
@@ -361,6 +365,13 @@ int main(int argc, char *argv[])
}
}
+ if (statsserverport != 0) {
+ global_stats = new StatsServer(statsserverport);
+ }
+ else {
+ global_stats = new StatsServer();
+ }
+
etiLog.log(info, "CRC-DABMUX starting up");
@@ -531,17 +542,14 @@ int main(int argc, char *argv[])
(*subchannel)->startAddress = (*(subchannel - 1))->startAddress +
getSizeCu(*(subchannel - 1));
}
- if ((*subchannel)->operations.open((*subchannel)->data,
- (*subchannel)->inputName) == -1) {
+ if ((*subchannel)->input->open((*subchannel)->inputName) == -1) {
perror((*subchannel)->inputName);
returnCode = -1;
goto EXIT;
}
// TODO Check errors
- int result = (*subchannel)->operations.setBitrate(
- &(*subchannel)->operations, (*subchannel)->data,
- (*subchannel)->bitrate);
+ result = (*subchannel)->input->setBitrate( (*subchannel)->bitrate);
if (result <= 0) {
etiLog.log(error, "can't set bitrate for source %s\n",
(*subchannel)->inputName);
@@ -1718,15 +1726,8 @@ int main(int argc, char *argv[])
subchannel != ensemble->subchannels.end();
++subchannel) {
int sizeSubchannel = getSizeByte(*subchannel);
- if ((*subchannel)->operations.lock != NULL) {
- (*subchannel)->operations.lock((*subchannel)->data);
- }
- result = (*subchannel)->operations.readFrame(
- &(*subchannel)->operations,
- (*subchannel)->data, &etiFrame[index], sizeSubchannel);
- if ((*subchannel)->operations.unlock != NULL) {
- (*subchannel)->operations.unlock((*subchannel)->data);
- }
+ result = (*subchannel)->input->readFrame(
+ &etiFrame[index], sizeSubchannel);
if (result < 0) {
etiLog.log(info, "Subchannel %d read failed at ETI frame number: %i\n", (*subchannel)->id, currentFrame);
}
@@ -1823,8 +1824,8 @@ EXIT:
for (subchannel = ensemble->subchannels.begin();
subchannel != ensemble->subchannels.end();
++subchannel) {
- (*subchannel)->operations.close((*subchannel)->data);
- (*subchannel)->operations.clean(&(*subchannel)->data);
+ (*subchannel)->input->close();
+ delete (*subchannel)->input;
}
for (output = outputs.begin() ; output != outputs.end(); ++output) {
if ((*output)->output) {