summaryrefslogtreecommitdiff
path: root/src/decoder.cc
diff options
context:
space:
mode:
authordeva <deva>2005-05-16 16:00:56 +0000
committerdeva <deva>2005-05-16 16:00:56 +0000
commit856ab0ece3e73e2b520d55aeab9adfbccdb6aa93 (patch)
tree3f1149e90e5a9c88c6f22a6f8e39cfc02fdf6e67 /src/decoder.cc
parent3b5893ffa6d4a761eff0d97c7223eecd4fc123c9 (diff)
Lots of stuff!
Diffstat (limited to 'src/decoder.cc')
-rw-r--r--src/decoder.cc55
1 files changed, 34 insertions, 21 deletions
diff --git a/src/decoder.cc b/src/decoder.cc
index 2c68935..e908b63 100644
--- a/src/decoder.cc
+++ b/src/decoder.cc
@@ -39,6 +39,10 @@
/*
* $Log$
+ * Revision 1.28 2005/05/16 16:00:56 deva
+ *
+ * Lots of stuff!
+ *
* Revision 1.27 2005/05/03 08:31:59 deva
* Removed the error object, and replaced it with a more generic info object.
*
@@ -120,7 +124,8 @@ void Decoder::decode()
{
bool local_shoot;
bool local_freeze;
- bool local_record;
+ bool local_record = false;
+ bool old_record;
dv1394 dv_stream = dv1394(info); // Use default port and channel.
@@ -133,6 +138,7 @@ void Decoder::decode()
ptr = dv_stream.readFrame();
if(!ptr) return; // No frame read. (Due to firewire error)
+ old_record = local_record;
local_shoot = b_shoot;
b_shoot = false;
local_freeze = b_freeze;
@@ -152,29 +158,36 @@ void Decoder::decode()
pthread_mutex_unlock(&shot_mutex);
}
- Frame *eframe = new Frame(ptr, DVPACKAGE_SIZE);
- eframe->shoot = local_shoot;
- eframe->freeze = local_freeze;
- eframe->record = local_record;
-
- Frame *pframe = new Frame(ptr, DVPACKAGE_SIZE);
- pframe->shoot = local_shoot;
- pframe->freeze = local_freeze;
- pframe->record = local_record;
-
- free(ptr);
+ 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);
- player_queue->push(pframe);
+ encode_queue->push(eframe);
+
+ sem_post(encode_sem);
+ }
- sem_post(encode_sem);
+ static int showframe = 1;
+ // showframe = 1 - showframe;
+ if(showframe) {
+ Frame *pframe = new Frame(ptr, DVPACKAGE_SIZE);
+ pframe->shoot = local_shoot;
+ pframe->freeze = local_freeze;
+ pframe->record = local_record;
+
+ player_queue->push(pframe);
- // 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;
- SDL_PushEvent(&user_event);
+ // 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;
+ SDL_PushEvent(&user_event);
+ }
+
+ free(ptr);
}
// Kick the others so they wake up with empty queues