Gnash  0.8.11dev
aos4/plugin.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // 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_AOS4_PLUGIN_H
20 #define GNASH_AOS4_PLUGIN_H
21 
22 #include <string>
23 #include "pluginbase.h"
24 
25 #include "prinit.h"
26 #include "prlock.h"
27 #include "prcvar.h"
28 #include "prerr.h"
29 #include "prerror.h"
30 #include "prthread.h"
31 
32 #include "log.h"
33 #include "rc.h"
34 #include "Player.h"
35 #include "URL.h"
36 #include "sound_handler.h"
37 #include "Renderer.h"
38 #include "Renderer_agg.h"
39 #include "MovieClip.h"
40 #include "movie_definition.h"
41 #include "movie_root.h"
42 #include "SystemClock.h"
43 #include "VM.h"
44 
45 class nsPluginInstance : public nsPluginInstanceBase
46 {
47 public:
48  nsPluginInstance(nsPluginCreateData*);
49  virtual ~nsPluginInstance();
50 
51  // We are required to implement these three methods.
52  NPBool init(NPWindow* aWindow);
53  void shut(void);
54  NPBool isInitialized(void) { return _initialized; }
55 
56  NPError NewStream(NPMIMEType type, NPStream *stream, NPBool seekable,
57  uint16_t *stype);
58  NPError DestroyStream(NPStream *stream, NPError reason);
59  int32 Write(NPStream *stream, int32 offset, int32 len, void *buffer);
60 
61  // locals
62  typedef std::map<std::string, std::string> VariableMap;
63  const char* getVersion();
64  void threadMain(void);
65 
66  struct Window *getWindow() { return _window; }
67  int getWidth() { return _width; };
68  int getHeight() { return _height; };
69  int getRowStride() { return _rowstride; }
70  APTR getMemDC() { return _hMemDC; } //was HDC
71  struct BitMap * getBitmap() { return _bmp; }
72  unsigned char* getMemAddr() { return _memaddr; }
73  size_t getMemSize() { return _rowstride * _height; }
74  void notify_mouse_state(int x, int y, int buttons)
75  {
76  mouse_x = x;
77  mouse_y = y;
78  if (buttons >= 0) {
79  mouse_buttons = buttons;
80  }
81  }
82 
83 private:
84  NPP _instance;
85  struct Window *_window;
86  NPBool _initialized;
87  NPBool _shutdown;
88  ULONG _oldWndProc;
89 
90  NPStream* _stream;
91  std::string _url;
92  VariableMap _flashVars;
93  PRThread* _thread;
94  uint32_t _x;
95  uint32_t _y;
96  uint32_t _width;
97  uint32_t _height;
98  uint32_t _rowstride;
99  APTR _hMemDC; //was HDC
100  APTR _bmpInfo; //was BITMAPINFO
101  struct BitMap *_bmp;
102  unsigned char* _memaddr;
103 
104  //std::unique_ptr<gnash::media::sound_handler> _sound_handler;
105  gnash::Renderer* _Renderer;
106 
107  // Mouse state.
108  int mouse_x;
109  int mouse_y;
110  int mouse_buttons;
111 
112  static void FSCommand_callback(gnash::MovieClip* movie, const std::string& command, const std::string& args);
113 };
114 
115 #endif // __PLUGIN_H__
Renderer_agg.h
nsPluginInstance::getMemAddr
unsigned char * getMemAddr()
Definition: aos4/plugin.h:72
gnash::LogFile::getDefaultInstance
static LogFile & getDefaultInstance()
Definition: log.cpp:77
sound_handler.h
gnash::GnashPluginScriptObject::setHostFD
void setHostFD(int x)
Definition: pluginScriptObject.cpp:647
gnash::MovieClip::get_frame_count
size_t get_frame_count() const
Definition: MovieClip.h:166
gnash::NPStringToString
std::string NPStringToString(const NPString &str)
Construct a std::string from an NPString.
Definition: GnashNPVariant.h:87
gnash::processLog_trace
void processLog_trace(const boost::format &fmt)
Definition: log.cpp:119
SystemClock.h
LOG_ONCE
#define LOG_ONCE(x)
Definition: npapi/plugin.cpp:114
gnash::movie_root::registerFSCommandCallback
DSOEXPORT void registerFSCommandCallback(FsCallback *handler)
Definition: movie_root.h:718
movie_root.h
Player.h
gnash::movie_root::display
void display()
Definition: movie_root.cpp:998
NS_PluginGetValue
NPError NS_PluginGetValue(NPPVariable aVariable, void *aValue)
Retrieve values from the plugin for the Browser.
Definition: npapi/plugin.cpp:340
nsPluginInstance::isInitialized
NPBool isInitialized(void)
Definition: aos4/plugin.h:54
name
std::string name
Definition: LocalConnection_as.cpp:149
gnash::nsPluginInstance::WriteReady
int32_t WriteReady(NPStream *stream)
Can the stream be written to yet ?
Definition: npapi/plugin.cpp:696
nsPluginInstance::VariableMap
std::map< std::string, std::string > VariableMap
Definition: aos4/plugin.h:62
nsPluginInstance::DestroyStream
NPError DestroyStream(NPStream *stream, NPError reason)
Definition: aos4/plugin.cpp:366
gnash::GnashException
Top-level gnash exception.
Definition: GnashException.h:31
gnash::remoteCallback
bool remoteCallback(NPObject *npobj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result)
Definition: callbacks.cpp:655
gnash::NPVariantToString
std::string NPVariantToString(const NPVariant &val)
Construct a std::string from an NPVariant.
Definition: GnashNPVariant.h:97
gnash::nsPluginInstance::init
NPBool init(NPWindow *aWindow)
Initialize an instance of the plugin object.
Definition: npapi/plugin.cpp:550
gnash::nsPluginInstance::NewStream
NPError NewStream(NPMIMEType type, NPStream *stream, NPBool seekable, uint16_t *stype)
Open a new stream. THis is called every time there is swf content.
Definition: npapi/plugin.cpp:658
gnash::movie_root::getRootMovie
Movie & getRootMovie()
Access the originating root movie (not necessarily _level0)
Definition: movie_root.h:303
gnash::nsPluginInstance::nsPluginInstance
nsPluginInstance(nsPluginCreateData *)
Constructor.
Definition: npapi/plugin.cpp:430
dbglogfile
#define dbglogfile
Definition: gtkext.cpp:48
PLUGIN_NAME
#define PLUGIN_NAME
Definition: aos4/plugin.cpp:37
external.h
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
y
std::int32_t y
Definition: BitmapData_as.cpp:435
gnash::key::i
@ i
Definition: GnashKey.h:155
gnash::LogFile
Definition: log.h:64
nsPluginInstance::notify_mouse_state
void notify_mouse_state(int x, int y, int buttons)
Definition: aos4/plugin.h:74
gnash::nsPluginInstance::~nsPluginInstance
virtual ~nsPluginInstance()
Destructor.
Definition: npapi/plugin.cpp:495
gnash::movie_root::set_background_alpha
void set_background_alpha(float alpha)
Definition: movie_root.cpp:2131
gnash::GnashPluginScriptObject::marshalGetNPClass
static NPClass * marshalGetNPClass()
Definition: pluginScriptObject.cpp:280
nsPluginInstance::nsPluginInstance
nsPluginInstance(nsPluginCreateData *)
Constructor.
Definition: aos4/plugin.cpp:219
rc.h
_
#define _(String)
Definition: log.h:44
Renderer.h
NS_PluginShutdown
void NS_PluginShutdown(void)
Definition: aos4/plugin.cpp:112
nsPluginInstance::init
NPBool init(NPWindow *aWindow)
Definition: aos4/plugin.cpp:263
nsPluginInstance::NewStream
NPError NewStream(NPMIMEType type, NPStream *stream, NPBool seekable, uint16_t *stype)
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
nsPluginInstance::getVersion
const char * getVersion()
Definition: aos4/plugin.cpp:584
NPN_ReleaseObject
void NPN_ReleaseObject(NPObject *npobj)
Definition: gshell.cpp:519
NPN_MemFree
void NPN_MemFree(void *ptr)
Definition: gshell.cpp:196
NPN_GetValue
NPError NPN_GetValue(NPP instance, NPNVariable aVariable, void *aValue)
Definition: gshell.cpp:293
gnash::URL::parse_querystring
static void parse_querystring(const std::string &query_string, std::map< std::string, std::string > &target_map)
Parse a query string filling the provided map.
Definition: URL.cpp:354
gnash::Renderer
Base class for render handlers.
Definition: Renderer.h:189
nsPluginInstance::threadMain
void threadMain(void)
Definition: aos4/plugin.cpp:398
nsPluginInstance::getWidth
int getWidth()
Definition: aos4/plugin.h:67
gnash::key::n
@ n
Definition: GnashKey.h:160
NPN_UserAgent
const char * NPN_UserAgent(NPP instance)
Definition: gshell.cpp:362
NS_NewPluginInstance
nsPluginInstanceBase * NS_NewPluginInstance(nsPluginCreateData *aCreateDataStruct)
construct our plugin instance object
Definition: npapi/plugin.cpp:396
NPP_GetMIMEDescription
char * NPP_GetMIMEDescription(void)
Return the MIME Type description for this plugin.
Definition: aos4/plugin.cpp:127
nsPluginInstance::shut
void shut(void)
Definition: aos4/plugin.cpp:323
__FUNCTION__
#define __FUNCTION__
Definition: log.h:437
gnash::movie_definition::createMovie
virtual Movie * createMovie(Global_as &, DisplayObject *=nullptr)
Create a movie instance from a def.
Definition: movie_definition.h:143
nsPluginInstance::getWindow
struct Window * getWindow()
Definition: aos4/plugin.h:66
MIME_TYPES_HANDLED
#define MIME_TYPES_HANDLED
Definition: aos4/plugin.cpp:34
gnash::MovieClip
A MovieClip is a container for DisplayObjects.
Definition: MovieClip.h:84
NS_PluginShutdown
void NS_PluginShutdown()
Shutdown the plugin.
Definition: npapi/plugin.cpp:322
gnash::nsPluginInstance::SetWindow
NPError SetWindow(NPWindow *aWindow)
Set the window to be used to render in.
Definition: npapi/plugin.cpp:596
gnash::movie_definition
Client program's interface to the definition of a movie or sprite.
Definition: movie_definition.h:96
nsPluginInstance::Write
int32 Write(NPStream *stream, int32 offset, int32 len, void *buffer)
Definition: aos4/plugin.cpp:381
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::GnashPluginScriptObject::AddMethod
bool AddMethod(NPIdentifier name, NPInvokeFunctionPtr func)
Definition: pluginScriptObject.cpp:543
NS_PluginGetValue
NPError NS_PluginGetValue(NPPVariable aVariable, void *aValue)
Retrieve values from the plugin for the Browser.
Definition: npapi/plugin.cpp:340
NPN_Invoke
bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result)
Definition: gshell.cpp:253
callbacks.h
gnash::nsPluginInstance::Write
int32_t Write(NPStream *stream, int32_t offset, int32_t len, void *buffer)
Read the data stream from Mozilla/Firefox.
Definition: npapi/plugin.cpp:709
GnashSleep.h
gnash::amf::write
void write(SimpleBuffer &buf, const std::string &str)
Write a string to an AMF buffer.
Definition: AMF.cpp:161
nsPluginInstance::getBitmap
struct BitMap * getBitmap()
Definition: aos4/plugin.h:71
gnash::movie_root::advance
bool advance()
Definition: movie_root.cpp:848
gnash::wait_for_gdb
void wait_for_gdb()
Definition: npapi/plugin.cpp:1321
gnash::close_fds
void close_fds(const int(&except)[N])
Definition: npapi/plugin.cpp:1299
gnash::InvalidatedRanges
geometry::SnappingRanges2d< std::int32_t > InvalidatedRanges
Standard snapping 2d ranges type for invalidated bounds calculation
Definition: snappingrange.h:655
StringPredicates.h
gnash::invoke
DSOEXPORT as_value invoke(const as_value &method, const as_environment &env, as_object *this_ptr, fn_call::Args &args, as_object *super=nullptr, const movie_definition *callerDef=nullptr)
Call an as_value on an as_object.
Definition: Global_as.h:166
gnash::geometry::SnappingRanges2d::setSnapFactor
void setSnapFactor(const float factor)
Definition: snappingrange.h:125
gnash::key::type
type
Definition: GnashKey.h:330
NPN_GetStringIdentifier
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
Definition: gshell.cpp:222
nsPluginInstance::getRowStride
int getRowStride()
Definition: aos4/plugin.h:69
pluginScriptObject.h
NPNFuncs
NPNetscapeFuncs NPNFuncs
length
@ length
Definition: klash_part.cpp:329
MIME_TYPES_DESCRIPTION
#define MIME_TYPES_DESCRIPTION
Definition: npapi/plugin.cpp:52
gnash::create_standalone_launcher
void create_standalone_launcher(const std::string &page_url, const std::string &swf_url, const std::map< std::string, std::string > &params)
Definition: npapi/plugin.cpp:1001
gnash::nsPluginInstance
Definition: npapi/plugin.h:64
gnash::StringNoCaseEqual
A case-insensitive string equality operator.
Definition: StringPredicates.h:42
DBG
#define DBG(x,...)
Definition: aos4/plugin.cpp:85
URL.h
MovieClip.h
GnashNPVariant.h
gnash::MovieClip::get_current_frame
size_t get_current_frame() const
Return 0-based index to current frame.
Definition: MovieClip.h:161
nsPluginInstance
Definition: aos4/plugin.h:46
GnashSystemIOHeaders.h
gnash::processLog_debug
void processLog_debug(const boost::format &fmt)
Definition: log.cpp:130
gnash::plugInitialized
NPBool plugInitialized
Definition: npapi/plugin.cpp:126
NPN_GetProperty
bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, NPVariant *result)
Definition: gshell.cpp:274
NS_PluginInitialize
NPError NS_PluginInitialize(void)
Definition: aos4/plugin.cpp:101
getfdsink
boost::iostreams::file_descriptor_sink getfdsink(char mkstemplate[])
Definition: npapi/plugin.cpp:161
gnash::getGnashExecutable
std::string getGnashExecutable()
Definition: npapi/plugin.cpp:966
gnash::Movie
A top-level, standalone Movie that can be loaded and played.
Definition: Movie.h:47
VM.h
__PRETTY_FUNCTION__
#define __PRETTY_FUNCTION__
Definition: log.h:444
gnash::plugin::ExternalInterface::convertNPVariant
static std::string convertNPVariant(const NPVariant *npv)
Definition: external.cpp:369
plugin.h
nsPluginInstance::getMemSize
size_t getMemSize()
Definition: aos4/plugin.h:73
nsPluginInstance::~nsPluginInstance
virtual ~nsPluginInstance()
Destructor.
Definition: aos4/plugin.cpp:243
gnash::HasScripting
bool HasScripting()
Definition: npapi/plugin.cpp:419
NPP_GetMIMEDescription
char * NPP_GetMIMEDescription(void)
Return the MIME Type description for this plugin.
Definition: npapi/plugin.cpp:135
log.h
gnash::nsPluginInstance::getScriptObject
GnashPluginScriptObject * getScriptObject()
Definition: npapi/plugin.h:89
gnash::gnashSleep
void gnashSleep(time_t useconds)
Sleep compatibly for the specified number of microseconds.
Definition: GnashSleep.h:35
nsPluginInstance::getMemDC
APTR getMemDC()
Definition: aos4/plugin.h:70
gnash::MovieClip::PLAYSTATE_PLAY
@ PLAYSTATE_PLAY
Definition: MovieClip.h:99
gnash::nsPluginInstance::GetValue
NPError GetValue(NPPVariable variable, void *value)
Definition: npapi/plugin.cpp:630
gnash::plugin::ExternalInterface::parseInvoke
static std::shared_ptr< invoke_t > parseInvoke(GnashPluginScriptObject *scriptobj, const std::string &xml)
Definition: external.cpp:203
__DBG
void __DBG(const char *fmt,...)
Definition: aos4/plugin.cpp:87
url
std::string url
Definition: gnash.cpp:59
gnash::remove_handler
gboolean remove_handler(GIOChannel *, GIOCondition, gpointer)
Definition: npapi/plugin.cpp:783
gnash::key::f
@ f
Definition: GnashKey.h:152
NPN_GetURL
NPError NPN_GetURL(NPP instance, const char *url, const char *target)
Definition: gshell.cpp:329
PLUGIN_DESCRIPTION
#define PLUGIN_DESCRIPTION
Definition: aos4/plugin.cpp:56
gnashconfig.h
gnash::RcInitFile::getDefaultInstance
static RcInitFile & getDefaultInstance()
Return the default instance of RC file.
Definition: rc.cpp:61
gnash::GnashPluginScriptObject::setControlFD
void setControlFD(int x)
Definition: pluginScriptObject.cpp:632
gnash::movie_root
This class represents the 'Stage' and top-level movie.
Definition: movie_root.h:151
nsPluginInstance::getHeight
int getHeight()
Definition: aos4/plugin.h:68
gnash::cleanup_childpid
gboolean cleanup_childpid(gpointer data)
Definition: npapi/plugin.cpp:473
gnash::processLog_error
void processLog_error(const boost::format &fmt)
Definition: log.cpp:176
PLUGIN_NAME
#define PLUGIN_NAME
Definition: npapi/plugin.cpp:51
gnash::movie_definition::get_width_pixels
virtual size_t get_width_pixels() const =0
Frame width in pixels.
gnash::nsPluginInstance::shut
void shut()
Shutdown an instantiated object.
Definition: npapi/plugin.cpp:575
PLUGIN_DESCRIPTION
#define PLUGIN_DESCRIPTION
Definition: npapi/plugin.cpp:61
NS_PluginInitialize
NPError NS_PluginInitialize()
Initialize the plugin.
Definition: npapi/plugin.cpp:200
NS_DestroyPluginInstance
void NS_DestroyPluginInstance(nsPluginInstanceBase *aPlugin)
destroy our plugin instance object
Definition: npapi/plugin.cpp:412
gnash::GnashPluginScriptObject::writePlayer
int writePlayer(const std::string &data)
Definition: pluginScriptObject.cpp:664
movie_definition.h
gnash::movie_definition::completeLoad
virtual bool completeLoad()
Definition: movie_definition.h:421
gnash::cookiefile
std::string cookiefile
Definition: npapi/plugin.cpp:127
gnash::SystemClock
A system-clock based virtual clock.
Definition: SystemClock.h:37
gnash::movie_root::add_invalidated_bounds
DSOEXPORT void add_invalidated_bounds(InvalidatedRanges &ranges, bool force)
Definition: movie_root.cpp:1358
gnash::URL
Uniform Resource Locator.
Definition: URL.h:35
gnash::RcInitFile::setDebugLog
void setDebugLog(const std::string &x)
Definition: rc.h:115
gnash::movie_definition::get_frame_rate
virtual float get_frame_rate() const =0
gnash::GnashPluginScriptObject
Definition: pluginScriptObject.h:58
NPN_RetainObject
NPObject * NPN_RetainObject(NPObject *obj)
Definition: gshell.cpp:513
gnash::key::N
@ N
Definition: GnashKey.h:126
x
std::int32_t x
Definition: BitmapData_as.cpp:434
gnash::nsPluginInstance::DestroyStream
NPError DestroyStream(NPStream *stream, NPError reason)
Destroy the stream.
Definition: npapi/plugin.cpp:681
test.v
v
Definition: test.py:11
NPPFuncs
NPPluginFuncs NPPFuncs
data
SimpleBuffer data
Definition: LocalConnection_as.cpp:151
gnash::movie_definition::get_height_pixels
virtual size_t get_height_pixels() const =0
Frame height in pixels.
NS_NewPluginInstance
nsPluginInstanceBase * NS_NewPluginInstance(nsPluginCreateData *aCreateDataStruct)
Definition: aos4/plugin.cpp:184
NS_DestroyPluginInstance
void NS_DestroyPluginInstance(nsPluginInstanceBase *aPlugin)
Definition: aos4/plugin.cpp:202
gnash::RcInitFile
Definition: rc.h:44
NPN_PostURL
NPError NP_LOADDS NPN_PostURL(NPP instance, const char *url, const char *target, uint32_t len, const char *buf, NPBool file)
Definition: gshell.cpp:335
NPN_CreateObject
NPObject * NPN_CreateObject(NPP npp, NPClass *aClass)
Definition: gshell.cpp:488
NPN_ReleaseVariantValue
void NPN_ReleaseVariantValue(NPVariant *variant)
Definition: gshell.cpp:464