diff options
author | enselic <enselic@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2008-09-13 14:41:31 +0000 |
---|---|---|
committer | enselic <enselic@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2008-09-13 14:41:31 +0000 |
commit | ba009b32fecf6f9651ab29bf7b980a972f0e2a1b (patch) | |
tree | 48088f95f4d9bea1a81fbff25955e392e668ccf1 | |
parent | 5f218bbf324ff0f9b1d3442386647a73b6f75443 (diff) |
include/rmdfunc.h: Get rid of InitializeData().
include/rmdmacro.h: Get rid of the DEFAULT_ARGS() macro.
src/initialize_data.[ch]: Completely move InitializeData() here and
also put the new DEFAULT_ARGS() replacement, the SetupDefaultArgs()
function, here.
src/Makefile.am
src/rmd_rescue.c
src/recordmydesktop.c: Adapt.
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@534 f606c939-3180-4ac9-a4b8-4b8779d57d0a
-rw-r--r-- | recordmydesktop/include/rmdfunc.h | 16 | ||||
-rw-r--r-- | recordmydesktop/include/rmdmacro.h | 51 | ||||
-rw-r--r-- | recordmydesktop/src/Makefile.am | 1 | ||||
-rw-r--r-- | recordmydesktop/src/initialize_data.c | 58 | ||||
-rw-r--r-- | recordmydesktop/src/initialize_data.h | 55 | ||||
-rw-r--r-- | recordmydesktop/src/recordmydesktop.c | 4 | ||||
-rw-r--r-- | recordmydesktop/src/rmd_rescue.c | 4 |
7 files changed, 119 insertions, 70 deletions
diff --git a/recordmydesktop/include/rmdfunc.h b/recordmydesktop/include/rmdfunc.h index 1df1e61..ac982cc 100644 --- a/recordmydesktop/include/rmdfunc.h +++ b/recordmydesktop/include/rmdfunc.h @@ -455,22 +455,6 @@ void EncodeCache(ProgData *pdata); */ void rmdThreads(ProgData *pdata); -/** -* initialize lists,mutexes,image buffers, take first screenshot, -* and anything else needed before launching the capture threads. -* -* \param pdata ProgData struct containing all program data -* -* \param enc_data reference to enc_data structure -* -* \param cache_data reference to cache_data structure -* -* \returns 0 on success, other values must cause the program to exit -*/ -int InitializeData(ProgData *pdata, - EncData *enc_data, - CacheData *cache_data); - #ifdef HAVE_JACK_H size_t (*jack_ringbuffer_read_p)(jack_ringbuffer_t *rb, diff --git a/recordmydesktop/include/rmdmacro.h b/recordmydesktop/include/rmdmacro.h index ee43cdf..db5300d 100644 --- a/recordmydesktop/include/rmdmacro.h +++ b/recordmydesktop/include/rmdmacro.h @@ -94,57 +94,6 @@ #endif - -#define DEFAULT_ARGS(args){\ - (args)->delay=0;\ - if(getenv("DISPLAY")!=NULL){\ - (args)->display=(char *)malloc(strlen(getenv("DISPLAY"))+1);\ - strcpy((args)->display,getenv("DISPLAY"));\ - }\ - else\ - (args)->display=NULL;\ - (args)->windowid=\ - (args)->x=\ - (args)->y=\ - (args)->width=\ - (args)->height=\ - (args)->nosound=\ - (args)->full_shots=\ - (args)->follow_mouse=\ - (args)->encOnTheFly=\ - (args)->nowmcheck=\ - (args)->overwrite=\ - (args)->use_jack=\ - (args)->noshared=\ - (args)->no_encode=\ - (args)->noframe=\ - (args)->jack_nports=0;\ - (args)->jack_ringbuffer_secs=3.0;\ - (args)->jack_port_names=NULL;\ - (args)->zerocompression=\ - (args)->no_quick_subsample=1;\ - (args)->filename=(char *)malloc(8);\ - strcpy((args)->filename,"out.ogv");\ - (args)->cursor_color=1;\ - (args)->have_dummy_cursor=0;\ - (args)->xfixes_cursor=1;\ - (args)->device=(char *)malloc(strlen(DEFAULT_AUDIO_DEVICE)+1);\ - strcpy((args)->device,DEFAULT_AUDIO_DEVICE);\ - (args)->fps=15;\ - (args)->channels=1;\ - (args)->frequency=22050;\ - (args)->buffsize=4096;\ - (args)->v_bitrate=45000;\ - (args)->v_quality=63;\ - (args)->s_quality=10;\ - (args)->workdir=(char *)malloc(5);\ - strcpy((args)->workdir,"/tmp");\ - (args)->pause_shortcut=(char *)malloc(15);\ - strcpy((args)->pause_shortcut,"Control+Mod1+p");\ - (args)->stop_shortcut=(char *)malloc(15);\ - strcpy((args)->stop_shortcut,"Control+Mod1+s");\ -} - #define AVG_4_PIXELS(data_array,width_img,k_tm,i_tm,offset)\ ((data_array[(k_tm*width_img+i_tm)*RMD_ULONG_SIZE_T+offset]+\ data_array[((k_tm-1)*width_img+i_tm)*RMD_ULONG_SIZE_T+offset]+\ diff --git a/recordmydesktop/src/Makefile.am b/recordmydesktop/src/Makefile.am index fff50e8..a939fe8 100644 --- a/recordmydesktop/src/Makefile.am +++ b/recordmydesktop/src/Makefile.am @@ -13,6 +13,7 @@ recordmydesktop_SOURCES = \ getzpixmap.c \ init_encoder.c \ initialize_data.c \ + initialize_data.h \ load_cache.c \ make_dummy_pointer.c \ opendev.c \ diff --git a/recordmydesktop/src/initialize_data.c b/recordmydesktop/src/initialize_data.c index acc2668..811f6fe 100644 --- a/recordmydesktop/src/initialize_data.c +++ b/recordmydesktop/src/initialize_data.c @@ -175,3 +175,61 @@ int InitializeData(ProgData *pdata, return 0; } + +void SetupDefaultArgs(ProgArgs *args) { + + args->delay = 0; + args->windowid = 0; + args->x = 0; + args->y = 0; + args->width = 0; + args->height = 0; + args->nosound = 0; + args->full_shots = 0; + args->follow_mouse = 0; + args->encOnTheFly = 0; + args->nowmcheck = 0; + args->overwrite = 0; + args->use_jack = 0; + args->noshared = 0; + args->no_encode = 0; + args->noframe = 0; + args->jack_nports = 0; + args->jack_ringbuffer_secs = 3.0; + args->jack_port_names = NULL; + args->zerocompression = 1; + args->no_quick_subsample = 1; + args->cursor_color = 1; + args->have_dummy_cursor = 0; + args->xfixes_cursor = 1; + args->fps = 15; + args->channels = 1; + args->frequency = 22050; + args->buffsize = 4096; + args->v_bitrate = 45000; + args->v_quality = 63; + args->s_quality = 10; + + if (getenv("DISPLAY") != NULL) { + args->display = (char *) malloc(strlen(getenv("DISPLAY")) + 1); + strcpy(args->display, getenv("DISPLAY")); + } + else { + args->display = NULL; + } + + args->device = (char *) malloc(strlen(DEFAULT_AUDIO_DEVICE) + 1); + strcpy(args->device, DEFAULT_AUDIO_DEVICE); + + args->workdir = (char *) malloc(5); + strcpy(args->workdir, "/tmp"); + + args->pause_shortcut = (char *) malloc(15); + strcpy(args->pause_shortcut, "Control+Mod1+p"); + + args->stop_shortcut = (char *) malloc(15); + strcpy(args->stop_shortcut, "Control+Mod1+s"); + + args->filename = (char *) malloc(8); + strcpy(args->filename, "out.ogv"); +} diff --git a/recordmydesktop/src/initialize_data.h b/recordmydesktop/src/initialize_data.h new file mode 100644 index 0000000..dee0ae7 --- /dev/null +++ b/recordmydesktop/src/initialize_data.h @@ -0,0 +1,55 @@ +/****************************************************************************** +* 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 INITIALIZE_DATA_H +#define INITIALIZE_DATA_H 1 + +#include "rmdtypes.h" + + +/** +* initialize lists,mutexes,image buffers, take first screenshot, +* and anything else needed before launching the capture threads. +* +* \param pdata ProgData struct containing all program data +* +* \param enc_data reference to enc_data structure +* +* \param cache_data reference to cache_data structure +* +* \returns 0 on success, other values must cause the program to exit +*/ +int InitializeData(ProgData *pdata, + EncData *enc_data, + CacheData *cache_data); + +/** +* Sets up the ProgArgs structure to default values. +*/ +void SetupDefaultArgs(ProgArgs *args); + + +#endif diff --git a/recordmydesktop/src/recordmydesktop.c b/recordmydesktop/src/recordmydesktop.c index 5a04bbc..53f776b 100644 --- a/recordmydesktop/src/recordmydesktop.c +++ b/recordmydesktop/src/recordmydesktop.c @@ -26,6 +26,7 @@ #include "recordmydesktop.h" +#include "initialize_data.h" #include "parseargs.h" @@ -33,7 +34,8 @@ int main(int argc,char **argv){ ProgData pdata; int exit_status = 0; - DEFAULT_ARGS(&pdata.args); + SetupDefaultArgs(&pdata.args); + if (!ParseArgs(argc, argv, &pdata.args)) { exit(1); } diff --git a/recordmydesktop/src/rmd_rescue.c b/recordmydesktop/src/rmd_rescue.c index ebd314e..b4624fd 100644 --- a/recordmydesktop/src/rmd_rescue.c +++ b/recordmydesktop/src/rmd_rescue.c @@ -25,6 +25,7 @@ ******************************************************************************/ #include "recordmydesktop.h" +#include "initialize_data.h" #include "register_callbacks.h" @@ -40,8 +41,7 @@ int rmdRescue(const char *path){ EncData enc_data; CacheData cache_data; - - DEFAULT_ARGS(&pdata.args); + SetupDefaultArgs(&pdata.args); pdata.enc_data=&enc_data; pdata.cache_data=&cache_data; |