Gnash  0.8.11dev
dump.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 // 2011 Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASH_DUMP_H
20 #define GNASH_DUMP_H
21 
22 #ifdef HAVE_CONFIG_H
23 #include "gnashconfig.h"
24 #endif
25 
26 #include "dsodefs.h" // for DSOEXPORT
27 #include "gui.h" // for inheritance
28 #include "ManualClock.h"
29 
30 #include <string>
31 #include <fstream>
32 
33 namespace gnash {
34  namespace sound {
35  class sound_handler;
36  }
37 }
38 
39 namespace gnash {
40 
41 class Renderer_agg_base;
42 
43 class DSOEXPORT DumpGui : public Gui
44 {
45  public:
46  DumpGui(unsigned long xid, float scale, bool loop, RunResources& r);
47  ~DumpGui();
48  void beforeRendering();
49  bool createMenu() { return true; }
50  bool createMenuBar() { return true; }
51  bool createWindow(int width, int height);
52  bool createWindow(const char* /*title*/, int width, int height,
53  int /*x*/, int /*y*/)
54  { return createWindow(width, height); }
55  bool init(int argc, char **argv[]);
56  virtual void quitUI();
57  void renderBuffer() {return; }
58  void render() { return; }
59  void render(int /*minx*/, int /*miny*/, int /*maxx*/, int /*maxy*/)
60  { render(); }
61  bool run();
62  void setInterval(unsigned int interval);
63  void setTimeout(unsigned int timeout);
64  bool setupEvents() { return true; }
65  void setFullscreen() { return; }
66  void setInvalidatedRegion(const SWFRect& /*bounds*/) { return; }
67  void setInvalidatedRegions(const InvalidatedRanges& /*ranges*/) { return; }
68  void setCursor(gnash_cursor_type /*newcursor*/) { return; }
69  void setRenderHandlerSize(int width, int height);
70  void unsetFullscreen() { return; }
71  bool want_multiple_regions() { return true; }
72  bool want_redraw() { return false; }
73  void writeFrame();
74  void writeSamples();
75 
76  virtual VirtualClock& getClock() { return _clock; }
77 
78 private:
79 
80  Renderer_agg_base* _agg_renderer;
81 
82  // A buffer to hold the actual image data. A boost::scoped_array
83  // is destroyed on reset and when it goes out of scope (including on
84  // stack unwinding after an exception), so there is no need to delete
85  // it.
86  std::unique_ptr<unsigned char[]> _offscreenbuf;
87 
88  int _offscreenbuf_size; /* size of window (bytes) */
89 
90  unsigned int _timeout; /* maximum length of movie */
91  unsigned int _framecount; /* number of frames rendered */
92  unsigned int _samplesFetched; /* number of samples fetched */
93 
94  unsigned int _bpp; /* bits per pixel */
95  std::string _pixelformat; /* colorspace name (eg, "RGB24") */
96 
97  std::string _fileOutput; /* path to video output file */
98  unsigned int _fileOutputFPS; /* requested FPS of video output file */
99  unsigned int _fileOutputAdvance; /* ms of time between video dump frms */
100  unsigned long _lastVideoFrameDump; /* time of last video frame dump */
101  std::ofstream _fileStream; /* stream for output file */
102  void init_dumpfile(); /* convenience method to create dump file */
103 
104  std::shared_ptr<sound::sound_handler> _soundHandler;
105 
106  ManualClock _clock;
107 
108  unsigned long _sleepUS; // micro-seconds sleep between iterations
109 
110  std::string _startTrigger;
111 
112  bool _started;
113 
114  size_t _startTime;
115 
116 };
117 
118 // end of namespace gnash
119 }
120 
121 #endif
void setFullscreen()
Definition: dump.h:65
A class used to virtualize time flow.
Definition: VirtualClock.h:33
bool createWindow(const char *, int width, int height, int, int)
Create and display our window.
Definition: dump.h:52
virtual VirtualClock & getClock()
Return the clock provided by this Gui.
Definition: dump.h:76
bool createMenu()
Definition: dump.h:49
bool createMenuBar()
Definition: dump.h:50
Sound mixer.
Definition: sound_handler.h:87
void render(int, int, int, int)
Definition: dump.h:59
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
gnash_cursor_type
Enumerates mouse cursor types.
Definition: gui.h:81
bool setupEvents()
Definition: dump.h:64
void setInvalidatedRegion(const SWFRect &)
Gives the GUI a hint which region of the stage should be redrawn.
Definition: dump.h:66
Definition: klash_part.cpp:329
void setCursor(gnash_cursor_type)
Sets the current mouse cursor for the Gui window.
Definition: dump.h:68
void setInvalidatedRegions(const InvalidatedRanges &)
Definition: dump.h:67
Parent class from which all GUI implementations will depend.
Definition: gui.h:88
Definition: GnashKey.h:164
Definition: klash_part.cpp:329
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:53
A manually advanced clock.
Definition: ManualClock.h:30
bool want_multiple_regions()
Definition: dump.h:71
void unsetFullscreen()
Definition: dump.h:70
Definition: Renderer_agg.h:29
#define DSOEXPORT
Definition: dsodefs.h:55
bool want_redraw()
Asks the GUI handler if the next frame should be redrawn completely.
Definition: dump.h:72
void render()
Definition: dump.h:58
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:44
Definition: dump.h:43
void renderBuffer()
Definition: dump.h:57