1 /*****************************************************************************
2 * vlcplugin.h: a VLC plugin for Mozilla
3 *****************************************************************************
4 * Copyright (C) 2002-2009 the VideoLAN team
7 * Authors: Samuel Hocevar <sam@zoy.org>
8 * Damien Fouilleul <damienf@videolan.org>
9 * Jean-Paul Saman <jpsaman@videolan.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
26 /*******************************************************************************
27 * Instance state information about the plugin.
28 ******************************************************************************/
29 #ifndef __VLCPLUGIN_H__
30 #define __VLCPLUGIN_H__
34 #include "control/nporuntime.h"
36 #if !defined(XP_MACOSX) && !defined(XP_UNIX) && !defined(XP_WIN)
38 #elif defined(XP_MACOSX)
48 # include <Quickdraw.h>
53 # include <X11/Xlib.h>
54 # include <X11/Intrinsic.h>
55 # include <X11/StringDefs.h>
64 # define __MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
67 # define __MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
70 typedef enum vlc_toolbar_clicked_e {
80 } vlc_toolbar_clicked_t;
85 VlcPlugin( NPP, uint16 );
88 NPError init(int argc, char* const argn[], char* const argv[]);
89 libvlc_instance_t* getVLC()
90 { return libvlc_instance; };
91 libvlc_media_player_t* getMD(libvlc_exception_t *ex)
93 if( !libvlc_media_player )
95 libvlc_exception_raise(ex,"no mediaplayer");
97 return libvlc_media_player;
100 { return p_browser; };
101 char* getAbsoluteURL(const char *url);
102 NPWindow& getWindow()
103 { return npwindow; };
104 void setWindow(const NPWindow &window)
105 { npwindow = window; };
107 NPClass* getScriptClass()
108 { return p_scriptClass; };
110 void setLog(libvlc_log_t *log)
111 { libvlc_log = log; };
112 libvlc_log_t* getLog()
113 { return libvlc_log; };
115 WNDPROC getWindowProc()
116 { return pf_wndproc; };
117 void setWindowProc(WNDPROC wndproc)
118 { pf_wndproc = wndproc; };
122 int setSize(unsigned width, unsigned height);
123 Window getVideoWindow()
125 void setVideoWindow(Window window)
126 { npvideo = window; };
127 Window getControlWindow()
128 { return npcontrol; };
129 void setControlWindow(Window window)
130 { npcontrol = window; };
134 void redrawToolbar();
135 void getToolbarSize(unsigned int *width, unsigned int *height)
136 { *width = i_tb_width; *height = i_tb_height; };
137 int setToolbarSize(unsigned int width, unsigned int height)
138 { i_tb_width = width; i_tb_height = height; return 1; };
139 vlc_toolbar_clicked_t getToolbarButtonClicked( int i_xpos, int i_ypos );
142 uint16 i_npmode; /* either NP_EMBED or NP_FULL */
144 /* plugin properties */
150 bool playlist_select(int,libvlc_exception_t *);
152 int playlist_add( const char *, libvlc_exception_t * );
153 int playlist_add_extended_untrusted( const char *, const char *, int,
154 const char **, libvlc_exception_t * );
155 void playlist_play( libvlc_exception_t * );
156 void playlist_play_item( int, libvlc_exception_t * );
157 void playlist_stop( libvlc_exception_t * );
158 void playlist_next( libvlc_exception_t * );
159 void playlist_prev( libvlc_exception_t * );
160 void playlist_pause( libvlc_exception_t * );
161 void playlist_delete_item( int, libvlc_exception_t * );
163 void playlist_clear( libvlc_exception_t * );
164 int playlist_count( libvlc_exception_t * );
165 int playlist_isplaying( libvlc_exception_t * );
167 void toggle_fullscreen( libvlc_exception_t * );
168 void set_fullscreen( int, libvlc_exception_t * );
169 int get_fullscreen( libvlc_exception_t * );
171 int player_has_vout( libvlc_exception_t * );
174 void set_player_window( libvlc_exception_t * );
178 libvlc_instance_t *libvlc_instance;
179 libvlc_media_list_t *libvlc_media_list;
180 libvlc_media_player_t *libvlc_media_player;
181 libvlc_log_t *libvlc_log;
182 NPClass *p_scriptClass;
184 /* browser reference */
188 /* display settings */
194 unsigned int i_width, i_height;
195 unsigned int i_tb_width, i_tb_height;
196 Window npvideo, npcontrol;
203 XImage *p_btnFullscreen;
211 /*******************************************************************************
213 ******************************************************************************/
214 #define PLUGIN_NAME "VLC Multimedia Plug-in"
215 #define PLUGIN_DESCRIPTION \
216 "Version %s, copyright 1996-2007 The VideoLAN Team" \
217 "<br><a href=\"http://www.videolan.org/\">http://www.videolan.org/</a>"
219 #define PLUGIN_MIMETYPES \
220 /* MPEG-1 and MPEG-2 */ \
221 "audio/mpeg:mp2,mp3,mpga,mpega:MPEG audio;" \
222 "audio/x-mpeg:mp2,mp3,mpga,mpega:MPEG audio;" \
223 "video/mpeg:mpg,mpeg,mpe:MPEG video;" \
224 "video/x-mpeg:mpg,mpeg,mpe:MPEG video;" \
225 "video/mpeg-system:mpg,mpeg,mpe,vob:MPEG video;" \
226 "video/x-mpeg-system:mpg,mpeg,mpe,vob:MPEG video;" \
228 "audio/x-mpegurl:m3u:MPEG audio;" \
230 "video/mp4:mp4,mpg4:MPEG-4 video;" \
231 "audio/mp4:mp4,mpg4:MPEG-4 audio;" \
232 "audio/x-m4a:m4a:MPEG-4 audio;" \
233 "application/mpeg4-iod:mp4,mpg4:MPEG-4 video;" \
234 "application/mpeg4-muxcodetable:mp4,mpg4:MPEG-4 video;" \
236 "video/x-msvideo:avi:AVI video;" \
238 "video/quicktime:mov,qt:QuickTime video;" \
240 "application/x-ogg:ogg:Ogg stream;" \
241 "application/ogg:ogg:Ogg stream;" \
243 "application/x-vlc-plugin:vlc:VLC plug-in;" \
244 /* Windows Media */ \
245 "video/x-ms-asf-plugin:asf,asx:Windows Media Video;" \
246 "video/x-ms-asf:asf,asx:Windows Media Video;" \
247 "application/x-mplayer2::Windows Media;" \
248 "video/x-ms-wmv:wmv:Windows Media;" \
249 "video/x-ms-wvx:wvx:Windows Media Video;" \
250 "audio/x-ms-wma:wma:Windows Media Audio;" \
252 "application/x-google-vlc-plugin::Google VLC plug-in;" \
254 "audio/wav:wav:WAV audio;" \
255 "audio/x-wav:wav:WAV audio;" \
257 "audio/3gpp:3gp,3gpp:3GPP audio;" \
258 "video/3gpp:3gp,3gpp:3GPP video;" \
260 "audio/3gpp2:3g2,3gpp2:3GPP2 audio;" \
261 "video/3gpp2:3g2,3gpp2:3GPP2 video;" \
263 "video/divx:divx:DivX video;" \
265 "video/flv:flv:FLV video;" \
266 "video/x-flv:flv:FLV video;" \
268 "video/x-matroska:mkv:Matroska video;" \
269 "audio/x-matroska:mka:Matroska audio;" \
271 "application/xspf+xml:xspf:Playlist xspf;"