1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/* Totem Basic Plugin
*
* Copyright (C) 2004 Bastien Nocera <hadess@hadess.net>
* Copyright (C) 2002 David A. Schleef <ds@schleef.org>
* Copyright (C) 2006 Christian Persch
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* $Id$
*/
#include <mozilla-config.h>
#include "config.h"
#include <glib.h>
#include <nsISupportsImpl.h>
#include <nsMemory.h>
#include <nsXPCOM.h>
#include <nsIProgrammingLanguage.h>
#define GNOME_ENABLE_DEBUG 1
/* define GNOME_ENABLE_DEBUG for more debug spew */
#include "debug.h"
#include "totemClassInfo.h"
#include "totemBasicPlugin.h"
/* 11ef8fce-9eb4-494e-804e-d56eae788625 */
static const nsCID kClassID =
{ 0x11ef8fce, 0x9eb4, 0x494e,
{ 0x80, 0x4e, 0xd5, 0x6e, 0xae, 0x78, 0x86, 0x25 } };
static const char kClassDescription[] = "totemBasicPlugin";
static const char kPluginDescription[] = "Totem Web Browser Plugin " VERSION;
static const totemPluginMimeEntry kMimeTypes[] = {
{ "application/ogg", "ogg", NULL, FALSE },
{ "video/mpeg", "mpg, mpeg, mpe", NULL, FALSE },
{ "audio/wav", "wav", NULL, FALSE },
{ "audio/x-wav", "wav", NULL, TRUE },
{ "audio/mpeg", "mp3", NULL, FALSE },
{ "audio/x-mpeg", "mp3", NULL, TRUE }
};
totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin)
: mPlugin(aPlugin)
{
D ("%s ctor [%p]", kClassDescription, (void*) this);
}
totemScriptablePlugin::~totemScriptablePlugin ()
{
D ("%s dtor [%p]", kClassDescription, (void*) this);
}
/* static */ char *
totemScriptablePlugin::PluginDescription ()
{
return (char*) kPluginDescription;
}
/* static */ void
totemScriptablePlugin::PluginMimeTypes (const totemPluginMimeEntry **_entries,
PRUint32 *_count)
{
*_entries = kMimeTypes;
*_count = G_N_ELEMENTS (kMimeTypes);
}
/* Interface implementations */
NS_IMPL_ISUPPORTS2 (totemScriptablePlugin,
totemIBasicPlayer,
nsIClassInfo)
/* nsIClassInfo */
TOTEM_CLASSINFO_BEGIN (totemScriptablePlugin,
1,
kClassID,
kClassDescription)
TOTEM_CLASSINFO_ENTRY (0, totemIBasicPlayer)
TOTEM_CLASSINFO_END
/* totemIBasicPlayer */
NS_IMETHODIMP
totemScriptablePlugin::Play ()
{
NS_ENSURE_STATE (IsValid ());
return mPlugin->DoCommand (TOTEM_COMMAND_PLAY);
}
NS_IMETHODIMP
totemScriptablePlugin::Rewind ()
{
NS_ENSURE_STATE (IsValid ());
return mPlugin->DoCommand (TOTEM_COMMAND_PAUSE);
}
NS_IMETHODIMP
totemScriptablePlugin::Stop ()
{
NS_ENSURE_STATE (IsValid ());
return mPlugin->DoCommand (TOTEM_COMMAND_STOP);
}
|