diff options
author | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-09-15 22:41:52 +0000 |
---|---|---|
committer | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2006-09-15 22:41:52 +0000 |
commit | 2cbeadeae00216a58e705ca9676e67f6b8a5ccfd (patch) | |
tree | deaece249fc6ddc29fd268743b259a371632269f /recordmydesktop/src | |
parent | be180f9385ffb3459525db309fe009b6f76906ad (diff) |
exit status values
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@48 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop/src')
-rw-r--r-- | recordmydesktop/src/init_encoder.c | 10 | ||||
-rw-r--r-- | recordmydesktop/src/parseargs.c | 16 | ||||
-rw-r--r-- | recordmydesktop/src/queryextensions.c | 23 | ||||
-rw-r--r-- | recordmydesktop/src/recordmydesktop.c | 20 |
4 files changed, 30 insertions, 39 deletions
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++) |