]> git.sesse.net Git - vlc/blob - mozilla/vlcplugin.h
all: rewrite of mozilla plugin
[vlc] / 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 #if 0
42 #ifdef XP_WIN
43     /* Windows stuff */
44 #endif
45
46 #ifdef XP_MACOSX
47     /* Mac OS X stuff */
48 #   include <Quickdraw.h>
49 #endif
50
51 #ifdef XP_UNIX
52     /* X11 stuff */
53 #   include <X11/Xlib.h>
54 #   include <X11/Intrinsic.h>
55 #   include <X11/StringDefs.h>
56 #endif
57 #endif
58
59 class VlcPlugin
60 {
61 public:
62              VlcPlugin( NPP, uint16 ); 
63     virtual ~VlcPlugin();
64
65     NPError             init(int argc, char* const argn[], char* const argv[]);
66     libvlc_instance_t*  getVLC() 
67                             { return libvlc_instance; };
68     NPP                 getBrowser()
69                             { return p_browser; };
70     char*               getAbsoluteURL(const char *url);
71     const NPWindow*     getWindow()
72                             { return &npwindow; };
73     void                setWindow(const NPWindow *window)
74                             { npwindow = *window; };
75
76     NPClass*            getScriptClass()
77                             { return scriptClass; };
78
79 #if XP_WIN
80     WNDPROC             getWindowProc()
81                             { return pf_wndproc; };
82     void                setWindowProc(WNDPROC wndproc)
83                             { pf_wndproc = wndproc; };
84 #endif
85
86 #if XP_UNIX
87     int                 setSize(unsigned width, unsigned height);
88 #endif
89
90     uint16    i_npmode; /* either NP_EMBED or NP_FULL */
91
92     /* plugin properties */
93     int      b_stream;
94     int      b_autoplay;
95     char *   psz_target;
96
97 private:
98     /* VLC reference */
99     libvlc_instance_t *libvlc_instance;
100     NPClass           *scriptClass;
101
102     /* browser reference */
103     NPP     p_browser;
104     char*   psz_baseURL;
105
106     /* display settings */
107     NPWindow  npwindow;
108 #if XP_WIN
109     WNDPROC   pf_wndproc;
110 #endif
111 #if XP_UNIX
112     unsigned int     i_width, i_height;
113 #endif
114 };
115
116 /*******************************************************************************
117  * Plugin properties.
118  ******************************************************************************/
119 #define PLUGIN_NAME         "VLC multimedia plugin"
120 #define PLUGIN_DESCRIPTION \
121     "VLC multimedia plugin <br>" \
122     " <br>" \
123     "version %s <br>" \
124     "VideoLAN WWW: <a href=\"http://www.videolan.org/\">http://www.videolan.org/</a>"
125
126 #define PLUGIN_MIMETYPES \
127     /* MPEG-1 and MPEG-2 */ \
128     "audio/mpeg:mp2,mp3,mpga,mpega:MPEG audio;" \
129     "audio/x-mpeg:mp2,mp3,mpga,mpega:MPEG audio;" \
130     "video/mpeg:mpg,mpeg,mpe:MPEG video;" \
131     "video/x-mpeg:mpg,mpeg,mpe:MPEG video;" \
132     "video/mpeg-system:mpg,mpeg,mpe,vob:MPEG video;" \
133     "video/x-mpeg-system:mpg,mpeg,mpe,vob:MPEG video;" \
134     /* MPEG-4 */ \
135     "video/mpeg4:mp4,mpg4:MPEG-4 video;" \
136     "audio/mpeg4:mp4,mpg4:MPEG-4 audio;" \
137     "application/mpeg4-iod:mp4,mpg4:MPEG-4 video;" \
138     "application/mpeg4-muxcodetable:mp4,mpg4:MPEG-4 video;" \
139     /* AVI */ \
140     "video/x-msvideo:avi:AVI video;" \
141     /* QuickTime */ \
142     "video/quicktime:mov,qt:QuickTime video;" \
143     /* Ogg */ \
144     "application/x-ogg:ogg:Ogg stream;" \
145     "application/ogg:ogg:Ogg stream;" \
146     /* explicit plugin call */ \
147     "application/x-vlc-plugin::VLC plugin;" \
148     /* windows media */ \
149     "video/x-ms-asf-plugin:asf,asx:Windows Media Video;" \
150     "video/x-ms-asf:asf,asx:Windows Media Video;" \
151     "application/x-mplayer2::Windows Media;" \
152     "video/x-ms-wmv:wmv:Windows Media;" \
153     /* Google VLC mime */ \
154     "application/x-google-vlc-plugin::Google VLC plugin" \
155     /* Misc */ \
156     "audio/wav::WAV audio" \
157     "audio/x-wav::WAV audio" \
158
159 #endif