~woodrow-shen/totem/mybranch

« back to all changes in this revision

Viewing changes to browser-plugin/totemBasicPlugin.cpp

Tags: 2.24.3-3
* totem-mozilla.docs: ship README.browser-plugin which explains how to 
  disable the plugin for some MIME types.
* rules: remove the hack that only let totem-xine support VCDs and 
  DVDs, now that GStreamer supports them. Closes: #370789.
* 01_fake_keypresses.patch: new patch. Completely disable the broken 
  XTEST code that generates fake keypresses. Closes: #500330.
* 90_autotools.patch: regenerated.
* Build-depend on nautilus 2.22 to be sure to build the extension for 
  the correct version.
* totem-xine depends on libxine1-x.
* Standards version is 3.8.1.
* Upload to unstable.
* 04_tracker_build.patch: new patch, stolen upstream. Fix build with 
  latest tracker version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Totem Basic Plugin
2
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
 
3
 * Copyright © 2004 Bastien Nocera <hadess@hadess.net>
 
4
 * Copyright © 2002 David A. Schleef <ds@schleef.org>
 
5
 * Copyright © 2006, 2008 Christian Persch
6
6
 *
7
7
 * This library is free software; you can redistribute it and/or
8
8
 * modify it under the terms of the GNU Library General Public
16
16
 *
17
17
 * You should have received a copy of the GNU Library General Public
18
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: totemBasicPlugin.cpp 5065 2008-02-04 14:32:50Z hadess $
 
19
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
20
 * Boston, MA 02110-1301  USA.
23
21
 */
24
22
 
25
 
#include <mozilla-config.h>
26
 
#include "config.h"
 
23
#include <config.h>
27
24
 
28
25
#include <glib.h>
29
26
 
30
 
#include <nsISupportsImpl.h>
31
 
#include <nsMemory.h>
32
 
#include <nsXPCOM.h>
33
 
#include <nsIProgrammingLanguage.h>
34
 
 
35
 
#define GNOME_ENABLE_DEBUG 1
36
 
/* define GNOME_ENABLE_DEBUG for more debug spew */
37
 
#include "debug.h"
38
 
 
39
 
#include "totemClassInfo.h"
40
 
 
 
27
#include "totemPlugin.h"
41
28
#include "totemBasicPlugin.h"
42
29
 
43
 
/* 11ef8fce-9eb4-494e-804e-d56eae788625 */
44
 
static const nsCID kClassID = 
45
 
  { 0x11ef8fce, 0x9eb4, 0x494e,
46
 
    { 0x80, 0x4e, 0xd5, 0x6e, 0xae, 0x78, 0x86, 0x25 } };
47
 
 
48
 
static const char kClassDescription[] = "totemBasicPlugin";
49
 
static const char kPluginDescription[] = "Totem Web Browser Plugin " VERSION;
50
 
 
51
 
static const totemPluginMimeEntry kMimeTypes[] = {
52
 
        { "application/x-ogg","ogg",NULL },
53
 
        { "application/ogg", "ogg", NULL },
54
 
        { "audio/ogg", "oga", NULL },
55
 
        { "audio/x-ogg", "ogg", NULL },
56
 
        { "video/ogg", "ogv", NULL },
57
 
        { "video/x-ogg", "ogg", NULL },
58
 
        { "application/annodex", "anx", NULL },
59
 
        { "audio/annodex", "axa", NULL },
60
 
        { "video/annodex", "axv", NULL },
61
 
        { "video/mpeg", "mpg, mpeg, mpe", NULL },
62
 
        { "audio/wav", "wav", NULL },
63
 
        { "audio/x-wav", "wav", NULL },
64
 
        { "audio/mpeg", "mp3", NULL },
65
 
        { "application/x-nsv-vp3-mp3", "nsv", "video/x-nsv" },
66
 
        { "video/flv", "flv", "application/x-flash-video" },
 
30
static const char *methodNames[] = {
 
31
  "Play",
 
32
  "Rewind",
 
33
  "Stop"
67
34
};
68
35
 
69
 
totemScriptablePlugin::totemScriptablePlugin (totemPlugin *aPlugin)
70
 
  : mPlugin(aPlugin)
71
 
{
72
 
  D ("%s ctor [%p]", kClassDescription, (void*) this);
73
 
}
74
 
 
75
 
totemScriptablePlugin::~totemScriptablePlugin ()
76
 
{
77
 
  D ("%s dtor [%p]", kClassDescription, (void*) this);
78
 
}
79
 
 
80
 
/* static */ char *
81
 
totemScriptablePlugin::PluginDescription ()
82
 
{
83
 
  return (char*) kPluginDescription;
84
 
}
85
 
 
86
 
/* static */ char *
87
 
totemScriptablePlugin::PluginLongDescription ()
88
 
{
89
 
  return (char*) totem_plugin_get_long_description();
90
 
}
91
 
 
92
 
/* static */ void
93
 
totemScriptablePlugin::PluginMimeTypes (const totemPluginMimeEntry **_entries,
94
 
                                        PRUint32 *_count)
95
 
{
96
 
  *_entries = kMimeTypes;
97
 
  *_count = G_N_ELEMENTS (kMimeTypes);
98
 
}
99
 
 
100
 
/* Interface implementations */
101
 
 
102
 
NS_IMPL_ISUPPORTS2 (totemScriptablePlugin,
103
 
                    totemIBasicPlayer,
104
 
                    nsIClassInfo)
105
 
 
106
 
/* nsIClassInfo */
107
 
 
108
 
TOTEM_CLASSINFO_BEGIN (totemScriptablePlugin,
109
 
                       1,
110
 
                       kClassID,
111
 
                       kClassDescription)
112
 
  TOTEM_CLASSINFO_ENTRY (0, totemIBasicPlayer)
113
 
TOTEM_CLASSINFO_END
114
 
 
115
 
/* totemIBasicPlayer */
116
 
 
117
 
NS_IMETHODIMP
118
 
totemScriptablePlugin::Play ()
119
 
{
120
 
  NS_ENSURE_STATE (IsValid ());
121
 
 
122
 
  return mPlugin->DoCommand (TOTEM_COMMAND_PLAY);
123
 
}
124
 
 
125
 
NS_IMETHODIMP
126
 
totemScriptablePlugin::Rewind ()
127
 
{
128
 
  NS_ENSURE_STATE (IsValid ());
129
 
 
130
 
  return mPlugin->DoCommand (TOTEM_COMMAND_PAUSE);
131
 
}
132
 
 
133
 
NS_IMETHODIMP
134
 
totemScriptablePlugin::Stop ()
135
 
{
136
 
  NS_ENSURE_STATE (IsValid ());
137
 
 
138
 
  return mPlugin->DoCommand (TOTEM_COMMAND_STOP);
139
 
}
 
36
totemBasicPlayer::totemBasicPlayer (NPP aNPP)
 
37
  : totemNPObject (aNPP)
 
38
{
 
39
  TOTEM_LOG_CTOR ();
 
40
}
 
41
 
 
42
totemBasicPlayer::~totemBasicPlayer ()
 
43
{
 
44
  TOTEM_LOG_DTOR ();
 
45
}
 
46
 
 
47
bool
 
48
totemBasicPlayer::InvokeByIndex (int aIndex,
 
49
                                 const NPVariant *argv,
 
50
                                 uint32_t argc,
 
51
                                 NPVariant *_result)
 
52
{
 
53
  TOTEM_LOG_INVOKE (aIndex, totemBasicPlayer);
 
54
 
 
55
  VOID_TO_NPVARIANT (*_result);
 
56
 
 
57
  switch (Methods (aIndex)) {
 
58
    case ePlay:
 
59
      Plugin()->Command (TOTEM_COMMAND_PLAY);
 
60
      return VoidVariant (_result);
 
61
 
 
62
    case eRewind:
 
63
      Plugin()->Command (TOTEM_COMMAND_PAUSE);
 
64
      return VoidVariant (_result);
 
65
 
 
66
    case eStop:
 
67
      Plugin()->Command (TOTEM_COMMAND_STOP);
 
68
      return VoidVariant (_result);
 
69
  }
 
70
 
 
71
  return false;
 
72
}
 
73
 
 
74
/* totemBasicPlayerNPClass */
 
75
 
 
76
TOTEM_IMPLEMENT_NPCLASS (totemBasicPlayer,
 
77
                         NULL, 0,
 
78
                         methodNames, G_N_ELEMENTS (methodNames),
 
79
                         NULL)