core/vidl/gui/vidl_capture_tableau.h
Go to the documentation of this file.
00001 // This is core/vidl/gui/vidl_capture_tableau.h
00002 #ifndef vidl_capture_tableau_h_
00003 #define vidl_capture_tableau_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief  Tableau for capturing OpenGL rendering to a video
00010 // \author Matt Leotta
00011 // \date   21 Nov 08
00012 //
00013 //  Contains classes  vidl_capture_tableau   vidl_capture_tableau_new
00014 
00015 
00016 #include <vidl/gui/vidl_capture_tableau_sptr.h>
00017 #include <vgui/vgui_wrapper_tableau.h>
00018 #include <vidl/vidl_ostream_sptr.h>
00019 
00020 //: Tableau for capturing OpenGL rendering to a video
00021 //
00022 //  After each draw events this tableau captures the current 
00023 //  OpenGL buffer and writes it as a frame of video to a vidl_ostream 
00024 class vidl_capture_tableau : public vgui_wrapper_tableau
00025 {
00026  public:
00027 
00028   //: Constructor - don't use this, use vidl_capture_tableau_new.
00029   //  Takes the single child tableau as a parameter.
00030   vidl_capture_tableau(vgui_tableau_sptr const& child);
00031 
00032   //: Returns the type of this tableau ('vidl_capture_tableau').
00033   vcl_string type_name() const;
00034 
00035   //: Handle all events sent to this tableau
00036   bool handle( vgui_event const &e);
00037   
00038   //: Set the output video stream
00039   void set_ostream(const vidl_ostream_sptr& os) { ostream_ = os; }
00040   
00041   //: Prompt the user to set an ostream with a gui dialog
00042   void prompt_for_ostream();
00043   
00044   //: Stop the video capture and close the ostream
00045   void close_ostream();
00046 
00047  protected:
00048   //: Destructor - called by vidl_capture_tableau_sptr.
00049   ~vidl_capture_tableau() { }
00050   
00051   vidl_ostream_sptr ostream_;
00052 
00053 };
00054 
00055 //: Create a smart-pointer to a vidl_capture_tableau tableau.
00056 struct vidl_capture_tableau_new : public vidl_capture_tableau_sptr
00057 {
00058   typedef vidl_capture_tableau_sptr base;
00059 
00060   //: Constructor - takes the single child tableau as a parameter.
00061   vidl_capture_tableau_new(vgui_tableau_sptr const& child) 
00062   : base(new vidl_capture_tableau(child)) { }
00063 };
00064 
00065 #endif // vidl_capture_tableau_h_