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
gnash::geometry::SnappingRanges2d< std::int32_t >
Renderer_agg.h
sound_handler.h
gnash::gnash_cursor_type
gnash_cursor_type
Enumerates mouse cursor types.
Definition: gui.h:81
path
VGPath path
Definition: testr_gtk.cpp:84
optind
int optind
gnash::Gui::_renderer
std::shared_ptr< Renderer > _renderer
The handler which is called to update the client area of our window.
Definition: gui.h:506
gnash::as_value::equals
DSOEXPORT bool equals(const as_value &v, int version) const
Return true if this value is abstractly equal to the given one.
Definition: as_value.cpp:555
gnash::create_Renderer_agg
DSOEXPORT Renderer_agg_base * create_Renderer_agg(const char *pixelformat)
Create a render handler.
Definition: Renderer_agg.cpp:2048
Movie.h
height
@ height
Definition: klash_part.cpp:329
gnash::as_object
The base class for all ActionScript objects.
Definition: as_object.h:162
gnash::movie_root::getRootMovie
Movie & getRootMovie()
Access the originating root movie (not necessarily _level0)
Definition: movie_root.h:303
gnash::DumpGui::setupEvents
bool setupEvents()
Definition: dump.h:64
gnash::VirtualClock
A class used to virtualize time flow.
Definition: VirtualClock.h:34
dsodefs.h
gnash::sound::sound_handler::fetchSamples
virtual void fetchSamples(std::int16_t *to, unsigned int nSamples)
Fetch mixed samples.
Definition: sound_handler.cpp:646
gnash::DumpGui
Definition: dump.h:44
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
ManualClock.h
gnash::DumpGui::render
void render()
Definition: dump.h:58
gnash::RunResources::setSoundHandler
void setSoundHandler(std::shared_ptr< sound::sound_handler > s)
Set the sound::sound_handler.
Definition: RunResources.h:88
rc.h
getopt
int getopt(int, char *const *, const char *)
_
#define _(String)
Definition: log.h:44
Renderer.h
gnash::ManualClock
A manually advanced clock.
Definition: ManualClock.h:31
gnash::as_environment
Provides information about timeline context.
Definition: as_environment.h:51
gnash::parsePath
bool parsePath(const std::string &var_path_in, std::string &path, std::string &var)
Definition: as_environment.cpp:397
dump.h
gnash::DumpGui::setRenderHandlerSize
void setRenderHandlerSize(int width, int height)
Definition: dump.cpp:373
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::Gui
Parent class from which all GUI implementations will depend.
Definition: gui.h:88
gnash::DumpGui::setTimeout
void setTimeout(unsigned int timeout)
Set the time in milliseconds after which the programme should exit.
Definition: dump.cpp:274
as_value.h
gnash::Renderer_agg_base::init_buffer
virtual void init_buffer(unsigned char *mem, int size, int x, int y, int rowstride)=0
gnash::key::n
@ n
Definition: GnashKey.h:160
gnash::DumpGui::~DumpGui
~DumpGui()
Definition: dump.cpp:107
gnash::DumpGui::want_multiple_regions
bool want_multiple_regions()
Definition: dump.h:71
gnash::DumpGui::run
bool run()
Start main rendering loop.
Definition: dump.cpp:189
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::Gui::_runResources
RunResources & _runResources
Per-run resources.
Definition: gui.h:500
gnash::RunResources::setRenderer
void setRenderer(std::shared_ptr< Renderer > r)
Definition: RunResources.h:108
gnash::media::MediaHandler
The MediaHandler class acts as a factory to provide parser and decoders.
Definition: MediaHandler.h:70
gnash::SWFRect
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:45
gnash::key::r
@ r
Definition: GnashKey.h:164
GnashSleep.h
gnash::DumpGui::writeFrame
void writeFrame()
Definition: dump.cpp:297
gnash::DumpGui::DumpGui
DumpGui(unsigned long xid, float scale, bool loop, RunResources &r)
Definition: dump.cpp:81
gnash::Gui::_width
int _width
Desired window width.
Definition: gui.h:494
gnash::movie_root::getVM
VM & getVM()
Return the VM used by this movie_root.
Definition: movie_root.h:356
gnash::DumpGui::createMenu
bool createMenu()
Definition: dump.h:49
gnash::sound::NullSoundHandler
Null sound_handler, for testing or manual fetching of samples.
Definition: NullSoundHandler.h:37
gnash::ManualClock::advance
void advance(unsigned long amount)
Advance the clock by the given amount of milliseconds.
Definition: ManualClock.h:53
WallClockTimer.h
gnash::DumpGui::init
bool init(int argc, char **argv[])
/ Initialise the gui and the associated renderer.
Definition: dump.cpp:113
NullSoundHandler.h
gnash::DumpGui::writeSamples
void writeSamples()
Definition: dump.cpp:309
gnash::RunResources
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:54
gnash::as_value
ActionScript value type.
Definition: as_value.h:95
gnash::RunResources::mediaHandler
media::MediaHandler * mediaHandler() const
Definition: RunResources.h:104
gnash::DumpGui::setCursor
void setCursor(gnash_cursor_type)
Sets the current mouse cursor for the Gui window.
Definition: dump.h:68
VM.h
gnash::DumpGui::render
void render(int, int, int, int)
Definition: dump.h:59
gnash::Gui::quit
void quit()
Always called on exit.
Definition: gui.cpp:215
gnash::DumpGui::renderBuffer
void renderBuffer()
Definition: dump.h:57
gnash::terminate_request
std::sig_atomic_t terminate_request
Definition: dump.cpp:69
gnash::DumpGui::setFullscreen
void setFullscreen()
Definition: dump.h:65
gnash::DumpGui::createWindow
bool createWindow(const char *, int width, int height, int, int)
Create and display our window.
Definition: dump.h:52
log.h
gnash::DumpGui::setInvalidatedRegion
void setInvalidatedRegion(const SWFRect &)
Gives the GUI a hint which region of the stage should be redrawn.
Definition: dump.h:66
gnash::gnashSleep
void gnashSleep(time_t useconds)
Sleep compatibly for the specified number of microseconds.
Definition: GnashSleep.h:35
gnash::terminate_signal
void terminate_signal(int)
Definition: dump.cpp:72
gnash::sound::sound_handler
Sound mixer.
Definition: sound_handler.h:88
as_environment.h
gnash::DumpGui::unsetFullscreen
void unsetFullscreen()
Definition: dump.h:70
gnash::DumpGui::createMenuBar
bool createMenuBar()
Definition: dump.h:50
gnash::Renderer_agg_base
Definition: Renderer_agg.h:30
gnashconfig.h
gnash::movie_root
This class represents the 'Stage' and top-level movie.
Definition: movie_root.h:151
gnash::Gui::getStage
movie_root * getStage()
The root movie, or "Stage".
Definition: gui.h:407
RunResources.h
gnash::Gui::_xid
unsigned long _xid
The X Window ID to attach to. If zero, we create a new window.
Definition: gui.h:486
gnash::key::c
@ c
Definition: GnashKey.h:149
DSOEXPORT
#define DSOEXPORT
Definition: dsodefs.h:55
gnash::geometry::Range2d::setTo
Range2d< T > & setTo(T x, T y)
Set ourself to bound the given point.
Definition: Range2d.h:339
gnash::getURI
ObjectURI getURI(const VM &vm, const std::string &str, bool lowerCaseHint=false)
Definition: VM.h:290
gnash::Gui::_interval
unsigned int _interval
Main loop interval: the time between successive advance_movie calls.
Definition: gui.h:503
gnash::DumpGui::createWindow
bool createWindow(int width, int height)
Definition: dump.cpp:287
gnash::Gui::_validbounds
geometry::Range2d< int > _validbounds
Definition: gui.h:491
gnash::RunResources::soundHandler
sound::sound_handler * soundHandler() const
Get a pointer to a sound::sound_handler set by a hosting application.
Definition: RunResources.h:96
gui.h
optarg
char * optarg
gnash::MovieClip::get_environment
virtual as_environment & get_environment()
Return a reference to the variable scope of this DisplayObject.
Definition: MovieClip.h:509
gnash::DumpGui::getClock
virtual VirtualClock & getClock()
Return the clock provided by this Gui.
Definition: dump.h:76
gnash::DumpGui::quitUI
virtual void quitUI()
End main rendering loop calling GUI-specific exit functions.
Definition: dump.cpp:422
gnash::DumpGui::setInterval
void setInterval(unsigned int interval)
Set main loop delay in milliseconds.
Definition: dump.cpp:280
gnash::DumpGui::setInvalidatedRegions
void setInvalidatedRegions(const InvalidatedRanges &)
Definition: dump.h:67
gnash::key::o
@ o
Definition: GnashKey.h:161
width
@ width
Definition: klash_part.cpp:329
gnash::key::u
@ u
Definition: GnashKey.h:167
gnash::ManualClock::elapsed
unsigned long elapsed() const
Return number of milliseconds elapsed since start.
Definition: ManualClock.h:41
gnash::DumpGui::want_redraw
bool want_redraw()
Asks the GUI handler if the next frame should be redrawn completely.
Definition: dump.h:72
gnash::findObject
as_object * findObject(const as_environment &ctx, const std::string &path, const as_environment::ScopeStack *scope)
Find the object referenced by the given path.
Definition: as_environment.cpp:116
gnash::Gui::advanceMovie
bool advanceMovie(bool doDisplay=true)
Give movie an heart-beat.
Definition: gui.cpp:935
gnash::key::e
@ e
Definition: GnashKey.h:151
gnash::Gui::_height
int _height
Desired window height.
Definition: gui.h:497
gnash::DumpGui::beforeRendering
void beforeRendering()
Definition: dump.cpp:417