Commit de4a06fb authored by Jan Möbius's avatar Jan Möbius

Basic work for video capturing

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5695 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7d36513a
......@@ -446,6 +446,9 @@ Core::init() {
this , SLOT(slotMouseEventIdentify(QMouseEvent*)));
connect( coreWidget_->examiner_widgets_[i], SIGNAL(signalWheelEvent(QWheelEvent *, const std::string &)),
this , SLOT(slotWheelEvent(QWheelEvent *, const std::string &)));
connect( coreWidget_->examiner_widgets_[i], SIGNAL( viewUpdated() ),
this, SLOT( viewUpdated()) );
}
}
......@@ -687,16 +690,17 @@ void Core::updateView() {
if ( elapsed < 1000 / OpenFlipper::Options::maxFrameRate() )
{
// redraw time not reached ... waiting for timer event for next redraw
if ( redrawTimer_->isActive() ) {
if ( OpenFlipper::Options::doSlotDebugging() )
emit log(LOGINFO,"Too early for redraw! Delaying request from " + QString( sender()->metaObject()->className() ) );
return;
}
// Start the timer
redrawTimer_->start( (1000 / OpenFlipper::Options::maxFrameRate()) - elapsed);
return;
// redraw time not reached ... waiting for timer event for next redraw
if ( redrawTimer_->isActive() ) {
if ( OpenFlipper::Options::doSlotDebugging() )
emit log(LOGINFO,"Too early for redraw! Delaying request from " +
QString( sender()->metaObject()->className() ) );
return;
}
// Start the timer
redrawTimer_->start( (1000 / OpenFlipper::Options::maxFrameRate()) - elapsed);
return;
}
else if ( redrawTimer_->isActive() )
redrawTimer_->stop ();
......@@ -709,10 +713,11 @@ void Core::updateView() {
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
coreWidget_->examiner_widgets_[i]->updateGL();
}
}
//-----------------------------------------------------------------------------
/** Check if scenegraph is dirty and initiate redraw
......
......@@ -401,6 +401,28 @@ private:
/** @} */
//===========================================================================
/** @name Video Stream creation
* @{ */
//===========================================================================
private slots:
/// Slot called everytime the view is updated
void viewUpdated();
/// Function called for every frame when capturing video
void captureVideo();
/// Start video capturing
void startVideoCapture();
/// Stop video capturing
void stopVideoCapture();
private:
QTimer videoTimer_;
QTime lastVideoTime_;
/** @} */
//===========================================================================
/** @name Load / Save slots
* @{ */
......
//=============================================================================
//
// OpenFlipper
// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
// www.openflipper.org
//
//-----------------------------------------------------------------------------
//
// License
//
// OpenFlipper is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
// $Revision: 2160 $
// $Author: wilden $
// $Date: 2008-07-08 18:05:21 +0200 (Di, 08. Jul 2008) $
//
//=============================================================================
//=============================================================================
//
// CLASS Core - IMPLEMENTATION
//
//=============================================================================
//== INCLUDES =================================================================
// -------------------- mview
#include "Core.hh"
//== IMPLEMENTATION ==========================================================
//-----------------------------------------------------------------------------
void Core::startVideoCapture() {
connect( &videoTimer_ , SIGNAL(timeout()), this, SLOT( viewUpdated() ) );
// set track auf true;
videoTimer_.setSingleShot(false);
// 25 fps
videoTimer_.start(40);
lastVideoTime_.start();
QString name = "/home/moebius/snaps/autosnapshot.jpg";
applicationSnapshotName(name);
std::cerr << "Start " << std::endl;
}
void Core::captureVideo() {
int elapsed = lastVideoTime_.elapsed();
if ( elapsed < 40 ) {
// std::cerr << "Too early to capture" << std::endl;
return;
}
lastVideoTime_.restart();
// std::cerr << "Capture " << std::endl;
applicationSnapshot();
}
void Core::stopVideoCapture() {
}
void Core::viewUpdated() {
bool track = true;
if ( track ) {
captureVideo();
}
}
//=============================================================================
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment