From 80569ab561baab61bfb7a42a862eb7a42d8cbdc4 Mon Sep 17 00:00:00 2001 From: Adrian Panasiuk Date: Fri, 13 Mar 2009 23:02:34 +0000 Subject: [PATCH] Enable Gnash standalone player to compile and work. --- net-www/gnash/gnash-0.8.4-haiku.diff | 1227 ++++++++++++++++++++++++++ 1 file changed, 1227 insertions(+) create mode 100644 net-www/gnash/gnash-0.8.4-haiku.diff diff --git a/net-www/gnash/gnash-0.8.4-haiku.diff b/net-www/gnash/gnash-0.8.4-haiku.diff new file mode 100644 index 000000000..1ad561694 --- /dev/null +++ b/net-www/gnash/gnash-0.8.4-haiku.diff @@ -0,0 +1,1227 @@ +Binary files clean-gnash/--library=stdc++ and gnash-0.8.4-3/--library=stdc++ differ +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/backend/render_handler_agg.cpp gnash-0.8.4-3/backend/render_handler_agg.cpp +--- clean-gnash/backend/render_handler_agg.cpp 2009-03-06 02:03:25.000000000 +0000 ++++ gnash-0.8.4-3/backend/render_handler_agg.cpp 2009-03-07 13:22:03.000000000 +0000 +@@ -1658,13 +1658,19 @@ + const std::vector& agg_paths, + const std::vector &line_styles, const cxform& cx, + const matrix& linestyle_matrix, scanline_type& sl) { ++ //QQQ ++ return ; ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + assert(m_pixf.get()); ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + if (m_drawing_mask) // Flash ignores lines in mask /definitions/ + return; ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + if ( _clipbounds.empty() ) return; ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + // TODO: While walking the paths for filling them, remember when a path + // has a line style associated, so that we avoid walking the paths again +@@ -1677,6 +1683,7 @@ + / 2.0f + * get_stroke_scale(); + ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + // AGG stuff + typedef agg::rasterizer_scanline_aa<> ras_type; +@@ -1684,62 +1691,81 @@ + renderer_base rbase(*m_pixf); + agg::renderer_scanline_aa_solid< + agg::renderer_base > ren_sl(rbase); // solid fills ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + + for (unsigned int cno=0; cno<_clipbounds_selected.size(); ++cno) { + ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + const geometry::Range2d* bounds = _clipbounds_selected[cno]; + + apply_clip_box (ras, *bounds); ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + int current_subshape=0; + ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + for (size_t pno=0, pcount=paths.size(); pno(agg_paths[pno]); ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + if (this_path_gnash.m_new_shape) + ++current_subshape; ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + if ((subshape_id>=0) && (current_subshape!=subshape_id)) { + // Skip this path as it is not part of the requested sub-shape. + continue; + } ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + if (this_path_gnash.m_line==0) { + // Skip this path as it contains no line style + continue; + } ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + agg::conv_curve< agg::path_storage > curve(this_path_agg); // to render curves ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + agg::conv_stroke< agg::conv_curve < agg::path_storage > > + stroke(curve); // to get an outline + ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + const line_style& lstyle = line_styles[this_path_gnash.m_line-1]; + ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + int thickness = lstyle.getThickness(); + if (!thickness) stroke.width(1); // hairline + else if ( (!lstyle.scaleThicknessVertically()) && (!lstyle.scaleThicknessHorizontally()) ) + { ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + stroke.width(TWIPS_TO_PIXELS(thickness)); + } + else + { ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + if ( (!lstyle.scaleThicknessVertically()) || (!lstyle.scaleThicknessHorizontally()) ) + { ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + LOG_ONCE( log_unimpl(_("Unidirectionally scaled strokes in AGG renderer (we'll scale by the scalable one)")) ); + } + stroke.width(std::max(1.0f, thickness*stroke_scale)); ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + } + ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + // TODO: support endCapStyle + + // TODO: When lstyle.noClose==0 and the start and end point matches, + // then render a real join instead of the caps. + ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + switch (lstyle.startCapStyle()) { + case CAP_NONE : stroke.line_cap(agg::butt_cap); break; + case CAP_SQUARE : stroke.line_cap(agg::square_cap); break; +@@ -1752,15 +1778,21 @@ + default : case JOIN_ROUND : stroke.line_join(agg::round_join); + } + ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + stroke.miter_limit(lstyle.miterLimitFactor()); ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + ras.reset(); ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + ras.add_path(stroke); + ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + rgba color = cx.transform(lstyle.get_color()); + ren_sl.color(agg::rgba8_pre(color.m_r, color.m_g, color.m_b, color.m_a)); + ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + agg::render_scanlines(ras, sl, ren_sl); ++ fprintf(stderr, "%s %s %d\n", __FILE__, __PRETTY_FUNCTION__, __LINE__); + + } + +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/gui/dump.cpp gnash-0.8.4-3/gui/dump.cpp +--- clean-gnash/gui/dump.cpp 2009-03-06 02:03:16.000000000 +0000 ++++ gnash-0.8.4-3/gui/dump.cpp 2009-03-07 13:22:07.000000000 +0000 +@@ -28,6 +28,9 @@ + + #include "log.h" + ++#include ++#include ++ + #include "gui.h" + #include "rc.h" + #include "sound_handler.h" +@@ -89,7 +92,8 @@ + _timeout(0), + _framecount(0), + _bpp(32), +- _pixelformat("BGRA32") ++ _pixelformat("BGRA32"), ++ _ble_data(NULL) + { + if (loop) { + std::cerr << "# WARNING: Gnash was told to loop the movie" << std::endl; +@@ -102,6 +106,13 @@ + DumpGui::~DumpGui() + { + std::cout << "FRAMECOUNT=" << _framecount << "" << std::endl; ++ if (_ble_data != NULL) ++ { ++ if (munmap(_ble_data, _ble_data_size) == -1) ++ perror("munmap"); ++ if (close(_ble_fd) == -1) ++ perror("close"); ++ } + } + + bool +@@ -245,9 +256,13 @@ + void + DumpGui::writeFrame() + { +- assert(_fileStream); +- if (_fileStream.is_open()) { +- _fileStream.write(reinterpret_cast(_offscreenbuf.get()), _offscreenbuf_size); ++ //assert(_fileStream); ++ //if (_fileStream.is_open()) { ++ if (1) { ++ //memmove(_ble_data, _offscreenbuf.get(), _offscreenbuf_size); ++ //if (msync(_ble_data, _offscreenbuf_size, MS_SYNC) == -1) ++ //perror("msync"); ++ // _fileStream.write(reinterpret_cast(_offscreenbuf.get()), _offscreenbuf_size); + _framecount++; + } + else { +@@ -263,13 +278,39 @@ + // This should never be empty. + assert (!_fileOutput.empty()); + +- _fileStream.open(_fileOutput.c_str()); ++ //_fileStream.open(_fileOutput.c_str()); + +- if (!_fileStream) { +- log_error(_("Unable to write file '%s'."), _fileOutput); +- std::cerr << "# FATAL: Unable to write file '" << _fileOutput << "'" << std::endl; +- exit(1); +- } ++ //if (!_fileStream) { ++ //log_error(_("Unable to write file '%s'."), _fileOutput); ++ //std::cerr << "# FATAL: Unable to write file '" << _fileOutput << "'" << std::endl; ++ //exit(1); ++ //} ++ ++ //_ble_fd = open(_fileOutput.c_str(), O_RDWR); ++ char *endptr; ++ _ble_fd = strtol(_fileOutput.c_str(), &endptr, 10); ++ if (*endptr) ++ { ++ std::cerr << "nie-liczba przy -D" << std::endl; ++ exit(1); ++ } ++ if (_ble_fd == -1) ++ { ++ std::cerr << "vid fd error" << std::endl; ++ exit(1); ++ } ++ std::cerr << "vid fd is " << _ble_fd << std::endl; ++ int pagesize = getpagesize(); ++ _ble_data_size = ((_offscreenbuf_size + pagesize - 1) / pagesize) ++ * pagesize; ++ _ble_data_size = 0x1000 * 3000; //XXX ++ _ble_data = (char*)mmap((caddr_t)0, _ble_data_size, PROT_READ|PROT_WRITE, ++ MAP_SHARED, _ble_fd, 0); ++ if (_ble_data == (void*) -1) ++ { ++ perror("mmap"); ++ exit(1); ++ } + + // Yes, this should go to cout. The user needs to know this + // information in order to process the file. Print out in a +@@ -288,7 +329,8 @@ + assert(height > 0); + assert(_agg_renderer != NULL); + +- if (_offscreenbuf.get() && (width == _width) && (height == _height)) { ++ //if (_offscreenbuf.get() && (width == _width) && (height == _height)) { ++ if (_offscreenbuf && (width == _width) && (height == _height)) { + return; + } + +@@ -304,7 +346,8 @@ + if (newBufferSize != _offscreenbuf_size) { + + try { +- _offscreenbuf.reset(new unsigned char[newBufferSize]); ++ //_offscreenbuf.reset(new unsigned char[newBufferSize]); ++ _offscreenbuf=((unsigned char*)_ble_data); + log_debug("DUMP-AGG: %i bytes offscreen buffer allocated", newBufferSize); + } + catch (std::bad_alloc &e) +@@ -322,7 +365,8 @@ + } + + static_cast (_agg_renderer)->init_buffer +- (_offscreenbuf.get(), ++ //(_offscreenbuf.get(), ++ (_offscreenbuf, + _offscreenbuf_size, + _width, + _height, +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/gui/dump.h gnash-0.8.4-3/gui/dump.h +--- clean-gnash/gui/dump.h 2009-03-06 02:03:15.000000000 +0000 ++++ gnash-0.8.4-3/gui/dump.h 2009-03-07 13:22:07.000000000 +0000 +@@ -70,7 +70,8 @@ + // is destroyed on reset and when it goes out of scope (including on + // stack unwinding after an exception), so there is no need to delete + // it. +- boost::scoped_array _offscreenbuf; ++ //boost::scoped_array _offscreenbuf; ++ unsigned char * _offscreenbuf; + + int _offscreenbuf_size; /* size of window (bytes) */ + +@@ -82,6 +83,10 @@ + + std::string _fileOutput; /* path to output file */ + std::ofstream _fileStream; /* stream for output file */ ++ FILE *_file; ++ char *_ble_data; ++ unsigned _ble_data_size; ++ int _ble_fd; + void init_dumpfile(); /* convenience method to create dump file */ + + +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/gui/gnash.cpp gnash-0.8.4-3/gui/gnash.cpp +--- clean-gnash/gui/gnash.cpp 2009-03-06 02:03:15.000000000 +0000 ++++ gnash-0.8.4-3/gui/gnash.cpp 2009-03-07 13:22:07.000000000 +0000 +@@ -28,6 +28,8 @@ + #include "arg_parser.h" + #include "utility.h" // for clamp + ++extern "C" void debugger(const char*); ++ + #ifdef HAVE_FFMPEG_AVCODEC_H + extern "C" { + # include "ffmpeg/avcodec.h" +@@ -427,9 +429,25 @@ + + } + ++void sighandler(int sno) ++{ ++ pid_t pid; ++ pid = getpid(); ++ fprintf(stderr, "signal %d, pid %d\n", sno, pid); ++ ++ debugger("signal"); ++} ++ + int + gnash_main(int argc, char *argv[]) + { ++ struct sigaction sa; ++ sa.sa_flags=0; ++ sa.sa_handler=sighandler; ++ sigemptyset(&sa.sa_mask); ++ if (sigaction(SIGSEGV, &sa, 0) != 0) ++ { fprintf(stderr, "error\n"); abort(); } ++ + gnash::Player player; + + // Enable native language support, i.e. internationalization +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/libbase/shm.cpp gnash-0.8.4-3/libbase/shm.cpp +--- clean-gnash/libbase/shm.cpp 2009-03-06 02:03:04.000000000 +0000 ++++ gnash-0.8.4-3/libbase/shm.cpp 2009-03-07 13:22:08.000000000 +0000 +@@ -136,7 +136,10 @@ + + return true; + #else +-#error "You need SYSV Shared memory support to use this option" ++//#error "You need SYSV Shared memory support to use this option" ++/* QQQ */ ++std::cerr << "QQQ " << __func__ << " " << __LINE__ << std::endl; ++raise(SIGABRT); + #endif // end of USE_SYSV_SHM + } + +@@ -223,10 +226,13 @@ + # ifdef __riscos__ + if (0) + # else +- _shmhandle = CreateFileMapping ((HANDLE) 0xFFFFFFFF, NULL, +- PAGE_READWRITE, 0, +- _size, filespec); +- if (_shmhandle <= 0) ++ //_shmhandle = CreateFileMapping ((HANDLE) 0xFFFFFFFF, NULL, ++ // PAGE_READWRITE, 0, ++ // _size, filespec); ++/* QQQ */ ++std::cerr << "QQQ " << __func__ << " " << __LINE__ << std::endl; ++raise(SIGABRT); ++ //if (_shmhandle <= 0) + # endif + # endif // end of HAVE_SHMGET + #else +@@ -249,9 +255,12 @@ + # ifdef __riscos__ + // do nothing, we never get here. + # else +- _shmhandle = CreateFileMapping ((HANDLE) 0xFFFFFFFF, NULL, +- PAGE_READWRITE, 0, +- _size, filespec); ++ //_shmhandle = CreateFileMapping ((HANDLE) 0xFFFFFFFF, NULL, ++ // PAGE_READWRITE, 0, ++ // _size, filespec); ++ /* QQQ */ ++ std::cerr << "QQQ " << __func__ << " " << __LINE__ << std::endl; ++ raise(SIGABRT); + # endif + # endif + # else +@@ -327,8 +336,11 @@ + return false; + } + # else +- _addr = (char *)MapViewOfFile (_shmhandle, FILE_MAP_ALL_ACCESS, +- 0, 0, _size); ++ //_addr = (char *)MapViewOfFile (_shmhandle, FILE_MAP_ALL_ACCESS, ++ // 0, 0, _size); ++ /* QQQ */ ++ std::cerr << "QQQ " << __func__ << " " << __LINE__ << std::endl; ++ raise(SIGABRT); + # endif + #endif + #endif +@@ -380,9 +392,12 @@ + # ifdef __riscos__ + _addr = _addr; + # else +- CloseHandle(_shmhandle); +- _addr = (char *)MapViewOfFile (_shmhandle, FILE_MAP_ALL_ACCESS, +- 0, 0, _size); ++ //CloseHandle(_shmhandle); ++ //_addr = (char *)MapViewOfFile (_shmhandle, FILE_MAP_ALL_ACCESS, ++ // 0, 0, _size); ++ /* QQQ */ ++ std::cerr << "QQQ " << __func__ << " " << __LINE__ << std::endl; ++ raise(SIGABRT); + # endif + # endif // end of HAVE_SHMAT + } +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/libbase/utf8.h gnash-0.8.4-3/libbase/utf8.h +--- clean-gnash/libbase/utf8.h 2009-03-06 02:03:04.000000000 +0000 ++++ gnash-0.8.4-3/libbase/utf8.h 2009-03-07 13:22:08.000000000 +0000 +@@ -21,8 +21,13 @@ + #ifndef UTF8_H + #define UTF8_H + ++ + #include "dsodefs.h" // For DSOEXPORT + #include ++namespace std ++{ ++ typedef std::basic_string wstring; ++}; + #include // for C99 int types + + /// Utilities to convert between std::string and std::wstring. +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/libbase/utility.h gnash-0.8.4-3/libbase/utility.h +--- clean-gnash/libbase/utility.h 2009-03-06 02:03:04.000000000 +0000 ++++ gnash-0.8.4-3/libbase/utility.h 2009-03-07 13:22:08.000000000 +0000 +@@ -61,7 +61,7 @@ + // Using a possible built-in pi constant M_PI, which is not in + // the C++ standard, has no conceivable advantage, so we will use this + // one. Make it as accurate as you like. +-static const double PI = 3.14159265358979323846; ++//static const double PI = 3.14159265358979323846; + + // Commonly-used inlined mathematical functions are defined in + // namespace gnash::utility so that it's clear where they +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/libcore/edit_text_character.h gnash-0.8.4-3/libcore/edit_text_character.h +--- clean-gnash/libcore/edit_text_character.h 2009-03-06 02:03:13.000000000 +0000 ++++ gnash-0.8.4-3/libcore/edit_text_character.h 2009-03-07 13:22:14.000000000 +0000 +@@ -18,6 +18,12 @@ + #ifndef GNASH_EDIT_TEXT_CHARACTER_H + #define GNASH_EDIT_TEXT_CHARACTER_H + ++#include ++namespace std ++{ ++ typedef std::basic_string wstring; ++}; ++ + #include "character.h" // for inheritance + #include "edit_text_character_def.h" // for inlines and typedefs + #include "styles.h" // for fill_style and line_style +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/libcore/movie_root.cpp gnash-0.8.4-3/libcore/movie_root.cpp +--- clean-gnash/libcore/movie_root.cpp 2009-03-06 02:03:14.000000000 +0000 ++++ gnash-0.8.4-3/libcore/movie_root.cpp 2009-03-07 13:22:14.000000000 +0000 +@@ -921,7 +921,9 @@ + + // Get current mouse coordinates + boost::int32_t x, y, buttons; +- get_mouse_state(x, y, buttons); ++ int X,Y,B; ++ get_mouse_state(X, Y, B); ++ x=X;y=Y;buttons=B; + point world_mouse(PIXELS_TO_TWIPS(x), PIXELS_TO_TWIPS(y)); + + boost::int32_t xoffset = world_mouse.x - world_origin.x; +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/plugin/mozilla-sdk/include/npapi.h gnash-0.8.4-3/plugin/mozilla-sdk/include/npapi.h +--- clean-gnash/plugin/mozilla-sdk/include/npapi.h 2009-03-06 02:03:24.000000000 +0000 ++++ gnash-0.8.4-3/plugin/mozilla-sdk/include/npapi.h 2009-03-07 13:22:20.000000000 +0000 +@@ -23,6 +23,14 @@ + #pragma pack(1) + #endif + ++#ifdef __HAIKU__ ++ typedef int Display; ++ typedef int Visual; ++ typedef int Colormap; ++ typedef int XEvent; ++ typedef int Region; ++#endif ++ + #include "prtypes.h" + /* Copied from xp_core.h */ + /* removed #ifdef for hpux defined in /usr/include/model.h */ +@@ -85,8 +93,8 @@ + #if defined(XP_UNIX) + # include + # if defined(MOZ_X11) +-# include +-# include ++//# include ++//# include + # endif + #endif + +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/plugin/mozilla-sdk/include/obsolete/protypes.h gnash-0.8.4-3/plugin/mozilla-sdk/include/obsolete/protypes.h +--- clean-gnash/plugin/mozilla-sdk/include/obsolete/protypes.h 2009-03-06 02:03:24.000000000 +0000 ++++ gnash-0.8.4-3/plugin/mozilla-sdk/include/obsolete/protypes.h 2009-03-07 13:22:20.000000000 +0000 +@@ -114,7 +114,8 @@ + + #if !defined(XP_BEOS) && !defined(VMS) + #if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO) +-typedef PRUint32 uint32; ++//typedef PRUint32 uint32; ++typedef unsigned long uint32; + #else + typedef unsigned long uint32; + #endif +@@ -153,7 +154,19 @@ + && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \ + && !defined(HPUX) + #if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO) +-typedef PRInt32 int32; ++//typedef PRInt32 int32; ++typedef long int int32; ++#if 0 ++ #ifdef _HACK_ELO ++ //typedef long int int32; ++ typedef long int int32_t; ++ #else ++ typedef int int32; ++ typedef int int32_t; ++ #endif ++ typedef unsigned int uint32_t; ++ typedef unsigned short int uint16_t; ++#endif + #else + typedef long int32; + #endif +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/plugin/plugin.cpp gnash-0.8.4-3/plugin/plugin.cpp +--- clean-gnash/plugin/plugin.cpp 2009-03-06 02:03:24.000000000 +0000 ++++ gnash-0.8.4-3/plugin/plugin.cpp 2009-03-07 13:22:21.000000000 +0000 +@@ -1,4 +1,4 @@ +-// ++ + // Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + // + // This program is free software; you can redistribute it and/or modify +@@ -16,11 +16,20 @@ + // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + ++extern "C" const short unsigned int * __ctype_b; ++ ++const short unsigned int * __ctype_b; ++struct _IO_FILE * stdin; ++ ++ + #ifdef HAVE_CONFIG_H + #include "gnashconfig.h" + #endif + + #include // getenv ++#include ++#include ++#include + + #define MIME_TYPES_HANDLED "application/x-shockwave-flash" + // The name must be this value to get flash movies that check the +@@ -118,6 +127,7 @@ + } + + /// \brief Return the MIME Type description for this plugin. ++extern "C" char * NPP_GetMIMEDescription(void); + char* + NPP_GetMIMEDescription(void) + { +@@ -170,6 +180,7 @@ + } + #endif // HAVE_XPCOM + ++#if 0 + /* Browser Functionality Checks */ + + NPError err = NPERR_NO_ERROR; +@@ -217,6 +228,7 @@ + { + cout << "GTK2 supported in this browser" << endl; + } ++#endif + + /* + Check for environment variables. +@@ -381,6 +393,8 @@ + _streamfd(-1), + _ichan(0), + _ichanWatchId(0), ++ _bview(NULL), ++ _hostvidfd(-1), + _childpid(0), + _filefd(-1), + _name() +@@ -479,6 +493,16 @@ + { + cout << "Shutting down" << endl; + ++ _bview->CancelThread(); ++ ++ assert(_bview != NULL); ++ BWindow *bw = _bview->Window(); ++ bw->LockLooper(); ++ _bview->RemoveSelf(); ++ bw->RemoveChild(_bview); ++ delete _bview; ++ bw->UnlockLooper(); ++ + if (_childpid > 0) + { + // it seems that waiting after a SIGINT hangs firefox +@@ -500,9 +524,214 @@ + /// to setup the window. This may get called multiple times by each + /// instantiated object, so it can't do much but window specific + /// setup here. ++ ++#include ++#include ++#include ++ ++ ++//FILE *fl; ++//int myBufferSz; ++//char *myBuffer; ++ ++void EloView::Draw(BRect updateRect) ++{ ++ (void)updateRect; ++ if (fShowing) ++ { ++ //fread(myBuffer, myBufferSz, 1, fl); ++ fBitmap->SetBits(reinterpret_cast(fEloData), ++ fEloImgDataSz, 0, B_RGBA32); ++ MovePenTo(BPoint(0,0)); ++ DrawBitmap(fBitmap); //XXX potrzebne ? ++ } else { ++ MovePenTo(BPoint(0,fHeight-5)); ++ DrawString("Click to see Flash content"); ++ } ++ ++} ++ ++ ++EloView::EloView(char *name, int width, int height, int fd, nsPluginInstance *plugin) ++: BView(BRect(0,0,width-1,height-1), name, B_FOLLOW_ALL, B_WILL_DRAW), ++ fEloData(NULL), ++ fEloFd(fd), ++ fShowing(false), ++ fPlugin(plugin), ++ fWidth(width), ++ fHeight(height), ++ fExiting(0) ++{ ++ if (fEloFd == -1) printf("fd zly!\n"); ++ SetViewColor(255,126,0); ++ SetLowColor (255,126,0); ++ ++ if (pthread_mutex_init(&fMxCnd.fMx, NULL) != 0) ++ printf("pthread_mutex_init error\n"); ++ if (pthread_cond_init(&fMxCnd.fCnd, NULL) != 0) ++ printf("pthread_cond_init error\n"); ++} ++ ++ ++void ++EloView::CancelThread() ++{ ++ if (fShowing) ++ { ++ fShowing = false; ++ //if (pthread_cancel(fPt) != 0) ++ //printf("error pthread_cancel\n"); ++ //pthread_cancel not implemented ++ ++ if (pthread_mutex_lock(&fMxCnd.fMx) != 0) ++ printf("error pthread_mutex_lock\n"); ++ fExiting = 1; ++ if (pthread_cond_wait(&fMxCnd.fCnd, &fMxCnd.fMx) != 0) ++ printf("error pthread_cond_wait\n"); ++ if (pthread_mutex_unlock(&fMxCnd.fMx) != 0) ++ printf("error pthread_mutex_unlock\n"); ++ } ++} ++ ++EloView::~EloView() ++{ ++ if (fShowing) ++ { ++ delete fBitmap; ++ fBitmap=0; ++ } ++ ++ if (fEloData != NULL) ++ { ++ if (munmap(fEloData, fEloDataSz) == -1) ++ perror("munmap"); ++ if (close(fEloFd) == -1) ++ perror("close"); ++ } ++ ++ if (pthread_cond_destroy(&fMxCnd.fCnd) != 0) ++ printf("pthread_cond_destroy error\n"); ++ if (pthread_mutex_destroy(&fMxCnd.fMx) != 0) ++ printf("pthread_mutex_destroy error\n"); ++} ++ ++ ++void ++EloViewThread_cleanup(EloView::mx_cnd_t *mx_cnd) ++{ ++ if (pthread_mutex_lock(&mx_cnd->fMx) != 0) ++ printf("error pthread_mutex_lock\n"); ++ if (pthread_cond_signal(&mx_cnd->fCnd) != 0) ++ printf("error pthread_cond_signal\n"); ++ if (pthread_mutex_unlock(&mx_cnd->fMx) != 0) ++ printf("error pthread_mutex_unlock\n"); ++} ++ ++ ++void* ++EloViewThread(void *p) ++{ ++ EloView *e = reinterpret_cast(p); ++ e->ThreadFunc(); ++ return NULL; ++} ++ ++ ++void ++EloView::ThreadFunc() ++{ ++ typedef void(*sadf)(void*); ++ pthread_cleanup_push((sadf)(EloViewThread_cleanup), &fMxCnd); ++ ++ //if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0) ++ //printf("error pthread_setcancelstate\n"); ++ //if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL) != 0) ++ //printf("error pthread_setcanceltype\n"); ++ while (true) ++ { ++ //pthread_testcancel(); ++ if (fExiting != 0) ++ pthread_exit(NULL); ++ usleep(40); ++ LockLooper(); ++ Invalidate(); ++ UnlockLooper(); ++ } ++ ++ pthread_cleanup_pop(false); ++} ++ ++ ++void ++EloView::MouseDown(BPoint where) ++{ ++ (void)where; ++ if (!fShowing) { ++ fPlugin->show_flash(); ++ fBitmap = new BBitmap(BRect(0,0,fWidth-1, fHeight-1), B_RGBA32); ++ fEloImgDataSz = fWidth * fHeight * 4; ++ fEloDataSz = 300 * 0x1000; ++ SetViewColor(0,0,0); ++ fShowing = true; ++ if (fEloFd == -1) ++ printf("fd zly\n"); ++ else { ++ fEloData = (char*)mmap((caddr_t)0, fEloDataSz, ++ PROT_READ|PROT_WRITE, MAP_SHARED, fEloFd, 0); ++ if (fEloData == (char*)-1) ++ perror("error mmap"); ++ if (pthread_create(&fPt, NULL, EloViewThread, this) != 0) ++ printf("error pthread_create\n"); ++ } ++ std::cerr << "mouse down" << std::endl; ++ } ++} ++ ++ ++ ++//BView *bv; + NPError + nsPluginInstance::SetWindow(NPWindow* aWindow) + { ++ BView *bv = (reinterpret_cast(aWindow->window)); ++ BWindow *bw; ++ bw = bv->Window(); ++ bw->Bounds().PrintToStream(); ++ ++ if (_hostvidfd == -1) ++ { ++ char nm[100]; ++ nm[99]='\0'; ++ strncpy(nm, "/tmp/gnashpluginXXXXXX", 99); ++ _hostvidfd = mkstemp(nm); ++ if (_hostvidfd == -1) ++ { ++ //XXX ++ cout << "mkstemp error" << endl; ++ return NPERR_GENERIC_ERROR ; ++ } ++ } ++ ++ if (_bview != NULL) ++ { ++ _bview->CancelThread(); ++ ++ BWindow *bwin; ++ bwin = _bview->Window(); ++ bwin->LockLooper(); ++ _bview->RemoveSelf(); ++ bwin->RemoveChild(_bview); ++ delete _bview; ++ bwin->UnlockLooper(); ++ } ++ ++ _bview = new EloView("mmello", aWindow->width, aWindow->height, _hostvidfd, this); ++ std::cout << "aWindow " << aWindow->width << "x" ++ << aWindow->height << std::endl; ++ //XXX should use windowless mode ++ //bw->AddChild(melo); ++ bv->AddChild(_bview); ++ + if(!aWindow) + { + cout << __FUNCTION__ << ": ERROR: Window handle was bogus!" << endl; +@@ -588,7 +817,7 @@ + } + #endif + +- startProc(_window); ++ //startProc(_window); + + return NPERR_NO_ERROR; + } +@@ -634,7 +863,7 @@ + } + + /// \brief Return how many bytes we can read into the buffer +-int32_t ++int32 + nsPluginInstance::WriteReady(NPStream * /* stream */ ) + { + #if 0 +@@ -647,8 +876,8 @@ + /// \brief Read the data stream from Mozilla/Firefox + /// + /// For now we read the bytes and write them to a disk file. +-int32_t +-nsPluginInstance::Write(NPStream * /* stream */, int32_t /* offset */, int32_t len, ++int32 ++nsPluginInstance::Write(NPStream * /* stream */, int32 /* offset */, int32 len, + void * buffer) + { + +@@ -853,7 +1082,8 @@ + if ( ! _cookieFile.empty() ) { + cout << " dumpCookies: file " << _cookieFile << " should be unlinked!" << endl; + } +- _cookieFile.clear(); ++ //_cookieFile.clear(); ++ _cookieFile=""; + + // Linking problems... + //#ifdef HAVE_XPCOM +@@ -961,9 +1191,47 @@ + + } + ++#if 0 ++void* VidPipeThread(void* p) ++{ ++ //int fd = (int)p; ++ nsPluginInstance *plugin = reinterpret_cast(p); ++ int fd = plugin->_vid_fd; ++ ++ while (true) ++ { ++ int read_bytes=0; ++ while (read_bytes < myBufferSz) ++ { ++ int ret; ++ ret = read(fd, myBuffer + read_bytes, myBufferSz - read_bytes); ++ if (ret == -1) ++ { ++ perror("read"); ++ break; ++ } ++ if (ret == 0) ++ usleep(5000); ++ read_bytes += ret; ++ } ++ //XXX deadlk? ++ //plugin->_bview->LockLooper(); ++ //plugin->_bview->Invalidate(); ++ //plugin->_bview->UnlockLooper(); ++ } ++} ++#endif ++ + void + nsPluginInstance::startProc(Window win) + { ++ //static int QQ=0; ++ //QQ++; ++ ++ //if (QQ != 1) ++ // return; ++ ++ + string procname; + char *gnash_env = std::getenv("GNASH_PLAYER"); + #ifdef GNASH_XPI_PLUGIN +@@ -973,7 +1241,8 @@ + #endif // def GNASH_XPI_PLUGIN + if (gnash_env == NULL) { + procname = GNASHBINDIR; +- procname += "/gtk-gnash"; ++//XXX ++ procname += "/dump-gnash"; + } + else + { +@@ -1000,6 +1269,8 @@ + // 0 For reading, 1 for writing. + int p2c_pipe[2]; + int c2p_pipe[2]; ++ ++ //int c2p_vid_pipe[2]; + + int ret = pipe(p2c_pipe); + if (ret == -1) +@@ -1014,6 +1285,13 @@ + cout << "ERROR: child to parent pipe() failed: " << strerror(errno) << endl; + } + ++ //ret = pipe(c2p_vid_pipe); ++ //if (ret == -1) ++ //{ ++ //cout << "ERROR: child to parent vid pipe() failed: " << strerror(errno) << endl; ++ //} ++ ++ + + /* + Setup the command line for starting Gnash +@@ -1022,10 +1300,18 @@ + // Prepare width, height and window ID variables + const size_t buf_size = 30; + char xid[buf_size], width[buf_size], height[buf_size], hostfd[buf_size]; ++ char hostvidfd[buf_size]; ++ //char hostvidfd[buf_size]; + snprintf(xid, buf_size, "%ld", win); + snprintf(width, buf_size, "%d", _width); + snprintf(height, buf_size, "%d", _height); + snprintf(hostfd, buf_size, "%d", c2p_pipe[1]); ++ //snprintf(hostvidfd, buf_size, "%d", c2p_vid_pipe[1]); ++ if (_hostvidfd == -1) ++ { ++ std::cerr << "_hostvidfd is -1" << std::endl; ++ } ++ snprintf(hostvidfd, buf_size, "%d", _hostvidfd); + + // Prepare Actionscript variables (e.g. Flashvars). + vector paramvalues; +@@ -1054,18 +1340,19 @@ + ADD NEW ARGUMENTS + */ + +- const size_t maxargc = 18 + paramvalues.size() * 2; ++ const size_t maxargc = 22 + paramvalues.size() * 2; ++ //const size_t maxargc = 18 + paramvalues.size() * 2; + const char **argv = new const char *[maxargc]; + + size_t argc = 0; + argv[argc++] = procname.c_str(); + + // Don't force verbosity, use configuration for that +- //argv[argc++] = "-v"; ++ argv[argc++] = "-vv"; + + // X window ID (necessary for gnash to function as a plugin) +- argv[argc++] = "-x"; +- argv[argc++] = xid; ++ //argv[argc++] = "-x"; ++ //argv[argc++] = xid; + + // Height and width + argv[argc++] = "-j"; +@@ -1081,6 +1368,15 @@ + argv[argc++] = "-F"; + argv[argc++] = hostfd; + ++ argv[argc++] = "-D"; ++ //argv[argc++] = "/boot/home/PLIK"; ++ argv[argc++] = hostvidfd; ++ //argv[argc++] = hostvidfd; ++ ++ // this limits to 25 FPS XXX ++ argv[argc++] = "-d"; ++ argv[argc++] = "40"; ++ + // Base URL is the page that the SWF is embedded in. It is + // by Gnash for resolving relative URLs in the movie. If the + // embed tag "base" is specified, its value overrides the -U +@@ -1099,6 +1395,7 @@ + } + + argv[argc++] = "-"; ++ //argv[argc++] = "http://www.youtube.com/player2.swf"; + argv[argc++] = 0; + + assert(argc <= maxargc); +@@ -1129,13 +1426,21 @@ + << endl; + } + +- // we want to read from c2p pipe, so close read-fd1 ++ // we want to read from c2p pipe, so close write-fd1 + ret = close (c2p_pipe[1]); + if (ret == -1) + { + cout << "ERROR: c2p_pipe[1] close() failed: " << strerror(errno) + << endl; + } ++ ++ // we want to read from c2p_vid pipe, so close write-fd1 ++ //ret = close(c2p_vid_pipe[1]); ++ //if (ret == -1) ++ // { ++ // cout << "ERROR: c2p_vid_pipe[1] close() failed: " << strerror(errno) ++ // << endl; ++ // } + + + cout << "Forked successfully, child process PID is " +@@ -1144,7 +1449,8 @@ + + _ichan = g_io_channel_unix_new(c2p_pipe[0]); + g_io_channel_set_close_on_unref(_ichan, true); +- _ichanWatchId = g_io_add_watch(_ichan, (GIOCondition)(G_IO_IN|G_IO_HUP), (GIOFunc)handlePlayerRequestsWrapper, this); ++ _ichanWatchId = g_io_add_watch(_ichan, (GIOCondition)(G_IO_IN|G_IO_HUP), ++ (GIOFunc)handlePlayerRequestsWrapper, this); + + return; + } +@@ -1162,15 +1468,32 @@ + } + + // close standard input and direct read-fd1 to standard input +- ret = dup2 (p2c_pipe[0], fileno(stdin)); ++ //ret = dup2 (p2c_pipe[0], fileno(stdin)); ++ ret = dup2 (p2c_pipe[0], 0); ++ //XXX + + if (ret == -1) + { + cout << "ERROR: dup2() failed: " << strerror(errno) << endl; + } + ++ ++ //ret = close (c2p_vid_pipe[0]); ++ //if (ret == -1) ++ //{ ++ //cout << "ERROR: close() c2p_vid_pipe[0] failed: " << strerror(errno) << endl; ++ //} ++ ++/* ++ ret = dup2 (p2c_pipe[1], 1); ++ if (ret == -1) ++ cout << "ERROR: dup2(p2c_pipe[1], 1) failed: " << ++ strerror(errno) << endl; ++*/ ++ + // Close all of the browser's file descriptors that we just + // inherited (including p2c_pipe[0] that we just dup'd to fd 0). ++ // and p2c_pipe[1] // + // Experiments show seventy or eighty file descriptors open in + // typical cases. Rather than close all the thousands of possible file + // descriptors, we start after stderr and keep closing higher numbers +@@ -1181,7 +1504,8 @@ + for ( ; numfailed < 10; anfd++) + { + if ( anfd == c2p_pipe[1] ) continue; // don't close this +- if ( anfd == c2p_pipe[0] ) continue; // don't close this either (correct?) ++ //if ( anfd == c2p_pipe[0] ) continue; // don't close this either (correct?) ++ if ( anfd == _hostvidfd ) continue; + ret = close (anfd); + if (ret < 0) numfailed++; + else +@@ -1241,6 +1565,12 @@ + exit (-1); + } + ++void ++nsPluginInstance::show_flash() ++{ ++ startProc(_window); ++} ++ + const char* + nsPluginInstance::getCurrentPageURL() const + { +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/plugin/plugin.h gnash-0.8.4-3/plugin/plugin.h +--- clean-gnash/plugin/plugin.h 2009-03-06 02:03:24.000000000 +0000 ++++ gnash-0.8.4-3/plugin/plugin.h 2009-03-07 13:22:21.000000000 +0000 +@@ -19,10 +19,26 @@ + #ifndef __PLUGIN_H__ + #define __PLUGIN_H__ + ++#include ++#include ++ ++#include ++#include ++typedef int32 image_id; ++#include ++#include ++ ++typedef unsigned Window; ++ ++#ifndef SYSCONFDIR ++# define SYSCONFDIR "/boot/etc/" ++#endif ++ + #ifdef HAVE_CONFIG_H + #include "gnashconfig.h" + #endif + ++ + #ifndef HAVE_FUNCTION + # ifndef HAVE_func + # define dummystr(x) # x +@@ -37,10 +53,12 @@ + #define __PRETTY_FUNCTION__ __FUNCTION__ + #endif + ++ ++ + /* Xlib/Xt stuff */ +-#include ++//#include + //#include +-#include ++//#include + #ifdef HAVE_GTK2 + #include + #endif +@@ -64,6 +82,45 @@ + extern PRLock *playerMutex; + extern PRCondVar *playerCond; + ++ ++ ++//XXX probably should use DSOLOCAL ++class EloView : public BView ++{ ++ void Draw(BRect updateRect); ++ BBitmap *fBitmap; ++ char* fEloData; ++ unsigned fEloImgDataSz; ++ unsigned fEloDataSz; ++ int fEloFd; ++ bool fShowing; ++ class nsPluginInstance *fPlugin; ++ int fWidth; ++ int fHeight; ++ pthread_t fPt; ++ volatile sig_atomic_t fExiting; ++public: ++ struct mx_cnd_t ++ { ++ pthread_mutex_t fMx; ++ pthread_cond_t fCnd; ++ }; ++private: ++ mx_cnd_t fMxCnd; ++public: ++ ++ EloView(char *name, int width, int height, int fd, nsPluginInstance *plugin); ++ ~EloView(); ++ ++ virtual void MouseDown(BPoint where); ++ ++ void ThreadFunc(); ++ void CancelThread(); ++}; ++ ++ ++ ++ + class DSOLOCAL nsPluginInstance : public nsPluginInstanceBase + { + public: +@@ -82,13 +139,14 @@ + uint16_t *stype); + NPError DestroyStream(NPStream * stream, NPError reason); + +- int32_t WriteReady(NPStream *stream); +- int32_t Write(NPStream *stream, int32_t offset, int32_t len, void *buffer); ++ int32 WriteReady(NPStream *stream); ++ int32 Write(NPStream *stream, int32 offset, int32 len, void *buffer); + + NPError WriteStatus(char *msg) const; + NPError WriteStatus(std::string msg) const; + + void startProc(Window win); ++ void show_flash(); + + private: + +@@ -129,6 +187,12 @@ + int _streamfd; + GIOChannel* _ichan; + int _ichanWatchId; ++ //GIOChannel* _ichan_vid; ++ //int _ichanWatchId_vid; ++ ++ EloView* _bview; ++ int _hostvidfd; ++ + pid_t _childpid; + int _filefd; + +diff -Nur -x 'Makefile*' -x '*.m4' -x configure -x 'config.*' -x '*libltdl*' -x '*.1' -x configurelog -x configure.ac -x ltmain.sh clean-gnash/sys/shm.h gnash-0.8.4-3/sys/shm.h +--- clean-gnash/sys/shm.h 1970-01-01 00:00:00.000000000 +0000 ++++ gnash-0.8.4-3/sys/shm.h 2009-03-07 13:22:21.000000000 +0000 +@@ -0,0 +1 @@ ++#warning "dummy sys/shm.h"