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__
virtual ~nsPluginInstance()
Destructor.
Definition: aos4/plugin.cpp:243
A MovieClip is a container for DisplayObjects.
Definition: MovieClip.h:83
APTR getMemDC()
Definition: aos4/plugin.h:70
int getHeight()
Definition: aos4/plugin.h:68
size_t getMemSize()
Definition: aos4/plugin.h:73
type
Definition: GnashKey.h:329
Base class for render handlers.
Definition: Renderer.h:188
unsigned char * getMemAddr()
Definition: aos4/plugin.h:72
nsPluginInstance(nsPluginCreateData *)
Constructor.
Definition: aos4/plugin.cpp:219
NPError NewStream(NPMIMEType type, NPStream *stream, NPBool seekable, uint16_t *stype)
NPBool isInitialized(void)
Definition: aos4/plugin.h:54
Definition: aos4/plugin.h:45
NPError DestroyStream(NPStream *stream, NPError reason)
Definition: aos4/plugin.cpp:366
std::int32_t x
Definition: BitmapData_as.cpp:434
std::map< std::string, std::string > VariableMap
Definition: aos4/plugin.h:62
struct Window * getWindow()
Definition: aos4/plugin.h:66
std::int32_t y
Definition: BitmapData_as.cpp:435
int32 Write(NPStream *stream, int32 offset, int32 len, void *buffer)
Definition: aos4/plugin.cpp:381
void notify_mouse_state(int x, int y, int buttons)
Definition: aos4/plugin.h:74
NPBool init(NPWindow *aWindow)
Definition: aos4/plugin.cpp:263
int getWidth()
Definition: aos4/plugin.h:67
const char * getVersion()
Definition: aos4/plugin.cpp:584
void shut(void)
Definition: aos4/plugin.cpp:323
void threadMain(void)
Definition: aos4/plugin.cpp:398
int getRowStride()
Definition: aos4/plugin.h:69
struct BitMap * getBitmap()
Definition: aos4/plugin.h:71