1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-07 18:30:55 +03:00

0023488: Make video recording functionality (OpenGl_AVIWriter) optional

CSF_AviLibs missing in EXTERNLIB of TKOpenGl toolkit. This cause incorrect project generation.
HAVE_VIDEOCAPTURE now should be defined to enable video recording capabilities on Windows.
This commit is contained in:
kgv 2012-11-02 15:56:36 +04:00
parent 5fec2f774c
commit 16fa0dfb08
4 changed files with 24 additions and 21 deletions

View File

@ -17,10 +17,13 @@
// purpose or non-infringement. Please see the License for the specific terms // purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License. // and conditions governing the rights and limitations under the License.
#include <OpenGl_AVIWriter.hxx> #include <OpenGl_AVIWriter.hxx>
#ifdef WNT #if (defined(_WIN32) || defined(__WIN32__)) && defined(HAVE_VIDEOCAPTURE)
#ifdef _MSC_VER
#pragma comment (lib, "vfw32.lib")
#endif
OpenGl_AVIWriter* OpenGl_AVIWriter::MyAVIWriterInstance = 0L; OpenGl_AVIWriter* OpenGl_AVIWriter::MyAVIWriterInstance = 0L;
OpenGl_AVIWriter * OpenGl_AVIWriter::GetInstance() OpenGl_AVIWriter * OpenGl_AVIWriter::GetInstance()
@ -479,4 +482,4 @@ Standard_Boolean OpenGl_AVIWriter_AllowWriting(void * hWin)
return aResult; return aResult;
} }
#endif //WNT #endif

View File

@ -17,10 +17,9 @@
// purpose or non-infringement. Please see the License for the specific terms // purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License. // and conditions governing the rights and limitations under the License.
#include <OpenGl_GlCore11.hxx> #include <OpenGl_GlCore11.hxx>
#if (defined(_WIN32) || defined(__WIN32__)) #if (defined(_WIN32) || defined(__WIN32__)) && defined(HAVE_VIDEOCAPTURE)
#include <OpenGl_AVIWriter.hxx> #include <OpenGl_AVIWriter.hxx>
#endif #endif
@ -68,7 +67,7 @@ void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView,
glViewport (aViewPortBack[0], aViewPortBack[1], aViewPortBack[2], aViewPortBack[3]); glViewport (aViewPortBack[0], aViewPortBack[1], aViewPortBack[2], aViewPortBack[3]);
} }
#if (defined(_WIN32) || defined(__WIN32__)) #if (defined(_WIN32) || defined(__WIN32__)) && defined(HAVE_VIDEOCAPTURE)
if (OpenGl_AVIWriter_AllowWriting (theCView.DefWindow.XWindow)) if (OpenGl_AVIWriter_AllowWriting (theCView.DefWindow.XWindow))
{ {
GLint params[4]; GLint params[4];

View File

@ -7,3 +7,4 @@ CSF_FTGL
CSF_GL2PS CSF_GL2PS
CSF_user32 CSF_user32
CSF_gdi32 CSF_gdi32
CSF_AviLibs

View File

@ -17,27 +17,26 @@
// purpose or non-infringement. Please see the License for the specific terms // purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License. // and conditions governing the rights and limitations under the License.
#if (defined(_WIN32) || defined(__WIN32__)) && defined(HAVE_VIDEOCAPTURE)
#include <windows.h>
#ifdef WNT #include <OpenGl_AVIWriter.hxx>
#include <windows.h>
#endif #endif
#include <ViewerTest.hxx> #include <ViewerTest.hxx>
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
#include <OpenGl_AVIWriter.hxx>
static Standard_Integer avi_record(Draw_Interpretor& di, static Standard_Integer avi_record(Draw_Interpretor& di,
Standard_Integer argc, const char** argv) Standard_Integer argc, const char** argv)
{ {
Standard_Integer aResult(1); if (argc < 2)
if (argc < 2) { {
cout << "Syntax: " << argv[0] << " file | start | stop | save" << endl; cout << "Syntax: " << argv[0] << " file | start | stop | save" << endl;
} else { return 1;
}
#ifndef WNT Standard_Integer aResult = 1;
cout << "AVI writer is implemented only in Windows version" << endl; #if (defined(_WIN32) || defined(__WIN32__))
#else #ifdef HAVE_VIDEOCAPTURE
static OpenGl_AVIWriter * pAviWriter = 0L; static OpenGl_AVIWriter * pAviWriter = 0L;
if (strncmp(argv[1], "file", 5) == 0) { if (strncmp(argv[1], "file", 5) == 0) {
@ -71,8 +70,12 @@ static Standard_Integer avi_record(Draw_Interpretor& di,
cout << pAviWriter->GetLastErrorMessage() << endl; cout << pAviWriter->GetLastErrorMessage() << endl;
aResult = 0; aResult = 0;
} }
#else
cout << "AVI writer capability was disabled\n";
#endif
#else
cout << "AVI writer is implemented only in Windows version\n";
#endif #endif
}
return aResult; return aResult;
} }
@ -96,6 +99,3 @@ void ViewerTest::AviCommands(Draw_Interpretor& theCommands)
__FILE__, __FILE__,
&avi_record, group); //Draft_Modification &avi_record, group); //Draft_Modification
} }