[artoolkit-commits] artoolkit/lib/SRC/VideoLinux1394Cam video.c, 1.8, 1.9
Optical marker tracking and overlay for augmented reality.
Brought to you by:
philip_lamb
From: Wayne P. <ti...@us...> - 2006-09-15 03:44:57
|
Update of /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinux1394Cam In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv17128 Modified Files: video.c Log Message: Various clean ups to make the error reporting consistent Index: video.c =================================================================== RCS file: /cvsroot/artoolkit/artoolkit/lib/SRC/VideoLinux1394Cam/video.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** video.c 15 Sep 2006 03:41:14 -0000 1.8 --- video.c 15 Sep 2006 03:44:54 -0000 1.9 *************** *** 164,173 **** { if( gVid != NULL ) { ! printf("Device has been opened!!\n"); ! return -1; } gVid = ar2VideoOpen( config ); ! if( gVid == NULL ) return -1; ! return 0; } --- 164,174 ---- { if( gVid != NULL ) { ! fprintf(stderr, "The device has already been opened!\n"); ! exit (1); } gVid = ar2VideoOpen( config ); ! if (gVid == NULL) ! return (-1); ! return 0; } *************** *** 235,239 **** int ar2VideoDispOption( void ) { ! printf("\n"); printf("ARVideo may be configured using one or more of the following options, separated by a space:\n\n"); printf(" -node=N\n"); --- 236,240 ---- int ar2VideoDispOption( void ) { ! printf ("\n"); printf("ARVideo may be configured using one or more of the following options, separated by a space:\n\n"); printf(" -node=N\n"); *************** *** 287,306 **** if (!strcmp (config, "")) { ! /* None suppplied, lets see if the user supplied one from the shell */ char *envconf = getenv ("ARTOOLKIT_CONFIG"); if ((envconf != NULL) && (strcmp (envconf, ""))) ! { ! config = envconf; ! printf ("Using config string from environment [%s]\n", config); ! } ! else ! { ! printf ("No config string supplied, assuming 640x480 with YUV411 encoding\n"); ! } } else printf ("Using supplied config string [%s]\n", config); - a = config; if( a != NULL) { --- 288,306 ---- if (!strcmp (config, "")) { ! /* None suppplied, lets see if the user supplied one from the shell */ char *envconf = getenv ("ARTOOLKIT_CONFIG"); if ((envconf != NULL) && (strcmp (envconf, ""))) ! { ! config = envconf; ! printf ("Using config string from environment [%s]\n", config); ! } ! else ! { ! printf ("No config string supplied, assuming 640x480 with YUV411 encoding\n"); ! } } else printf ("Using supplied config string [%s]\n", config); a = config; if( a != NULL) { *************** *** 449,453 **** break; default: ! printf("Sorry, Unsupported Frame Rate for IEEE1394 Camera.\n"); exit(1); } --- 449,453 ---- break; default: ! fprintf(stderr, "Sorry, Unsupported Frame Rate for IEEE1394 Camera.\n"); exit(1); } *************** *** 612,616 **** if(vid->status != 0 && vid->status != 3){ ! printf("arVideoCapStart has already been called.\n"); return -1; } --- 612,616 ---- if(vid->status != 0 && vid->status != 3){ ! fprintf(stderr, "arVideoCapStart has already been called.\n"); return -1; } *************** *** 667,671 **** { if(vid->status == 0 || vid->status == 3){ ! printf("arVideoCapStart has never been called.\n"); return -1; } --- 667,671 ---- { if(vid->status == 0 || vid->status == 3){ ! fprintf(stderr, "arVideoCapStart has never been called.\n"); return -1; } *************** *** 685,689 **** } if(vid->status == 0){ ! printf("arVideoCapStart has never been called.\n"); return -1; } --- 685,689 ---- } if(vid->status == 0){ ! fprintf(stderr, "arVideoCapStart has never been called.\n"); return -1; } *************** *** 691,695 **** if( dc1394_stop_iso_transmission(arV1394.handle, vid->node) != DC1394_SUCCESS ) { ! printf("couldn't stop the camera?\n"); return -1; } --- 691,695 ---- if( dc1394_stop_iso_transmission(arV1394.handle, vid->node) != DC1394_SUCCESS ) { ! fprintf(stderr, "couldn't stop the camera?\n"); return -1; } *************** *** 717,730 **** if(vid->status == 0){ ! printf("arVideoCapStart has never been called.\n"); return NULL; } if(vid->status == 2){ ! printf("arVideoCapNext has never been called since previous arVideoGetImage.\n"); return NULL; } if( dc1394_dma_single_capture( &(vid->camera) ) != DC1394_SUCCESS ) { ! fprintf( stderr, "unable to capture a frame\n"); return NULL; } --- 717,730 ---- if(vid->status == 0){ ! fprintf(stderr, "arVideoCapStart has never been called.\n"); return NULL; } if(vid->status == 2){ ! fprintf(stderr, "arVideoCapNext has never been called since previous arVideoGetImage.\n"); return NULL; } if( dc1394_dma_single_capture( &(vid->camera) ) != DC1394_SUCCESS ) { ! fprintf(stderr, "unable to capture a frame\n"); return NULL; } *************** *** 772,781 **** break; case 0x59595959: /* YYYY = BW */ ! printf ("Camera is black and white, Bayer conversion is not possible\n"); exit (1); default: if (prev_pattern == -1) { ! printf ("Camera BAYER_TILE_MAPPING register has an unexpected value 0x%x on initial startup, which should not occur\n", qValue); exit (1); } --- 772,781 ---- break; case 0x59595959: /* YYYY = BW */ ! fprintf (stderr, "Camera is black and white, Bayer conversion is not possible\n"); exit (1); default: if (prev_pattern == -1) { ! fprintf (stderr, "Camera BAYER_TILE_MAPPING register has an unexpected value 0x%x on initial startup, which should not occur\n", qValue); exit (1); } *************** *** 783,787 **** { /* This is a wierd bug where occasionally you get an invalid register value and I have no idea why this is */ ! printf ("WARNING! The BAYER_TILE_MAPPING register has an unexpected value 0x%x, but I was able to use the previous stored result\n", qValue); pattern = prev_pattern; } --- 783,787 ---- { /* This is a wierd bug where occasionally you get an invalid register value and I have no idea why this is */ ! fprintf (stderr, "WARNING! The BAYER_TILE_MAPPING register has an unexpected value 0x%x, but I was able to use the previous stored result\n", qValue); pattern = prev_pattern; } |