diff options
author | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2007-03-13 19:58:05 +0000 |
---|---|---|
committer | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2007-03-13 19:58:05 +0000 |
commit | 25a6bc31f431f59147739876f1d9a96340b65fb2 (patch) | |
tree | 818ca96f721cbc42da2ff9f8b18afde4c40fe830 /recordmydesktop/include | |
parent | ee0b215b94e92a1592a9f7c817c8dd0acefdce83 (diff) |
fixed xdamage with xshm and
removed anything related to conditional shared memory usage.
Added GetZPixmapShm.Cleaned up pdata stuct from unneeded members.
Removed argumednts related to conditional shared (--no-cond-shared,
--shared threshold).Changed default for Shm and --with-shared is now
--no-shared.
Also, dummy cursor has been shaped up a bit.
Version changed to 0.3.4-cvs.
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@293 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop/include')
-rw-r--r-- | recordmydesktop/include/rmdfunc.h | 42 | ||||
-rw-r--r-- | recordmydesktop/include/rmdmacro.h | 40 | ||||
-rw-r--r-- | recordmydesktop/include/rmdtypes.h | 85 |
3 files changed, 90 insertions, 77 deletions
diff --git a/recordmydesktop/include/rmdfunc.h b/recordmydesktop/include/rmdfunc.h index b4d3ef6..4c8e964 100644 --- a/recordmydesktop/include/rmdfunc.h +++ b/recordmydesktop/include/rmdfunc.h @@ -161,6 +161,8 @@ void UpdateImage(Display * dpy, EncData *enc, char *datatemp, int noshmem, + XShmSegmentInfo *shminfo, + int shm_opcode, int no_quick_subsample); /** @@ -182,8 +184,6 @@ void UpdateImage(Display * dpy, * * \param height height position of the screenshot * -* \param x x position of the screenshot -* * \returns 0 on Success 1 on Failure */ int GetZPixmap(Display *dpy, @@ -195,6 +195,41 @@ int GetZPixmap(Display *dpy, int height); /** +* Rerieve pixmap data from xserver through the MIT-Shm extension +* +* \param dpy Connection to the server +* +* \param root root window of the display +* +* \param shminfo Info for the shared memory segment +* +* \param shm_opcode Opcode of Shm extension +* +* \param data (preallocated)buffer to place the data +* +* \param x x position of the screenshot +* +* \param y y position of the screenshot +* +* \param x x position of the screenshot +* +* \param width width of the screenshot +* +* \param height height position of the screenshot +* +* \returns 0 on Success 1 on Failure +*/ +int GetZPixmapSHM(Display *dpy, + Window root, + XShmSegmentInfo *shminfo, + int shm_opcode, + char *data, + int x, + int y, + int width, + int height); + +/** * Fill ProgArgs struct with arguments entered at execution * * \param argc argc as entered from main @@ -223,7 +258,8 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return); void QueryExtensions(Display *dpy, ProgArgs *args, int *damage_event, - int *damage_error); + int *damage_error, + int *shm_opcode); /** * Check and align window size diff --git a/recordmydesktop/include/rmdmacro.h b/recordmydesktop/include/rmdmacro.h index ebeb8bf..f620f73 100644 --- a/recordmydesktop/include/rmdmacro.h +++ b/recordmydesktop/include/rmdmacro.h @@ -198,25 +198,21 @@ (args)->y=\ (args)->width=\ (args)->height=\ - (args)->quietmode=\ (args)->nosound=\ (args)->full_shots=\ (args)->encOnTheFly=\ (args)->zerocompression=\ (args)->nowmcheck=\ - (args)->dropframes=\ (args)->overwrite=\ (args)->use_jack=\ - (args)->jack_nports=\ - (args)->nocondshared=0;\ + (args)->noshared=\ + (args)->jack_nports=0;\ (args)->jack_ringbuffer_secs=3.0;\ (args)->jack_port_names=NULL;\ - (args)->no_quick_subsample=\ - (args)->noshared=1;\ + (args)->no_quick_subsample=1;\ (args)->filename=(char *)malloc(8);\ strcpy((args)->filename,"out.ogg");\ (args)->cursor_color=1;\ - (args)->shared_thres=75;\ (args)->have_dummy_cursor=0;\ (args)->xfixes_cursor=1;\ (args)->device=(char *)malloc(strlen(DEFAULT_AUDIO_DEVICE)+1);\ @@ -286,15 +282,12 @@ height_tm,\ width_tm,\ yuv,\ - __copy_type,\ __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\ - +((__copy_type==__X_SHARED)?\ - (x_tm+y_tm*yuv->y_width):0);\ + register u_int##__bit_depth__##_t *datapi=(u_int##__bit_depth__##_t *)data;\ for(k=0;k<height_tm;k++){\ for(i=0;i<width_tm;i++){\ t_val=*datapi;\ @@ -305,8 +298,6 @@ yuv_y++;\ }\ yuv_y+=yuv->y_width-width_tm;\ - if(__copy_type==__X_SHARED)\ - datapi+=yuv->y_width-width_tm;\ }\ } @@ -316,7 +307,6 @@ height_tm,\ width_tm,\ yuv,\ - __copy_type,\ __sampling_type,\ __bit_depth__){ \ int k,i;\ @@ -325,13 +315,10 @@ *yuv_v=yuv->v+x_tm/2+(y_tm*yuv->uv_width)/2,\ *_ur=Ur,*_ug=Ug,*_ub=Ub,\ *_vr=Vr,*_vg=Vg,*_vb=Vb;\ - register u_int##__bit_depth__##_t *datapi=(u_int##__bit_depth__##_t *)data\ - +((__copy_type==__X_SHARED)?\ - (x_tm+y_tm*yuv->y_width):0),\ + register u_int##__bit_depth__##_t *datapi=(u_int##__bit_depth__##_t *)data,\ *datapi_next=NULL;\ if(__sampling_type==__PXL_AVERAGE){\ - datapi_next=datapi+\ - ((__copy_type==__X_SHARED)?(yuv->y_width):(width_tm));\ + datapi_next=datapi+width_tm;\ }\ for(k=0;k<height_tm;k+=2){\ for(i=0;i<width_tm;i+=2){\ @@ -356,11 +343,9 @@ }\ yuv_u+=(yuv->y_width-width_tm)/2;\ yuv_v+=(yuv->y_width-width_tm)/2;\ - datapi+=((__copy_type==__X_SHARED)?\ - (2*yuv->y_width-width_tm):width_tm);\ + datapi+=width_tm;\ if(__sampling_type==__PXL_AVERAGE)\ - datapi_next+=((__copy_type==__X_SHARED)?\ - (2*yuv->y_width-width_tm):width_tm);\ + datapi_next+=width_tm;\ }\ } @@ -370,18 +355,17 @@ y_tm,\ width_tm,\ height_tm,\ - __copy_type,\ __sampling_type,\ __color_depth){\ if((__color_depth==24)||(__color_depth==32)){\ - UPDATE_Y_PLANE(data,x_tm,y_tm,height_tm,width_tm,yuv,__copy_type,32)\ + UPDATE_Y_PLANE(data,x_tm,y_tm,height_tm,width_tm,yuv,32)\ UPDATE_UV_PLANES(data,x_tm,y_tm,height_tm,width_tm,\ - yuv,__copy_type,__sampling_type,32)\ + yuv,__sampling_type,32)\ }\ else if(__color_depth==16){\ - UPDATE_Y_PLANE(data,x_tm,y_tm,height_tm,width_tm,yuv,__copy_type,16)\ + UPDATE_Y_PLANE(data,x_tm,y_tm,height_tm,width_tm,yuv,16)\ UPDATE_UV_PLANES(data,x_tm,y_tm,height_tm,width_tm,\ - yuv,__copy_type,__sampling_type,16)\ + yuv,__sampling_type,16)\ }\ } diff --git a/recordmydesktop/include/rmdtypes.h b/recordmydesktop/include/rmdtypes.h index f8d9f4a..31a0d6d 100644 --- a/recordmydesktop/include/rmdtypes.h +++ b/recordmydesktop/include/rmdtypes.h @@ -60,6 +60,7 @@ #include <X11/extensions/Xfixes.h> #include <X11/extensions/Xdamage.h> #include <X11/extensions/XShm.h> +#include <X11/extensions/shmstr.h> #include <theora/theora.h> #include <vorbis/codec.h> #include <vorbis/vorbisenc.h> @@ -93,11 +94,6 @@ typedef u_int64_t cmp_int_t; typedef u_int32_t cmp_int_t; #endif -//how we obtained the image we are converting to yuv -enum{ - __X_SHARED, //through MIT/Shm - __X_IPC //through the regular X IPC mechanism -}; //type of pixel proccessing for the Cb,Cr planes //when converting from full rgb to 4:2:2 Ycbcr enum{ @@ -144,7 +140,6 @@ typedef struct _ProgArgs{ char *display; //display to connect(default :0) int x,y; //x,y offset(default 0,0) int width,height; //defaults to window width and height - int quietmode; //no messages to stderr,stdout char *filename; //output file(default out.[ogg|*]) int cursor_color; //black or white=>1 or 0 int have_dummy_cursor; //disable/enable drawing of the dummy cursor @@ -160,15 +155,12 @@ typedef struct _ProgArgs{ u_int32_t buffsize; #endif int nosound; //do not record sound(default 0) - int noshared; //do not use shared memory extension(default 1) - int nocondshared; //do not use shared memory on large image aquititions + int noshared; //do not use shared memory extension(default 0) int nowmcheck; //do not check if there's a 3d comp window manager //(which changes full-shots and with-shared to 1) - int shared_thres; //threshold to use shared memory int full_shots; //do not poll damage, take full screenshots int no_quick_subsample; //average pixels in chroma planes int v_bitrate,v_quality,s_quality; //video bitrate,video-sound quality - int dropframes; //option for theora encoder int encOnTheFly; //encode while recording, no caching(default 0) char *workdir; //directory to be used for cache files(default $HOME) int zerocompression;//image data are always flushed uncompressed @@ -264,43 +256,23 @@ typedef struct _JackData{ //threads,so they will have access to the program data, avoiding //at the same time usage of any globals. typedef struct _ProgData{ +/**recordMyDesktop specific structs*/ ProgArgs args; //the program arguments DisplaySpecs specs; //Display specific information BRWindow brwin; //recording window - Display *dpy; //curtrent display - char *window_manager; //name of the window manager at program launch - XImage *image; //the image that holds the current full screenshot - XImage *shimage; //the image that holds the current - //full screenshot(shared memory) - XShmSegmentInfo shminfo;//info structure for the image above. - unsigned char *dummy_pointer; //a dummy pointer to be drawn - //in every frame - //data is casted to unsigned for - //later use in YUV buffer - int dummy_p_size; //initially 16x16,always square - unsigned char npxl; //this is the no pixel convention - //when drawing the dummy pointer - char *datamain, //the data of image - *datash, //the data of shimage - *datatemp; //buffer for the temporary image,which will be - //preallocated in case shared memory is not used. RectArea *rect_root[2]; //the interchanging list roots for storing //the changed regions - int list_selector, //selector for the above - damage_event, //damage event base code - damage_error, //damage error base code - running; SndBuffer *sound_buffer; EncData *enc_data; CacheData *cache_data; #ifdef HAVE_JACK_H JackData *jdata; #endif - int hard_pause; //if sound device doesn't support pause - //we have to close and reopen - int avd; //syncronization among audio and video - unsigned int periodtime, - frametime; +/**X related info*/ + Display *dpy; //curtrent display + XImage *image; //the image that holds the current full screenshot + XShmSegmentInfo shminfo;//info structure for the image above. +/** Mutexes*/ pthread_mutex_t list_mutex[2], //mutexes for concurrency //protection of the lists sound_buffer_mutex, @@ -317,6 +289,7 @@ typedef struct _ProgData{ //to avoid wrong coloring to render //Currently this mutex only prevents //the cursor from flickering +/**Condition Variables*/ pthread_cond_t time_cond, //this gets a broadcast by the handler //whenever it's time to get a screenshot pause_cond, //this is blocks execution, @@ -328,10 +301,30 @@ typedef struct _ProgData{ //procceed to creating last vorbis_lib_clean; //packages until these two libs //are no longer used, by other threads - int th_encoding_clean, - v_encoding_clean; - int v_enc_thread_waiting, //these indicate a wait - th_enc_thread_waiting; //condition on the above cond vars +/**Buffers,Flags and other vars*/ + unsigned char *dummy_pointer, //a dummy pointer to be drawn + //in every frame + //data is casted to unsigned for + //later use in YUV buffer + npxl; //this is the no pixel convention + //when drawing the dummy pointer + unsigned int periodtime,//time that a sound buffer lasts (microsecs) + frametime; //time that a frame lasts (microsecs) + char *pxl_data, //the data of image + *window_manager; //name of the window manager at program launch + int list_selector, //selector for the rect_roots + damage_event, //damage event base code + damage_error, //damage error base code + shm_opcode, //MIT-Shm opcode + running, //1 while the program is capturing/paused/encoding + dummy_p_size, //dummy pointer size,initially 16x16,always square + th_encoding_clean, //thread exit inidcator + v_encoding_clean, // >> >> + v_enc_thread_waiting, //these indicate a wait + th_enc_thread_waiting, //condition on the cond vars. + hard_pause, //if sound device doesn't support pause + //we have to close and reopen + avd; //syncronization among audio and video #ifdef HAVE_LIBASOUND snd_pcm_t *sound_handle; snd_pcm_uframes_t periodsize; @@ -371,12 +364,12 @@ typedef struct _FrameHeader{ typedef struct _CachedFrame{ FrameHeader *header; - u_int32_t *YBlocks; //identifying number on the grid, - u_int32_t *UBlocks; //starting at top left - u_int32_t *VBlocks; // >> >> - unsigned char *YData; //pointer to data for the blocks that have changed, - unsigned char *UData; //which have to be remapped - unsigned char *VData; //on the buffer when reading + u_int32_t *YBlocks, //identifying number on the grid, + *UBlocks, //starting at top left + *VBlocks; // >> >> + unsigned char *YData, //pointer to data for the blocks that have changed, + *UData, //which have to be remapped + *VData; //on the buffer when reading }CachedFrame; #endif |