summaryrefslogtreecommitdiff
path: root/src/decoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder.cc')
-rw-r--r--src/decoder.cc33
1 files changed, 21 insertions, 12 deletions
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