3
* Copyright (C) 2004 Bastien Nocera <hadess@hadess.net>
4
* Copyright (C) 2002 David A. Schleef <ds@schleef.org>
5
* Copyright (C) 2006 Christian Persch
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Library General Public
9
* License as published by the Free Software Foundation; either
10
* version 2 of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Library General Public License for more details.
17
* You should have received a copy of the GNU Library General Public
18
* License along with this library; if not, write to the
19
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
* Boston, MA 02111-1307, USA.
22
* $Id: totemNarrowSpacePlugin.cpp 3413 2006-08-11 14:15:44Z hadess $
25
#include <mozilla-config.h>
30
#include <nsIProgrammingLanguage.h>
31
#include <nsISupportsImpl.h>
35
#include "totemNarrowSpacePlugin.h"
37
/* 2e390ee1-f0e3-423c-9764-f5ab50a40c06 */
38
static const nsCID kClassID =
39
{ 0x2e390ee1, 0xf0e3, 0x423c, \
40
{ 0x97, 0x64, 0xf5, 0xab, 0x50, 0xa4, 0x0c, 0x06 } };
42
static const char kClassDescription[] = "totemNarrowSpacePlugin";
43
static const char kPluginDescription[] = "QuickTime Plug-in 7.0 (compatible; Totem)";
45
static const totemPluginMimeEntry kMimeTypes[] = {
46
{ "video/quicktime", "mov", NULL },
49
totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin)
52
g_print ("%s ctor [%p]\n", kClassDescription, (void*) this);
55
totemScriptablePlugin::~totemScriptablePlugin ()
57
g_print ("%s dtor [%p]\n", kClassDescription, (void*) this);
61
totemScriptablePlugin::PluginDescription ()
63
return (char*) kPluginDescription;
67
totemScriptablePlugin::PluginMimeTypes (const totemPluginMimeEntry **_entries,
70
*_entries = kMimeTypes;
71
*_count = G_N_ELEMENTS (kMimeTypes);
74
/* Interface implementations */
76
NS_IMPL_ISUPPORTS2 (totemScriptablePlugin,
77
totemINarrowSpacePlayer,
83
totemScriptablePlugin::GetFlags (PRUint32 *aFlags)
85
*aFlags = nsIClassInfo::PLUGIN_OBJECT | nsIClassInfo::DOM_OBJECT;
90
totemScriptablePlugin::GetImplementationLanguage (PRUint32 *aImplementationLanguage)
92
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
97
totemScriptablePlugin::GetInterfaces (PRUint32 *count,
100
*array = NS_STATIC_CAST (nsIID**, nsMemory::Alloc (sizeof (nsIID)));
102
return NS_ERROR_OUT_OF_MEMORY;
106
(*array)[0] = NS_STATIC_CAST (nsIID*,
107
nsMemory::Clone (&NS_GET_IID (totemINarrowSpacePlayer),
110
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY (0, *array);
111
return NS_ERROR_OUT_OF_MEMORY;
114
g_message ("GetInterfaces");
119
totemScriptablePlugin::GetHelperForLanguage (PRUint32 language,
120
nsISupports **_retval)
123
g_message ("GetHelperForLanguage %d", language);
128
totemScriptablePlugin::GetContractID (char * *aContractID)
130
*aContractID = nsnull;
135
totemScriptablePlugin::GetClassDescription (char * *aClassDescription)
137
*aClassDescription = NS_STATIC_CAST (char*,
138
nsMemory::Clone (kClassDescription,
139
sizeof (kClassDescription)));
140
if (!*aClassDescription)
141
return NS_ERROR_OUT_OF_MEMORY;
143
g_message ("GetClassDescription: %s", *aClassDescription);
148
totemScriptablePlugin::GetClassID (nsCID * *aClassID)
150
*aClassID = NS_STATIC_CAST (nsCID*,
151
nsMemory::Clone (&kClassID,
154
return NS_ERROR_OUT_OF_MEMORY;
156
g_message ("GetClassID");
161
totemScriptablePlugin::GetClassIDNoAlloc (nsCID *aClassIDNoAlloc)
163
/* We don't need to implement this since we're not implementing nsISerializable */
164
return NS_ERROR_NOT_AVAILABLE;
165
*aClassIDNoAlloc = kClassID;
166
g_message ("GetClassIDNoAlloc");
170
/* totemINarrowSpacePlayer */
173
totemScriptablePlugin::Play ()
175
NS_ENSURE_STATE (mPlugin);
177
totem_plugin_play (mPlugin);
183
totemScriptablePlugin::Rewind ()
185
NS_ENSURE_STATE (mPlugin);
187
totem_plugin_pause (mPlugin);
193
totemScriptablePlugin::Stop ()
195
NS_ENSURE_STATE (mPlugin);
197
totem_plugin_stop (mPlugin);