From 64efd74ecfa761c83b70ec2374bf448b6e42e254 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 2 Jun 2005 20:45:01 +0000 Subject: Added clear button Optimized the frame handling a little (very little!). --- src/decoder.cc | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'src/decoder.cc') diff --git a/src/decoder.cc b/src/decoder.cc index ec3f695..7b3dd97 100644 --- a/src/decoder.cc +++ b/src/decoder.cc @@ -39,6 +39,11 @@ /* * $Log$ + * Revision 1.31 2005/06/02 20:45:01 deva + * + * Added clear button + * Optimized the frame handling a little (very little!). + * * Revision 1.30 2005/06/02 15:03:23 deva * * Fixed crash in network.cc if socket not connected. @@ -171,21 +176,11 @@ void Decoder::decode() pthread_mutex_unlock(&shot_mutex); } - if(local_record | (local_record != old_record) | local_shoot | local_freeze) { - Frame *eframe = new Frame(ptr, DVPACKAGE_SIZE); - eframe->shoot = local_shoot; - eframe->freeze = local_freeze; - eframe->record = local_record; - - encode_queue->push(eframe); - - sem_post(encode_sem); - } - static int showframe = 1; if(skip_frames != 0) showframe = 1 - showframe; if(showframe) { Frame *pframe = new Frame(ptr, DVPACKAGE_SIZE); + pframe->shoot = local_shoot; pframe->freeze = local_freeze; pframe->record = local_record; @@ -200,7 +195,21 @@ void Decoder::decode() SDL_PushEvent(&user_event); } - free(ptr); + if(local_record | (local_record != old_record) | local_shoot | local_freeze) { + Frame *eframe = new Frame(NULL, 0); + eframe->data = ptr; + eframe->size = DVPACKAGE_SIZE; + + eframe->shoot = local_shoot; + eframe->freeze = local_freeze; + eframe->record = local_record; + + encode_queue->push(eframe); + + sem_post(encode_sem); + } else { + free(ptr); + } } // Kick the others so they wake up with empty queues -- cgit v1.2.3