~ubuntu-branches/ubuntu/quantal/gecko-mediaplayer/quantal

« back to all changes in this revision

Viewing changes to .pc/dont_use_libxul.patch/src/plugin.h

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2011-05-27 15:19:19 UTC
  • Revision ID: james.westby@ubuntu.com-20110527151919-rkrubbf0f2od2js0
Tags: 1.0.0-0ubuntu3
* Don't use any Mozilla interfaces at all. The only interfaces used
  previously were nsIPrefBranch and nsIPrefService to change a preference
  which configured the UA string to "QuickTime/7.6.4". This functionality
  is Firefox specific anyway, and so doesn't work in any Webkit based browser
  (Chromium, Epiphany, Midori etc). It also doesn't work in Firefox 4
  and later since the plugin is running in a separate process, where setting
  prefs in the plugin process has no effect on the browser process at all
  - add debian/patches/dont_use_libxul.patch
  - add debian/patches/autotools.patch
  - update debian/patches/series
  - update debian/control to build-depend on firefox-dev
  - see https://blueprints.launchpad.net/ubuntu/+spec/
          desktop-o-mozilla-rapid-release-maintenance and
    https://lists.ubuntu.com/archives/ubuntu-devel/2011-May/033229.html

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 
2
/* ***** BEGIN LICENSE BLOCK *****
 
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
4
 *
 
5
 * The contents of this file are subject to the Mozilla Public License Version
 
6
 * 1.1 (the "License"); you may not use this file except in compliance with
 
7
 * the License. You may obtain a copy of the License at
 
8
 * http://www.mozilla.org/MPL/
 
9
 *
 
10
 * Software distributed under the License is distributed on an "AS IS" basis,
 
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
12
 * for the specific language governing rights and limitations under the
 
13
 * License.
 
14
 *
 
15
 * The Original Code is mozilla.org code.
 
16
 *
 
17
 * The Initial Developer of the Original Code is
 
18
 * Netscape Communications Corporation.
 
19
 * Portions created by the Initial Developer are Copyright (C) 1998
 
20
 * the Initial Developer. All Rights Reserved.
 
21
 *
 
22
 * Contributor(s):
 
23
 *
 
24
 * Alternatively, the contents of this file may be used under the terms of
 
25
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 
26
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
27
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
28
 * of those above. If you wish to allow use of your version of this file only
 
29
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
30
 * use your version of this file under the terms of the MPL, indicate your
 
31
 * decision by deleting the provisions above and replace them with the notice
 
32
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
33
 * the provisions above, a recipient may use your version of this file under
 
34
 * the terms of any one of the MPL, the GPL or the LGPL.
 
35
 *
 
36
 * ***** END LICENSE BLOCK ***** */
 
37
 
 
38
#ifndef __PLUGIN_H__
 
39
#define __PLUGIN_H__
 
40
#include <npapi.h>
 
41
#include <npruntime.h>
 
42
#include <npfunctions.h>
 
43
#include <X11/Xlib.h>
 
44
#include <dbus/dbus.h>
 
45
#include <dbus/dbus-glib-lowlevel.h>
 
46
#ifdef HAVE_CONFIG_H
 
47
#  include <config.h>
 
48
#endif
 
49
#ifdef HAVE_GCONF
 
50
#include <gconf/gconf.h>
 
51
#include <gconf/gconf-client.h>
 
52
#include <gconf/gconf-value.h>
 
53
#endif
 
54
 
 
55
#include <glib.h>
 
56
#include <glib/gstdio.h>
 
57
#include <glib/gi18n.h>
 
58
#include "plugin_list.h"
 
59
#ifdef ENABLE_NLS
 
60
#include <libintl.h>
 
61
#endif
 
62
 
 
63
#include "libgmlib/gmlib.h"
 
64
 
 
65
// JavaScript Playstates
 
66
#define STATE_UNDEFINED     0
 
67
#define STATE_STOPPED       1
 
68
#define STATE_PAUSED        2
 
69
#define STATE_PLAYING       3
 
70
#define STATE_SCANFORWARD   4
 
71
#define STATE_SCANREVERSE   5
 
72
#define STATE_BUFFERING     6
 
73
#define STATE_WAITING       7
 
74
#define STATE_MEDIAENDED    8
 
75
#define STATE_TRANSITIONING 9
 
76
#define STATE_READY         10
 
77
#define STATE_RECONNECTING  11
 
78
 
 
79
// config settings stored in gconf
 
80
#define CACHE_SIZE              "cache_size"
 
81
#define DISABLE_QT              "disable_qt"
 
82
#define DISABLE_REAL    "disable_real"
 
83
#define DISABLE_WMP             "disable_wmp"
 
84
#define DISABLE_DVX             "disable_dvx"
 
85
#define DEBUG_LEVEL             "debug_level"
 
86
#define DISABLE_MIDI    "disable_midi"
 
87
#define PLAYER_BACKEND  "player_backend"
 
88
 
 
89
typedef enum {
 
90
    PLAYING,
 
91
    PAUSED,
 
92
    STOPPED,
 
93
    QUIT
 
94
} PLAYSTATE;
 
95
 
 
96
void postDOMEvent(NPP mInstance, const gchar * id, const gchar * event);
 
97
 
 
98
class CPlugin {
 
99
  private:
 
100
    NPWindow * m_Window;
 
101
    NPStream *m_pNPStream;
 
102
    NPBool mInitialized;
 
103
    NPObject *m_pScriptableObject;
 
104
    NPObject *m_pScriptableObjectControls;
 
105
 
 
106
  public:
 
107
     CPlugin(NPP pNPInstance);
 
108
    ~CPlugin();
 
109
 
 
110
    NPBool init(NPWindow * aWindow);
 
111
    void shut();
 
112
    NPBool isInitialized();
 
113
    int16_t handleEvent(void *event);
 
114
 
 
115
    NPObject *GetScriptableObject();
 
116
    NPObject *GetScriptableObjectControls();
 
117
 
 
118
    NPError GetValue(NPPVariable variable, void *value);
 
119
    NPError SetWindow(NPWindow * aWindow);
 
120
    NPError NewStream(NPMIMEType type, NPStream * stream, NPBool seekable, uint16_t * stype);
 
121
    NPError DestroyStream(NPStream * stream, NPError reason);
 
122
    void URLNotify(const char *url, NPReason reason, void *notifyData);
 
123
    int32_t WriteReady(NPStream * stream);
 
124
    int32_t Write(NPStream * stream, int32_t offset, int32_t len, void *buffer);
 
125
 
 
126
 
 
127
 
 
128
    void Play();
 
129
    void Pause();
 
130
    void PlayPause();
 
131
    void Stop();
 
132
    void FastForward();
 
133
    void FastReverse();
 
134
    void Seek(double counter);
 
135
    void SetShowControls(bool value);
 
136
    void SetFullScreen(bool value);
 
137
    void SetVolume(double value);
 
138
    void GetVolume(double *_retval);
 
139
    void GetFullScreen(bool * _retval);
 
140
    void GetShowControls(bool * _retval);
 
141
    void GetTime(double *_retval);
 
142
    void GetDuration(double *_retval);
 
143
    void GetPercent(double *_retval);
 
144
    void GetPlayState(int32_t * playstate);
 
145
    void SetFilename(const char *filename);
 
146
    void GetFilename(char **filename);
 
147
    void GetMIMEType(char **_retval);
 
148
    void GetLoop(bool * _retval);
 
149
    void SetLoop(bool value);
 
150
    void SetOnClick(const char *event);
 
151
    void SetOnMediaComplete(const char *event);
 
152
    void SetOnMouseUp(const char *event);
 
153
    void SetOnMouseDown(const char *event);
 
154
    void SetOnMouseOut(const char *event);
 
155
    void SetOnMouseOver(const char *event);
 
156
    void SetOnDestroy(const char *event);
 
157
 
 
158
  private:
 
159
 
 
160
     gint mX, mY;
 
161
    gint mWidth, mHeight;
 
162
 
 
163
  public:
 
164
     Window mWindow;
 
165
    NPP mInstance;
 
166
    gchar *page_url;
 
167
    gboolean windowless;
 
168
    gint nextid;
 
169
    uint16_t mode;
 
170
    gchar *mimetype;
 
171
    GList *playlist;
 
172
    gboolean acceptdata;
 
173
    gchar *path;
 
174
    gboolean player_launched;
 
175
    gboolean playerready;
 
176
    DBusConnection *connection;
 
177
    GThread *dbus_dispatch;
 
178
    ListItem *lastopened;
 
179
    gint cache_size;
 
180
    gboolean hidden;
 
181
    gint controlid;
 
182
    gint state;
 
183
    gint autostart;
 
184
    time_t lastupdate;
 
185
    gboolean disable_context_menu;
 
186
    gboolean disable_fullscreen;
 
187
    gboolean debug;
 
188
    gint show_controls;
 
189
    gchar *name;
 
190
    gchar *id;
 
191
    gchar *console;
 
192
    gchar *controls;
 
193
    gchar *user_agent;
 
194
    gchar *player_backend;
 
195
 
 
196
    // events
 
197
    gboolean post_dom_events;
 
198
    gchar *event_mediacomplete;
 
199
    gchar *event_destroy;
 
200
    gchar *event_mousedown;
 
201
    gchar *event_mouseup;
 
202
    gchar *event_mouseclicked;
 
203
    gchar *event_enterwindow;
 
204
    gchar *event_leavewindow;
 
205
 
 
206
    // options
 
207
    gint debug_level;
 
208
 
 
209
    // tv options
 
210
    gchar *tv_device;
 
211
    gchar *tv_driver;
 
212
    gchar *tv_input;
 
213
    gint tv_width;
 
214
    gint tv_height;
 
215
 
 
216
 
 
217
};
 
218
 
 
219
void pluginSpecific(CPlugin * instance);
 
220
void setPreference(CPlugin * instance, const gchar * name, const gchar * value);
 
221
 
 
222
#endif                          // __PLUGIN_H__