Gnash
0.8.10
|
00001 // 00002 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 00003 // 2011 Free Software Foundation, Inc 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 #ifndef GNASH_DUMP_H 00020 #define GNASH_DUMP_H 00021 00022 #ifdef HAVE_CONFIG_H 00023 #include "gnashconfig.h" 00024 #endif 00025 00026 #include "dsodefs.h" // for DSOEXPORT 00027 #include "gui.h" // for inheritance 00028 #include "sound_handler.h" // for dtor visibility 00029 #include "ManualClock.h" 00030 00031 #include <string> 00032 #include <fstream> 00033 #include <boost/scoped_array.hpp> 00034 #include <boost/shared_ptr.hpp> 00035 00036 namespace gnash { 00037 00038 class Renderer_agg_base; 00039 00040 class DSOEXPORT DumpGui : public Gui 00041 { 00042 public: 00043 DumpGui(unsigned long xid, float scale, bool loop, RunResources& r); 00044 ~DumpGui(); 00045 void beforeRendering(); 00046 bool createMenu() { return true; } 00047 bool createMenuBar() { return true; } 00048 bool createWindow(int width, int height); 00049 bool createWindow(const char* /*title*/, int width, int height, 00050 int /*x*/, int /*y*/) 00051 { return createWindow(width, height); } 00052 bool init(int argc, char **argv[]); 00053 virtual void quitUI(); 00054 void renderBuffer() {return; } 00055 void render() { return; } 00056 void render(int /*minx*/, int /*miny*/, int /*maxx*/, int /*maxy*/) 00057 { render(); } 00058 bool run(); 00059 void setInterval(unsigned int interval); 00060 void setTimeout(unsigned int timeout); 00061 bool setupEvents() { return true; } 00062 void setFullscreen() { return; } 00063 void setInvalidatedRegion(const SWFRect& /*bounds*/) { return; } 00064 void setInvalidatedRegions(const InvalidatedRanges& /*ranges*/) { return; } 00065 void setCursor(gnash_cursor_type /*newcursor*/) { return; } 00066 void setRenderHandlerSize(int width, int height); 00067 void unsetFullscreen() { return; } 00068 bool want_multiple_regions() { return true; } 00069 bool want_redraw() { return false; } 00070 void writeFrame(); 00071 void writeSamples(); 00072 00073 virtual VirtualClock& getClock() { return _clock; } 00074 00075 private: 00076 00077 Renderer_agg_base* _agg_renderer; 00078 00079 // A buffer to hold the actual image data. A boost::scoped_array 00080 // is destroyed on reset and when it goes out of scope (including on 00081 // stack unwinding after an exception), so there is no need to delete 00082 // it. 00083 boost::scoped_array<unsigned char> _offscreenbuf; 00084 00085 int _offscreenbuf_size; /* size of window (bytes) */ 00086 00087 unsigned int _timeout; /* maximum length of movie */ 00088 unsigned int _framecount; /* number of frames rendered */ 00089 unsigned int _samplesFetched; /* number of samples fetched */ 00090 00091 unsigned int _bpp; /* bits per pixel */ 00092 std::string _pixelformat; /* colorspace name (eg, "RGB24") */ 00093 00094 std::string _fileOutput; /* path to video output file */ 00095 unsigned int _fileOutputFPS; /* requested FPS of video output file */ 00096 unsigned int _fileOutputAdvance; /* ms of time between video dump frms */ 00097 unsigned long _lastVideoFrameDump; /* time of last video frame dump */ 00098 std::ofstream _fileStream; /* stream for output file */ 00099 void init_dumpfile(); /* convenience method to create dump file */ 00100 00101 boost::shared_ptr<sound::sound_handler> _soundHandler; 00102 00103 ManualClock _clock; 00104 00105 unsigned long _sleepUS; // micro-seconds sleep between iterations 00106 00107 unsigned int _videoDumpFPS; 00108 00109 std::string _startTrigger; 00110 00111 bool _started; 00112 00113 size_t _startTime; 00114 00115 }; 00116 00117 // end of namespace gnash 00118 } 00119 00120 #endif