1 // Created on: 2008-06-30
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2008-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
20 #if (defined(_WIN32) || defined(__WIN32__)) && defined(HAVE_VIDEOCAPTURE)
22 #include <OpenGl_AVIWriter.hxx>
25 #include <ViewerTest.hxx>
26 #include <Draw_Interpretor.hxx>
28 static Standard_Integer avi_record(Draw_Interpretor& di,
29 Standard_Integer argc, const char** argv)
33 cout << "Syntax: " << argv[0] << " file | start | stop | save" << endl;
37 Standard_Integer aResult = 1;
38 #if (defined(_WIN32) || defined(__WIN32__))
39 #ifdef HAVE_VIDEOCAPTURE
40 static OpenGl_AVIWriter * pAviWriter = 0L;
42 if (strncmp(argv[1], "file", 5) == 0) {
44 cout << "Please define the name of AVI file to create ..." << endl;
46 const char * aFilename = argv[2];
47 DWORD aFormat = mmioFOURCC('X','V','I','D');
49 const char * aFourcc = argv[3];
50 aFormat = mmioFOURCC(aFourcc[0], aFourcc[1], aFourcc[2], aFourcc[3]);
52 pAviWriter = new OpenGl_AVIWriter (aFilename, aFormat, 25);
55 } else if (pAviWriter == 0L) {
56 cout << "AVI Writer instance has not been initialized. Use command "
57 << argv[0] << " file ..." << endl;
58 } else if (strncmp(argv[1], "start", 6) == 0) {
59 pAviWriter->StartRecording();
61 } else if (strncmp(argv[1], "stop", 5) == 0) {
62 pAviWriter->StopRecording();
64 } else if (strncmp(argv[1], "save", 5) == 0) {
65 pAviWriter->StopRecording();
69 } else if (strncmp(argv[1], "status", 7) == 0) {
70 cout << pAviWriter->GetLastErrorMessage() << endl;
74 cout << "AVI writer capability was disabled\n";
77 cout << "AVI writer is implemented only in Windows version\n";
82 //=======================================================================
83 //function : AviCommands
85 //=======================================================================
87 void ViewerTest::AviCommands(Draw_Interpretor& theCommands)
89 const char* group = "ViewerTest AVI commands";
91 theCommands.Add("vrecord", "vrecord [option]\n"
92 "where [option] can be:\n"
93 "\tfile <filename.avi> <FOURCC=VIDX': Create AVI file "
95 "\tstart : begin/restart recording,\n"
96 "\tstop : stop recording,\n"
97 "\tstatus : log error message,\n"
98 "\tsave : close the AVI file\n",
100 &avi_record, group); //Draft_Modification