summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am9
-rw-r--r--src/camera.cc4
-rw-r--r--src/camera.h4
-rw-r--r--src/decoder.cc73
-rw-r--r--src/decoder.h17
-rw-r--r--src/dvframe.h47
-rw-r--r--src/encoder.cc11
-rw-r--r--src/encoder.h17
-rw-r--r--src/ffframe.cc41
-rw-r--r--src/frame.cc (renamed from src/dvframe.cc)13
-rw-r--r--src/frame.h (renamed from src/ffframe.h)18
-rw-r--r--src/img_encoder.cc6
-rw-r--r--src/img_encoder.h4
-rw-r--r--src/mov_encoder.cc6
-rw-r--r--src/mov_encoder.h4
-rw-r--r--src/player.cc48
-rw-r--r--src/player.h10
-rw-r--r--src/queue.h4
-rw-r--r--src/server.cc14
-rw-r--r--src/server.h2
20 files changed, 124 insertions, 228 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 24c6972..4f0ffa2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,9 +11,8 @@ miav_SOURCES = $(shell if [ $QT_CXXFLAGS ] ; then ../tools/MocList cc; fi ) \
aboutwindow.cc \
camera.cc \
decoder.cc \
- dvframe.cc \
encoder.cc \
- ffframe.cc \
+ frame.cc \
mainwindow.cc \
cprquerydialog.cc \
miav.cc \
@@ -37,10 +36,9 @@ EXTRA_DIST = \
camera.h \
cprquerydialog.h \
decoder.h \
- dvframe.h \
encoder.h \
error.h \
- ffframe.h \
+ frame.h \
img_encoder.h \
mainwindow.h \
messagebox.h \
@@ -55,7 +53,8 @@ EXTRA_DIST = \
socket.h \
thread.h \
util.h \
- videowidget.h
+ videowidget.h \
+ debug.h
miav_LDADD := $(shell if [ $QT_CXXFLAGS ] ; then ../tools/MocList o; fi ) \
-lavcodec -lavformat
diff --git a/src/camera.cc b/src/camera.cc
index a73c063..449c653 100644
--- a/src/camera.cc
+++ b/src/camera.cc
@@ -46,8 +46,8 @@ void Camera::connect(const char *ip, const int port)
av_register_all();
- encode_queue = new Queue<DVFrame>(); // infinite size
- player_queue = new Queue<FFFrame>(1); // fixed size of 1
+ encode_queue = new Queue<Frame>(); // infinite size
+ player_queue = new Queue<Frame>(1); // fixed size of 1
sem_init(&encode_sem, 0, 0);
sem_init(&player_sem, 0, 0);
diff --git a/src/camera.h b/src/camera.h
index e5b4cee..ab18d04 100644
--- a/src/camera.h
+++ b/src/camera.h
@@ -88,8 +88,8 @@ private:
Decoder *decoder;
Player *player;
- Queue<DVFrame> *encode_queue;
- Queue<FFFrame> *player_queue;
+ Queue<Frame> *encode_queue;
+ Queue<Frame> *player_queue;
sem_t encode_sem;
sem_t player_sem;
pthread_mutex_t mutex;// = PTHREAD_MUTEX_INITIALIZER;
diff --git a/src/decoder.cc b/src/decoder.cc
index 10ef245..9633f18 100644
--- a/src/decoder.cc
+++ b/src/decoder.cc
@@ -27,14 +27,15 @@
#include <fcntl.h>
#include <errno.h>
#include <libraw1394/raw1394.h>
+
#include "decoder.h"
#include "debug.h"
Decoder::Decoder(Error* err,
sem_t *gencode_sem,
sem_t *gplayer_sem,
- Queue<DVFrame> *gencode_queue,
- Queue<FFFrame> *gplayer_queue,
+ Queue<Frame> *gencode_queue,
+ Queue<Frame> *gplayer_queue,
pthread_mutex_t *gmutex,
volatile int *grunning)
{
@@ -46,24 +47,12 @@ Decoder::Decoder(Error* err,
mutex = gmutex;
running = grunning;
- AVCodec *dec_codec;
-
- // Find ffmpeg-dv-codec
- if(!(dec_codec = avcodec_find_decoder(CODEC_ID_DVVIDEO))) {
- errobj->pushError("Unable to find codec.");
- return;
- }
-
- // Initialize ffmpeg-dv-codec
- if(avcodec_open(&dvcodec, dec_codec) < 0) {
- errobj->pushError("Error while opening codec for input stream.");
- return;
- }
+ // Initialize libdv
}
Decoder::~Decoder()
{
- avcodec_close(&dvcodec);
+ // Close libdv
}
static int raw_reader( raw1394handle_t handle, int channel, size_t length, quadlet_t *data )
@@ -120,7 +109,7 @@ static int raw_reader( raw1394handle_t handle, int channel, size_t length, quadl
memcpy( framedata + dif_sequence * 150 * 80 + ( 7 + ( dif_block / 15 ) + dif_block ) * 80, p, 480 );
break;
- default: // we canĀ“t handle any other data
+ default: // we can't handle any other data
break;
}
}
@@ -164,69 +153,41 @@ void Decoder::decode()
raw1394_start_iso_rcv( handle, channel);
while(*running) {
- AVPacket pkt;
uint8_t *ptr;
int len;
SDL_Event user_event;
+ // Read a dvframe
while(1) {
raw1394_loop_iterate(handle);
- pkt.data = (uint8_t *)raw1394_get_userdata(handle);
- if(pkt.data) {
+ ptr = (uint8_t *)raw1394_get_userdata(handle);
+ if(ptr) {
raw1394_set_userdata(handle, NULL);
break;
}
+ len = DVPACKAGE_SIZE;
}
-printf("1"); fflush(stdout);
- len = pkt.size = DVPACKAGE_SIZE;
- ptr = pkt.data;
- pkt.stream_index = 0;
-
- // NOTE: we only decode video, we only need the data from stream_index 0
- // (stream 0: video, stream 1: audio)
- // while(pkt.stream_index == 0 && len > 0) {
- int ret;
- int got_picture;
- // buf_t *buf = buf_alloc();
- FFFrame *fff = new FFFrame(); ALLOC(fff, "FFFrame in decode");
- memset(fff->frame, 0 , sizeof(AVFrame));
- //DVFrame *dvf = new DVFrame(); ALLOC(dvf, "DVFrame in decode");
- // dvf->type = DVF_VIDEO;
-
- // memcpy(dvf->frame, ptr, len);
-
-printf("2"); fflush(stdout);
- ret = avcodec_decode_video(&dvcodec, fff->frame, &got_picture, ptr, len);
-printf("3"); fflush(stdout);
-
- if(ret < 0) {
- errobj->pushError("Error while decoding stream.");
- return;
- }
-
-printf("4"); fflush(stdout);
+ Frame *frame = new Frame((void*)ptr, len);
+
pthread_mutex_lock(mutex);
- // encode_queue->push(dvf);
- player_queue->push(fff);
+ encode_queue->push(frame);
+ player_queue->push(frame);
pthread_mutex_unlock(mutex);
-printf("5"); fflush(stdout);
sem_post(encode_sem);
+ // Create and send SDL event.
user_event.type = SDL_USEREVENT;
user_event.user.code = 0;
user_event.user.data1 = NULL;
user_event.user.data2 = NULL;
-printf("6"); fflush(stdout);
SDL_PushEvent(&user_event);
-printf("7"); fflush(stdout);
+ // Free framedata.
free(ptr);
-printf("8"); fflush(stdout);
}
-printf("9"); fflush(stdout);
- /* Kick the others so they wake up with empty queues */
+ // Kick the others so they wake up with empty queues
sem_post(encode_sem);
pthread_exit(NULL);
}
diff --git a/src/decoder.h b/src/decoder.h
index 6d50e5b..0fd09d1 100644
--- a/src/decoder.h
+++ b/src/decoder.h
@@ -30,24 +30,25 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <avformat.h>
+//#include <avformat.h>
#include <SDL/SDL.h>
-#include <queue.h>
+#include "queue.h"
#include "encoder.h"
#include "player.h"
#include "thread.h"
-#include "ffframe.h"
-#include <dvframe.h>
+#include "frame.h"
+
+#define DVPACKAGE_SIZE 144000
class Decoder : public Thread {
public:
Decoder(Error* err,
sem_t *gencode_sem,
sem_t *gplayer_sem,
- Queue<DVFrame> *gencode_queue,
- Queue<FFFrame> *gplayer_queue,
+ Queue<Frame> *gencode_queue,
+ Queue<Frame> *gplayer_queue,
pthread_mutex_t *gmutex,
volatile int *grunning);
~Decoder();
@@ -59,8 +60,8 @@ private:
sem_t *encode_sem;
sem_t *player_sem;
- Queue<DVFrame> *encode_queue;
- Queue<FFFrame> *player_queue;
+ Queue<Frame> *encode_queue;
+ Queue<Frame> *player_queue;
pthread_mutex_t *mutex;
volatile int *running;
diff --git a/src/dvframe.h b/src/dvframe.h
deleted file mode 100644
index 3bf61fe..0000000
--- a/src/dvframe.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/***************************************************************************
- * frame.h
- *
- * Mon Nov 15 19:45:07 CET 2004
- * Copyright 2004 Bent Bisballe
- * deva@aasimon.org
- ****************************************************************************/
-
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-#include <config.h>
-#ifndef __DVFRAME_H__
-#define __DVFRAME_H__
-
-#include <avformat.h>
-
-#define DVPACKAGE_SIZE 144000
-
-typedef enum {
- DVF_AUDIO = 0x01,
- DVF_VIDEO = 0x02
-} DVFrameType;
-
-
-class DVFrame {
-public:
- DVFrame();
- ~DVFrame();
- DVFrameType type;
- char frame[DVPACKAGE_SIZE];
-};
-
-#endif/*__DVFRAME_H__*/
diff --git a/src/encoder.cc b/src/encoder.cc
index ca8fb4f..a762c99 100644
--- a/src/encoder.cc
+++ b/src/encoder.cc
@@ -30,7 +30,7 @@ Encoder::Encoder(Error* err,
const char *gip,
const int gport,
sem_t *gsem,
- Queue<DVFrame> *gqueue,
+ Queue<Frame> *gqueue,
pthread_mutex_t *gmutex,
volatile int *grunning)
{
@@ -68,7 +68,7 @@ Encoder::~Encoder()
void Encoder::encode()
{
- DVFrame *f;
+ Frame *f;
while(*running) {
sem_wait(sem);
@@ -92,10 +92,11 @@ void Encoder::encode()
if(freeze_request != freeze_value) freeze_value = freeze_request;
if(shoot_request != shoot_value) shoot_value = shoot_request;
- n->sendPackage(&h, f->frame, sizeof(f->frame));
+ n->sendPackage(&h, f->data, f->size);
+
+ free(f->data);
+ delete f;
}
-
- if(f) delete f;
}
pthread_exit(NULL);
}
diff --git a/src/encoder.h b/src/encoder.h
index 75788b4..d9534b3 100644
--- a/src/encoder.h
+++ b/src/encoder.h
@@ -30,17 +30,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <avformat.h>
-
-#include <miav.h>
+//#include <avformat.h>
+#include "miav.h"
#include "util.h"
-#include <queue.h>
-
#include "package.h"
-
#include "thread.h"
-#include <dvframe.h>
+#include "frame.h"
+#include "queue.h"
// FIXME: One size fits all...
#define VIDEO_BUFFER_SIZE (1024*1024)
@@ -56,7 +53,7 @@ public:
const char *gip,
const int gport,
sem_t *gsem,
- Queue<DVFrame> *gqueue,
+ Queue<Frame> *gqueue,
pthread_mutex_t *gmutex,
volatile int *grunning);
~Encoder();
@@ -71,9 +68,9 @@ public:
void run();
- AVFormatContext *fc;
+ // AVFormatContext *fc;
sem_t *sem;
- Queue<DVFrame> *queue;
+ Queue<Frame> *queue;
pthread_mutex_t *mutex;
volatile int *running;
diff --git a/src/ffframe.cc b/src/ffframe.cc
deleted file mode 100644
index d2bd5f9..0000000
--- a/src/ffframe.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/***************************************************************************
- * frame.cc
- *
- * Mon Nov 15 19:45:07 CET 2004
- * Copyright 2004 Bent Bisballe
- * deva@aasimon.org
- ****************************************************************************/
-
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include "ffframe.h"
-
-#include "debug.h"
-
-FFFrame::FFFrame()
-{
- frame = avcodec_alloc_frame(); ALLOC(frame, "FFFrame (inside obj)");
- fprintf(stderr, "Frame: %d, \n", frame); fflush(stderr);
-}
-
-FFFrame::~FFFrame()
-{
- av_free(frame); FREE(frame);
-}
-
diff --git a/src/dvframe.cc b/src/frame.cc
index c1948ba..61b2ec7 100644
--- a/src/dvframe.cc
+++ b/src/frame.cc
@@ -22,18 +22,19 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <config.h>
-#include "dvframe.h"
+#include <config.h>
+#include "frame.h"
-#include <memory.h>
+#include "debug.h"
-DVFrame::DVFrame()
+Frame::Frame(void *d, int sz)
{
- memset(frame, 0, sizeof(frame));
+ data = d;
+ size = sz;
}
-DVFrame::~DVFrame()
+Frame::~Frame()
{
}
diff --git a/src/ffframe.h b/src/frame.h
index 5b02780..8894dff 100644
--- a/src/ffframe.h
+++ b/src/frame.h
@@ -23,16 +23,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
-#ifndef __FFFRAME_H__
-#define __FFFRAME_H__
+#ifndef __FRAME_H__
+#define __FRAME_H__
-#include <avformat.h>
-
-class FFFrame {
+class Frame {
public:
- FFFrame();
- ~FFFrame();
- AVFrame *frame;
+ Frame(void *d, int sz);
+ ~Frame();
+
+ void *data;
+ int size;
};
-#endif/*__FFFRAME_H__*/
+#endif/*__FRAME_H__*/
diff --git a/src/img_encoder.cc b/src/img_encoder.cc
index 1a464f8..d83a906 100644
--- a/src/img_encoder.cc
+++ b/src/img_encoder.cc
@@ -59,7 +59,7 @@ ImgEncoder::~ImgEncoder()
// FIXME: free: deccodec and dcc
}
-void ImgEncoder::encode(DVFrame *dvframe,
+void ImgEncoder::encode(Frame *dvframe,
char *filename,
int quality)
{
@@ -71,8 +71,8 @@ void ImgEncoder::encode(DVFrame *dvframe,
int got_picture = 1;
int len;
- ptr = (uint8_t *)dvframe->frame;
- len = sizeof(dvframe->frame);
+ ptr = (uint8_t *)dvframe->data;
+ len = dvframe->size;
ret = avcodec_decode_video(dcc, rawframe, &got_picture, ptr, len);
diff --git a/src/img_encoder.h b/src/img_encoder.h
index 79f4184..92fe0de 100644
--- a/src/img_encoder.h
+++ b/src/img_encoder.h
@@ -23,7 +23,7 @@
#ifndef __RTVIDEOREC_IMGENCODER_H
#define __RTVIDEOREC_IMGENCODER_H
-#include "dvframe.h"
+#include "frame.h"
#include "util.h"
#include <stdio.h>
@@ -46,7 +46,7 @@ class ImgEncoder {
public:
ImgEncoder();
~ImgEncoder();
- void encode(DVFrame *frame, char* filename, int quality);
+ void encode(Frame *frame, char* filename, int quality);
void writeJPEGFile(char *filename,
int quality,
JSAMPLE * image_buffer, // Points to large array of R,G,B-order data
diff --git a/src/mov_encoder.cc b/src/mov_encoder.cc
index ece1cff..edfafb7 100644
--- a/src/mov_encoder.cc
+++ b/src/mov_encoder.cc
@@ -166,7 +166,7 @@ MovEncoder::~MovEncoder()
url_fclose(&efc->pb);
}
-void MovEncoder::encode(DVFrame *dvframe)
+void MovEncoder::encode(Frame *dvframe)
{
int ret;
AVFrame *rawframe = avcodec_alloc_frame();ALLOC(dcc, "mov_encoder, rawframe");
@@ -176,8 +176,8 @@ void MovEncoder::encode(DVFrame *dvframe)
int got_picture = 1;
int len;
- ptr = (uint8_t *)dvframe->frame;
- len = sizeof(dvframe->frame);
+ ptr = (uint8_t *)dvframe->data;
+ len = dvframe->size;
ret = avcodec_decode_video(dcc,//&dfc->streams[0]->codec,
rawframe, &got_picture, ptr, len);
diff --git a/src/mov_encoder.h b/src/mov_encoder.h
index eb67350..ecdb95e 100644
--- a/src/mov_encoder.h
+++ b/src/mov_encoder.h
@@ -28,7 +28,7 @@
#include <string.h>
#include <avformat.h>
-#include <dvframe.h>
+#include "frame.h"
#include "util.h"
@@ -38,7 +38,7 @@ class MovEncoder {
public:
MovEncoder(const char *filename);
~MovEncoder();
- void encode(DVFrame *frame);
+ void encode(Frame *frame);
private:
// Decoder
diff --git a/src/player.cc b/src/player.cc
index dcce6b7..2a08dc1 100644
--- a/src/player.cc
+++ b/src/player.cc
@@ -25,10 +25,14 @@
#include "player.h"
+// Use libdv
+#include <libdv/dv.h>
+#include <libdv/dv_types.h>
+
Player::Player(Error *err,
volatile int *grunning,
sem_t *gsem,
- Queue<FFFrame> *gqueue,
+ Queue<Frame> *gqueue,
pthread_mutex_t *gmutex)
{
// No errors has ocurred... yet!
@@ -85,8 +89,11 @@ void Player::player()
{
SDL_Event event;
SDL_Rect rect;
- FFFrame *f;
- AVPicture pict;
+ Frame *frame;
+ // AVPicture pict;
+ unsigned char pixel_buffer[720 * 576 * 3];
+ int pitches[3];
+
int i;
struct timespec ts;
@@ -97,13 +104,21 @@ void Player::player()
rect.y = 0;
rect.w = DISPLAYWIDTH;
rect.h = DISPLAYHEIGHT;
-
+ /*
//+++++Reference to the overlay pixels/pitches, only after creating a new overlay+++++
+ // ?????????
for(i = 0; i < 3; i++) {
pict.data[i] = overlay->pixels[i];
pict.linesize[i] = overlay->pitches[i];
}
-
+ */
+
+ dv_decoder_t *decoder = NULL;
+ decoder = dv_decoder_new(FALSE, FALSE, FALSE);
+ decoder->quality = DV_QUALITY_BEST;
+ decoder->clamp_luma = FALSE;
+ decoder->clamp_chroma = FALSE;
+
while(*running) {
// Wait for the semaphore to be free... then run
sem_wait(&play_sem);
@@ -124,18 +139,25 @@ void Player::player()
case SDL_USEREVENT:
pthread_mutex_lock(mutex);
- f = queue->pop();
+ frame = queue->pop();
pthread_mutex_unlock(mutex);
- if(!f) break;
+ if(!frame) break;
- img_convert(&pict, PIX_FMT_YUV420P, (AVPicture *)f->frame,
- PIX_FMT_YUV420P, DISPLAYWIDTH, DISPLAYHEIGHT);
+ // img_convert(&pict, PIX_FMT_YUV420P, (AVPicture *)f->frame,
+ // PIX_FMT_YUV420P, DISPLAYWIDTH, DISPLAYHEIGHT);
+ // libdv img decode
+ dv_decode_full_frame(decoder,
+ (const uint8_t*)frame->data,
+ e_dv_color_yuv,
+ (uint8_t**)pixel_buffer,
+ pitches);
+
SDL_LockYUVOverlay(overlay);
- overlay->pixels = pict.data;
+ overlay->pixels = (Uint8**)pixel_buffer;
SDL_UnlockYUVOverlay(overlay);
SDL_DisplayYUVOverlay(overlay, &rect);
- delete f;
+ // delete f;
break;
case SDL_QUIT:
@@ -154,9 +176,9 @@ void Player::player()
nanosleep(&ts, NULL);
pthread_mutex_lock(mutex);
- f = queue->pop();
+ frame = queue->pop();
pthread_mutex_unlock(mutex);
- if(f) delete f;
+ // if(f) delete f;
}
void Player::run()
diff --git a/src/player.h b/src/player.h
index 2af4165..ca2d241 100644
--- a/src/player.h
+++ b/src/player.h
@@ -34,13 +34,13 @@
#include <pthread.h>
#include <time.h>
#include <SDL/SDL.h>
-#include <avformat.h>
+//#include <avformat.h>
#include "util.h"
-#include <queue.h>
+#include "queue.h"
#include "thread.h"
-#include "ffframe.h"
+#include "frame.h"
#include <qwidget.h>
@@ -56,7 +56,7 @@ public:
Player(Error* err,
volatile int *grunning,
sem_t *gsem,
- Queue<FFFrame> *gqueue,
+ Queue<Frame> *gqueue,
pthread_mutex_t *gmutex);
~Player();
@@ -75,7 +75,7 @@ private:
volatile int *running;
sem_t *sem;
- Queue<FFFrame> *queue;
+ Queue<Frame> *queue;
pthread_mutex_t *mutex;
sem_t play_sem;
diff --git a/src/queue.h b/src/queue.h
index 7352071..8851c57 100644
--- a/src/queue.h
+++ b/src/queue.h
@@ -70,7 +70,7 @@ Queue<T>::~Queue()
{
if(count != 0) {
fprintf(stderr, "Queue not empty (%d)\n", count);
- while(T *t = pop()) delete t;
+ while(T *t = pop()) {}//delete t;
}
}
@@ -84,7 +84,7 @@ void Queue<T>::push(T *t)
if(limit && count > 0) {
T* tmp = (T*)pop();
- delete tmp;
+ // delete tmp;
}
if(!head) {
diff --git a/src/server.cc b/src/server.cc
index 44abe2d..b659fb5 100644
--- a/src/server.cc
+++ b/src/server.cc
@@ -32,7 +32,7 @@
#include "mov_encoder.h"
#include "img_encoder.h"
-void saveFrameAsImage(char* cpr, DVFrame *f)
+void saveFrameAsImage(char* cpr, Frame *f)
{
char fname[256];
ImgEncoder imgenc;
@@ -78,16 +78,17 @@ void newConnection(Socket *s)
{
n_savestate savestate = LATER;
n_header h;
- DVFrame *f;
- DVFrame *freeze_frame = NULL;
+ Frame *f;
+ Frame *freeze_frame = NULL;
MovEncoder *enc = NULL;
- f = new DVFrame();
+ // FIXME: Allocate buffer
+ f = new Frame(NULL, 0);
printf("New connection[pid: %d]...\n", getpid());
Network n = Network(s);
- while(int ret = n.recvPackage(&h, (void*)f->frame, DVPACKAGE_SIZE)) {
+ while(int ret = n.recvPackage(&h, f->data, DVPACKAGE_SIZE)) {
if(ret == -1) {
fprintf(stderr, "An error occurred...!\n");
break;
@@ -125,7 +126,8 @@ void newConnection(Socket *s)
delete f;
}
- f = new DVFrame();
+ // FIXME: Allocate buffer
+ f = new Frame(NULL, 0);
}
// TODO: Use save state
diff --git a/src/server.h b/src/server.h
index fd28f33..0aa9a9a 100644
--- a/src/server.h
+++ b/src/server.h
@@ -35,7 +35,7 @@
#include <time.h>
-#include "dvframe.h"
+#include "frame.h"
#include "socket.h"
void newConnection(Socket *s);