1 // File: ViewerTest_AviCommands.cxx
2 // Created: 30.06.08 18:02
3 // Author: Alexander GRIGORIEV
4 // Copyright: Open Cascade 2008
11 #include <ViewerTest.hxx>
12 #include <Draw_Interpretor.hxx>
13 #include <OpenGl_AVIWriter.hxx>
15 static Standard_Integer avi_record(Draw_Interpretor& di,
16 Standard_Integer argc, const char** argv)
18 Standard_Integer aResult(1);
20 cout << "Syntax: " << argv[0] << " file | start | stop | save" << endl;
24 cout << "AVI writer is implemented only in Windows version" << endl;
26 static OpenGl_AVIWriter * pAviWriter = 0L;
28 if (strncmp(argv[1], "file", 5) == 0) {
30 cout << "Please define the name of AVI file to create ..." << endl;
32 const char * aFilename = argv[2];
33 DWORD aFormat = mmioFOURCC('X','V','I','D');
35 const char * aFourcc = argv[3];
36 aFormat = mmioFOURCC(aFourcc[0], aFourcc[1], aFourcc[2], aFourcc[3]);
38 pAviWriter = new OpenGl_AVIWriter (aFilename, aFormat, 25);
41 } else if (pAviWriter == 0L) {
42 cout << "AVI Writer instance has not been initialized. Use command "
43 << argv[0] << " file ..." << endl;
44 } else if (strncmp(argv[1], "start", 6) == 0) {
45 pAviWriter->StartRecording();
47 } else if (strncmp(argv[1], "stop", 5) == 0) {
48 pAviWriter->StopRecording();
50 } else if (strncmp(argv[1], "save", 5) == 0) {
51 pAviWriter->StopRecording();
55 } else if (strncmp(argv[1], "status", 7) == 0) {
56 cout << pAviWriter->GetLastErrorMessage() << endl;
64 //=======================================================================
65 //function : AviCommands
67 //=======================================================================
69 void ViewerTest::AviCommands(Draw_Interpretor& theCommands)
71 const char* group = "ViewerTest AVI commands";
73 theCommands.Add("vrecord", "vrecord [option]\n"
74 "where [option] can be:\n"
75 "\tfile <filename.avi> <FOURCC=VIDX': Create AVI file "
77 "\tstart : begin/restart recording,\n"
78 "\tstop : stop recording,\n"
79 "\tstatus : log error message,\n"
80 "\tsave : close the AVI file\n",
82 &avi_record, group); //Draft_Modification