From ff2a0b78a229d2fac6162d2fa88f3e058b6382d8 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 10 Apr 2006 14:14:31 +0000 Subject: *** empty log message *** --- client/decoder.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'client/decoder.cc') diff --git a/client/decoder.cc b/client/decoder.cc index fd2464b..5c2cce5 100644 --- a/client/decoder.cc +++ b/client/decoder.cc @@ -42,7 +42,7 @@ Decoder::Decoder(): semaphore(1) { - frame = NULL; + frame = NULL; running = true; qApp->installEventFilter(this); } @@ -62,14 +62,25 @@ void Decoder::run() #endif/* READ_DV_FROM_FILE*/ while(running) { - frame = new Frame(reader.readFrame()); + char *tmp = (char*)reader.readFrame(); + mutex.lock(); + if(frame) free(frame); + frame = tmp; + mutex.unlock(); } semaphore.release(); // Unlock the shutdown process } -Frame *Decoder::getFrame() +char *Decoder::getFrame() { - return frame; + char *tmp; + + mutex.lock(); + tmp = frame; + frame = NULL; + mutex.unlock(); + + return tmp; } bool Decoder::eventFilter(QObject *o, QEvent *e) -- cgit v1.2.3