From d7f4fe1de14209b7d2587a602a01dd93f6714fad Mon Sep 17 00:00:00 2001 From: iovar Date: Sat, 13 Dec 2008 17:20:24 +0000 Subject: Added missing stdio.h and errno.h headers in any files that needed them (could cause compilation failure on some platforms). Also, rearranged the sequence with which include's happen, so that any missing headers will be more likely to show up as copilation errors, in the future. rmd_yuv_utils.[ch] and rmd_block_utils.[ch] have been merged within the former, as they deal with the same subject (converting rgb buffers to yuv ones, with the only difference that rmd_block_utils had the double-buffer convertions while rmd_yuv_utils dealt with the single-buffered ones). Their headers also had the a circular dependency (rmd_yuv_utils.h included rmd_block_utils.h and vice-versa). rmd_math.[ch] was added. This file holds now the rmdRoundf function which is a portable implementation of roundf (which depends on C99). The reasoning behind the addition of these files, is that they might hold more purely mathematical functions, in the future. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@583 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/configure.ac | 6 +- recordmydesktop/src/Makefile.am | 4 +- recordmydesktop/src/rmd.c | 8 +- recordmydesktop/src/rmd_block_utils.c | 37 ------ recordmydesktop/src/rmd_block_utils.h | 170 -------------------------- recordmydesktop/src/rmd_cache.c | 11 +- recordmydesktop/src/rmd_cache.h | 5 + recordmydesktop/src/rmd_cache_audio.c | 10 +- recordmydesktop/src/rmd_cache_frame.c | 14 ++- recordmydesktop/src/rmd_capture_sound.c | 11 +- recordmydesktop/src/rmd_encode_cache.c | 13 +- recordmydesktop/src/rmd_encode_image_buffer.c | 3 +- recordmydesktop/src/rmd_encode_sound_buffer.c | 10 +- recordmydesktop/src/rmd_error.c | 7 +- recordmydesktop/src/rmd_flush_to_ogg.c | 12 +- recordmydesktop/src/rmd_frame.c | 6 +- recordmydesktop/src/rmd_get_frame.c | 20 +-- recordmydesktop/src/rmd_getzpixmap.c | 7 +- recordmydesktop/src/rmd_getzpixmap.h | 1 + recordmydesktop/src/rmd_init_encoder.c | 9 +- recordmydesktop/src/rmd_initialize_data.c | 12 +- recordmydesktop/src/rmd_jack.c | 6 +- recordmydesktop/src/rmd_load_cache.c | 15 ++- recordmydesktop/src/rmd_macro.h | 4 +- recordmydesktop/src/rmd_make_dummy_pointer.c | 7 +- recordmydesktop/src/rmd_math.c | 36 ++++++ recordmydesktop/src/rmd_math.h | 44 +++++++ recordmydesktop/src/rmd_opendev.c | 12 +- recordmydesktop/src/rmd_parseargs.c | 7 +- recordmydesktop/src/rmd_poll_events.c | 17 +-- recordmydesktop/src/rmd_queryextensions.c | 6 +- recordmydesktop/src/rmd_rectinsert.c | 4 +- recordmydesktop/src/rmd_register_callbacks.c | 5 +- recordmydesktop/src/rmd_rescue.c | 13 +- recordmydesktop/src/rmd_setbrwindow.c | 3 +- recordmydesktop/src/rmd_shortcuts.c | 11 +- recordmydesktop/src/rmd_specsfile.c | 6 +- recordmydesktop/src/rmd_threads.c | 15 ++- recordmydesktop/src/rmd_timer.c | 9 +- recordmydesktop/src/rmd_types.h | 1 + recordmydesktop/src/rmd_update_image.c | 11 +- recordmydesktop/src/rmd_update_image.h | 1 + recordmydesktop/src/rmd_wm_check.c | 6 +- recordmydesktop/src/rmd_wm_is_compositing.c | 9 +- recordmydesktop/src/rmd_yuv_utils.c | 27 ++-- recordmydesktop/src/rmd_yuv_utils.h | 135 +++++++++++++++++++- recordmydesktop/src/skeleton.h | 1 + recordmydesktop/src/test-rectinsert-data.c | 2 +- recordmydesktop/src/test-rectinsert.c | 4 +- 49 files changed, 426 insertions(+), 367 deletions(-) delete mode 100644 recordmydesktop/src/rmd_block_utils.c delete mode 100644 recordmydesktop/src/rmd_block_utils.h create mode 100644 recordmydesktop/src/rmd_math.c create mode 100644 recordmydesktop/src/rmd_math.h diff --git a/recordmydesktop/configure.ac b/recordmydesktop/configure.ac index 72409e8..a18c092 100644 --- a/recordmydesktop/configure.ac +++ b/recordmydesktop/configure.ac @@ -95,8 +95,7 @@ AC_CHECK_LIB([pthread],[pthread_mutex_lock],, AC_MSG_ERROR([Can't find libpthread])) if test x$jack = xtrue ; then -AC_CHECK_LIB([jack],[jack_activate],, - jack_lib_found=false) +AC_CHECK_LIB([jack],[jack_activate],jack_lib_found=true,) fi if test x$oss = xfalse; then @@ -120,8 +119,7 @@ AC_OUTPUT if test x$audio_backend != xOSS; then audio_backend="ALSA" fi -if test x$jack_lib_found != xfalse ; then -# AC_DEFINE([HAVE_JACK_H],1,define to 1 if libjack is found) , +if test x$jack_lib_found = xtrue ; then jack_support="Enabled" else jack_support="Disabled" diff --git a/recordmydesktop/src/Makefile.am b/recordmydesktop/src/Makefile.am index 47b3320..a63c3c4 100644 --- a/recordmydesktop/src/Makefile.am +++ b/recordmydesktop/src/Makefile.am @@ -2,8 +2,6 @@ bin_PROGRAMS = recordmydesktop recordmydesktop_SOURCES = \ rmd.c \ - rmd_block_utils.c \ - rmd_block_utils.h \ rmd_cache.c \ rmd_cache.h \ rmd_cache_audio.c \ @@ -39,6 +37,8 @@ recordmydesktop_SOURCES = \ rmd_macro.h \ rmd_make_dummy_pointer.c \ rmd_make_dummy_pointer.h \ + rmd_math.c \ + rmd_math.h \ rmd_opendev.c \ rmd_opendev.h \ rmd_parseargs.c \ diff --git a/recordmydesktop/src/rmd.c b/recordmydesktop/src/rmd.c index ce36a2b..c945d2f 100644 --- a/recordmydesktop/src/rmd.c +++ b/recordmydesktop/src/rmd.c @@ -26,8 +26,6 @@ #include "config.h" -#include "rmd_types.h" - #include "rmd_cache.h" #include "rmd_encode_cache.h" #include "rmd_error.h" @@ -39,7 +37,13 @@ #include "rmd_shortcuts.h" #include "rmd_threads.h" #include "rmd_wm_is_compositing.h" +#include "rmd_types.h" + +#include +#include +#include +#include int main(int argc,char **argv){ ProgData pdata; diff --git a/recordmydesktop/src/rmd_block_utils.c b/recordmydesktop/src/rmd_block_utils.c deleted file mode 100644 index 20b5aac..0000000 --- a/recordmydesktop/src/rmd_block_utils.c +++ /dev/null @@ -1,37 +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 * -******************************************************************************/ - -#include "config.h" - -#include "rmd_block_utils.h" - - -// FIXME: These globals are modified in other source files! We keep -// thsee here for now. These are the cache blocks. They need to be -// accesible in the dbuf macros -u_int32_t *yblocks, - *ublocks, - *vblocks; diff --git a/recordmydesktop/src/rmd_block_utils.h b/recordmydesktop/src/rmd_block_utils.h deleted file mode 100644 index 02aa77f..0000000 --- a/recordmydesktop/src/rmd_block_utils.h +++ /dev/null @@ -1,170 +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 BLOCK_UTILS_H -#define BLOCK_UTILS_H 1 - -#include "rmd_macro.h" -#include "rmd_types.h" -#include "rmd_yuv_utils.h" - - -// We keep these global for now. FIXME: Isolate them. -extern u_int32_t *yblocks, - *ublocks, - *vblocks; - -#define POINT_IN_BLOCK(xv,yv,widthv,blocksize) ((yv/blocksize)*\ - (widthv/blocksize)+\ - (xv/blocksize)) - -#define UPDATE_Y_PLANE_DBUF(data,\ - data_back,\ - x_tm,\ - y_tm,\ - height_tm,\ - width_tm,\ - yuv,\ - __bit_depth__){ \ - int k,i;\ - register u_int##__bit_depth__##_t t_val;\ - register unsigned char *yuv_y=yuv->y+x_tm+y_tm*yuv->y_width,\ - *_yr=Yr,*_yg=Yg,*_yb=Yb;\ - register u_int##__bit_depth__##_t *datapi=(u_int##__bit_depth__##_t *)data,\ - *datapi_back=(u_int##__bit_depth__##_t *)data_back;\ - for(k=0;ky_width-width_tm;\ - }\ -} - -#define UPDATE_UV_PLANES_DBUF( data,\ - data_back,\ - x_tm,\ - y_tm,\ - height_tm,\ - width_tm,\ - yuv,\ - __sampling_type,\ - __bit_depth__){ \ - int k,i;\ - register u_int##__bit_depth__##_t t_val;\ - register unsigned char *yuv_u=yuv->u+x_tm/2+(y_tm*yuv->uv_width)/2,\ - *yuv_v=yuv->v+x_tm/2+(y_tm*yuv->uv_width)/2,\ - *_ur=Ur,*_ug=Ug,*_ubvr=UbVr,\ - *_vg=Vg,*_vb=Vb;\ - register u_int##__bit_depth__##_t *datapi=(u_int##__bit_depth__##_t *)data,\ - *datapi_next=NULL,\ - *datapi_back=(u_int##__bit_depth__##_t *)data_back,\ - *datapi_back_next=NULL;\ - if(__sampling_type==__PXL_AVERAGE){\ - datapi_next=datapi+width_tm;\ - datapi_back_next=datapi_back+width_tm;\ - for(k=0;ky_width-width_tm)/2;\ - yuv_v+=(yuv->y_width-width_tm)/2;\ - datapi+=width_tm;\ - datapi_back+=width_tm;\ - if(__sampling_type==__PXL_AVERAGE){\ - datapi_next+=width_tm;\ - datapi_back_next+=width_tm;\ - }\ - }\ - }\ - else{\ - for(k=0;ky_width-width_tm)/2;\ - yuv_v+=(yuv->y_width-width_tm)/2;\ - datapi+=width_tm;\ - datapi_back+=width_tm;\ - if(__sampling_type==__PXL_AVERAGE){\ - datapi_next+=width_tm;\ - datapi_back_next+=width_tm;\ - }\ - }\ - }\ -} - - -#endif diff --git a/recordmydesktop/src/rmd_cache.c b/recordmydesktop/src/rmd_cache.c index 536d217..56e4301 100644 --- a/recordmydesktop/src/rmd_cache.c +++ b/recordmydesktop/src/rmd_cache.c @@ -25,14 +25,15 @@ ******************************************************************************/ #include "config.h" - -#include - -#include "rmd_types.h" - #include "rmd_cache.h" #include "rmd_specsfile.h" +#include "rmd_types.h" + +#include +#include +#include +#include /** diff --git a/recordmydesktop/src/rmd_cache.h b/recordmydesktop/src/rmd_cache.h index 01efa21..a4ee79f 100644 --- a/recordmydesktop/src/rmd_cache.h +++ b/recordmydesktop/src/rmd_cache.h @@ -29,6 +29,11 @@ #include "rmd_types.h" +#include + +#include + + /** * Change file pointer to a new file while writting diff --git a/recordmydesktop/src/rmd_cache_audio.c b/recordmydesktop/src/rmd_cache_audio.c index d31b607..c061ed3 100644 --- a/recordmydesktop/src/rmd_cache_audio.c +++ b/recordmydesktop/src/rmd_cache_audio.c @@ -25,13 +25,17 @@ ******************************************************************************/ #include "config.h" +#include "rmd_cache_audio.h" + +#include "rmd_jack.h" +#include "rmd_types.h" #include -#include "rmd_types.h" +#include +#include +#include -#include "rmd_cache_audio.h" -#include "rmd_jack.h" void *CacheSoundBuffer(ProgData *pdata){ diff --git a/recordmydesktop/src/rmd_cache_frame.c b/recordmydesktop/src/rmd_cache_frame.c index 03e3506..92c9955 100644 --- a/recordmydesktop/src/rmd_cache_frame.c +++ b/recordmydesktop/src/rmd_cache_frame.c @@ -25,15 +25,17 @@ ******************************************************************************/ #include "config.h" +#include "rmd_cache_frame.h" -#include -#include - +#include "rmd_yuv_utils.h" +#include "rmd_cache.h" #include "rmd_types.h" -#include "rmd_block_utils.h" -#include "rmd_cache.h" -#include "rmd_cache_frame.h" +#include +#include +#include +#include +#include #define BYTES_PER_MB (1024 * 1024) diff --git a/recordmydesktop/src/rmd_capture_sound.c b/recordmydesktop/src/rmd_capture_sound.c index b9be47b..33c5814 100644 --- a/recordmydesktop/src/rmd_capture_sound.c +++ b/recordmydesktop/src/rmd_capture_sound.c @@ -25,14 +25,15 @@ ******************************************************************************/ #include "config.h" - -#include - -#include "rmd_types.h" - #include "rmd_capture_sound.h" + #include "rmd_jack.h" #include "rmd_opendev.h" +#include "rmd_types.h" + +#include +#include +#include void *CaptureSound(ProgData *pdata){ diff --git a/recordmydesktop/src/rmd_encode_cache.c b/recordmydesktop/src/rmd_encode_cache.c index 40b0a8d..1ada5d0 100644 --- a/recordmydesktop/src/rmd_encode_cache.c +++ b/recordmydesktop/src/rmd_encode_cache.c @@ -25,15 +25,18 @@ ******************************************************************************/ #include "config.h" - -#include - -#include "rmd_types.h" - #include "rmd_encode_cache.h" + #include "rmd_flush_to_ogg.h" #include "rmd_init_encoder.h" #include "rmd_load_cache.h" +#include "rmd_types.h" + +#include + +#include +#include + void EncodeCache(ProgData *pdata){ diff --git a/recordmydesktop/src/rmd_encode_image_buffer.c b/recordmydesktop/src/rmd_encode_image_buffer.c index 4b91239..957ad66 100644 --- a/recordmydesktop/src/rmd_encode_image_buffer.c +++ b/recordmydesktop/src/rmd_encode_image_buffer.c @@ -25,10 +25,11 @@ ******************************************************************************/ #include "config.h" +#include "rmd_encode_image_buffer.h" #include "rmd_types.h" -#include "rmd_encode_image_buffer.h" +#include void *EncodeImageBuffer(ProgData *pdata){ diff --git a/recordmydesktop/src/rmd_encode_sound_buffer.c b/recordmydesktop/src/rmd_encode_sound_buffer.c index 4a04d71..3a6572c 100644 --- a/recordmydesktop/src/rmd_encode_sound_buffer.c +++ b/recordmydesktop/src/rmd_encode_sound_buffer.c @@ -25,13 +25,15 @@ ******************************************************************************/ #include "config.h" +#include "rmd_encode_sound_buffer.h" -#include - +#include "rmd_jack.h" #include "rmd_types.h" -#include "rmd_encode_sound_buffer.h" -#include "rmd_jack.h" +#include + +#include +#include void *EncodeSoundBuffer(ProgData *pdata){ diff --git a/recordmydesktop/src/rmd_error.c b/recordmydesktop/src/rmd_error.c index 1640ffe..44144bf 100644 --- a/recordmydesktop/src/rmd_error.c +++ b/recordmydesktop/src/rmd_error.c @@ -25,13 +25,14 @@ ******************************************************************************/ #include "config.h" +#include "rmd_error.h" -#include -#include #include #include -#include "rmd_error.h" +#include +#include + int rmdErrorHandler( Display *dpy, XErrorEvent *e ) diff --git a/recordmydesktop/src/rmd_flush_to_ogg.c b/recordmydesktop/src/rmd_flush_to_ogg.c index 1f78115..ae94b2f 100644 --- a/recordmydesktop/src/rmd_flush_to_ogg.c +++ b/recordmydesktop/src/rmd_flush_to_ogg.c @@ -25,14 +25,18 @@ ******************************************************************************/ #include "config.h" +#include "rmd_flush_to_ogg.h" + +#include "rmd_encode_image_buffer.h" +#include "rmd_encode_sound_buffer.h" +#include "rmd_types.h" #include -#include "rmd_types.h" +#include +#include +#include -#include "rmd_encode_image_buffer.h" -#include "rmd_encode_sound_buffer.h" -#include "rmd_flush_to_ogg.h" //we copy the page because the next call to ogg_stream_pageout diff --git a/recordmydesktop/src/rmd_frame.c b/recordmydesktop/src/rmd_frame.c index ccda02e..740dacf 100644 --- a/recordmydesktop/src/rmd_frame.c +++ b/recordmydesktop/src/rmd_frame.c @@ -25,13 +25,13 @@ ******************************************************************************/ #include "config.h" +#include "rmd_frame.h" -#include -#include #include #include -#include "rmd_frame.h" +#include +#include #define BORDER_WIDTH 6 diff --git a/recordmydesktop/src/rmd_get_frame.c b/recordmydesktop/src/rmd_get_frame.c index acbb6e2..0baff5e 100644 --- a/recordmydesktop/src/rmd_get_frame.c +++ b/recordmydesktop/src/rmd_get_frame.c @@ -25,24 +25,24 @@ ******************************************************************************/ #include "config.h" - -#include -#include -#include - -#include -#include - -#include "rmd_types.h" +#include "rmd_get_frame.h" #include "rmd_cache.h" #include "rmd_frame.h" -#include "rmd_get_frame.h" #include "rmd_getzpixmap.h" #include "rmd_poll_events.h" #include "rmd_rectinsert.h" #include "rmd_update_image.h" #include "rmd_yuv_utils.h" +#include "rmd_types.h" + +#include +#include + +#include +#include +#include +#include #define AVG_4_PIXELS(data_array,width_img,k_tm,i_tm,offset)\ diff --git a/recordmydesktop/src/rmd_getzpixmap.c b/recordmydesktop/src/rmd_getzpixmap.c index f001844..33c31c2 100644 --- a/recordmydesktop/src/rmd_getzpixmap.c +++ b/recordmydesktop/src/rmd_getzpixmap.c @@ -25,15 +25,16 @@ ******************************************************************************/ #include "config.h" +#include "rmd_getzpixmap.h" + +#include "rmd_types.h" + #include #include #include #include -#include "rmd_types.h" - -#include "rmd_getzpixmap.h" int GetZPixmap(Display *dpy, diff --git a/recordmydesktop/src/rmd_getzpixmap.h b/recordmydesktop/src/rmd_getzpixmap.h index b154e5a..81e0025 100644 --- a/recordmydesktop/src/rmd_getzpixmap.h +++ b/recordmydesktop/src/rmd_getzpixmap.h @@ -29,6 +29,7 @@ #include "rmd_types.h" +#include /** * Rerieve pixmap data from xserver diff --git a/recordmydesktop/src/rmd_init_encoder.c b/recordmydesktop/src/rmd_init_encoder.c index 2f71ba5..ad4e976 100644 --- a/recordmydesktop/src/rmd_init_encoder.c +++ b/recordmydesktop/src/rmd_init_encoder.c @@ -25,16 +25,19 @@ ******************************************************************************/ #include "config.h" +#include "rmd_init_encoder.h" + +#include "rmd_types.h" + +#include "skeleton.h" #include +#include #include #include -#include "skeleton.h" -#include "rmd_types.h" -#include "rmd_init_encoder.h" static void m_add_fishead_packet(ogg_stream_state *m_ogg_state) { diff --git a/recordmydesktop/src/rmd_initialize_data.c b/recordmydesktop/src/rmd_initialize_data.c index 7451866..6754f7b 100644 --- a/recordmydesktop/src/rmd_initialize_data.c +++ b/recordmydesktop/src/rmd_initialize_data.c @@ -25,19 +25,21 @@ ******************************************************************************/ #include "config.h" +#include "rmd_initialize_data.h" -#include - -#include "rmd_types.h" - -#include "rmd_block_utils.h" #include "rmd_cache.h" #include "rmd_init_encoder.h" #include "rmd_jack.h" #include "rmd_make_dummy_pointer.h" #include "rmd_opendev.h" #include "rmd_yuv_utils.h" +#include "rmd_types.h" + +#include +#include +#include +#include #ifdef HAVE_LIBASOUND static void FixBufferSize(snd_pcm_uframes_t *buffsize) { diff --git a/recordmydesktop/src/rmd_jack.c b/recordmydesktop/src/rmd_jack.c index 9236ad4..eb9de28 100644 --- a/recordmydesktop/src/rmd_jack.c +++ b/recordmydesktop/src/rmd_jack.c @@ -25,13 +25,13 @@ ******************************************************************************/ #include "config.h" - -#include +#include "rmd_jack.h" #include "rmd_types.h" -#include "rmd_jack.h" +#include +#include #ifdef HAVE_LIBJACK diff --git a/recordmydesktop/src/rmd_load_cache.c b/recordmydesktop/src/rmd_load_cache.c index c402473..1e527a2 100644 --- a/recordmydesktop/src/rmd_load_cache.c +++ b/recordmydesktop/src/rmd_load_cache.c @@ -25,17 +25,20 @@ ******************************************************************************/ #include "config.h" - -#include -#include - -#include "rmd_types.h" +#include "rmd_load_cache.h" #include "rmd_cache.h" #include "rmd_encode_image_buffer.h" #include "rmd_encode_sound_buffer.h" -#include "rmd_load_cache.h" #include "rmd_macro.h" +#include "rmd_types.h" + +#include +#include + +#include +#include +#include //The number of bytes for every diff --git a/recordmydesktop/src/rmd_macro.h b/recordmydesktop/src/rmd_macro.h index 262c91c..37c032d 100644 --- a/recordmydesktop/src/rmd_macro.h +++ b/recordmydesktop/src/rmd_macro.h @@ -29,10 +29,10 @@ #include "config.h" -#include - #include "rmd_types.h" +#include + //define which way we are reading a pixmap #if __BYTE_ORDER == __LITTLE_ENDIAN diff --git a/recordmydesktop/src/rmd_make_dummy_pointer.c b/recordmydesktop/src/rmd_make_dummy_pointer.c index 7b409cf..527fe43 100644 --- a/recordmydesktop/src/rmd_make_dummy_pointer.c +++ b/recordmydesktop/src/rmd_make_dummy_pointer.c @@ -25,13 +25,12 @@ ******************************************************************************/ #include "config.h" +#include "rmd_make_dummy_pointer.h" -#include - +#include "rmd_macro.h" #include "rmd_types.h" -#include "rmd_macro.h" -#include "rmd_make_dummy_pointer.h" +#include unsigned char *MakeDummyPointer(Display *display, diff --git a/recordmydesktop/src/rmd_math.c b/recordmydesktop/src/rmd_math.c new file mode 100644 index 0000000..d344c78 --- /dev/null +++ b/recordmydesktop/src/rmd_math.c @@ -0,0 +1,36 @@ +/****************************************************************************** +* recordMyDesktop - rmd_math.c * +******************************************************************************* +* * +* Copyright (C) 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 * +******************************************************************************/ + +#include "config.h" +#include "rmd_math.h" + +#include + +double rmdRoundf(double val){ + + return val < 0.0 ? ceilf( val - 0.5 ) : floorf( val + 0.5 ); + +} + diff --git a/recordmydesktop/src/rmd_math.h b/recordmydesktop/src/rmd_math.h new file mode 100644 index 0000000..87c6166 --- /dev/null +++ b/recordmydesktop/src/rmd_math.h @@ -0,0 +1,44 @@ +/****************************************************************************** +* recordMyDesktop - rmd_math.h * +******************************************************************************* +* * +* Copyright (C) 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 RMD_MATH_H +#define RMD_MATH_H 1 + +/* + * Since roundf depends on C99, using it might make + * the code non-portable. rmdRoundf solves this + * problem, by behaving identically with roundf + * and being portable (floorf and ceilf, that are + * used in the implementation, are defined in C89) + * + * \param val Number to be rounded + * + * \returns val rounded + * + */ +double rmdRoundf( double val ); + +#endif + diff --git a/recordmydesktop/src/rmd_opendev.c b/recordmydesktop/src/rmd_opendev.c index 9b334ab..65d3dac 100644 --- a/recordmydesktop/src/rmd_opendev.c +++ b/recordmydesktop/src/rmd_opendev.c @@ -25,11 +25,7 @@ ******************************************************************************/ #include "config.h" - -#include -#include -#include -#include +#include "rmd_opendev.h" #ifdef HAVE_LIBASOUND #include @@ -38,7 +34,11 @@ #include #endif -#include "rmd_opendev.h" +#include +#include +#include +#include + #ifdef HAVE_LIBASOUND diff --git a/recordmydesktop/src/rmd_parseargs.c b/recordmydesktop/src/rmd_parseargs.c index 758f515..254a011 100644 --- a/recordmydesktop/src/rmd_parseargs.c +++ b/recordmydesktop/src/rmd_parseargs.c @@ -25,11 +25,14 @@ ******************************************************************************/ #include "config.h" - -#include +#include "rmd_parseargs.h" #include "rmd_types.h" +#include +#include +#include + static void PrintConfig(void) { fprintf(stderr,"\nrecordMyDesktop was compiled with" diff --git a/recordmydesktop/src/rmd_poll_events.c b/recordmydesktop/src/rmd_poll_events.c index 5c29f04..4ba33b6 100644 --- a/recordmydesktop/src/rmd_poll_events.c +++ b/recordmydesktop/src/rmd_poll_events.c @@ -25,21 +25,22 @@ ******************************************************************************/ #include "config.h" +#include "rmd_poll_events.h" + +#include "rmd_frame.h" +#include "rmd_macro.h" +#include "rmd_rectinsert.h" +#include "rmd_types.h" -#include -#include #include #include #include + +#include +#include #include #include -#include "rmd_frame.h" -#include "rmd_macro.h" -#include "rmd_poll_events.h" -#include "rmd_rectinsert.h" -#include "rmd_types.h" - #define CLIP_EVENT_AREA(e,brwin,xrect){\ if(((e)->area.x<=(brwin)->rrect.x)&&((e)->area.y<=(brwin)->rrect.y)&&\ diff --git a/recordmydesktop/src/rmd_queryextensions.c b/recordmydesktop/src/rmd_queryextensions.c index cc9c69c..3a196d4 100644 --- a/recordmydesktop/src/rmd_queryextensions.c +++ b/recordmydesktop/src/rmd_queryextensions.c @@ -25,14 +25,14 @@ ******************************************************************************/ #include "config.h" +#include "rmd_queryextensions.h" + +#include "rmd_types.h" #include #include #include -#include "rmd_types.h" - -#include "rmd_queryextensions.h" void QueryExtensions(Display *dpy, diff --git a/recordmydesktop/src/rmd_rectinsert.c b/recordmydesktop/src/rmd_rectinsert.c index 1950d65..8b9ea95 100644 --- a/recordmydesktop/src/rmd_rectinsert.c +++ b/recordmydesktop/src/rmd_rectinsert.c @@ -25,10 +25,12 @@ ******************************************************************************/ #include "config.h" - #include "rmd_rectinsert.h" + #include "rmd_types.h" +#include + /** * Collide two rectangles and dictate most sane action for insertion, diff --git a/recordmydesktop/src/rmd_register_callbacks.c b/recordmydesktop/src/rmd_register_callbacks.c index 6291825..fa322d5 100644 --- a/recordmydesktop/src/rmd_register_callbacks.c +++ b/recordmydesktop/src/rmd_register_callbacks.c @@ -25,12 +25,11 @@ ******************************************************************************/ #include "config.h" - -#include +#include "rmd_register_callbacks.h" #include "rmd_types.h" -#include "rmd_register_callbacks.h" +#include // There seem to be no way of passing user data to the signal handler, diff --git a/recordmydesktop/src/rmd_rescue.c b/recordmydesktop/src/rmd_rescue.c index 2b48eb0..f8776b0 100644 --- a/recordmydesktop/src/rmd_rescue.c +++ b/recordmydesktop/src/rmd_rescue.c @@ -25,17 +25,18 @@ ******************************************************************************/ #include "config.h" +#include "rmd_rescue.h" -#include - -#include "rmd_types.h" - -#include "rmd_block_utils.h" +#include "rmd_yuv_utils.h" #include "rmd_encode_cache.h" #include "rmd_initialize_data.h" #include "rmd_register_callbacks.h" -#include "rmd_rescue.h" #include "rmd_specsfile.h" +#include "rmd_types.h" + +#include + +#include int rmdRescue(const char *path){ diff --git a/recordmydesktop/src/rmd_setbrwindow.c b/recordmydesktop/src/rmd_setbrwindow.c index 431ff43..df77620 100644 --- a/recordmydesktop/src/rmd_setbrwindow.c +++ b/recordmydesktop/src/rmd_setbrwindow.c @@ -25,11 +25,10 @@ ******************************************************************************/ #include "config.h" +#include "rmd_setbrwindow.h" #include "rmd_types.h" -#include "rmd_setbrwindow.h" - /** *Align the recording window to a divisible by 2 pixel start and diff --git a/recordmydesktop/src/rmd_shortcuts.c b/recordmydesktop/src/rmd_shortcuts.c index a4031bc..dcd39d0 100644 --- a/recordmydesktop/src/rmd_shortcuts.c +++ b/recordmydesktop/src/rmd_shortcuts.c @@ -25,16 +25,17 @@ ******************************************************************************/ #include "config.h" +#include "rmd_shortcuts.h" + +#include "rmd_types.h" -#include -#include -#include #include #include #include -#include "rmd_shortcuts.h" -#include "rmd_types.h" +#include +#include +#include int RegisterShortcut(Display *dpy, Window root, diff --git a/recordmydesktop/src/rmd_specsfile.c b/recordmydesktop/src/rmd_specsfile.c index c168401..201a36a 100644 --- a/recordmydesktop/src/rmd_specsfile.c +++ b/recordmydesktop/src/rmd_specsfile.c @@ -25,13 +25,13 @@ ******************************************************************************/ #include "config.h" +#include "rmd_specsfile.h" + +#include "rmd_types.h" #include #include -#include "rmd_specsfile.h" -#include "rmd_types.h" - int WriteSpecsFile(ProgData *pdata){ diff --git a/recordmydesktop/src/rmd_threads.c b/recordmydesktop/src/rmd_threads.c index b658a49..6716fe2 100644 --- a/recordmydesktop/src/rmd_threads.c +++ b/recordmydesktop/src/rmd_threads.c @@ -25,13 +25,7 @@ ******************************************************************************/ #include "config.h" - -#include -#include -#include -#include - -#include "rmd_types.h" +#include "rmd_threads.h" #include "rmd_cache_audio.h" #include "rmd_cache_frame.h" @@ -42,9 +36,14 @@ #include "rmd_get_frame.h" #include "rmd_jack.h" #include "rmd_register_callbacks.h" -#include "rmd_threads.h" #include "rmd_timer.h" +#include "rmd_types.h" + +#include +#include +#include +#include void rmdThreads(ProgData *pdata){ pthread_t image_capture_t, diff --git a/recordmydesktop/src/rmd_timer.c b/recordmydesktop/src/rmd_timer.c index 78de72b..8891cc3 100644 --- a/recordmydesktop/src/rmd_timer.c +++ b/recordmydesktop/src/rmd_timer.c @@ -25,14 +25,15 @@ ******************************************************************************/ #include "config.h" +#include "rmd_timer.h" + +#include "rmd_types.h" #include + #include #include - -#include "rmd_types.h" - -#include "rmd_timer.h" +#include void *rmdTimer(ProgData *pdata){ diff --git a/recordmydesktop/src/rmd_types.h b/recordmydesktop/src/rmd_types.h index 213745d..3324760 100644 --- a/recordmydesktop/src/rmd_types.h +++ b/recordmydesktop/src/rmd_types.h @@ -27,6 +27,7 @@ #include "config.h" +#include #include #include #include diff --git a/recordmydesktop/src/rmd_update_image.c b/recordmydesktop/src/rmd_update_image.c index 458172e..502b859 100644 --- a/recordmydesktop/src/rmd_update_image.c +++ b/recordmydesktop/src/rmd_update_image.c @@ -25,17 +25,16 @@ ******************************************************************************/ #include "config.h" +#include "rmd_update_image.h" + +#include "rmd_getzpixmap.h" +#include "rmd_yuv_utils.h" +#include "rmd_types.h" #include #include #include -#include "rmd_types.h" - -#include "rmd_getzpixmap.h" -#include "rmd_update_image.h" -#include "rmd_yuv_utils.h" - void UpdateImage(Display * dpy, yuv_buffer *yuv, diff --git a/recordmydesktop/src/rmd_update_image.h b/recordmydesktop/src/rmd_update_image.h index f31e735..5ffe8fd 100644 --- a/recordmydesktop/src/rmd_update_image.h +++ b/recordmydesktop/src/rmd_update_image.h @@ -29,6 +29,7 @@ #include "rmd_types.h" +#include /** * Retrieve and apply all changes, if xdamage is used. diff --git a/recordmydesktop/src/rmd_wm_check.c b/recordmydesktop/src/rmd_wm_check.c index b0692da..39d86da 100644 --- a/recordmydesktop/src/rmd_wm_check.c +++ b/recordmydesktop/src/rmd_wm_check.c @@ -25,12 +25,12 @@ ******************************************************************************/ #include "config.h" - -#include +#include "rmd_wm_check.h" #include "rmd_types.h" -#include "rmd_wm_check.h" +#include + char *rmdWMCheck(Display *dpy,Window root){ diff --git a/recordmydesktop/src/rmd_wm_is_compositing.c b/recordmydesktop/src/rmd_wm_is_compositing.c index e170835..f893910 100644 --- a/recordmydesktop/src/rmd_wm_is_compositing.c +++ b/recordmydesktop/src/rmd_wm_is_compositing.c @@ -25,14 +25,15 @@ ******************************************************************************/ #include "config.h" +#include "rmd_wm_is_compositing.h" -#include - +#include "rmd_wm_check.h" #include "rmd_types.h" -#include "rmd_wm_check.h" +#include + +#include -#include "rmd_wm_is_compositing.h" boolean rmdWMIsCompositing( Display *dpy, int screen ) { diff --git a/recordmydesktop/src/rmd_yuv_utils.c b/recordmydesktop/src/rmd_yuv_utils.c index 5da501b..dbe87ae 100644 --- a/recordmydesktop/src/rmd_yuv_utils.c +++ b/recordmydesktop/src/rmd_yuv_utils.c @@ -25,14 +25,23 @@ ******************************************************************************/ #include "config.h" - #include "rmd_yuv_utils.h" +#include "rmd_math.h" + + // Keep these global (for performance reasons I assume). unsigned char Yr[256], Yg[256], Yb[256], Ur[256], Ug[256], UbVr[256], Vg[256], Vb[256]; +// FIXME: These globals are modified in other source files! We keep +// thsee here for now. These are the cache blocks. They need to be +// accesible in the dbuf macros +u_int32_t *yblocks, + *ublocks, + *vblocks; + void MakeMatrices (void) { int i; @@ -68,16 +77,16 @@ void MakeMatrices (void) { for( i = 0 ; i < 256 ; i++ ) { - Yr[i] = (unsigned char) roundf( Yoffset + yr * i ); - Yg[i] = (unsigned char) roundf( yg * i ); - Yb[i] = (unsigned char) roundf( yb * i ); + Yr[i] = (unsigned char) rmdRoundf( Yoffset + yr * i ); + Yg[i] = (unsigned char) rmdRoundf( yg * i ); + Yb[i] = (unsigned char) rmdRoundf( yb * i ); - Ur[i] = (unsigned char) roundf( Coffset + ur * i ); - Ug[i] = (unsigned char) roundf( ug * i ); - UbVr[i] = (unsigned char) roundf( ub * i ); + Ur[i] = (unsigned char) rmdRoundf( Coffset + ur * i ); + Ug[i] = (unsigned char) rmdRoundf( ug * i ); + UbVr[i] = (unsigned char) rmdRoundf( ub * i ); - Vg[i] = (unsigned char) roundf( vg * i ); - Vb[i] = (unsigned char) roundf( Coffset + vb * i ); + Vg[i] = (unsigned char) rmdRoundf( vg * i ); + Vb[i] = (unsigned char) rmdRoundf( Coffset + vb * i ); } diff --git a/recordmydesktop/src/rmd_yuv_utils.h b/recordmydesktop/src/rmd_yuv_utils.h index b1af63b..a8960a4 100644 --- a/recordmydesktop/src/rmd_yuv_utils.h +++ b/recordmydesktop/src/rmd_yuv_utils.h @@ -27,7 +27,6 @@ #ifndef YUV_UTILS_H #define YUV_UTILS_H 1 -#include "rmd_block_utils.h" #include "rmd_macro.h" #include "rmd_types.h" @@ -39,6 +38,15 @@ extern unsigned char Yr[256], Yg[256], Yb[256], Vg[256], Vb[256]; +// We keep these global for now. FIXME: Isolate them. +extern u_int32_t *yblocks, + *ublocks, + *vblocks; + +#define POINT_IN_BLOCK(xv,yv,widthv,blocksize) ((yv/blocksize)*\ + (widthv/blocksize)+\ + (xv/blocksize)) + //when adding the r values, we go beyond //the (16 bit)range of the t_val variable, but we are performing //32 bit arithmetics, so there's no problem. @@ -238,6 +246,131 @@ extern unsigned char Yr[256], Yg[256], Yb[256], }\ } +#define UPDATE_Y_PLANE_DBUF(data,\ + data_back,\ + x_tm,\ + y_tm,\ + height_tm,\ + width_tm,\ + yuv,\ + __bit_depth__){ \ + int k,i;\ + register u_int##__bit_depth__##_t t_val;\ + register unsigned char *yuv_y=yuv->y+x_tm+y_tm*yuv->y_width,\ + *_yr=Yr,*_yg=Yg,*_yb=Yb;\ + register u_int##__bit_depth__##_t *datapi=(u_int##__bit_depth__##_t *)data,\ + *datapi_back=(u_int##__bit_depth__##_t *)data_back;\ + for(k=0;ky_width-width_tm;\ + }\ +} + +#define UPDATE_UV_PLANES_DBUF( data,\ + data_back,\ + x_tm,\ + y_tm,\ + height_tm,\ + width_tm,\ + yuv,\ + __sampling_type,\ + __bit_depth__){ \ + int k,i;\ + register u_int##__bit_depth__##_t t_val;\ + register unsigned char *yuv_u=yuv->u+x_tm/2+(y_tm*yuv->uv_width)/2,\ + *yuv_v=yuv->v+x_tm/2+(y_tm*yuv->uv_width)/2,\ + *_ur=Ur,*_ug=Ug,*_ubvr=UbVr,\ + *_vg=Vg,*_vb=Vb;\ + register u_int##__bit_depth__##_t *datapi=(u_int##__bit_depth__##_t *)data,\ + *datapi_next=NULL,\ + *datapi_back=(u_int##__bit_depth__##_t *)data_back,\ + *datapi_back_next=NULL;\ + if(__sampling_type==__PXL_AVERAGE){\ + datapi_next=datapi+width_tm;\ + datapi_back_next=datapi_back+width_tm;\ + for(k=0;ky_width-width_tm)/2;\ + yuv_v+=(yuv->y_width-width_tm)/2;\ + datapi+=width_tm;\ + datapi_back+=width_tm;\ + if(__sampling_type==__PXL_AVERAGE){\ + datapi_next+=width_tm;\ + datapi_back_next+=width_tm;\ + }\ + }\ + }\ + else{\ + for(k=0;ky_width-width_tm)/2;\ + yuv_v+=(yuv->y_width-width_tm)/2;\ + datapi+=width_tm;\ + datapi_back+=width_tm;\ + if(__sampling_type==__PXL_AVERAGE){\ + datapi_next+=width_tm;\ + datapi_back_next+=width_tm;\ + }\ + }\ + }\ +} + /** * Fill Yr,Yg,Yb,Ur,Ug.Ub,Vr,Vg,Vb arrays(globals) with values. */ diff --git a/recordmydesktop/src/skeleton.h b/recordmydesktop/src/skeleton.h index 9805cdc..d088e3e 100644 --- a/recordmydesktop/src/skeleton.h +++ b/recordmydesktop/src/skeleton.h @@ -10,6 +10,7 @@ extern "C" { #endif +#include #include #define SKELETON_VERSION_MAJOR 3 diff --git a/recordmydesktop/src/test-rectinsert-data.c b/recordmydesktop/src/test-rectinsert-data.c index 2bb5c4a..9540a5f 100644 --- a/recordmydesktop/src/test-rectinsert-data.c +++ b/recordmydesktop/src/test-rectinsert-data.c @@ -21,9 +21,9 @@ ******************************************************************************/ #include "config.h" +#include "test-rectinsert-data.h" #include "test-rectinsert-types.h" -#include "test-rectinsert-data.h" // Defines to increase readability of test data diff --git a/recordmydesktop/src/test-rectinsert.c b/recordmydesktop/src/test-rectinsert.c index b63e5ce..007cfb9 100644 --- a/recordmydesktop/src/test-rectinsert.c +++ b/recordmydesktop/src/test-rectinsert.c @@ -21,12 +21,12 @@ ******************************************************************************/ #include "config.h" - -#include "rmd_types.h" #include "rmd_rectinsert.h" #include "test-rectinsert-types.h" #include "test-rectinsert-data.h" +#include "rmd_types.h" + static void SetPixel(boolean *state, int x, int y, boolean value) { -- cgit v1.2.1