diff --git a/src/OpenGl/FILES b/src/OpenGl/FILES index 326d2bcf33..b316d7a6b2 100755 --- a/src/OpenGl/FILES +++ b/src/OpenGl/FILES @@ -47,8 +47,6 @@ OpenGl_LineAttributes.cxx OpenGl_Window.hxx OpenGl_Window.cxx OpenGl_Window_1.mm -OpenGl_AVIWriter.hxx -OpenGl_AVIWriter.cxx OpenGl_FrameBuffer.hxx OpenGl_FrameBuffer.cxx OpenGl_Texture.cxx diff --git a/src/OpenGl/OpenGl_AVIWriter.cxx b/src/OpenGl/OpenGl_AVIWriter.cxx deleted file mode 100644 index 961da54018..0000000000 --- a/src/OpenGl/OpenGl_AVIWriter.cxx +++ /dev/null @@ -1,481 +0,0 @@ -// Created on: 2007-04-15 -// Created by: Alexey MORENOV & Alexander GRIGORIEV -// Copyright (c) 2007-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#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::GetInstance() -{ - return MyAVIWriterInstance; -} - -//======================================================================= -//function : OpenGl_AVIWriter -//purpose : -//======================================================================= - -Standard_EXPORT OpenGl_AVIWriter::OpenGl_AVIWriter - (const char * theFileName, - DWORD dwCodec /* = mmioFOURCC('M','P','G','4') */, - Standard_Integer theFrameRate /* = 25 */) - : myhHeap (0L), - myhWindow (0L), - myhAviDC (0L), - mylpBits (0L), - mylSample (0L), - mypAviFile (0L), - mypAviStream (0L), - mypAviCompressedStream(0L), - myFileName (0L), - myIsAllowRecord (Standard_False), - myAppendFuncSelector(1) //0=Dummy 1=FirstTime 2=Usual -{ - ::AVIFileInit(); - if (theFileName != 0L && theFileName[0] != '\0') { - - const size_t aLen = strlen(theFileName) + 1; - myFileName = new char [aLen]; - memcpy(myFileName, theFileName, aLen); - myErrMsg = (Standard_CString)"Method Succeeded"; - - pAppendFrame[0]= &OpenGl_AVIWriter::AppendDummy; - pAppendFrame[1]= &OpenGl_AVIWriter::AppendFrameFirstTime; - pAppendFrame[2]= &OpenGl_AVIWriter::AppendFrameUsual; - - pAppendFrameBits[0]=&OpenGl_AVIWriter::AppendDummyBits; - pAppendFrameBits[1]=&OpenGl_AVIWriter::AppendFrameBitsFirstTime; - pAppendFrameBits[2]=&OpenGl_AVIWriter::AppendFrameBitsUsual; - - MyAVIWriterInstance = this; - - ZeroMemory(&myAviStreamInfo,sizeof(AVISTREAMINFO)); - myAviStreamInfo.fccType = streamtypeVIDEO; - myAviStreamInfo.fccHandler = dwCodec; - myAviStreamInfo.dwScale = 1; - myAviStreamInfo.dwRate = theFrameRate; // Frames Per Second; - myAviStreamInfo.dwQuality = 100;/*//-1; // Default Quality*/ - - ZeroMemory(&myAviCompressOptions,sizeof(AVICOMPRESSOPTIONS)); - myAviCompressOptions.fccType = streamtypeVIDEO; - myAviCompressOptions.fccHandler = myAviStreamInfo.fccHandler; - myAviCompressOptions.dwFlags = - AVICOMPRESSF_KEYFRAMES|AVICOMPRESSF_VALID|AVICOMPRESSF_DATARATE; - myAviCompressOptions.dwKeyFrameEvery = 1; - myAviCompressOptions.dwBytesPerSecond = 125000; - myAviCompressOptions.dwQuality = 100; - } -} - -//======================================================================= -//function : ~OpenGl_AVIWriter -//purpose : -//======================================================================= - -Standard_EXPORT OpenGl_AVIWriter::~OpenGl_AVIWriter(void) -{ - ReleaseMemory(); - AVIFileExit(); - if (myFileName) - delete [] myFileName; - MyAVIWriterInstance = 0L; -} - -//======================================================================= -//function : StartRecording -//purpose : -//======================================================================= - -void OpenGl_AVIWriter::StartRecording(const HANDLE hWin) -{ - if (hWin != NULL) - myhWindow = hWin; - myIsAllowRecord = Standard_True; -} - -//======================================================================= -//function : StopRecording -//purpose : -//======================================================================= - -void OpenGl_AVIWriter::StopRecording() -{ - myIsAllowRecord = Standard_False; -} - -//======================================================================= -//function : ReleaseMemory -//purpose : -//======================================================================= - -void OpenGl_AVIWriter::ReleaseMemory() -{ - myAppendFuncSelector=0; //Point to DummyFunction - - if(myhAviDC) - { - DeleteDC(myhAviDC); - myhAviDC=NULL; - } - if(mypAviCompressedStream) - { - AVIStreamRelease(mypAviCompressedStream); - mypAviCompressedStream=NULL; - } - if(mypAviStream) - { - AVIStreamRelease(mypAviStream); - mypAviStream=NULL; - } - if(mypAviFile) - { - AVIFileRelease(mypAviFile); - mypAviFile=NULL; - } - if(mylpBits) - { - HeapFree(myhHeap,HEAP_NO_SERIALIZE,mylpBits); - mylpBits=NULL; - } - if(myhHeap) - { - HeapDestroy(myhHeap); - myhHeap=NULL; - } -} - -//======================================================================= -//function : SetErrorMessage -//purpose : -//======================================================================= - -void OpenGl_AVIWriter::SetErrorMessage(const char * theErrorMessage) -{ - myErrMsg = (Standard_CString)theErrorMessage; -} - -//======================================================================= -//function : InitMovieCreation -//purpose : -//======================================================================= - -HRESULT OpenGl_AVIWriter::InitMovieCreation (int nFrameWidth, - int nFrameHeight, - int nBitsPerPixel) -{ - int nMaxWidth=GetSystemMetrics(SM_CXSCREEN), - nMaxHeight=GetSystemMetrics(SM_CYSCREEN); - - myhAviDC = CreateCompatibleDC(NULL); - if(myhAviDC==NULL) - { - SetErrorMessage("Unable to Create Compatible DC"); - return E_FAIL; - } - - if (nFrameWidth > nMaxWidth) - nMaxWidth= nFrameWidth; - if (nFrameHeight > nMaxHeight) - nMaxHeight = nFrameHeight; - - myhHeap=HeapCreate(HEAP_NO_SERIALIZE, nMaxWidth*nMaxHeight*4, 0); - if(myhHeap==NULL) - { - SetErrorMessage("Unable to Create Heap"); - return E_FAIL; - } - - mylpBits=HeapAlloc(myhHeap, HEAP_ZERO_MEMORY|HEAP_NO_SERIALIZE, - nMaxWidth*nMaxHeight*4); - if(mylpBits==NULL) - { - SetErrorMessage("Unable to Allocate Memory on Heap"); - return E_FAIL; - } - - HRESULT hr; - hr = ::AVIFileOpen(&mypAviFile, myFileName, OF_CREATE|OF_WRITE, NULL); - if (!hr == AVIERR_OK) - { - SetErrorMessage("Unable to Create the Movie File"); - return E_FAIL; - } - /* - if(FAILED(::AVIFileOpen(&mypAviFile, myszFileName, OF_CREATE|OF_WRITE, NULL))) - { - SetErrorMessage("Unable to Create the Movie File"); - return E_FAIL; - } - */ - - myAviStreamInfo.dwSuggestedBufferSize = nMaxWidth * nMaxHeight * 4; - SetRect(&myAviStreamInfo.rcFrame, 0, 0, nFrameWidth, nFrameHeight); - strncpy(myAviStreamInfo.szName, "Video Stream", 64); - - if(FAILED(AVIFileCreateStream(mypAviFile,&mypAviStream,&myAviStreamInfo))) - { - SetErrorMessage("Unable to Create Video Stream in the Movie File"); - return E_FAIL; - } - - if(FAILED(AVIMakeCompressedStream(&mypAviCompressedStream, - mypAviStream, - &myAviCompressOptions, - NULL))) - { - // One reason this error might occur is if you are using a Codec that is not - // available on your system. Check the mmioFOURCC() code you are using and - // make sure you have that codec installed properly on your machine. - SetErrorMessage("Unable to Create Compressed Stream: " - "Check your CODEC options"); - return E_FAIL; - } - - BITMAPINFO bmpInfo; - ZeroMemory(&bmpInfo,sizeof(BITMAPINFO)); - bmpInfo.bmiHeader.biPlanes = 1; - bmpInfo.bmiHeader.biWidth = nFrameWidth; - bmpInfo.bmiHeader.biHeight = nFrameHeight; - bmpInfo.bmiHeader.biCompression = BI_RGB; - bmpInfo.bmiHeader.biBitCount = nBitsPerPixel; - bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmpInfo.bmiHeader.biSizeImage = (bmpInfo.bmiHeader.biWidth * - bmpInfo.bmiHeader.biHeight* - bmpInfo.bmiHeader.biBitCount)/8; - - if(FAILED(AVIStreamSetFormat(mypAviCompressedStream, - 0, - (LPVOID)&bmpInfo, - bmpInfo.bmiHeader.biSize))) - { - // One reason this error might occur is if your bitmap does not meet - // the Codec requirements. - // For example, - // your bitmap is 32bpp while the Codec supports only 16 or 24 bpp; Or - // your bitmap is 274 * 258 size, while the Codec supports only sizes - // that are powers of 2; etc... - // Possible solution to avoid this is: make your bitmap suit the codec - // requirements, or Choose a codec that is suitable for your bitmap. - SetErrorMessage("Unable to Set Video Stream Format"); - return E_FAIL; - } - - return S_OK; // Everything went Fine -} - -//======================================================================= -//function : AppendFrameFirstTime -//purpose : -//======================================================================= - -HRESULT OpenGl_AVIWriter::AppendFrameFirstTime(HBITMAP hBitmap) -{ - BITMAP Bitmap; - GetObject(hBitmap, sizeof(BITMAP), &Bitmap); - - if(SUCCEEDED(InitMovieCreation( Bitmap.bmWidth, - Bitmap.bmHeight, - Bitmap.bmBitsPixel))) - { - myAppendFuncSelector = 2; //Point to the UsualAppend Function - return AppendFrameUsual(hBitmap); - } - - ReleaseMemory(); - return E_FAIL; -} - -//======================================================================= -//function : AppendFrameUsual -//purpose : -//======================================================================= - -HRESULT OpenGl_AVIWriter::AppendFrameUsual(HBITMAP hBitmap) -{ - BITMAPINFO bmpInfo; - - bmpInfo.bmiHeader.biBitCount=0; - bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); - - GetDIBits(myhAviDC,hBitmap,0,0,NULL,&bmpInfo,DIB_RGB_COLORS); - - bmpInfo.bmiHeader.biCompression=BI_RGB; - - GetDIBits(myhAviDC, - hBitmap, - 0, - bmpInfo.bmiHeader.biHeight, - mylpBits, - &bmpInfo, - DIB_RGB_COLORS); - - if(FAILED(AVIStreamWrite(mypAviCompressedStream, - mylSample++, - 1, - mylpBits, - bmpInfo.bmiHeader.biSizeImage, - 0, - NULL, - NULL))) - { - SetErrorMessage("Unable to Write Video Stream to the output Movie File"); - ReleaseMemory(); - return E_FAIL; - } - - return S_OK; -} - -//======================================================================= -//function : AppendDummy -//purpose : -//======================================================================= - -HRESULT OpenGl_AVIWriter::AppendDummy(HBITMAP) -{ - return E_FAIL; -} - -//======================================================================= -//function : AppendNewFrame -//purpose : -//======================================================================= - -HRESULT OpenGl_AVIWriter::AppendNewFrame(HBITMAP hBitmap) -{ - return (this->*pAppendFrame[myAppendFuncSelector])((HBITMAP)hBitmap); -} - -//======================================================================= -//function : AppendNewFrame -//purpose : -//======================================================================= - -HRESULT OpenGl_AVIWriter::AppendNewFrame(int nWidth, - int nHeight, - LPVOID pBits, - int nBitsPerPixel) -{ - return (this->*pAppendFrameBits[myAppendFuncSelector])(nWidth, - nHeight, - pBits, - nBitsPerPixel); -} - -//======================================================================= -//function : AppendFrameFirstTime -//purpose : -//======================================================================= - -HRESULT OpenGl_AVIWriter::AppendFrameBitsFirstTime(int nWidth, - int nHeight, - LPVOID pBits, - int nBitsPerPixel) -{ - if(SUCCEEDED(InitMovieCreation(nWidth, nHeight, nBitsPerPixel))) - { - myAppendFuncSelector=2; //Point to the UsualAppend Function - return AppendFrameBitsUsual(nWidth, nHeight, pBits, nBitsPerPixel); - } - ReleaseMemory(); - - return E_FAIL; -} - -//======================================================================= -//function : AppendFrameUsual -//purpose : -//======================================================================= - -HRESULT OpenGl_AVIWriter::AppendFrameBitsUsual(int nWidth, - int nHeight, - LPVOID pBits, - int nBitsPerPixel) -{ - DWORD dwSize=nWidth*nHeight*nBitsPerPixel/8; - - if(FAILED(AVIStreamWrite(mypAviCompressedStream, - mylSample++, - 1, - pBits, - dwSize, - 0, - NULL, - NULL))) - { - SetErrorMessage("Unable to Write Video Stream to the output Movie File"); - ReleaseMemory(); - return E_FAIL; - } - - return S_OK; -} - -//======================================================================= -//function : AppendDummy -//purpose : -//======================================================================= - -HRESULT OpenGl_AVIWriter::AppendDummyBits(int nWidth, - int nHeight, - LPVOID pBits, - int nBitsPerPixel) -{ - return E_FAIL; -} - -//======================================================================= -//function : AviWriter -//purpose : -//======================================================================= - -void OpenGl_AVIWriter_AVIWriter(void * pp, - int nWidth, - int nHeight, - int nBitsPerPixel) -{ - if (OpenGl_AVIWriter::GetInstance() != 0L) - if (OpenGl_AVIWriter::GetInstance()->IsRecording()) - { - - OpenGl_AVIWriter::GetInstance()->AppendNewFrame(nWidth, - nHeight, - pp, - nBitsPerPixel); - } -} - -//======================================================================= -//function : AllowWriting -//purpose : -//======================================================================= - -Standard_Boolean OpenGl_AVIWriter_AllowWriting(void * hWin) -{ - Standard_Boolean aResult(Standard_False); - const OpenGl_AVIWriter * anInst = OpenGl_AVIWriter::GetInstance(); - if (anInst != 0L) { - if (hWin == NULL || anInst->HWindow() == hWin) - aResult = static_cast (anInst->IsRecording()); - } - return aResult; -} - -#endif diff --git a/src/OpenGl/OpenGl_AVIWriter.hxx b/src/OpenGl/OpenGl_AVIWriter.hxx deleted file mode 100644 index 96ad331978..0000000000 --- a/src/OpenGl/OpenGl_AVIWriter.hxx +++ /dev/null @@ -1,193 +0,0 @@ -// Created on: 2007-04-15 -// Created by: Alexey MORENOV & Alexander GRIGORIEV -// Copyright (c) 2007-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef __OPENGL_AVIWRITER_H -#define __OPENGL_AVIWRITER_H - -#if defined(_WIN32) - #include -#endif - -#include - -#if defined(_MSC_VER) && !defined(OCCT_UWP) - -#include -#include -#include - -/** - * Class providing the API to record AVI files using a codec installed in the - * system -- Only on Windows NT/2k/XP/Vista platform under MS Visual Studio. - * The following tasks are supported: - *
    - * - *
  1. Creation of AVI data stream: launched by the constructor. - * The constructor accepts the filename, FOURCC video code and the frame rate - * setting as parameters. - * The default codec name used here is MPG4. To use a different codec, pass - * its FOURCC value as the input parameter for dwCodec. - * For example, - *
      - *
    • pass mmioFOURCC('D','I','V','X') to use DIVX codec, or
    • - *
    • pass mmioFOURCC('I','V','5','0') to use IV50 codec etc...
    • - *
    - * Also, you can pass just 0 to avoid the codecs altogether. In that case, - * the frames would be saved as they are without any compression; However, - * the output movie file size would be very huge in that case. - * - * Finally, make sure you have the codec installed on the machine before - * passing its Fourcc here. - *
  2. - *
  3. - * Start the recording: call the method StartRecording(). This method should be - * called at least once; execution of the constructor does not begin the - * process. - *
  4. - *
  5. - * Stop the recording: call the method StopRecording(). Can be omitted if the - * next to execute would be the destructor. - *
  6. - *
  7. - * Close the AVI file and exit the process of recording. This is done - * automatically by the destructor. - *
  8. - *
- */ -class OpenGl_AVIWriter -{ -public: - - /** - * Constructor. Initializes the internal data structures, prepares for the - * creation of an AVI stream when the first frame is ready to be captured. - * @param theFileName - * Name of the output movie file to create. - * @param theCodec - * FourCC of the Video Codec to be used for compression - * @param theFrameRate - * The Frames Per Second (FPS) setting to be used for the movie - */ - Standard_EXPORT OpenGl_AVIWriter(const char * theFileName, - DWORD theCodec = mmioFOURCC('M','P','G','4'), - Standard_Integer theFrameRate = 25); - - /** - * Destructor: closes the movie file and flushes all the frames - */ - Standard_EXPORT ~OpenGl_AVIWriter (); - - /** - * Begin the recording. - */ - Standard_EXPORT void StartRecording(const HANDLE hWin = NULL); - - /** - * Stop the recording (can be restarted using StartRecording()). - */ - Standard_EXPORT void StopRecording (); - - /** - * Query the state of recording. - */ - inline Standard_Boolean IsRecording () const { return myIsAllowRecord; } - - /** - * Returns the last error message, if any. - */ - inline Standard_EXPORT const TCollection_AsciiString& - GetLastErrorMessage() const - { return myErrMsg; } - - /** - * Get the instance of AVI Writer class. - */ - static Standard_EXPORT OpenGl_AVIWriter * - GetInstance (); - - /** - * Get the Window handle that contains the actual OpenGl context. - */ - inline HANDLE HWindow () const - { return myhWindow; } - - /// Inserts the given HBitmap into the movie as a new Frame at the end. - HRESULT AppendNewFrame(HBITMAP hBitmap); - - /// Inserts the given bitmap bits into the movie as a new Frame at the end. - /// The width, height and nBitsPerPixel are the width, height and bits per pixel - /// of the bitmap pointed to by the input pBits. - HRESULT AppendNewFrame(int nWidth, - int nHeight, - LPVOID pBits, - int nBitsPerPixel); - -private: - - void call_avi(); - -private: - static OpenGl_AVIWriter * MyAVIWriterInstance; - Standard_Boolean myIsAllowRecord; - - BYTE * mypBits; - UINT myWidth; - UINT myHeight; - - HDC myhAviDC; - HANDLE myhHeap; - HANDLE myhWindow; // window containing the OGL context - LPVOID mylpBits; // Useful to hold the bitmap content if any - LONG mylSample; // Keeps track of the current Frame Index - PAVIFILE mypAviFile; - PAVISTREAM mypAviStream; - PAVISTREAM mypAviCompressedStream; - AVISTREAMINFO myAviStreamInfo; - AVICOMPRESSOPTIONS myAviCompressOptions; - char * myFileName; // Holds the Output Movie File Name - TCollection_AsciiString myErrMsg; // Holds the Last Error Message, if any - - int myAppendFuncSelector; //0=Dummy 1=FirstTime 2=Usual - - HRESULT AppendFrameFirstTime(HBITMAP ); - HRESULT AppendFrameUsual(HBITMAP); - HRESULT AppendDummy(HBITMAP); - HRESULT (OpenGl_AVIWriter::*pAppendFrame[3])(HBITMAP hBitmap); - - HRESULT AppendFrameBitsFirstTime(int, int, LPVOID,int ); - HRESULT AppendFrameBitsUsual(int, int, LPVOID,int ); - HRESULT AppendDummyBits(int, int, LPVOID,int ); - HRESULT (OpenGl_AVIWriter::*pAppendFrameBits[3])(int, int, LPVOID, int); - - /// Takes care of creating the memory, streams, compression options etc. - /// required for the movie - HRESULT InitMovieCreation(int nFrameWidth,int nFrameHeight,int nBitsPerPixel); - - /// Takes care of releasing the memory and movie related handles - void ReleaseMemory(); - - /// Sets the Error Message - void SetErrorMessage(const char * theErrMsg); -}; - -Standard_EXPORT void OpenGl_AVIWriter_AVIWriter(void * pp, - int nWidth, - int nHeight, - int nBitsPerPixel); - -Standard_EXPORT Standard_Boolean OpenGl_AVIWriter_AllowWriting(void * hWin); - -#endif // _MSC_VER -#endif diff --git a/src/OpenGl/OpenGl_View_Redraw.cxx b/src/OpenGl/OpenGl_View_Redraw.cxx index 6b76f4f379..984da2b4dd 100644 --- a/src/OpenGl/OpenGl_View_Redraw.cxx +++ b/src/OpenGl/OpenGl_View_Redraw.cxx @@ -440,24 +440,6 @@ void OpenGl_View::Redraw() } } -#if defined(_WIN32) && defined(HAVE_VIDEOCAPTURE) - if (OpenGl_AVIWriter_AllowWriting (myWindow->PlatformWindow()->NativeHandle())) - { - GLint params[4]; - glGetIntegerv (GL_VIEWPORT, params); - int nWidth = params[2] & ~0x7; - int nHeight = params[3] & ~0x7; - - const int nBitsPerPixel = 24; - GLubyte* aDumpData = new GLubyte[nWidth * nHeight * nBitsPerPixel / 8]; - - glPixelStorei (GL_PACK_ALIGNMENT, 1); - glReadPixels (0, 0, nWidth, nHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, aDumpData); - OpenGl_AVIWriter_AVIWriter (aDumpData, nWidth, nHeight, nBitsPerPixel); - delete[] aDumpData; - } -#endif - if (myRenderParams.Method == Graphic3d_RM_RAYTRACING && myRenderParams.IsGlobalIlluminationEnabled) { diff --git a/src/ViewerTest/FILES b/src/ViewerTest/FILES index 6706686d80..148e5e3019 100755 --- a/src/ViewerTest/FILES +++ b/src/ViewerTest/FILES @@ -2,7 +2,6 @@ ViewerTest.cxx ViewerTest.hxx ViewerTest_AutoUpdater.cxx ViewerTest_AutoUpdater.hxx -ViewerTest_AviCommands.cxx ViewerTest_CmdParser.cxx ViewerTest_CmdParser.hxx ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx index c52ae150cb..7eb042d6ac 100644 --- a/src/ViewerTest/ViewerTest.cxx +++ b/src/ViewerTest/ViewerTest.cxx @@ -6082,7 +6082,6 @@ void ViewerTest::Factory(Draw_Interpretor& theDI) { // definition of Viewer Command ViewerTest::Commands(theDI); - ViewerTest::AviCommands(theDI); #ifdef OCCT_DEBUG theDI << "Draw Plugin : OCC V2d & V3d commands are loaded\n"; diff --git a/src/ViewerTest/ViewerTest.hxx b/src/ViewerTest/ViewerTest.hxx index 0f26ac11d9..9c74292d6c 100644 --- a/src/ViewerTest/ViewerTest.hxx +++ b/src/ViewerTest/ViewerTest.hxx @@ -118,8 +118,6 @@ public: Standard_EXPORT static void Commands (Draw_Interpretor& theCommands); - Standard_EXPORT static void AviCommands (Draw_Interpretor& theCommands); - Standard_EXPORT static void ViewerCommands (Draw_Interpretor& theCommands); Standard_EXPORT static void MyCommands (Draw_Interpretor& theCommands); diff --git a/src/ViewerTest/ViewerTest_AviCommands.cxx b/src/ViewerTest/ViewerTest_AviCommands.cxx deleted file mode 100644 index 5aa4729c19..0000000000 --- a/src/ViewerTest/ViewerTest_AviCommands.cxx +++ /dev/null @@ -1,106 +0,0 @@ -// Created on: 2008-06-30 -// Created by: Alexander GRIGORIEV -// Copyright (c) 2008-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#if (defined(_WIN32) || defined(__WIN32__)) && defined(HAVE_VIDEOCAPTURE) - #include - #include - #include - #include -#endif - -#include -#include - -static Standard_Integer avi_record(Draw_Interpretor& /*di*/, - Standard_Integer argc, const char** argv) -{ - if (argc < 2) - { - cout << "Syntax: " << argv[0] << " file | start | stop | save" << endl; - return 1; - } - - Standard_Integer aResult = 1; -#if (defined(_WIN32) || defined(__WIN32__)) - #ifdef HAVE_VIDEOCAPTURE - Handle(V3d_View) aView = ViewerTest::CurrentView (); - if (aView.IsNull()) - { - std::cout << "Call vinit before!\n"; - return 1; - } - - static OpenGl_AVIWriter * pAviWriter = 0L; - - if (strncmp(argv[1], "file", 5) == 0) { - if (argc < 3) { - cout << "Please define the name of AVI file to create ..." << endl; - } else { - const char * aFilename = argv[2]; - DWORD aFormat = mmioFOURCC('X','V','I','D'); - if (argc > 3) { - const char * aFourcc = argv[3]; - aFormat = mmioFOURCC(aFourcc[0], aFourcc[1], aFourcc[2], aFourcc[3]); - } - pAviWriter = new OpenGl_AVIWriter (aFilename, aFormat, 25); - aResult = 0; - } - } else if (pAviWriter == 0L) { - cout << "AVI Writer instance has not been initialized. Use command " - << argv[0] << " file ..." << endl; - } else if (strncmp(argv[1], "start", 6) == 0) { - pAviWriter->StartRecording (aView->Window()->NativeHandle()); - aResult = 0; - } else if (strncmp(argv[1], "stop", 5) == 0) { - pAviWriter->StopRecording(); - aResult = 0; - } else if (strncmp(argv[1], "save", 5) == 0) { - pAviWriter->StopRecording(); - delete pAviWriter; - pAviWriter = 0L; - aResult = 0; - } else if (strncmp(argv[1], "status", 7) == 0) { - cout << pAviWriter->GetLastErrorMessage() << endl; - aResult = 0; - } - #else - cout << "AVI writer capability was disabled\n"; - #endif -#else - cout << "AVI writer is implemented only in Windows version\n"; -#endif - return aResult; -} - -//======================================================================= -//function : AviCommands -//purpose : -//======================================================================= - -void ViewerTest::AviCommands(Draw_Interpretor& theCommands) -{ - const char* group = "ViewerTest AVI commands"; - - theCommands.Add("vrecord", "vrecord [option]\n" - "where [option] can be:\n" - "\tfile