diff options
Diffstat (limited to 'recordmydesktop/src')
-rw-r--r-- | recordmydesktop/src/get_frame.c | 45 | ||||
-rw-r--r-- | recordmydesktop/src/initialize_data.c | 33 | ||||
-rw-r--r-- | recordmydesktop/src/recordmydesktop.c | 4 | ||||
-rw-r--r-- | recordmydesktop/src/update_image.c | 36 |
4 files changed, 35 insertions, 83 deletions
diff --git a/recordmydesktop/src/get_frame.c b/recordmydesktop/src/get_frame.c index d020f97..d3fb2ab 100644 --- a/recordmydesktop/src/get_frame.c +++ b/recordmydesktop/src/get_frame.c @@ -29,6 +29,8 @@ void *GetFrame(ProgData *pdata){ int tlist_sel=0; + unsigned char *dtap=NULL; //pointer switching among shared memory and + //normal buffer pthread_mutex_t pmut,tmut; uint msk_ret; WGeometry mouse_pos_abs,mouse_pos_rel,mouse_pos_temp; @@ -76,9 +78,6 @@ void *GetFrame(ProgData *pdata){ level*=100; level/=pixel_total; pdata->args.noshared=(level<pdata->args.shared_thres); -// if(!pdata->args.noshared){ -// fprintf(stderr,"shared screenshot with %d\n",level); -// } } } if(pdata->args.xfixes_cursor){ @@ -126,6 +125,10 @@ void *GetFrame(ProgData *pdata){ pdata->args.noshared, pdata->args.no_quick_subsample); else{ + + dtap=(((pdata->args.nocondshared)&&(!pdata->args.noshared))? + ((unsigned char*)pdata->shimage->data): + ((unsigned char*)pdata->image->data)); if(pdata->args.noshared){ GetZPixmap( pdata->dpy, pdata->specs.root, @@ -134,34 +137,16 @@ void *GetFrame(ProgData *pdata){ pdata->brwin.rgeom.y, pdata->brwin.rgeom.width, pdata->brwin.rgeom.height); - pthread_mutex_lock(&pdata->yuv_mutex); - if(pdata->args.no_quick_subsample){ - UPDATE_YUV_BUFFER_IM_AVG((&pdata->enc_data->yuv),((unsigned char*)pdata->image->data), - (pdata->enc_data->x_offset),(pdata->enc_data->y_offset), - (pdata->brwin.rgeom.width),(pdata->brwin.rgeom.height)); - } - else{ - UPDATE_YUV_BUFFER_IM((&pdata->enc_data->yuv),((unsigned char*)pdata->image->data), - (pdata->enc_data->x_offset),(pdata->enc_data->y_offset), - (pdata->brwin.rgeom.width),(pdata->brwin.rgeom.height)); - } - pthread_mutex_unlock(&pdata->yuv_mutex); - } - else{ - pthread_mutex_lock(&pdata->yuv_mutex); - if(pdata->args.no_quick_subsample){ - UPDATE_YUV_BUFFER_IM_AVG((&pdata->enc_data->yuv),((unsigned char*)pdata->shimage->data), - (pdata->enc_data->x_offset),(pdata->enc_data->y_offset), - (pdata->brwin.rgeom.width),(pdata->brwin.rgeom.height)); - } - else{ - UPDATE_YUV_BUFFER_IM((&pdata->enc_data->yuv),((unsigned char*)pdata->shimage->data), - (pdata->enc_data->x_offset),(pdata->enc_data->y_offset), - (pdata->brwin.rgeom.width),(pdata->brwin.rgeom.height)); - } - - pthread_mutex_unlock(&pdata->yuv_mutex); } + pthread_mutex_lock(&pdata->yuv_mutex); + UPDATE_YUV_BUFFER((&pdata->enc_data->yuv),dtap, + (pdata->enc_data->x_offset), + (pdata->enc_data->y_offset), + (pdata->brwin.rgeom.width), + (pdata->brwin.rgeom.height), + pdata->args.noshared, + pdata->args.no_quick_subsample); + pthread_mutex_unlock(&pdata->yuv_mutex); } if(pdata->args.xfixes_cursor){ //avoid segfaults diff --git a/recordmydesktop/src/initialize_data.c b/recordmydesktop/src/initialize_data.c index f06d71e..2a710b5 100644 --- a/recordmydesktop/src/initialize_data.c +++ b/recordmydesktop/src/initialize_data.c @@ -31,6 +31,8 @@ int InitializeData(ProgData *pdata, EncData *enc_data, CacheData *cache_data){ int i; + unsigned char *dtap=NULL; //pointer switching among shared memory and + //normal buffer //these are globals, look for them at the header frames_total=frames_lost=encoder_busy=capture_busy=0; @@ -115,30 +117,15 @@ int InitializeData(ProgData *pdata, pdata->enc_data->yuv.v[i]=pdata->enc_data->yuv.u[i]=127; } - if((pdata->args.nocondshared)&&(!pdata->args.noshared)){ - if(pdata->args.no_quick_subsample){ - UPDATE_YUV_BUFFER_IM_AVG((&pdata->enc_data->yuv),((unsigned char*)pdata->shimage->data), - (pdata->enc_data->x_offset),(pdata->enc_data->y_offset), - (pdata->brwin.rgeom.width),(pdata->brwin.rgeom.height)); - } - else{ - UPDATE_YUV_BUFFER_IM((&pdata->enc_data->yuv),((unsigned char*)pdata->shimage->data), - (pdata->enc_data->x_offset),(pdata->enc_data->y_offset), - (pdata->brwin.rgeom.width),(pdata->brwin.rgeom.height)); - } - } - else{ - if(pdata->args.no_quick_subsample){ - UPDATE_YUV_BUFFER_IM_AVG((&pdata->enc_data->yuv),((unsigned char*)pdata->image->data), - (pdata->enc_data->x_offset),(pdata->enc_data->y_offset), - (pdata->brwin.rgeom.width),(pdata->brwin.rgeom.height)); - } - else{ - UPDATE_YUV_BUFFER_IM((&pdata->enc_data->yuv),((unsigned char*)pdata->image->data), + dtap=(((pdata->args.nocondshared)&&(!pdata->args.noshared))? + ((unsigned char*)pdata->shimage->data): + ((unsigned char*)pdata->image->data)); + + + UPDATE_YUV_BUFFER((&pdata->enc_data->yuv),dtap, (pdata->enc_data->x_offset),(pdata->enc_data->y_offset), - (pdata->brwin.rgeom.width),(pdata->brwin.rgeom.height)); - } - } + (pdata->brwin.rgeom.width),(pdata->brwin.rgeom.height), + __X_IPC,(pdata->args.no_quick_subsample)); pdata->frametime=(1000000)/pdata->args.fps; diff --git a/recordmydesktop/src/recordmydesktop.c b/recordmydesktop/src/recordmydesktop.c index decc86d..7f41e6e 100644 --- a/recordmydesktop/src/recordmydesktop.c +++ b/recordmydesktop/src/recordmydesktop.c @@ -54,8 +54,8 @@ int main(int argc,char **argv){ CacheData cache_data; QUERY_DISPLAY_SPECS(pdata.dpy,&pdata.specs); - if(pdata.specs.depth!=24){ - fprintf(stderr,"Only 24bpp color depth mode is currently supported.\n"); + if((pdata.specs.depth!=32)&&(pdata.specs.depth!=24)&&(pdata.specs.depth!=16)){ + fprintf(stderr,"Only 32bpp,24bpp and 16bpp color depth modes are currently supported.\n"); exit(10); } if(SetBRWindow(pdata.dpy,&pdata.brwin,&pdata.specs,&pdata.args)) diff --git a/recordmydesktop/src/update_image.c b/recordmydesktop/src/update_image.c index 2725011..1bf0cd5 100644 --- a/recordmydesktop/src/update_image.c +++ b/recordmydesktop/src/update_image.c @@ -40,7 +40,7 @@ void UpdateImage(Display * dpy, RectArea *temp; unsigned char *dtap=(unsigned char*)datatemp; temp=*root; - + if(temp!=NULL){ do{ if(noshmem){ @@ -51,34 +51,14 @@ void UpdateImage(Display * dpy, temp->geom.y, temp->geom.width, temp->geom.height); - - pthread_mutex_lock(yuv_mutex); - if(no_quick_subsample){ - UPDATE_YUV_BUFFER_IM_AVG(yuv,dtap, - (temp->geom.x-brwin->rgeom.x+enc->x_offset),(temp->geom.y-brwin->rgeom.y+enc->y_offset), - (temp->geom.width),(temp->geom.height)); - } - else{ - UPDATE_YUV_BUFFER_IM(yuv,dtap, - (temp->geom.x-brwin->rgeom.x+enc->x_offset),(temp->geom.y-brwin->rgeom.y+enc->y_offset), - (temp->geom.width),(temp->geom.height)); - } - - pthread_mutex_unlock(yuv_mutex); - } - else{ - if(no_quick_subsample){ - UPDATE_YUV_BUFFER_SH_AVG(yuv,dtap, - (temp->geom.x-brwin->rgeom.x+enc->x_offset),(temp->geom.y-brwin->rgeom.y+enc->y_offset), - (temp->geom.width),(temp->geom.height)); - } - else{ - UPDATE_YUV_BUFFER_SH(yuv,dtap, - (temp->geom.x-brwin->rgeom.x+enc->x_offset),(temp->geom.y-brwin->rgeom.y+enc->y_offset), - (temp->geom.width),(temp->geom.height)); - } - } + pthread_mutex_lock(yuv_mutex); + UPDATE_YUV_BUFFER(yuv,dtap, + (temp->geom.x-brwin->rgeom.x+enc->x_offset), + (temp->geom.y-brwin->rgeom.y+enc->y_offset), + (temp->geom.width),(temp->geom.height), + noshmem,no_quick_subsample); + pthread_mutex_unlock(yuv_mutex); temp=temp->next; }while(temp!=NULL); } |