Exemplo n.º 1
0
void MagRead::toggleRead() {
	QString backStr;

	if( captureAudio ) {
		captureStop();
		if( onMainPage )
			backStr = "Start";
		else
			backStr = "Back";
		captureAudio = false;
	} else if( onMainPage ) {
		captureStart();
		backStr = "Stop";
		captureAudio = true;
	} else {
		card.clear();
		backStr = "Start";
		mainPage();
	}

#ifdef Q_OS_SYMBIAN
			backSoftKey->setText( backStr );
#else
			mainBackBtn->setText( backStr );
#endif
}
Exemplo n.º 2
0
void SWipe::mainBtn_clicked() {
	if( captureAudio ) {
		captureStop();
		statusLabel.setText( "Stopped.  Press Start to capture" );
	} else {
		captureStart();
		statusLabel.setText( "Capturing audio.  Press Stop to stop" );
	}

	captureAudio = !captureAudio;
}
Exemplo n.º 3
0
void closeSample(int errCode)
{
	captureStop(0);
	closeDevice();
    
	if (errCode != ERR_OK)
	{
		printf("Press any key to continue . . .\n");
		_getch();
	}
    
	exit(errCode);
}
Exemplo n.º 4
0
void KeyboardCallback(unsigned char key, int /*x*/, int /*y*/)
{
	if (isCapturing())
	{
		captureStop(0);
	}
	else
	{
		handleKey(key);
	}
    
	//glutPostRedisplay();
}
Exemplo n.º 5
0
FREObject toggleCapturing(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[])
{
    int32_t _id, _opt;
    FREGetObjectAsInt32(argv[0], &_id);
    FREGetObjectAsInt32(argv[1], &_opt);

    CCapture* cap;
    cap = active_cams[_id];

    if(cap)
    {
        if(_opt == 0)
        {
            captureStop(cap);
        }
        else if(_opt == 1)
        {
            // TODO can fail when starting after stop so we need to handle result
            captureStart(cap);
        }
    }

    return NULL;
}
Exemplo n.º 6
0
void captureRestart(int)
{
    captureStop(0);
    captureStart(0);
}
Exemplo n.º 7
0
int main(int argc, char **argv)
{

    for (;;) {
        int index, c = 0;

        c = getopt_long(argc, argv, short_options, long_options, &index);

        if (-1 == c)
            break;

        switch (c) {
        case 0: /* getopt_long() flag */
            break;

        case 'd':
            deviceName = optarg;
            break;

        case 'h':
            // print help
            usage(stdout, argc, argv);
            exit(EXIT_SUCCESS);

        case 'o':
            // set jpeg filename
            jpegFilename = optarg;
            break;

        case 'q':
            // set jpeg quality
            jpegQuality = atoi(optarg);
            break;

        case 'm':
#ifdef IO_MMAP
            io = IO_METHOD_MMAP;
#else
            fprintf(stderr, "You didn't compile for mmap support.\n");
            exit(EXIT_FAILURE);
#endif
            break;

        case 'r':
#ifdef IO_READ
            io = IO_METHOD_READ;
#else
            fprintf(stderr, "You didn't compile for read support.\n");
            exit(EXIT_FAILURE);
#endif
            break;

        case 'u':
#ifdef IO_USERPTR
            io = IO_METHOD_USERPTR;
#else
            fprintf(stderr, "You didn't compile for userptr support.\n");
            exit(EXIT_FAILURE);
#endif
            break;

        case 'W':
            // set width
            width = atoi(optarg);
            break;

        case 'H':
            // set height
            height = atoi(optarg);
            break;

        case 'I':
            // set fps
            fps = atoi(optarg);
            break;

        case 'c':
            // set flag for continuous capture, interuptible by sigint
            continuous = 1;
            InstallSIGINTHandler();
            break;


        case 'v':
            printf("Version: %s\n", VERSION);
            exit(EXIT_SUCCESS);
            break;

        default:
            usage(stderr, argc, argv);
            exit(EXIT_FAILURE);
        }
    }

    // check for need parameters
    if (!jpegFilename) {
        fprintf(stderr, "You have to specify JPEG output filename!\n\n");
        usage(stdout, argc, argv);
        exit(EXIT_FAILURE);
    }

    if(continuous == 1) {
        int max_name_len = snprintf(NULL,0,continuousFilenameFmt,jpegFilename,UINT32_MAX,INT64_MAX);
        jpegFilenamePart = jpegFilename;
        jpegFilename = calloc(max_name_len+1,sizeof(char));
        strcpy(jpegFilename,jpegFilenamePart);
    }


    // open and initialize device
    deviceOpen();
    deviceInit();

    // start capturing
    captureStart();

    // process frames
    mainLoop();

    // stop capturing
    captureStop();

    // close device
    deviceUninit();
    deviceClose();

    if(jpegFilenamePart != 0) {
        free(jpegFilename);
    }

    exit(EXIT_SUCCESS);

    return 0;
}
Exemplo n.º 8
0
int main(int argc, char **argv)
{

	for (;;) {
		int index, c = 0;

		c = getopt_long(argc, argv, short_options, long_options, &index);

		if (-1 == c)
			break;

		switch (c) {
			case 0: /* getopt_long() flag */
				break;

			case 'd':
				deviceName = optarg;
				break;

			case 'h':
				// print help
				usage(stdout, argc, argv);
				exit(EXIT_SUCCESS);

			case 'o':
				// set jpeg filename
				jpegFilename = optarg;
				break;

			case 'q':
				// set jpeg quality
				jpegQuality = atoi(optarg);
				break;

			case 'm':
#ifdef IO_MMAP
				io = IO_METHOD_MMAP;
#else
				fprintf(stderr, "You didn't compile for mmap support.\n");
				exit(EXIT_FAILURE);
#endif
				break;

			case 'r':
#ifdef IO_READ
				io = IO_METHOD_READ;
#else
				fprintf(stderr, "You didn't compile for read support.\n");
				exit(EXIT_FAILURE);
#endif
				break;

			case 'u':
#ifdef IO_USERPTR
				io = IO_METHOD_USERPTR;
#else
				fprintf(stderr, "You didn't compile for userptr support.\n");
				exit(EXIT_FAILURE);
#endif
				break;

			case 'W':
				// set width
				width = atoi(optarg);
				break;

			case 'H':
				// set height
				height = atoi(optarg);
				break;
				
			case 'I':
				// set fps
				fps = atoi(optarg);
				break;

			case 'v':
				printf("Version: %s\n", VERSION);
				exit(EXIT_SUCCESS);
				break;

			default:
				usage(stderr, argc, argv);
				exit(EXIT_FAILURE);
		}
	}

	// check for need parameters
	if (!jpegFilename) {
		fprintf(stderr, "You have to specify JPEG output filename!\n\n");
		usage(stdout, argc, argv);
		exit(EXIT_FAILURE);
	}

	// open and initialize device
	deviceOpen();
	deviceInit();

	// start capturing
	captureStart();

	// process frames
	mainLoop();

	// stop capturing
	captureStop();

	// close device
	deviceUninit();
	deviceClose();

	exit(EXIT_SUCCESS);

	return 0;
}
Exemplo n.º 9
0
void onExit()
{
	captureStop(0);
}