1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  * http://www.mozilla.org/MPL/
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 MPL, 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 MPL, the GPL or the LGPL.
35  *
36  * ***** END LICENSE BLOCK ***** */
37 
38 #include "plugin_types.h"
39 
GetMIMEDescription()40 gchar *GetMIMEDescription()
41 {
42     gchar MimeTypes[4000];
43     GmPrefStore *store;
44     gboolean wmp_disabled = FALSE;
45 
46     g_type_init();
47     store = gm_pref_store_new("gecko-mediaplayer");
48     if (store != NULL) {
49         wmp_disabled = gm_pref_store_get_boolean(store, DISABLE_WMP);
50         gm_pref_store_free(store);
51     }
52 
53 
54     if (wmp_disabled) {
55         return NULL;
56     } else {
57 
58         g_strlcpy(MimeTypes,
59                   "application/asx:*:Media Files;"
60                   "video/x-ms-asf-plugin:*:Media Files;"
61                   "video/x-msvideo:avi,*:AVI;"
62                   "video/msvideo:avi,*:AVI;"
63                   "application/x-mplayer2:*:Media Files;"
64                   "video/x-mplayer2:*:Media Files;"
65                   "application/x-ms-wmv:wmv,*:Microsoft WMV video;"
66                   "video/x-ms-asf:asf,asx,*:Media Files;"
67                   "video/x-ms-asx:asx,*:Media Files;"
68                   "video/x-ms-wm:wm,*:Media Files;"
69                   "video/x-ms-wmv:wmv,*:Microsoft WMV video;"
70                   "audio/x-ms-wmv:wmv,*:Windows Media;"
71                   "video/x-ms-wmp:wmp,*:Windows Media;"
72                   "application/x-ms-wmp:wmp,*:Windows Media;"
73                   "video/x-ms-wvx:wvx,*:Windows Media;"
74                   "audio/x-ms-wax:wax,*:Windows Media;"
75                   "audio/x-ms-wma:wma,*:Windows Media;"
76                   "application/x-drm-v2:asx,*:Windows Media;"
77                   "audio/wav:wav,*:Microsoft wave file;"
78                   "audio/x-wav:wav,*:Microsoft wave file;", sizeof(MimeTypes));
79 
80         return g_strdup(MimeTypes);
81 
82     }
83 }
84 
PluginGetValue(NPPVariable variable,void * value)85 NPError PluginGetValue(NPPVariable variable, void *value)
86 {
87     NPError err = NPERR_NO_ERROR;
88 
89     // some sites use this description to figure out what formats can be played. So we have to make sure the
90     // description matches the features
91 
92     if (variable == NPPVpluginNameString) {
93         *((const char **) value) = "Windows Media Player Plug-in";
94     }
95     if (variable == NPPVpluginDescriptionString) {
96         *((const char **) value) =
97             "<a href=\"http://kdekorte.googlepages.com/gecko-mediaplayer\">Gecko Media Player</a> "
98             VERSION
99             "<br><br>Video Player Plug-in for QuickTime, RealPlayer and Windows Media Player streams using <a href=\"http://mplayerhq.hu\">MPlayer</a>";
100 
101     }
102 
103     if (variable == NPPVpluginNeedsXEmbed) {
104         *((bool *) value) = TRUE;
105     }
106 
107     if ((variable != NPPVpluginNameString)
108         && (variable != NPPVpluginDescriptionString)
109         && (variable != NPPVpluginNeedsXEmbed)) {
110         err = NPERR_INVALID_PARAM;
111     }
112 
113     return err;
114 
115 }
116 
pluginSpecific(CPlugin * instance)117 void pluginSpecific(CPlugin * instance)
118 {
119     instance->quicktime_emulation = FALSE;
120 }
121