summaryrefslogtreecommitdiff
path: root/recordmydesktop
diff options
context:
space:
mode:
Diffstat (limited to 'recordmydesktop')
-rw-r--r--recordmydesktop/doc/recordmydesktop.142
-rw-r--r--recordmydesktop/include/recordmydesktop.h2
-rw-r--r--recordmydesktop/src/init_encoder.c10
-rw-r--r--recordmydesktop/src/parseargs.c16
-rw-r--r--recordmydesktop/src/queryextensions.c23
-rw-r--r--recordmydesktop/src/recordmydesktop.c20
6 files changed, 66 insertions, 47 deletions
diff --git a/recordmydesktop/doc/recordmydesktop.1 b/recordmydesktop/doc/recordmydesktop.1
index b77e061..12061e2 100644
--- a/recordmydesktop/doc/recordmydesktop.1
+++ b/recordmydesktop/doc/recordmydesktop.1
@@ -112,6 +112,34 @@ sections.
.br
Non-zero means an error occurred, which is printed in stderr.
.br
+.br
+The following error codes indicate the nature of the error:
+.br
+1 Error while parsing the arguments.
+.br
+2 Initializing the encoder failed(either vorbis or theora).
+.br
+3 Could not open/configure sound card.
+.br
+4 Xdamage extension not present.
+.br
+5 Shared memory extension not present.
+.br
+6 Xfixes extension not present.
+.br
+7 XInitThreads failed.
+.br
+8 No $DISPLAY environment variable and none specified as argument.
+.br
+9 Cannot connect to Xserver.
+.br
+10 Color depth is not 24bpp.
+.br
+11 Improper window specification.
+.br
+12 Cannot attach shared memory to proccess.
+.br
+.br
.SH OPTIONS
.PP
.B
@@ -169,12 +197,12 @@ Image Options:
.TP
.B
\-dummy\-cursor color
- Color of the dummy cursor [black|white](default black)
+ Draw a dummy cursor, instead of the normal one.Value of color can be "black" or "white".
.br
.TP
.B
- \-\-no\-dummy\-cursor
- Disable drawing of a dummy cursor.
+ \-\-no\-cursor
+ Disable drawing of the cursor.
.br
.TP
.B
@@ -198,8 +226,8 @@ Image Options:
.br
.TP
.B
- \-\-no\-quick\-subsampling
- Do subsampling of the chroma planes by averaging,not discarding extra pixels.
+ \-\-quick\-subsampling
+ Do subsampling of the chroma planes by discarding extra pixels.
.br
.TP
.B
@@ -298,11 +326,11 @@ If no other option is specified, filename can be given without the \-o switch.
.br
\-v_quality n| \-s_quality n| \-v_bitrate n| \-\-no\-framedrop| \-dummy\-cursor color|
.br
-\-\-no\-dummy\-cursor| \-freq N(number>0)| \-channels N(number>0)| \-device SOUND_DEVICE|
+\-\-no\-cursor| \-freq N(number>0)| \-channels N(number>0)| \-device SOUND_DEVICE|
.br
\-\-nosound| \-\-with\-shared| \-\-no\-cond\-shared| \-shared\-threshold n| \-\-full\-shots|
.br
-\-\-no\-quick\-subsampling| \-\-scshot| \-scale\-shot N| \-o filename]^filename
+\-\-quick\-subsampling| \-\-scshot| \-scale\-shot N| \-o filename]^filename
.br
.br
.br
diff --git a/recordmydesktop/include/recordmydesktop.h b/recordmydesktop/include/recordmydesktop.h
index cc1f025..055918a 100644
--- a/recordmydesktop/include/recordmydesktop.h
+++ b/recordmydesktop/include/recordmydesktop.h
@@ -471,7 +471,7 @@ void RegisterCallbacks(ProgArgs *args);
void UpdateImage(Display * dpy,yuv_buffer *yuv,pthread_mutex_t *yuv_mutex,DisplaySpecs *specs,RectArea **root,BRWindow *brwin,EncData *enc,char *datatemp,int noshmem,int no_quick_subsample);
int GetZPixmap(Display *dpy,Window root,char *data,int x,int y,int width,int height);
int ParseArgs(int argc,char **argv,ProgArgs *arg_return);
-int QueryExtensions(Display *dpy,ProgArgs *args,int *damage_event,int *damage_error);
+void QueryExtensions(Display *dpy,ProgArgs *args,int *damage_event,int *damage_error);
int SetBRWindow(Display *dpy,BRWindow *brwin,DisplaySpecs *specs,ProgArgs *args);
int ZPixmapToBMP(XImage *imgz,BRWindow *brwin,char *fname,int nbytes,int scale);
unsigned char *MakeDummyPointer(DisplaySpecs *specs,int size,int color,int type,unsigned char *npxl);
diff --git a/recordmydesktop/src/init_encoder.c b/recordmydesktop/src/init_encoder.c
index f8af53f..1ca9ed4 100644
--- a/recordmydesktop/src/init_encoder.c
+++ b/recordmydesktop/src/init_encoder.c
@@ -78,7 +78,7 @@ void InitEncoder(ProgData *pdata,EncData *enc_data_t){
ret = vorbis_encode_init_vbr(&(enc_data_t)->m_vo_inf,pdata->args.channels,pdata->args.frequency,(float)pdata->args.s_quality*0.1);
if(ret){
fprintf(stderr,"Error while setting up vorbis stream quality!\n");
- exit(1);
+ exit(2);
}
vorbis_comment_init(&(enc_data_t)->m_vo_cmmnt);
vorbis_analysis_init(&(enc_data_t)->m_vo_dsp,&(enc_data_t)->m_vo_inf);
@@ -90,7 +90,7 @@ void InitEncoder(ProgData *pdata,EncData *enc_data_t){
ogg_stream_packetin(&(enc_data_t)->m_ogg_ts,&(enc_data_t)->m_ogg_pckt1);
if(ogg_stream_pageout(&(enc_data_t)->m_ogg_ts,&(enc_data_t)->m_ogg_pg)!=1){
fprintf(stderr,"Internal Ogg library error.\n");
- exit(1);
+ exit(2);
}
fwrite((enc_data_t)->m_ogg_pg.header,1,(enc_data_t)->m_ogg_pg.header_len,(enc_data_t)->fp);
fwrite((enc_data_t)->m_ogg_pg.body,1,(enc_data_t)->m_ogg_pg.body_len,(enc_data_t)->fp);
@@ -112,7 +112,7 @@ void InitEncoder(ProgData *pdata,EncData *enc_data_t){
ogg_stream_packetin(&(enc_data_t)->m_ogg_vs,&header);
if(ogg_stream_pageout(&(enc_data_t)->m_ogg_vs,&(enc_data_t)->m_ogg_pg)!=1){
fprintf(stderr,"Internal Ogg library error.\n");
- exit(1);
+ exit(2);
}
fwrite((enc_data_t)->m_ogg_pg.header,1,(enc_data_t)->m_ogg_pg.header_len,(enc_data_t)->fp);
fwrite((enc_data_t)->m_ogg_pg.body,1,(enc_data_t)->m_ogg_pg.body_len,(enc_data_t)->fp);
@@ -127,7 +127,7 @@ void InitEncoder(ProgData *pdata,EncData *enc_data_t){
int result = ogg_stream_flush(&(enc_data_t)->m_ogg_ts,&(enc_data_t)->m_ogg_pg);
if(result<0){
fprintf(stderr,"Internal Ogg library error.\n");
- exit(1);
+ exit(2);
}
if(result==0)break;
fwrite((enc_data_t)->m_ogg_pg.header,1,(enc_data_t)->m_ogg_pg.header_len,(enc_data_t)->fp);
@@ -139,7 +139,7 @@ void InitEncoder(ProgData *pdata,EncData *enc_data_t){
int result=ogg_stream_flush(&(enc_data_t)->m_ogg_vs,&(enc_data_t)->m_ogg_pg);
if(result<0){
fprintf(stderr,"Internal Ogg library error.\n");
- exit(1);
+ exit(2);
}
if(result==0)break;
fwrite((enc_data_t)->m_ogg_pg.header,1,(enc_data_t)->m_ogg_pg.header_len,(enc_data_t)->fp);
diff --git a/recordmydesktop/src/parseargs.c b/recordmydesktop/src/parseargs.c
index 6b40cc9..5280cf2 100644
--- a/recordmydesktop/src/parseargs.c
+++ b/recordmydesktop/src/parseargs.c
@@ -34,7 +34,7 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){
"\trecordmydesktop [-h| --help| --version| -delay n[H|h|M|m]| -windowid id_of_window|\n"
"\t-display DISPLAY| -x X| -y Y|-width N| -height N| -fps N(number>0)|\n"
"\t -v_quality n| -s_quality n| -v_bitrate n| --no-framedrop| -dummy-cursor color|\n"
- "\t --no-dummy-cursor| -freq N(number>0)| -channels N(number>0)| -device SOUND_DEVICE|\n"
+ "\t --no-cursor| -freq N(number>0)| -channels N(number>0)| -device SOUND_DEVICE|\n"
"\t --nosound| --with-shared| --no-cond-shared| -shared-threshold n| --full-shots|\n"
"\t --quick-subsampling| --scshot| -scale-shot N| -o filename]^filename\n\n\n"
@@ -50,8 +50,8 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){
"\t-width N\t\tWidth of recorded window.\n"
"\t-height N\t\tHeight of recorded window.\n\n"
- "\t-dummy-cursor color\tColor of the dummy cursor [black|white](default black)\n"
- "\t--no-dummy-cursor\tDisable drawing of a dummy cursor.\n"
+ "\t-dummy-cursor color\tColor of the dummy cursor [black|white]\n"
+ "\t--no-cursor\tDisable drawing of the cursor.\n"
"\t--with-shared\t\tEnable usage of MIT-shared memory extension at all times.\n"
"\t--no-cond-shared\tDo not use the MIT-shared memory extension when aquiring large areas.\n"
"\t-shared-threshold n\tThreshold over which shared memory is used(default 75).\n"
@@ -275,18 +275,20 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){
else if(!strcmp(argv[i+1],"black"))
arg_return->cursor_color=1;
else{
- fprintf(stderr,"Argument Usage: -dummy-cursor [black|white](default black)\n");
+ fprintf(stderr,"Argument Usage: -dummy-cursor [black|white]\n");
return 1;
}
+ arg_return->have_dummy_cursor=1;
+ arg_return->xfixes_cursor=0;
}
else{
- fprintf(stderr,"Argument Usage: -dummy-cursor [black|white](default black)\n");
+ fprintf(stderr,"Argument Usage: -dummy-cursor [black|white]\n");
return 1;
}
i++;
}
- else if(!strcmp(argv[i],"--no-dummy-cursor"))
- arg_return->have_dummy_cursor=0;
+ else if(!strcmp(argv[i],"--no-cursor"))
+ arg_return->xfixes_cursor=0;
else if(!strcmp(argv[i],"-freq")){
if(i+1<argc){
int num=atoi(argv[i+1]);
diff --git a/recordmydesktop/src/queryextensions.c b/recordmydesktop/src/queryextensions.c
index 0ccac84..0b311b9 100644
--- a/recordmydesktop/src/queryextensions.c
+++ b/recordmydesktop/src/queryextensions.c
@@ -27,33 +27,22 @@
#include <recordmydesktop.h>
-int QueryExtensions(Display *dpy,ProgArgs *args,int *damage_event,int *damage_error){
+void QueryExtensions(Display *dpy,ProgArgs *args,int *damage_event,int *damage_error){
int xf_event_basep,
xf_error_basep;
if(!XDamageQueryExtension( dpy, damage_event, damage_error)){
fprintf(stderr,"XDamage extension not found!!!\n");
- return 1;
+ exit(4);
}
if((!args->noshared)&&(XShmQueryExtension(dpy)==False)){
args->noshared=1;
- fprintf(stderr,"Shared Memory extension not present!\nContinuing without it.\n");
+ fprintf(stderr,"Shared Memory extension not present!\nTry again removing the --with-shared option(if you used it)\nand add the --no-cond-shared option.\n");
+ exit(5);
}
if((args->xfixes_cursor)&&(XFixesQueryExtension(dpy,&xf_event_basep,&xf_error_basep)==False)){
args->xfixes_cursor=0;
- fprintf(stderr,"Xfixes extension not present!\nContinuing without it.\n");
+ fprintf(stderr,"Xfixes extension not present!\nPlease run with the -dummy-cursor or --no-cursor option.\n");
+ exit(6);
}
-// XFixesCursorImage *xcim;
-// xcim=XFixesGetCursorImage (dpy);
-// fprintf(stderr,"XFIXES:\n\n%d %d\n\n\n%d %d\n\n",xcim->width,xcim->height,xcim->xhot,xcim->yhot);
-// int i=0,k=0;
-// unsigned char *cp=((unsigned char *)xcim->pixels);
-// for(i=0;i<xcim->height;i++){
-// for(k=0;k<xcim->width*4;k+=4){
-// fprintf(stderr,"%d",cp[i*xcim->width*4+k]);
-// }
-// fprintf(stderr,"\n");
-// }
-
- return 0;
}
diff --git a/recordmydesktop/src/recordmydesktop.c b/recordmydesktop/src/recordmydesktop.c
index c2f8710..fda74f9 100644
--- a/recordmydesktop/src/recordmydesktop.c
+++ b/recordmydesktop/src/recordmydesktop.c
@@ -33,7 +33,7 @@ int main(int argc,char **argv){
if(XInitThreads ()==0){
fprintf(stderr,"Couldn't initialize thread support!\n");
- exit(1);
+ exit(7);
}
DEFAULT_ARGS(&pdata.args);
if(ParseArgs(argc,argv,&pdata.args)){
@@ -43,11 +43,11 @@ int main(int argc,char **argv){
pdata.dpy = XOpenDisplay(pdata.args.display);
else{
fprintf(stderr,"No display specified for connection!\n");
- exit(1);
+ exit(8);
}
if (pdata.dpy == NULL) {
fprintf(stderr, "Cannot connect to X server %s\n",pdata.args.display);
- exit(1);
+ exit(9);
}
else{
EncData enc_data;
@@ -63,12 +63,12 @@ int main(int argc,char **argv){
QUERY_DISPLAY_SPECS(pdata.dpy,&pdata.specs);
if(pdata.specs.depth!=24){
fprintf(stderr,"Only 24bpp color depth mode is currently supported.\n");
- exit(1);
+ exit(10);
}
if(SetBRWindow(pdata.dpy,&pdata.brwin,&pdata.specs,&pdata.args))
- exit(1);
- if(QueryExtensions(pdata.dpy,&pdata.args,&pdata.damage_event, &pdata.damage_error))
- exit(1);
+ exit(11);
+
+ QueryExtensions(pdata.dpy,&pdata.args,&pdata.damage_event, &pdata.damage_error);
//init data
@@ -120,7 +120,7 @@ int main(int argc,char **argv){
shminfo.readOnly = False;
if(!XShmAttach(pdata.dpy,&shminfo)){
fprintf(stderr,"Failed to attach shared memory to proccess.\n");
- exit(1);
+ exit(12);
}
XShmGetImage(pdata.dpy,pdata.specs.root,pdata.shimage,pdata.brwin.rgeom.x,pdata.brwin.rgeom.y,AllPlanes);
}
@@ -139,8 +139,8 @@ int main(int argc,char **argv){
if(!pdata.args.nosound)
pdata.sound_handle=OpenDev(pdata.args.device,&pdata.args.channels,&pdata.args.frequency,&pdata.periodsize, &pdata.periodtime,&pdata.hard_pause);
if(pdata.sound_handle==NULL){
- fprintf(stderr,"Error while opening/configuring soundcard %s\nProcceeding with no sound\n",pdata.args.device);
- pdata.args.nosound=1;
+ fprintf(stderr,"Error while opening/configuring soundcard %s\nTry running with the --no-sound or specify a correct device.\n",pdata.args.device);
+ exit(3);
}
InitEncoder(&pdata,&enc_data);
for(i=0;i<(pdata.enc_data->yuv.y_width*pdata.enc_data->yuv.y_height);i++)
© All Rights Reserved