Esempio n. 1
0
/*
 *			M A I N
 */
int
main(int argc, char **argv)
{
    register FBIO	*fbp = FBIO_NULL;
    int scene_number = 1;
    int start_frame = 1;
    int number_of_frames=0;
    int number_of_images=0;
    int start_seq_number=0;
    int	exit_code;

    exit_code = 0;

    bu_log(""
	   "*** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***\n"
	   "\n"
	   "This tool is deprecated and under consideration for removal from\n"
	   "BRL-CAD.  If you use this tool, please contact the developers via\n"
	   "[email protected] to express your interest and justification for not\n"
	   "removing this tool.  Otherwise, this tool will likely be removed from\n"
	   "a future release of BRL-CAD.\n"
	   "\n"
	   "*** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***\n"
	   "\n");

    if ( !get_args( argc, argv ) )  {
	usage();
	bu_exit( 1, NULL );
    }

    argc -= (bu_optind-1);
    argv += (bu_optind-1);

    /*
     *  First group of commands.
     *  No checking of VAS IV status is performed first.
     */
    if (strcmp(argv[1], "init") == 0) {
	vas_open();
	if ( get_vas_status() < 0 )
	    bu_exit(1, NULL);
	vas_putc(C_INIT);
	vas_await(R_INIT, 5);
	if ( get_vtr_status(0) < 0 )
	    exit_code = 1;
	goto done;
    }
    else if (strcmp(argv[1], "status") == 0) {
	vas_open();
	(void)get_vas_status();
	(void)get_vtr_status(1);
	get_tape_position();
	(void)get_frame_code();
	goto done;
    }
    else if (strcmp(argv[1], "sequence") == 0) {
	if (argc == 2) {
	    number_of_images = 1;
	    number_of_frames = 1;
	    start_seq_number = 1;
	}
	else if (argc == 4) {
	    number_of_images = atoi(argv[2]);
	    if (number_of_images < 1)
		usage_seq();
	    number_of_frames = str2frames(argv[3]);
	    if (number_of_frames < 1)
		usage_seq();
	    start_seq_number = 1;
	}
	else if (argc == 5) {
	    number_of_images = atoi(argv[2]);
	    if (number_of_images < 1)
		usage_seq();
	    number_of_frames = str2frames(argv[3]);
	    if (number_of_frames < 1)
		usage_seq();
	    start_seq_number = atoi(argv[4]);
	}
	else
	    usage_seq();


	record_seq(number_of_images, number_of_frames, start_seq_number);
	goto done;
    }

    /*
     *  Second group of commands.
     *  VAS IV is opened, and status of VAS is checked first
     *  but VTR is not queried.
     */
    vas_open();
    if ( get_vas_status() < 0 )
	bu_exit(1, NULL);

    if (strcmp(argv[1], "rewind") == 0) {
	vas_putc(C_REWIND);
	goto done;
    }
    else if (strcmp(argv[1], "play") == 0) {
	vas_putc(C_PLAY);
	goto done;
    }
    else if (strcmp(argv[1], "stop") == 0) {
	vas_putc(C_STOP);
	goto done;
    }
    else if (strcmp(argv[1], "fforward") == 0) {
	vas_putc(C_FFORWARD);
	goto done;
    }

    /*
     *  Third group of commands.
     *  VAS IV is opened and checked above,
     *  and VTR status is checked here.
     */
    if ( get_vtr_status(0) < 0 )  {
	exit_code = 1;
	goto done;
    }
    if ( strcmp(argv[1], "search") == 0 )  {
	if ( argc >= 3 )
	    start_frame = str2frames(argv[2]);
	else
	    start_frame = 1;
	exit_code = search_frame(start_frame);
	goto done;
    }
    else if ( strcmp(argv[1], "time0") == 0 )  {
	exit_code = time0();
	goto done;
    }
    else if ( strcmp( argv[1], "reset_time" ) == 0 )  {
	exit_code = reset_tape_time();
	goto done;
    }

    /*
     *  If this is running on a workstation, and a window has to be
     *  opened to cause image to be re-displayed, do so now.
     */
    if ( framebuffer != (char *)0 )  {
	if ( (fbp = fb_open( framebuffer, scr_width, scr_height )) == FBIO_NULL )  {
	    exit_code = 12;
	    goto done;
	}
    }

    /*
     *  Commands that will actually record some image onto tape
     */
    if (strcmp(argv[1], "new") == 0) {
	if ( argc >= 4 )  {
	    if ( (start_frame = str2frames(argv[3])) < 1 )
		usage_new();
	}
	if (argc >= 3) {
	    if ( (scene_number = atoi(argv[2])) < 1 )
		usage_new();
	}
	else if (argc == 2) {
	    scene_number = 1;
	}
	else {
	    usage_new();
	}
	program_recording(1, scene_number, start_frame);
	goto done;
    }
    else if (strcmp(argv[1], "old") == 0) {
	if ( argc >= 4 )  {
	    if ( (start_frame = str2frames(argv[3])) < 1 )
		usage_new();
	}
	if (argc >= 3) {
	    if ( (scene_number = atoi(argv[2])) < 1 )
		usage_new();
	}
	else if (argc == 2) {
	    scene_number = 1;
	}
	else {
	    usage_new();
	}
	/* May need one more parameter here, eventually */
	program_recording(0, scene_number, start_frame);
	goto done;
    }
    else if (strcmp(argv[1], "record") == 0) {
	if (argc == 3) {
	    number_of_frames = str2frames(argv[2]);
	    if (number_of_frames < 1) {
		usage_record();
	    }
	}
	else if (argc == 2) {
	    number_of_frames = 1;
	}
	else {
	    usage_record();
	}
	record_add_to_scene(number_of_frames);
	goto done;
    } else {
	/* None of the above */
	usage();
	exit_code = 1;
    }

 done:
    vas_close();
    if (fbp) fb_close(fbp);
    bu_exit(exit_code, NULL);
}
Esempio n. 2
0
status(void)
{
    char c;

    vas_open();

    /* Request activity */
    vas_putc(C_ACTIVITY);

    /* Read result code */
    c = vas_getc();

    /* Print appropropriate message */
    /* See page c-6 */
    switch (c) {
	case '`':
	    M("Power-on condition; no recording programmed (%c)\n", c);
	    break;
	case 'b':
	    M("Accepting programming for a recording (%c)\n", c);
	    break;
	case 'c':
	    M("Accepting programming for an edit recording (%c)\n", c);
	    break;
	case 'd':
	    M("Flashing E/E switch; ready to search for frame (%c)\n", c);
	    break;
	case 'e':
	    M("Checking for position on correct scene (%c)\n", c);
	    break;
	case 'j':
	    M("Searching for frame preceding next to record (%c)\n", c);
	    break;
	case 'm':
	    M("Displaying a warning message (%c)\n", c);
	    break;
	case 'n':
	    M("Ready to record first recording on old scene (%c)\n", c);
	    break;
	case 'f':
	    M("Ready to record next recording or TITLE (%c)\n", c);
	    break;
	case 'a':
	    M("Register function is active (%c)\n", c);
	    break;
	case 'g':
	    M("Prerolling, about to make recording (%c)\n", c);
	    break;
	case 'h':
	    M("Recording in progress (%c)\n", c);
	    break;
	case 'i':
	    M("Backspacing for next preroll and recording (%c)\n", c);
	    break;
	case 'o':
	    M("Holding momentarily before allowing to RECORD (%c)\n", c);
	    break;
	case 'k':
	    M("Accepting programming for Frame Change (%c)\n", c);
	    break;
	case 'l':
	    M("Accepting programming for HOLD (%c)\n", c);
	    break;
	default:
	    fprintf(stderr, "Unknow activity code: '%c' (%c)\n", c);
    }

    vas_close();
}