コード例 #1
0
CaptureStream *V4LCaptureSystem::openCaptureDeviceStream(const wchar_t *deviceId, int output, int input) /*throws CaptureException*/
{
	if (output != 0) {
		throw new CaptureException("Output index out of range", output);
	}
	if (input != 0) {
		throw new CaptureException("Input index out of range", input);
	}
	const char *deviceId_char_array = wchar_t_to_char_array_alloc(deviceId);
	FRAMEGRABBER* fg;

	if ( ( fg = fg_open( deviceId_char_array ) ) == NULL )
	{	delete[] deviceId_char_array;
		FailWithException("fg_open failed", -1);
	}
	delete[] deviceId_char_array;

	return new V4LCaptureStream(fg);

}
コード例 #2
0
int main( int argc, char* argv[] )
{
    int i;
    int rc;
    FRAMEGRABBER* fg = NULL;

    printf( "test_capture: libfg testing harness\n$Revision: 1.1 $\n" );

    // Bail if the default device cannot be opened
    if ( ( fg = fg_open( NULL ) ) == NULL )
        return -1;

    // Dump the fg's state
    fg_dump_info( fg );

    // Run all tests
    for ( i = 0; i < sizeof(tests)/sizeof(FG_TEST); i++ )
    {
        printf( "\n------------------------------------"
                "------------------------------------\n");
        printf( "Executing test: %s\n", tests[i].name );
        printf( "------------------------------------"
                "------------------------------------\n\n");

        rc = tests[i].test_fn( fg );

        if ( rc == 0 )
        {
            printf( "Success.\n" );
        }
        else
        {
            printf( "  *** Failed: rc=%d\n", rc );
        }
    }

    fg_close( fg );

    return 0;
}