summaryrefslogtreecommitdiff
path: root/src/server.cc
diff options
context:
space:
mode:
authordeva <deva>2005-04-29 13:53:47 +0000
committerdeva <deva>2005-04-29 13:53:47 +0000
commit0791ce8426fe56246afa4123c37388c2f506f8ce (patch)
tree3bf583d2ce5b998e789c0002dff23ba3b52083a5 /src/server.cc
parentedb7f06d81d94178aace1a9c29888e4bb800fb6a (diff)
Testing mpeg4 (divx) codec
Diffstat (limited to 'src/server.cc')
-rw-r--r--src/server.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/server.cc b/src/server.cc
index 3bfd1a2..d603b41 100644
--- a/src/server.cc
+++ b/src/server.cc
@@ -32,6 +32,8 @@
#include "mov_encoder.h"
#include "img_encoder.h"
+#include "server_status.h"
+
#include "dv.h"
void saveFrameAsImage(char* cpr, Frame *f)
@@ -78,26 +80,27 @@ MovEncoder *newMovEncoder(char* cpr)
void newConnection(Socket *socket)
{
+ ServerStatus status;
+
n_savestate savestate = LATER;
n_header h;
Frame *frame;
Frame *freeze_frame = NULL;
MovEncoder *enc = NULL;
- unsigned char dvbuf[DVPACKAGE_SIZE];
+ // unsigned char dvbuf[DVPACKAGE_SIZE];
- // frame = new Frame((unsigned char *)malloc(DVPACKAGE_SIZE), DVPACKAGE_SIZE);
+ frame = new Frame(NULL, DVPACKAGE_SIZE);
printf("New connection[pid: %d]...\n", getpid());
Network network = Network(socket);
- while(int ret = network.recvPackage(&h, dvbuf, DVPACKAGE_SIZE)) {
+ while(int ret = network.recvPackage(&h, frame->data, frame->size)) {
+ status.checkPoint();
if(ret == -1) {
fprintf(stderr, "An error occurred...!\n");
break;
}
- frame = new Frame(dvbuf, DVPACKAGE_SIZE);
-
printf("Read: %d bytes ", ret);
printf("\ttyp: %d ", h.header_type);
printf("\tcpr: %s ", h.header.h_data.cpr);
@@ -130,6 +133,8 @@ void newConnection(Socket *socket)
} else {
delete frame;
}
+
+ frame = new Frame(NULL, DVPACKAGE_SIZE);
}
// TODO: Use save state