~ubuntu-branches/ubuntu/vivid/mplayerplug-in/vivid

« back to all changes in this revision

Viewing changes to Source/plugin.h

  • Committer: Bazaar Package Importer
  • Author(s): Rene Engelhard
  • Date: 2004-07-18 22:26:29 UTC
  • Revision ID: james.westby@ubuntu.com-20040718222629-ecntwplhhqpw1s0i
Tags: upstream-2.66
ImportĀ upstreamĀ versionĀ 2.66

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: NPL 1.1/GPL 2.0/LGPL 2.1
 
4
 *
 
5
 * The contents of this file are subject to the Netscape Public License
 
6
 * Version 1.1 (the "License"); you may not use this file except in
 
7
 * compliance with the License. You may obtain a copy of the License at
 
8
 * http://www.mozilla.org/NPL/
 
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 NPL, 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 NPL, the GPL or the LGPL.
 
35
 *
 
36
 * ***** END LICENSE BLOCK ***** */
 
37
 
 
38
#ifndef __PLUGIN_H__
 
39
#define __PLUGIN_H__
 
40
#define _XOPEN_SOURCE 500
 
41
 
 
42
#ifndef _GNU_SOURCE
 
43
#define _GNU_SOURCE
 
44
#endif
 
45
#ifdef GECKOSDK_ENABLED
 
46
#include "mozilla-config.h"
 
47
#endif
 
48
#include "pluginbase.h"
 
49
#include "nsScriptablePeer.h"
 
50
#include "plugin-setup.h"
 
51
#include <pthread.h>
 
52
#include <sys/types.h>
 
53
#include <signal.h>
 
54
 
 
55
class nsPluginInstance:public nsPluginInstanceBase {
 
56
  public:
 
57
    nsPluginInstance(NPP aInstance);
 
58
    virtual ~ nsPluginInstance();
 
59
 
 
60
    NPBool init(NPWindow * aWindow);
 
61
    void shut();
 
62
    NPBool isInitialized();
 
63
    NPError NewStream(NPMIMEType type, NPStream * stream, NPBool seekable,
 
64
                      uint16 * stype);
 
65
    NPError SetWindow(NPWindow * aWindow);
 
66
    NPError DestroyStream(NPStream * stream, NPError reason);
 
67
    int32 WriteReady(NPStream * stream);
 
68
    int32 Write(NPStream * stream, int32 offset, int32 len, void *buffer);
 
69
 
 
70
    // JS Methods
 
71
    void Play();
 
72
    void Pause();
 
73
    void Stop();
 
74
    void Quit();
 
75
    void FastForward();
 
76
    void FastReverse();
 
77
    void Seek(double counter);
 
78
    void GetPlayState(PRInt32 * playstate);
 
79
    void GetTime(double *_retval);
 
80
    void GetDuration(double *_retval);
 
81
    void GetPercent(double *_retval);
 
82
    void GetFilename(char * *filename);
 
83
    void SetFilename(const char *filename);
 
84
    void GetShowControls(PRBool *_retval);
 
85
    void SetShowControls(PRBool value);
 
86
    void GetFullscreen(PRBool *_retval);
 
87
    void SetFullscreen(PRBool value);
 
88
    void GetShowlogo(PRBool *_retval);
 
89
    void SetShowlogo(PRBool value);
 
90
    
 
91
    // we need to provide implementation of this method as it will be
 
92
    // used by Mozilla to retrive the scriptable peer
 
93
    // and couple of other things on Unix
 
94
    NPError GetValue(NPPVariable variable, void *value);
 
95
 
 
96
    nsScriptablePeer *getScriptablePeer();
 
97
    nsControlsScriptablePeer *getControlsScriptablePeer();
 
98
    
 
99
  public:
 
100
     NPP mInstance;
 
101
    NPBool mInitialized;
 
102
    nsScriptablePeer *mScriptablePeer;
 
103
    nsControlsScriptablePeer *mControlsScriptablePeer;
 
104
    
 
105
    // put member data here
 
106
    char *mimetype;
 
107
    int state;
 
108
    char *url;
 
109
    char *fname;
 
110
    char *href;
 
111
    char *lastmessage;
 
112
    uint16 mode;
 
113
    uint32 window_width;
 
114
    uint32 window_height;
 
115
    uint32 embed_width;
 
116
    uint32 embed_height;
 
117
    uint32 movie_width;
 
118
    uint32 movie_height;
 
119
    int setwindow;
 
120
    char *baseurl;
 
121
    char *hostname;
 
122
    int control;
 
123
    FILE *player;
 
124
    pid_t pid;
 
125
    int noredraw;
 
126
    int hrefrequested;
 
127
    int threadsetup;
 
128
    int threadlaunched;
 
129
    int threadsignaled;
 
130
    int cancelled;
 
131
    int autostart;
 
132
    int controlwindow;
 
133
    int showcontrols;
 
134
    int mmsstream;
 
135
    Node *list;
 
136
    Node *currentnode;
 
137
    ThreadData *td;
 
138
    Window window;
 
139
    Window player_window;
 
140
    Display *display;
 
141
    Widget widget;
 
142
    uint32 nQtNext;
 
143
    char *qtNext[256];
 
144
    int panel_height;
 
145
    int panel_drawn;
 
146
    float percent;
 
147
    char *mediaCompleteCallback;
 
148
    float mediaLength;                  // length of media in seconds
 
149
    int mediaPercent;                   // percentage of media played
 
150
    float mediaTime;                    // time in seconds
 
151
    int nomediacache;
 
152
    int controlsvisible;
 
153
    int fullscreen;
 
154
    int showlogo;
 
155
    int DPMSEnabled;
 
156
    
 
157
#ifdef GTK_ENABLED
 
158
    GtkWidget *gtkwidget;
 
159
    GtkWidget *image;
 
160
    GtkWidget *fixed_container;
 
161
    GtkProgressBar *progress_bar;
 
162
    GtkProgressBar *mediaprogress_bar;
 
163
    GtkLabel *status;
 
164
    GtkWidget *drawing_area;
 
165
 
 
166
    GtkWidget *play_event_box;
 
167
    GtkWidget *pause_event_box;
 
168
    GtkWidget *stop_event_box;
 
169
    GtkWidget *ff_event_box;
 
170
    GtkWidget *rew_event_box;
 
171
    GtkWidget *fs_event_box;
 
172
 
 
173
    GtkWidget *image_play;
 
174
    GtkWidget *image_pause;
 
175
    GtkWidget *image_stop;
 
176
    GtkWidget *image_ff;
 
177
    GtkWidget *image_rew;
 
178
    GtkWidget *image_fs;
 
179
    
 
180
    GtkMenu *popup_menu;
 
181
    GtkMenuItem *menuitem_play;
 
182
    GtkMenuItem *menuitem_pause;
 
183
    GtkMenuItem *menuitem_stop;
 
184
    GtkMenuItem *menuitem_sep1;
 
185
    GtkMenuItem *menuitem_sep2;
 
186
    GtkMenuItem *menuitem_showcontrols;
 
187
    GtkMenuItem *menuitem_fullscreen;
 
188
    GtkMenuItem *menuitem_save;
 
189
    
 
190
#endif
 
191
 
 
192
    pthread_t player_thread;
 
193
    pthread_attr_t thread_attr;
 
194
    pthread_cond_t playlist_complete_cond;
 
195
    pthread_mutex_t playlist_mutex;
 
196
    pthread_mutex_t playlist_cond_mutex;
 
197
    pthread_mutex_t control_mutex;
 
198
 
 
199
#ifdef GTK2_ENABLED
 
200
    // Pixbufs - GTK1 does not use Pixbufs
 
201
    GdkPixbuf *logo;
 
202
 
 
203
 
 
204
    GdkPixbuf *pb_sm_play_up;
 
205
    GdkPixbuf *pb_sm_play_down;
 
206
    GdkPixbuf *pb_sm_pause_up;
 
207
    GdkPixbuf *pb_sm_pause_down;
 
208
    GdkPixbuf *pb_sm_stop_up;
 
209
    GdkPixbuf *pb_sm_stop_down;
 
210
    GdkPixbuf *pb_sm_ff_up;
 
211
    GdkPixbuf *pb_sm_ff_down;
 
212
    GdkPixbuf *pb_sm_rew_up;
 
213
    GdkPixbuf *pb_sm_rew_down;
 
214
    GdkPixbuf *pb_sm_fs_up;
 
215
    GdkPixbuf *pb_sm_fs_down;
 
216
 
 
217
#endif
 
218
 
 
219
#ifdef GTK1_ENABLED
 
220
    GdkPixmap *logo;
 
221
 
 
222
    GdkPixmap *pb_sm_play_up;
 
223
    GdkPixmap *pb_sm_play_down;
 
224
    GdkPixmap *pb_sm_pause_up;
 
225
    GdkPixmap *pb_sm_pause_down;
 
226
    GdkPixmap *pb_sm_stop_up;
 
227
    GdkPixmap *pb_sm_stop_down;
 
228
    GdkPixmap *pb_sm_ff_up;
 
229
    GdkPixmap *pb_sm_ff_down;
 
230
    GdkPixmap *pb_sm_rew_up;
 
231
    GdkPixmap *pb_sm_rew_down;
 
232
    GdkPixmap *pb_sm_fs_up;
 
233
    GdkPixmap *pb_sm_fs_down;
 
234
 
 
235
    GtkRcStyle *style;
 
236
    GdkColor color;
 
237
#endif
 
238
 
 
239
#ifdef X_ENABLED
 
240
    XFontStruct *font;
 
241
    Pixmap logo;
 
242
    Pixmap logomask;
 
243
    Pixmap progress_left;
 
244
    Pixmap progress_leftmask;
 
245
    Pixmap progress_middle;
 
246
    Pixmap progress_middlemask;
 
247
    Pixmap progress_right;
 
248
    Pixmap progress_rightmask;
 
249
    Pixmap progress_fill;
 
250
    Pixmap progress_fillmask;
 
251
    int lastpercent;
 
252
#endif
 
253
 
 
254
    // options
 
255
    char *vo;
 
256
    char *vop;
 
257
    int novop;
 
258
    int noembed;
 
259
    char *ao;
 
260
    int loop;
 
261
    int rtsp_use_tcp;
 
262
    int keep_download;
 
263
    int maintain_aspect;
 
264
    int qt_speed;
 
265
    char *download_dir;
 
266
    int cachesize;
 
267
    char *output_display;
 
268
    int osdlevel;
 
269
    int cache_percent;
 
270
    int toolkitok;
 
271
    int moz_toolkit;
 
272
    int plug_toolkit;
 
273
    
 
274
    // JavaScript State
 
275
    int paused;
 
276
    int js_state;
 
277
};
 
278
 
 
279
#endif                          // __PLUGIN_H__