diff options
27 files changed, 95 insertions, 111 deletions
diff --git a/recordmydesktop/src/Makefile.am b/recordmydesktop/src/Makefile.am index 3cbf469..b334e7b 100644 --- a/recordmydesktop/src/Makefile.am +++ b/recordmydesktop/src/Makefile.am @@ -38,7 +38,6 @@ recordmydesktop_SOURCES = \ queryextensions.c \ queryextensions.h \ recordmydesktop.c \ - recordmydesktop.h \ rectinsert.c \ rectinsert.h \ register_callbacks.c \ diff --git a/recordmydesktop/src/cache_audio.c b/recordmydesktop/src/cache_audio.c index 3322567..8eb5d65 100644 --- a/recordmydesktop/src/cache_audio.c +++ b/recordmydesktop/src/cache_audio.c @@ -24,8 +24,9 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ +#include "rmdtypes.h" + #include "cache_audio.h" -#include "recordmydesktop.h" #include "rmd_jack.h" diff --git a/recordmydesktop/src/cache_frame.c b/recordmydesktop/src/cache_frame.c index 776e98a..1cb3bfa 100644 --- a/recordmydesktop/src/cache_frame.c +++ b/recordmydesktop/src/cache_frame.c @@ -26,8 +26,9 @@ #include <signal.h> +#include "rmdtypes.h" + #include "cache_frame.h" -#include "recordmydesktop.h" #include "rmd_cache.h" #include "block_utils.h" @@ -169,7 +170,7 @@ void *CacheImageBuffer(ProgData *pdata){ strncpy(fheader.frame_prefix,"FRAM",4); fheader.frameno=++frameno; - fheader.current_total=frames_total; + fheader.current_total = pdata->frames_total; fheader.Ynum=ynum; fheader.Unum=unum; @@ -273,8 +274,12 @@ void *CacheImageBuffer(ProgData *pdata){ } - fprintf(stderr,"Saved %d frames in a total of %d requests\n", - frameno,frames_total);fflush(stderr); + fprintf(stderr, + "Saved %d frames in a total of %d requests\n", + frameno, + pdata->frames_total); + fflush(stderr); + if(!pdata->args.zerocompression){ gzflush(fp,Z_FINISH); gzclose(fp); diff --git a/recordmydesktop/src/capture_sound.c b/recordmydesktop/src/capture_sound.c index 37a5c18..5f04fb9 100644 --- a/recordmydesktop/src/capture_sound.c +++ b/recordmydesktop/src/capture_sound.c @@ -24,12 +24,10 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ -#include "opendev.h" -#include "recordmydesktop.h" -#include "rmd_jack.h" +#include "rmdtypes.h" #include "capture_sound.h" -#include "recordmydesktop.h" +#include "opendev.h" #include "rmd_jack.h" diff --git a/recordmydesktop/src/encode_cache.c b/recordmydesktop/src/encode_cache.c index 01a7968..e15781c 100644 --- a/recordmydesktop/src/encode_cache.c +++ b/recordmydesktop/src/encode_cache.c @@ -24,11 +24,12 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ +#include "rmdtypes.h" + #include "encode_cache.h" #include "flush_to_ogg.h" #include "init_encoder.h" #include "load_cache.h" -#include "recordmydesktop.h" void EncodeCache(ProgData *pdata){ diff --git a/recordmydesktop/src/encode_image_buffer.c b/recordmydesktop/src/encode_image_buffer.c index 5b3f84d..1fa1176 100644 --- a/recordmydesktop/src/encode_image_buffer.c +++ b/recordmydesktop/src/encode_image_buffer.c @@ -24,7 +24,8 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ -#include "recordmydesktop.h" +#include "rmdtypes.h" + #include "encode_image_buffer.h" @@ -37,7 +38,7 @@ void *EncodeImageBuffer(ProgData *pdata){ &pdata->img_buff_ready_mutex); pthread_mutex_unlock(&pdata->img_buff_ready_mutex); pdata->th_enc_thread_waiting=0; - encoder_busy=1; + pdata->encoder_busy = 1; if (pdata->paused) { pthread_mutex_lock(&pdata->pause_mutex); pthread_cond_wait(&pdata->pause_cond, &pdata->pause_mutex); @@ -61,7 +62,7 @@ void *EncodeImageBuffer(ProgData *pdata){ pdata->avd+=pdata->frametime; } } - encoder_busy=0; + pdata->encoder_busy = 0; } //last packet pdata->th_encoding_clean=1; diff --git a/recordmydesktop/src/encode_sound_buffer.c b/recordmydesktop/src/encode_sound_buffer.c index 018de63..b158d86 100644 --- a/recordmydesktop/src/encode_sound_buffer.c +++ b/recordmydesktop/src/encode_sound_buffer.c @@ -24,8 +24,9 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ +#include "rmdtypes.h" + #include "encode_sound_buffer.h" -#include "recordmydesktop.h" #include "rmd_jack.h" diff --git a/recordmydesktop/src/flush_to_ogg.c b/recordmydesktop/src/flush_to_ogg.c index 7b32346..f9585ba 100644 --- a/recordmydesktop/src/flush_to_ogg.c +++ b/recordmydesktop/src/flush_to_ogg.c @@ -24,10 +24,11 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ +#include "rmdtypes.h" + #include "encode_image_buffer.h" #include "encode_sound_buffer.h" #include "flush_to_ogg.h" -#include "recordmydesktop.h" //we copy the page because the next call to ogg_stream_pageout diff --git a/recordmydesktop/src/get_frame.c b/recordmydesktop/src/get_frame.c index 7bc4ede..46d0a7b 100644 --- a/recordmydesktop/src/get_frame.c +++ b/recordmydesktop/src/get_frame.c @@ -24,10 +24,11 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ +#include "rmdtypes.h" + #include "get_frame.h" #include "getzpixmap.h" #include "poll_events.h" -#include "recordmydesktop.h" #include "rectinsert.h" #include "rmd_cache.h" #include "rmd_frame.h" @@ -439,7 +440,7 @@ void *GetFrame(ProgData *pdata){ //switch back and front buffers (full_shots only) if(d_buff) img_sel=(img_sel)?0:1; - capture_busy=1; + pdata->capture_busy = 1; BRWinCpy(&temp_brwin,&pdata->brwin); @@ -627,13 +628,13 @@ void *GetFrame(ProgData *pdata){ if(!pdata->args.full_shots){ ClearList(&pdata->rect_root); } - if(encoder_busy){ - frames_lost++; + if (pdata->encoder_busy) { + pdata->frames_lost++; } pthread_mutex_lock(&pdata->img_buff_ready_mutex); pthread_cond_broadcast(&pdata->image_buffer_ready); pthread_mutex_unlock(&pdata->img_buff_ready_mutex); - capture_busy=0; + pdata->capture_busy = 0; } if(!pdata->args.noframe){ diff --git a/recordmydesktop/src/getzpixmap.c b/recordmydesktop/src/getzpixmap.c index d4a7809..a303731 100644 --- a/recordmydesktop/src/getzpixmap.c +++ b/recordmydesktop/src/getzpixmap.c @@ -24,7 +24,8 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ -#include "recordmydesktop.h" +#include "rmdtypes.h" + #include "getzpixmap.h" diff --git a/recordmydesktop/src/init_encoder.c b/recordmydesktop/src/init_encoder.c index ad3f608..18b1a74 100644 --- a/recordmydesktop/src/init_encoder.c +++ b/recordmydesktop/src/init_encoder.c @@ -27,8 +27,10 @@ #include <string.h> +#include "rmdtypes.h" + #include "init_encoder.h" -#include "recordmydesktop.h" +#include "rmdmacro.h" #include "skeleton.h" diff --git a/recordmydesktop/src/initialize_data.c b/recordmydesktop/src/initialize_data.c index 4efda69..9356f6a 100644 --- a/recordmydesktop/src/initialize_data.c +++ b/recordmydesktop/src/initialize_data.c @@ -24,11 +24,12 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ +#include "rmdtypes.h" + #include "block_utils.h" #include "init_encoder.h" #include "make_dummy_pointer.h" #include "opendev.h" -#include "recordmydesktop.h" #include "rmd_cache.h" #include "rmd_jack.h" #include "yuv_utils.h" @@ -54,8 +55,6 @@ int InitializeData(ProgData *pdata, EncData *enc_data, CacheData *cache_data){ int i; - //these are globals, look for them at the header - frames_total=frames_lost=encoder_busy=capture_busy=0; fprintf(stderr,"Initializing...\n"); MakeMatrices(); @@ -93,6 +92,10 @@ int InitializeData(ProgData *pdata, pdata->paused = FALSE; pdata->aborted = FALSE; pdata->pause_state_changed = FALSE; + pdata->frames_total = 0; + pdata->frames_lost = 0; + pdata->encoder_busy = 0; + pdata->capture_busy = 0; if(!pdata->args.nosound){ if(!pdata->args.use_jack){ diff --git a/recordmydesktop/src/load_cache.c b/recordmydesktop/src/load_cache.c index 82db79f..8be5dda 100644 --- a/recordmydesktop/src/load_cache.c +++ b/recordmydesktop/src/load_cache.c @@ -26,11 +26,13 @@ #include <signal.h> +#include "rmdtypes.h" + #include "encode_image_buffer.h" #include "encode_sound_buffer.h" #include "load_cache.h" -#include "recordmydesktop.h" #include "rmd_cache.h" +#include "rmdmacro.h" //The number of bytes for every @@ -225,9 +227,11 @@ void *LoadCache(ProgData *pdata){ //sync missing_frames+=frame.header->current_total- (extra_frames+frame.header->frameno); - if(frames_total) - fprintf(stdout,"\r[%d%%] ", - ((frame.header->frameno+extra_frames)*100)/frames_total); + if (pdata->frames_total) { + fprintf(stdout, + "\r[%d%%] ", + ((frame.header->frameno + extra_frames) * 100) / pdata->frames_total); + } else fprintf(stdout,"\r[%d frames rendered] ", (frame.header->frameno+extra_frames)); diff --git a/recordmydesktop/src/make_dummy_pointer.c b/recordmydesktop/src/make_dummy_pointer.c index bbad17a..98fb18f 100644 --- a/recordmydesktop/src/make_dummy_pointer.c +++ b/recordmydesktop/src/make_dummy_pointer.c @@ -24,8 +24,10 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ -#include "recordmydesktop.h" +#include "rmdtypes.h" + #include "make_dummy_pointer.h" +#include "rmdmacro.h" unsigned char *MakeDummyPointer(DisplaySpecs *specs, diff --git a/recordmydesktop/src/parseargs.c b/recordmydesktop/src/parseargs.c index 12fb52e..ddfafeb 100644 --- a/recordmydesktop/src/parseargs.c +++ b/recordmydesktop/src/parseargs.c @@ -24,9 +24,10 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ +#include "rmdtypes.h" -#include "recordmydesktop.h" #include "rmd_rescue.h" +#include "rmdmacro.h" static void PrintConfig(void) { diff --git a/recordmydesktop/src/queryextensions.c b/recordmydesktop/src/queryextensions.c index dfc7120..5074d2d 100644 --- a/recordmydesktop/src/queryextensions.c +++ b/recordmydesktop/src/queryextensions.c @@ -26,7 +26,8 @@ #include <X11/extensions/shape.h> -#include "recordmydesktop.h" +#include "rmdtypes.h" + #include "queryextensions.h" diff --git a/recordmydesktop/src/recordmydesktop.c b/recordmydesktop/src/recordmydesktop.c index 622a75e..a4740ce 100644 --- a/recordmydesktop/src/recordmydesktop.c +++ b/recordmydesktop/src/recordmydesktop.c @@ -24,17 +24,18 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ -#include "recordmydesktop.h" +#include "rmdtypes.h" + +#include "encode_cache.h" #include "initialize_data.h" -#include "rmd_error.h" #include "parseargs.h" -#include "setbrwindow.h" -#include "wm_check.h" #include "queryextensions.h" -#include "shortcuts.h" -#include "rmdthreads.h" #include "rmd_cache.h" -#include "encode_cache.h" +#include "rmd_error.h" +#include "rmdthreads.h" +#include "setbrwindow.h" +#include "shortcuts.h" +#include "wm_check.h" int main(int argc,char **argv){ diff --git a/recordmydesktop/src/recordmydesktop.h b/recordmydesktop/src/recordmydesktop.h deleted file mode 100644 index 8e2e22b..0000000 --- a/recordmydesktop/src/recordmydesktop.h +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** -* recordMyDesktop * -******************************************************************************* -* * -* Copyright (C) 2006,2007,2008 John Varouhakis * -* * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with this program; if not, write to the Free Software * -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * -* * -* * -* * -* For further information contact me at johnvarouhakis@gmail.com * -******************************************************************************/ - - -#ifndef RECORDMYDESKTOP_H -#define RECORDMYDESKTOP_H 1 - -#ifdef HAVE_CONFIG_H - #include "config.h" -#endif - -//header inclusion is completely fucked up -//I'll fix it, I promise -#include "rmdtypes.h" - -#include "rmdmacro.h" - - - -/**Globals*/ -//I've read somewhere that I'll go to hell for using globals... - -//the following values are of no effect -//but they might be usefull later for profiling -unsigned int frames_total, //frames calculated by total time expirations - frames_lost; //the value of shame - - - -//used to determine frame drop which can -//happen on failure to receive a signal over a condition variable -int capture_busy, - encoder_busy; - -#endif - diff --git a/recordmydesktop/src/register_callbacks.c b/recordmydesktop/src/register_callbacks.c index 044fefc..eb372d3 100644 --- a/recordmydesktop/src/register_callbacks.c +++ b/recordmydesktop/src/register_callbacks.c @@ -26,7 +26,8 @@ #include <signal.h> -#include "recordmydesktop.h" +#include "rmdtypes.h" + #include "register_callbacks.h" diff --git a/recordmydesktop/src/rmd_cache.c b/recordmydesktop/src/rmd_cache.c index 1d05e67..4f85292 100644 --- a/recordmydesktop/src/rmd_cache.c +++ b/recordmydesktop/src/rmd_cache.c @@ -24,9 +24,11 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ -#include "recordmydesktop.h" +#include "rmdtypes.h" + #include "rmd_cache.h" #include "specsfile.h" +#include "rmdmacro.h" /** diff --git a/recordmydesktop/src/rmd_jack.c b/recordmydesktop/src/rmd_jack.c index edc7076..9717e78 100644 --- a/recordmydesktop/src/rmd_jack.c +++ b/recordmydesktop/src/rmd_jack.c @@ -24,8 +24,10 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ -#include "recordmydesktop.h" +#include "rmdtypes.h" + #include "rmd_jack.h" +#include "rmdmacro.h" #ifdef HAVE_JACK_H diff --git a/recordmydesktop/src/rmd_rescue.c b/recordmydesktop/src/rmd_rescue.c index 0b686eb..382587a 100644 --- a/recordmydesktop/src/rmd_rescue.c +++ b/recordmydesktop/src/rmd_rescue.c @@ -24,13 +24,14 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ +#include "rmdtypes.h" + +#include "block_utils.h" #include "encode_cache.h" #include "initialize_data.h" -#include "recordmydesktop.h" #include "register_callbacks.h" #include "rmd_rescue.h" #include "specsfile.h" -#include "block_utils.h" int rmdRescue(const char *path){ diff --git a/recordmydesktop/src/rmd_timer.c b/recordmydesktop/src/rmd_timer.c index edc6f3e..2059f90 100644 --- a/recordmydesktop/src/rmd_timer.c +++ b/recordmydesktop/src/rmd_timer.c @@ -32,7 +32,8 @@ #include <stdio.h> #include <stdlib.h> -#include "recordmydesktop.h" +#include "rmdtypes.h" + #include "rmd_timer.h" @@ -62,9 +63,9 @@ void *rmdTimer(ProgData *pdata){ } if (!pdata->paused) { - frames_total++; - if(capture_busy){ - frames_lost++; + pdata->frames_total++; + if (pdata->capture_busy) { + pdata->frames_lost++; } } diff --git a/recordmydesktop/src/rmdtypes.h b/recordmydesktop/src/rmdtypes.h index f4099ce..cdd4fbf 100644 --- a/recordmydesktop/src/rmdtypes.h +++ b/recordmydesktop/src/rmdtypes.h @@ -348,6 +348,16 @@ struct _ProgData { boolean aborted; //1 if we should abort boolean pause_state_changed; //1 if pause state changed + //the following values are of no effect + //but they might be usefull later for profiling + unsigned int frames_total, //frames calculated by total time expirations + frames_lost; //the value of shame + + //used to determine frame drop which can + //happen on failure to receive a signal over a condition variable + int capture_busy, + encoder_busy; + pthread_mutex_t pause_mutex; pthread_mutex_t time_mutex; diff --git a/recordmydesktop/src/setbrwindow.c b/recordmydesktop/src/setbrwindow.c index ce82ddd..b3bed24 100644 --- a/recordmydesktop/src/setbrwindow.c +++ b/recordmydesktop/src/setbrwindow.c @@ -24,7 +24,8 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ -#include "recordmydesktop.h" +#include "rmdtypes.h" + #include "setbrwindow.h" diff --git a/recordmydesktop/src/update_image.c b/recordmydesktop/src/update_image.c index efbe5a8..2f72fd6 100644 --- a/recordmydesktop/src/update_image.c +++ b/recordmydesktop/src/update_image.c @@ -24,8 +24,9 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ +#include "rmdtypes.h" + #include "getzpixmap.h" -#include "recordmydesktop.h" #include "update_image.h" #include "yuv_utils.h" diff --git a/recordmydesktop/src/wm_check.c b/recordmydesktop/src/wm_check.c index 555d960..374680a 100644 --- a/recordmydesktop/src/wm_check.c +++ b/recordmydesktop/src/wm_check.c @@ -24,7 +24,8 @@ * For further information contact me at johnvarouhakis@gmail.com * ******************************************************************************/ -#include "recordmydesktop.h" +#include "rmdtypes.h" + #include "wm_check.h" |