This patch was based originally on: https://savannah.gnu.org/patch/index.php?7742 Comments from submitter: Submitter: Park Hyunwoo Submitted: Mon 12 Mar 2012 06:10:42 AM UTC Mon 12 Mar 2012 06:10:42 AM UTC, original submission: Hi hackers. I'm using gnash to make 'movie' file from SWF. At first, I dumped SWF files with 'dump-gnash -D' options. But I cou- ldn't get best quality movie with that option - it only supports 'interval/delay', so I can't get each of exact frame of SWF. Default dump-gnash delay is 10ms - 100fps, but my SWFs are 30fps and we can't use float value(16.66667ms) as interval. And also, The result from converting 100fps into 30fps via ffmpeg was not good. So I decided to use 'screenshot' feature to make a movie. [This] is a patch for adding 'dump all screenshot' using: --screenshot all I wanted to add a help message on '-h' option, I can't find a good lo- cation for it. There is no help message for 'last' option that cur- rently supported, neither. Thanks. --- gnash-patches-git-29748750e.old/gui/Player.cpp +++ gnash-patches-git-29748750e/gui/Player.cpp @@ -638,10 +638,12 @@ std::istringstream is(_screenshots); std::string arg; bool last = false; + bool all = false; ScreenShotter::FrameList v; while (std::getline(is, arg, ',')) { if (arg == "last") last = true; + else if (arg == "all") all = true; else try { const size_t frame = boost::lexical_cast(arg); v.push_back(frame); @@ -657,11 +659,12 @@ url.path().substr(p + 1); _screenshotFile = "screenshot-" + name + "-%f"; } - if (!last && v.empty()) return; + if (!all && !last && v.empty()) return; std::unique_ptr ss(new ScreenShotter(_screenshotFile, _screenshotQuality)); - if (last) ss->lastFrame(); + if (last) ss->lastFrame(); else if (all) ss->allFrames(); + ss->setFrames(v); _gui->setScreenShotter(std::move(ss)); } --- gnash-patches-git-29748750e.old/gui/ScreenShotter.cpp +++ gnash-patches-git-29748750e/gui/ScreenShotter.cpp @@ -63,6 +63,8 @@ _immediate(false), _fileName(fileName), _last(false), + _all(false), + _last_saved_frame(-1), _type(typeFromFileName(fileName)), _quality(quality) { --- gnash-patches-git-29748750e.old/gui/ScreenShotter.h +++ gnash-patches-git-29748750e/gui/ScreenShotter.h @@ -24,6 +24,9 @@ #include #include +#include +#include + #include "GnashEnums.h" namespace gnash { @@ -57,6 +60,11 @@ _last = true; } + /// Take whole screenshots + void allFrames() { + _all = true; + } + struct NoAction { void operator()() const {} }; /// To be called on the last frame before exit. @@ -115,7 +123,16 @@ void screenShot(const Renderer& r, size_t frameAdvance, Action* t = 0) { // Save an image if a spontaneous screenshot was requested or the // frame is in the list of requested frames. - if (_immediate || std::binary_search(_frames.begin(), _frames.end(), + if ( _all ) { + if( frameAdvance != _last_saved_frame ) + { + if (t) (*t)(); + std::string frame = boost::str( boost::format("%06d") % frameAdvance); + saveImage(r, frame); + // printf("screenShot-all : %s\n", frame.c_str()); + _last_saved_frame = frameAdvance; + } + } else if (_immediate || std::binary_search(_frames.begin(), _frames.end(), frameAdvance)) { // Check whether we've rendered an image for this frame. @@ -148,6 +165,10 @@ /// Whether to take a screenshot on the last frame. bool _last; + /// Whether to take screenshots on each frame.. + bool _all; + size_t _last_saved_frame; + FrameList _frames; const FileType _type;