Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
grabframe.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef __GRABFRAME_H
25 #define __GRABFRAME_H
26 
27 #include <string>
28 #include <osg/Image>
29 #include <osg/Camera>
30 #include <selforg/backcaller.h>
31 
32 namespace lpzrobots{
33 
34  class VideoStream : public osg::Camera::DrawCallback, public BackCaller {
35  public:
37  VideoStream(){ opened=false; pause = false;}
38 
39  void open(const std::string& dir, const std::string& filename);
40  void close();
41  bool grabAndWriteFrame(const osg::Camera& camera);
42 
43  bool isOpen() const { return opened; }
44 
45  // DrawCallback interface
46  virtual void operator() (const osg::Camera &) const ;
47 
48  virtual long int getCounter() { return counter; }
49  virtual const std::string& getDirectory() { return directory; }
50 
51  bool pause;
52  private:
53  bool opened;
54  std::string filename;
55  std::string directory;
56  unsigned int w;
57  unsigned int h;
58  long int counter;
59  };
60 
61 }
62 
63 #endif
bool isOpen() const
Definition: grabframe.h:43
virtual const std::string & getDirectory()
Definition: grabframe.h:49
static const BackCaller::CallbackableType FRAMECAPTURE
Definition: grabframe.h:36
bool pause
Definition: grabframe.h:51
bool grabAndWriteFrame(const osg::Camera &camera)
Definition: grabframe.cpp:57
unsigned long CallbackableType
Definition: backcaller.h:45
Definition: grabframe.h:34
virtual void operator()(const osg::Camera &) const
Definition: grabframe.cpp:34
virtual long int getCounter()
Definition: grabframe.h:48
VideoStream()
Definition: grabframe.h:37
void open(const std::string &dir, const std::string &filename)
Definition: grabframe.cpp:46
void close()
Definition: grabframe.cpp:53
Class prototype which provides functions to handle callbackable classes.
Definition: backcaller.h:42