Gnash 0.8.9

dump.h

Go to the documentation of this file.
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 
00039 class Renderer_agg_base;
00040 
00041 typedef bool (*callback_t)(void*, int, void *data);
00042 
00043 class DSOEXPORT DumpGui : public Gui
00044 {
00045  public:
00046     DumpGui(unsigned long xid, float scale, bool loop, RunResources& r);
00047     ~DumpGui();
00048     void beforeRendering();
00049     bool createMenu() { return true; }
00050     bool createMenuBar() { return true; }
00051     bool createWindow(int width, int height);
00052     bool createWindow(const char* /*title*/, int width, int height,
00053             int /*x*/, int /*y*/)
00054         { return createWindow(width, height); }
00055     bool init(int argc, char **argv[]);
00056     virtual void quitUI();
00057     void renderBuffer() {return; }
00058     void render() { return; }
00059     void render(int /*minx*/, int /*miny*/, int /*maxx*/, int /*maxy*/)
00060          { render(); }
00061     bool run();
00062     void setInterval(unsigned int interval);
00063     void setTimeout(unsigned int timeout);
00064     bool setupEvents() { return true; }
00065     void setFullscreen() { return; }
00066     void setInvalidatedRegion(const SWFRect& /*bounds*/) { return; }
00067     void setInvalidatedRegions(const InvalidatedRanges& /*ranges*/) { return; }
00068     void setCursor(gnash_cursor_type /*newcursor*/) { return; }
00069     void setRenderHandlerSize(int width, int height);
00070     void unsetFullscreen() { return; }
00071     bool want_multiple_regions() { return true; }
00072     bool want_redraw() { return false; }
00073     void writeFrame();
00074     void writeSamples();
00075     VirtualClock& getClock() { return _manualClock; }
00076 
00077 private:
00078     
00079     Renderer_agg_base* _agg_renderer;
00080 
00081     // A buffer to hold the actual image data. A boost::scoped_array
00082     // is destroyed on reset and when it goes out of scope (including on
00083     // stack unwinding after an exception), so there is no need to delete
00084     // it.
00085     boost::scoped_array<unsigned char> _offscreenbuf;
00086 
00087     int _offscreenbuf_size;             /* size of window (bytes) */
00088 
00089     unsigned int _timeout;              /* maximum length of movie */
00090     unsigned int _framecount;           /* number of frames rendered */
00091     unsigned int _samplesFetched;       /* number of samples fetched */
00092 
00093     unsigned int _bpp;                  /* bits per pixel */
00094     std::string _pixelformat;              /* colorspace name (eg, "RGB24") */
00095 
00096     std::string _fileOutput;           /* path to video output file */
00097     unsigned int _fileOutputFPS;       /* requested FPS of video output file */
00098     unsigned int _fileOutputAdvance;   /* ms of time between video dump frms */
00099     unsigned long _lastVideoFrameDump; /* time of last video frame dump */
00100     std::ofstream _fileStream;         /* stream for output file */
00101     void init_dumpfile();               /* convenience method to create dump file */
00102 
00103     boost::shared_ptr<sound::sound_handler> _soundHandler;
00104 
00105     ManualClock _manualClock;
00106 
00107     unsigned long _sleepUS; // micro-seconds sleep between iterations
00108 
00109     unsigned int _videoDumpFPS;
00110 
00111 
00112 };
00113 
00114 // end of namespace gnash 
00115 }
00116 
00117 // end of __DUMP_H__
00118 #endif