summaryrefslogtreecommitdiff
path: root/recordmydesktop/src
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2007-01-20 22:21:28 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2007-01-20 22:21:28 +0000
commitfa96f09ceadcad5247a84245ad933782b4b71ee6 (patch)
treee4e4b1d3d5d6f95b7122c4c01141fea60b72ce1f /recordmydesktop/src
parent27ef1920cf848e9add94c4106f8a76230efe787a (diff)
Concatated all UPDATE_YUV_BUFFER_* macros into one, UPDATE_YUV_BUFFER.
This one is further broken into UPDATE_(X)_PLANE(S)_(Y) macros, where X is Y or UV and Y is 32 or 16(color depth). This will allow easier incorporation of 16bpp support, without code duplication(where it can be avoided) and without bloating the toplevel calls of these macros with multiple similar blocks of code. Also changed toplevel check of depth, to allow running on 16 bpp git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@259 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop/src')
-rw-r--r--recordmydesktop/src/get_frame.c45
-rw-r--r--recordmydesktop/src/initialize_data.c33
-rw-r--r--recordmydesktop/src/recordmydesktop.c4
-rw-r--r--recordmydesktop/src/update_image.c36
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);
}
© All Rights Reserved