- Only allow letters, digits and slash in access/demux specification
[vlc.git] / mozilla / vlcplugin.h
1 /*****************************************************************************
2  * vlcplugin.h: a VLC plugin for Mozilla
3  *****************************************************************************
4  * Copyright (C) 2002-2006 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Samuel Hocevar <sam@zoy.org>
8             Damien Fouilleul <damienf@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 /*******************************************************************************
26  * Instance state information about the plugin.
27  ******************************************************************************/
28 #ifndef __VLCPLUGIN_H__
29 #define __VLCPLUGIN_H__
30
31 #include <vlc/libvlc.h>
32 #include <npapi.h>
33 #include "control/nporuntime.h"
34
35 #if !defined(XP_MACOSX) && !defined(XP_UNIX) && !defined(XP_WIN)
36 #define XP_UNIX 1
37 #elif defined(XP_MACOSX)
38 #undef XP_UNIX
39 #endif
40
41 #ifdef XP_WIN
42     /* Windows stuff */
43 #endif
44
45 #ifdef XP_MACOSX
46     /* Mac OS X stuff */
47 #   include <Quickdraw.h>
48 #endif
49
50 #ifdef XP_UNIX
51     /* X11 stuff */
52 #   include <X11/Xlib.h>
53 #   include <X11/Intrinsic.h>
54 #   include <X11/StringDefs.h>
55 #endif
56
57 class VlcPlugin
58 {
59 public:
60              VlcPlugin( NPP, uint16 ); 
61     virtual ~VlcPlugin();
62
63     NPError             init(int argc, char* const argn[], char* const argv[]);
64     libvlc_instance_t*  getVLC() 
65                             { return libvlc_instance; };
66     NPP                 getBrowser()
67                             { return p_browser; };
68     char*               getAbsoluteURL(const char *url);
69     NPWindow&           getWindow()
70                             { return npwindow; };
71     void                setWindow(const NPWindow &window)
72                             { npwindow = window; };
73
74     NPClass*            getScriptClass()
75                             { return p_scriptClass; };
76
77     void                setLog(libvlc_log_t *log)
78                             { libvlc_log = log; };
79     libvlc_log_t*       getLog()
80                             { return libvlc_log; };
81 #if XP_WIN
82     WNDPROC             getWindowProc()
83                             { return pf_wndproc; };
84     void                setWindowProc(WNDPROC wndproc)
85                             { pf_wndproc = wndproc; };
86 #endif
87
88 #if XP_UNIX
89     int                 setSize(unsigned width, unsigned height);
90 #endif
91
92     uint16    i_npmode; /* either NP_EMBED or NP_FULL */
93
94     /* plugin properties */
95     int      b_stream;
96     int      b_autoplay;
97     char *   psz_target;
98
99 private:
100     /* VLC reference */
101     libvlc_instance_t   *libvlc_instance;
102     libvlc_log_t        *libvlc_log;
103     NPClass             *p_scriptClass;
104
105     /* browser reference */
106     NPP     p_browser;
107     char*   psz_baseURL;
108
109     /* display settings */
110     NPWindow  npwindow;
111 #if XP_WIN
112     WNDPROC   pf_wndproc;
113 #endif
114 #if XP_UNIX
115     unsigned int     i_width, i_height;
116 #endif
117 };
118
119 /*******************************************************************************
120  * Plugin properties.
121  ******************************************************************************/
122 #define PLUGIN_NAME         "VLC Multimedia Plugin"
123 #define PLUGIN_DESCRIPTION \
124     "Version %s, copyright 1996-2007 The VideoLAN Team" \
125     "<br><a href=\"http://www.videolan.org/\">http://www.videolan.org/</a>"
126
127 #define PLUGIN_MIMETYPES \
128     /* MPEG-1 and MPEG-2 */ \
129     "audio/mpeg:mp2,mp3,mpga,mpega:MPEG audio;" \
130     "audio/x-mpeg:mp2,mp3,mpga,mpega:MPEG audio;" \
131     "video/mpeg:mpg,mpeg,mpe:MPEG video;" \
132     "video/x-mpeg:mpg,mpeg,mpe:MPEG video;" \
133     "video/mpeg-system:mpg,mpeg,mpe,vob:MPEG video;" \
134     "video/x-mpeg-system:mpg,mpeg,mpe,vob:MPEG video;" \
135     /* MPEG-4 */ \
136     "video/mpeg4:mp4,mpg4:MPEG-4 video;" \
137     "audio/mpeg4:mp4,mpg4:MPEG-4 audio;" \
138     "application/mpeg4-iod:mp4,mpg4:MPEG-4 video;" \
139     "application/mpeg4-muxcodetable:mp4,mpg4:MPEG-4 video;" \
140     /* AVI */ \
141     "video/x-msvideo:avi:AVI video;" \
142     /* QuickTime */ \
143     "video/quicktime:mov,qt:QuickTime video;" \
144     /* OGG */ \
145     "application/x-ogg:ogg:Ogg stream;" \
146     "application/ogg:ogg:Ogg stream;" \
147     /* VLC */ \
148     "application/x-vlc-plugin:vlc:VLC plugin;" \
149     /* Windows Media */ \
150     "video/x-ms-asf-plugin:asf,asx:Windows Media Video;" \
151     "video/x-ms-asf:asf,asx:Windows Media Video;" \
152     "application/x-mplayer2::Windows Media;" \
153     "video/x-ms-wmv:wmv:Windows Media;" \
154     /* Google VLC */ \
155     "application/x-google-vlc-plugin::Google VLC plugin;" \
156     /* WAV audio */ \
157     "audio/wav:wav:WAV audio;" \
158     "audio/x-wav:wav:WAV audio;" \
159     /* 3GPP */ \
160     "audio/3gpp:3gp,3gpp:3GPP audio;" \
161     "video/3gpp:3gp,3gpp:3GPP video;" \
162     /* 3GPP2 */ \
163     "audio/3gpp2:3g2,3gpp2:3GPP2 audio;" \
164     "video/3gpp2:3g2,3gpp2:3GPP2 video;" \
165
166 #endif