From 856ab0ece3e73e2b520d55aeab9adfbccdb6aa93 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 16 May 2005 16:00:56 +0000 Subject: Lots of stuff! --- src/decoder.cc | 55 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 21 deletions(-) (limited to 'src/decoder.cc') 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 -- cgit v1.2.3