summaryrefslogtreecommitdiff
path: root/src/server.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-05-28 15:05:57 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-05-28 15:05:57 +0200
commit0332e496347f6b563abb86d4ef9650bbd6ebc3e1 (patch)
tree74dadbe6e4f3216c8a3c8570e203aad0187febf3 /src/server.cc
parent8eb0759e2e8a5405b2dd9e6d72d3bd620b51bee4 (diff)
Port server to hugin.
Diffstat (limited to 'src/server.cc')
-rw-r--r--src/server.cc26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/server.cc b/src/server.cc
index 45d8b48..69e45b6 100644
--- a/src/server.cc
+++ b/src/server.cc
@@ -44,6 +44,8 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <hugin.hpp>
+
#include "miav_config.h"
#include "mov_encoder_thread.h"
@@ -54,12 +56,12 @@
#include "dv.h"
#include "network.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 +71,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));
+ INFO(connection, "CONNECTION OPENED");
+ INFO(connection, "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");
+ ERR(connection, "A network error ocurred, terminating session");
break;
}
@@ -92,17 +94,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 );
+ INFO(connecion, "GOT SAVESTATE FROM NETWORK: %d", savestate );
}
if(h.header.h_data.freeze) {
@@ -114,14 +116,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...");
+ INFO(connection, "Closing connection...");
// No encoder exists, if this is a pure snapshot (image) connection.
if(enc) {
@@ -132,5 +134,5 @@ void newConnection(Socket *socket, Info *info)
delete enc;
}
- info->info("CONNECTION CLOSED");
+ INFO(connection, "CONNECTION CLOSED");
}