]> git.sesse.net Git - vlc/blob - mozilla/vlcplugin.h
vlcplugin.cpp: removed hardcoded path
[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 #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     const NPWindow*     getWindow()
70                             { return &npwindow; };
71     void                setWindow(const NPWindow *window)
72                             { npwindow = *window; };
73
74     NPClass*            getScriptClass()
75                             { return scriptClass; };
76
77 #if XP_WIN
78     WNDPROC             getWindowProc()
79                             { return pf_wndproc; };
80     void                setWindowProc(WNDPROC wndproc)
81                             { pf_wndproc = wndproc; };
82 #endif
83
84 #if XP_UNIX
85     int                 setSize(unsigned width, unsigned height);
86 #endif
87
88     uint16    i_npmode; /* either NP_EMBED or NP_FULL */
89
90     /* plugin properties */
91     int      b_stream;
92     int      b_autoplay;
93     char *   psz_target;
94
95 private:
96     /* VLC reference */
97     libvlc_instance_t *libvlc_instance;
98     NPClass           *scriptClass;
99
100     /* browser reference */
101     NPP     p_browser;
102     char*   psz_baseURL;
103
104     /* display settings */
105     NPWindow  npwindow;
106 #if XP_WIN
107     WNDPROC   pf_wndproc;
108 #endif
109 #if XP_UNIX
110     unsigned int     i_width, i_height;
111 #endif
112 };
113
114 /*******************************************************************************
115  * Plugin properties.
116  ******************************************************************************/
117 #define PLUGIN_NAME         "VLC multimedia plugin"
118 #define PLUGIN_DESCRIPTION \
119     "VLC multimedia plugin <br>" \
120     " <br>" \
121     "version %s <br>" \
122     "VideoLAN WWW: <a href=\"http://www.videolan.org/\">http://www.videolan.org/</a>"
123
124 #define PLUGIN_MIMETYPES \
125     /* MPEG-1 and MPEG-2 */ \
126     "audio/mpeg:mp2,mp3,mpga,mpega:MPEG audio;" \
127     "audio/x-mpeg:mp2,mp3,mpga,mpega:MPEG audio;" \
128     "video/mpeg:mpg,mpeg,mpe:MPEG video;" \
129     "video/x-mpeg:mpg,mpeg,mpe:MPEG video;" \
130     "video/mpeg-system:mpg,mpeg,mpe,vob:MPEG video;" \
131     "video/x-mpeg-system:mpg,mpeg,mpe,vob:MPEG video;" \
132     /* MPEG-4 */ \
133     "video/mpeg4:mp4,mpg4:MPEG-4 video;" \
134     "audio/mpeg4:mp4,mpg4:MPEG-4 audio;" \
135     "application/mpeg4-iod:mp4,mpg4:MPEG-4 video;" \
136     "application/mpeg4-muxcodetable:mp4,mpg4:MPEG-4 video;" \
137     /* AVI */ \
138     "video/x-msvideo:avi:AVI video;" \
139     /* QuickTime */ \
140     "video/quicktime:mov,qt:QuickTime video;" \
141     /* Ogg */ \
142     "application/x-ogg:ogg:Ogg stream;" \
143     "application/ogg:ogg:Ogg stream;" \
144     /* explicit plugin call */ \
145     "application/x-vlc-plugin::VLC plugin;" \
146     /* windows media */ \
147     "video/x-ms-asf-plugin:asf,asx:Windows Media Video;" \
148     "video/x-ms-asf:asf,asx:Windows Media Video;" \
149     "application/x-mplayer2::Windows Media;" \
150     "video/x-ms-wmv:wmv:Windows Media;" \
151     /* Google VLC mime */ \
152     "application/x-google-vlc-plugin::Google VLC plugin" \
153     /* Misc */ \
154     "audio/wav::WAV audio" \
155     "audio/x-wav::WAV audio" \
156
157 #endif