1 // Created on: 2008-06-30
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2008-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #if (defined(_WIN32) || defined(__WIN32__)) && defined(HAVE_VIDEOCAPTURE)
18 #include <OpenGl_AVIWriter.hxx>
21 #include <ViewerTest.hxx>
22 #include <Draw_Interpretor.hxx>
24 static Standard_Integer avi_record(Draw_Interpretor& /*di*/,
25 Standard_Integer argc, const char** argv)
29 cout << "Syntax: " << argv[0] << " file | start | stop | save" << endl;
33 Standard_Integer aResult = 1;
34 #if (defined(_WIN32) || defined(__WIN32__))
35 #ifdef HAVE_VIDEOCAPTURE
36 static OpenGl_AVIWriter * pAviWriter = 0L;
38 if (strncmp(argv[1], "file", 5) == 0) {
40 cout << "Please define the name of AVI file to create ..." << endl;
42 const char * aFilename = argv[2];
43 DWORD aFormat = mmioFOURCC('X','V','I','D');
45 const char * aFourcc = argv[3];
46 aFormat = mmioFOURCC(aFourcc[0], aFourcc[1], aFourcc[2], aFourcc[3]);
48 pAviWriter = new OpenGl_AVIWriter (aFilename, aFormat, 25);
51 } else if (pAviWriter == 0L) {
52 cout << "AVI Writer instance has not been initialized. Use command "
53 << argv[0] << " file ..." << endl;
54 } else if (strncmp(argv[1], "start", 6) == 0) {
55 pAviWriter->StartRecording();
57 } else if (strncmp(argv[1], "stop", 5) == 0) {
58 pAviWriter->StopRecording();
60 } else if (strncmp(argv[1], "save", 5) == 0) {
61 pAviWriter->StopRecording();
65 } else if (strncmp(argv[1], "status", 7) == 0) {
66 cout << pAviWriter->GetLastErrorMessage() << endl;
70 cout << "AVI writer capability was disabled\n";
73 cout << "AVI writer is implemented only in Windows version\n";
78 //=======================================================================
79 //function : AviCommands
81 //=======================================================================
83 void ViewerTest::AviCommands(Draw_Interpretor& theCommands)
85 const char* group = "ViewerTest AVI commands";
87 theCommands.Add("vrecord", "vrecord [option]\n"
88 "where [option] can be:\n"
89 "\tfile <filename.avi> <FOURCC=VIDX': Create AVI file "
91 "\tstart : begin/restart recording,\n"
92 "\tstop : stop recording,\n"
93 "\tstatus : log error message,\n"
94 "\tsave : close the AVI file\n",
96 &avi_record, group); //Draft_Modification