7 #include "PlusConfigure.h" 8 #include "vtkCallbackCommand.h" 10 #include "vtkPlusNvidiaDVPVideoSourceWin32.h" 12 #include "vtkPlusNvidiaDVPVideoSourceLinux.h" 14 #include "vtkSmartPointer.h" 15 #include "vtksys/CommandLineArguments.hxx" 17 void PrintLogsCallback( vtkObject* obj,
unsigned long eid,
void* clientdata,
void* calldata );
19 int main(
int argc,
char** argv )
21 bool printHelp(
false );
22 bool renderingOff(
false );
24 vtksys::CommandLineArguments args;
25 args.Initialize( argc, argv );
27 int verboseLevel = vtkPlusLogger::LOG_LEVEL_UNDEFINED;
29 args.AddArgument(
"--help", vtksys::CommandLineArguments::NO_ARGUMENT, &printHelp,
"Print this help." );
30 args.AddArgument(
"--rendering-off", vtksys::CommandLineArguments::NO_ARGUMENT, &renderingOff,
"Run test without rendering." );
31 args.AddArgument(
"--verbose", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &verboseLevel,
"Verbose level (1=error only, 2=warning, 3=info, 4=debug, 5=trace)" );
35 std::cerr <<
"Problem parsing arguments" << std::endl;
36 std::cout <<
"\n\nvtkPlusNvidiaDVPVideoSourceTest help:" << args.GetHelp() << std::endl;
44 std::cout <<
"\n\nvtkPlusNvidiaDVPVideoSourceTest help:" << args.GetHelp() << std::endl;
49 vtkSmartPointer<vtkPlusNvidiaDVPVideoSource> dvpDevice = vtkSmartPointer<vtkPlusNvidiaDVPVideoSource>::New();
52 vtkSmartPointer<vtkCallbackCommand> callbackCommand = vtkSmartPointer<vtkCallbackCommand>::New();
54 dvpDevice->AddObserver(
"WarningEvent", callbackCommand );
55 dvpDevice->AddObserver(
"ErrorEvent", callbackCommand );
57 LOG_INFO(
"Initialize..." );
60 if ( dvpDevice->GetConnected() )
62 LOG_INFO(
"Start recording..." );
63 dvpDevice->StartRecording();
67 dvpDevice->Disconnect();
68 LOG_ERROR(
"Unable to connect to IC capture device" );
74 dvpDevice->StopRecording();
75 dvpDevice->Disconnect();
76 LOG_INFO(
"Exit successfully" );
81 void PrintLogsCallback( vtkObject* obj,
unsigned long eid,
void* clientdata,
void* calldata )
83 if ( eid == vtkCommand::GetEventIdFromString(
"WarningEvent" ) )
85 LOG_WARNING( (
const char* )calldata );
87 else if ( eid == vtkCommand::GetEventIdFromString(
"ErrorEvent" ) )
89 LOG_ERROR( (
const char* )calldata );
int main(int argc, char **argv)
static vtkIGSIOLogger * Instance()
void PrintLogsCallback(vtkObject *obj, unsigned long eid, void *clientdata, void *calldata)