0023948: Wrong intersection between a surface of revolution and a plane.
[occt.git] / src / ViewerTest / ViewerTest_AviCommands.cxx
CommitLineData
b311480e 1// Created on: 2008-06-30
2// Created by: Alexander GRIGORIEV
973c2be1 3// Copyright (c) 2008-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
16fa0dfb 16#if (defined(_WIN32) || defined(__WIN32__)) && defined(HAVE_VIDEOCAPTURE)
17 #include <windows.h>
18 #include <OpenGl_AVIWriter.hxx>
7fd59977 19#endif
20
21#include <ViewerTest.hxx>
22#include <Draw_Interpretor.hxx>
7fd59977 23
35e08fe8 24static Standard_Integer avi_record(Draw_Interpretor& /*di*/,
7fd59977 25 Standard_Integer argc, const char** argv)
26{
16fa0dfb 27 if (argc < 2)
28 {
7fd59977 29 cout << "Syntax: " << argv[0] << " file | start | stop | save" << endl;
16fa0dfb 30 return 1;
31 }
7fd59977 32
16fa0dfb 33 Standard_Integer aResult = 1;
34#if (defined(_WIN32) || defined(__WIN32__))
35 #ifdef HAVE_VIDEOCAPTURE
7fd59977 36 static OpenGl_AVIWriter * pAviWriter = 0L;
37
38 if (strncmp(argv[1], "file", 5) == 0) {
39 if (argc < 3) {
40 cout << "Please define the name of AVI file to create ..." << endl;
41 } else {
42 const char * aFilename = argv[2];
43 DWORD aFormat = mmioFOURCC('X','V','I','D');
44 if (argc > 3) {
45 const char * aFourcc = argv[3];
46 aFormat = mmioFOURCC(aFourcc[0], aFourcc[1], aFourcc[2], aFourcc[3]);
47 }
48 pAviWriter = new OpenGl_AVIWriter (aFilename, aFormat, 25);
49 aResult = 0;
50 }
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();
56 aResult = 0;
57 } else if (strncmp(argv[1], "stop", 5) == 0) {
58 pAviWriter->StopRecording();
59 aResult = 0;
60 } else if (strncmp(argv[1], "save", 5) == 0) {
61 pAviWriter->StopRecording();
62 delete pAviWriter;
63 pAviWriter = 0L;
64 aResult = 0;
65 } else if (strncmp(argv[1], "status", 7) == 0) {
66 cout << pAviWriter->GetLastErrorMessage() << endl;
67 aResult = 0;
68 }
16fa0dfb 69 #else
70 cout << "AVI writer capability was disabled\n";
71 #endif
72#else
73 cout << "AVI writer is implemented only in Windows version\n";
7fd59977 74#endif
7fd59977 75 return aResult;
76}
77
78//=======================================================================
79//function : AviCommands
80//purpose :
81//=======================================================================
82
83void ViewerTest::AviCommands(Draw_Interpretor& theCommands)
84{
85 const char* group = "ViewerTest AVI commands";
86
87 theCommands.Add("vrecord", "vrecord [option]\n"
88 "where [option] can be:\n"
89 "\tfile <filename.avi> <FOURCC=VIDX': Create AVI file "
90 "for recording,\n"
91 "\tstart : begin/restart recording,\n"
92 "\tstop : stop recording,\n"
93 "\tstatus : log error message,\n"
94 "\tsave : close the AVI file\n",
95 __FILE__,
96 &avi_record, group); //Draft_Modification
97}