~ubuntu-branches/ubuntu/saucy/totem/saucy-proposed

« back to all changes in this revision

Viewing changes to browser-plugin/totemNarrowSpacePlugin.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Loic Minier, Sebastien Bacher, Loic Minier
  • Date: 2007-03-08 14:51:55 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070308145155-cnu1r0s1z4ffcxza
Tags: 2.16.5-3
[ Sebastien Bacher ]
* debian/patches/30_dlopen_noremove_dbus_glib.dpatch:
  - fix "crash because NPPVpluginKeepLibraryInMemory is broken in gecko",
    patch from Alexander Sack (GNOME bug #415389)

[ Loic Minier ]
* Urgency medium.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Totem Basic Plugin
 
2
 *
 
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
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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.
 
21
 *
 
22
 * $Id: totemNarrowSpacePlugin.cpp 3413 2006-08-11 14:15:44Z hadess $
 
23
 */
 
24
 
 
25
#include <mozilla-config.h>
 
26
#include "config.h"
 
27
 
 
28
#include <glib.h>
 
29
 
 
30
#include <nsIProgrammingLanguage.h>
 
31
#include <nsISupportsImpl.h>
 
32
#include <nsMemory.h>
 
33
#include <nsXPCOM.h>
 
34
 
 
35
#include "totemNarrowSpacePlugin.h"
 
36
 
 
37
/* 2e390ee1-f0e3-423c-9764-f5ab50a40c06 */
 
38
static const nsCID kClassID = 
 
39
{ 0x2e390ee1, 0xf0e3, 0x423c, \
 
40
  { 0x97, 0x64, 0xf5, 0xab, 0x50, 0xa4, 0x0c, 0x06 } };
 
41
 
 
42
static const char kClassDescription[] = "totemNarrowSpacePlugin";
 
43
static const char kPluginDescription[] = "QuickTime Plug-in 7.0 (compatible; Totem)";
 
44
 
 
45
static const totemPluginMimeEntry kMimeTypes[] = {
 
46
        { "video/quicktime", "mov", NULL },
 
47
};
 
48
 
 
49
totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin)
 
50
  : mPlugin(aPlugin)
 
51
{
 
52
  g_print ("%s ctor [%p]\n", kClassDescription, (void*) this);
 
53
}
 
54
 
 
55
totemScriptablePlugin::~totemScriptablePlugin ()
 
56
{
 
57
  g_print ("%s dtor [%p]\n", kClassDescription, (void*) this);
 
58
}
 
59
 
 
60
/* static */ char *
 
61
totemScriptablePlugin::PluginDescription ()
 
62
{
 
63
  return (char*) kPluginDescription;
 
64
}
 
65
 
 
66
/* static */ void
 
67
totemScriptablePlugin::PluginMimeTypes (const totemPluginMimeEntry **_entries,
 
68
                                        PRUint32 *_count)
 
69
{
 
70
  *_entries = kMimeTypes;
 
71
  *_count = G_N_ELEMENTS (kMimeTypes);
 
72
}
 
73
 
 
74
/* Interface implementations */
 
75
 
 
76
NS_IMPL_ISUPPORTS2 (totemScriptablePlugin,
 
77
                    totemINarrowSpacePlayer,
 
78
                    nsIClassInfo)
 
79
 
 
80
/* nsIClassInfo */
 
81
 
 
82
NS_IMETHODIMP
 
83
totemScriptablePlugin::GetFlags (PRUint32 *aFlags)
 
84
{
 
85
  *aFlags = nsIClassInfo::PLUGIN_OBJECT | nsIClassInfo::DOM_OBJECT;
 
86
  return NS_OK;
 
87
}
 
88
 
 
89
NS_IMETHODIMP
 
90
totemScriptablePlugin::GetImplementationLanguage (PRUint32 *aImplementationLanguage)
 
91
{
 
92
  *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
 
93
  return NS_OK;
 
94
}
 
95
 
 
96
NS_IMETHODIMP
 
97
totemScriptablePlugin::GetInterfaces (PRUint32 *count,
 
98
                                      nsIID * **array)
 
99
{
 
100
  *array = NS_STATIC_CAST (nsIID**, nsMemory::Alloc (sizeof (nsIID)));
 
101
  if (!*array)
 
102
    return NS_ERROR_OUT_OF_MEMORY;
 
103
 
 
104
  *count = 1;
 
105
 
 
106
  (*array)[0] = NS_STATIC_CAST (nsIID*,
 
107
                                nsMemory::Clone (&NS_GET_IID (totemINarrowSpacePlayer),
 
108
                                                 sizeof(nsIID)));
 
109
  if (!(*array)[0]) {
 
110
    NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY (0, *array);
 
111
    return NS_ERROR_OUT_OF_MEMORY;
 
112
  }
 
113
 
 
114
  g_message ("GetInterfaces");
 
115
  return NS_OK;
 
116
}
 
117
     
 
118
NS_IMETHODIMP
 
119
totemScriptablePlugin::GetHelperForLanguage (PRUint32 language,
 
120
                                             nsISupports **_retval)
 
121
{
 
122
  *_retval = nsnull;
 
123
  g_message ("GetHelperForLanguage %d", language);
 
124
  return NS_OK;
 
125
}
 
126
     
 
127
NS_IMETHODIMP
 
128
totemScriptablePlugin::GetContractID (char * *aContractID)
 
129
{
 
130
  *aContractID = nsnull;
 
131
  return NS_OK;
 
132
}
 
133
 
 
134
NS_IMETHODIMP
 
135
totemScriptablePlugin::GetClassDescription (char * *aClassDescription)
 
136
{
 
137
  *aClassDescription = NS_STATIC_CAST (char*,
 
138
                                       nsMemory::Clone (kClassDescription,
 
139
                                                        sizeof (kClassDescription)));
 
140
  if (!*aClassDescription)
 
141
    return NS_ERROR_OUT_OF_MEMORY;
 
142
 
 
143
  g_message ("GetClassDescription: %s", *aClassDescription);
 
144
  return NS_OK;
 
145
}
 
146
 
 
147
NS_IMETHODIMP
 
148
totemScriptablePlugin::GetClassID (nsCID * *aClassID)
 
149
{
 
150
  *aClassID = NS_STATIC_CAST (nsCID*,
 
151
                              nsMemory::Clone (&kClassID,
 
152
                                               sizeof (nsCID*)));
 
153
  if (!*aClassID)
 
154
    return NS_ERROR_OUT_OF_MEMORY;
 
155
 
 
156
  g_message ("GetClassID");
 
157
  return NS_OK;
 
158
}
 
159
     
 
160
NS_IMETHODIMP
 
161
totemScriptablePlugin::GetClassIDNoAlloc (nsCID *aClassIDNoAlloc)
 
162
{
 
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");
 
167
  return NS_OK;
 
168
}
 
169
 
 
170
/* totemINarrowSpacePlayer */
 
171
 
 
172
NS_IMETHODIMP
 
173
totemScriptablePlugin::Play ()
 
174
{
 
175
  NS_ENSURE_STATE (mPlugin);
 
176
 
 
177
  totem_plugin_play (mPlugin);
 
178
 
 
179
  return NS_OK;
 
180
}
 
181
 
 
182
NS_IMETHODIMP
 
183
totemScriptablePlugin::Rewind ()
 
184
{
 
185
  NS_ENSURE_STATE (mPlugin);
 
186
 
 
187
  totem_plugin_pause (mPlugin);
 
188
 
 
189
  return NS_OK;
 
190
}
 
191
 
 
192
NS_IMETHODIMP
 
193
totemScriptablePlugin::Stop ()
 
194
{
 
195
  NS_ENSURE_STATE (mPlugin);
 
196
 
 
197
  totem_plugin_stop (mPlugin);
 
198
 
 
199
  return NS_OK;
 
200
}