]> git.sesse.net Git - vlc/blobdiff - mozilla/vlcplugin.cpp
* backport 11374
[vlc] / mozilla / vlcplugin.cpp
index 75ba43b15a2737d9478d39af80a37a1e530008d2..5d81a2f7e5ad058cd0fcf99b5adc10463422a92d 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
- * vlcplugin.cpp: a VideoLAN Client plugin for Mozilla
+ * vlcplugin.cpp: a VLC plugin for Mozilla
  *****************************************************************************
- * Copyright (C) 2002 VideoLAN
- * $Id: vlcplugin.cpp,v 1.1 2002/09/17 08:18:24 sam Exp $
+ * Copyright (C) 2002-2005 VideoLAN
+ * $Id$
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <npapi.h>
+#include "config.h"
 
 #include <vlc/vlc.h>
 
+#ifdef HAVE_MOZILLA_CONFIG_H
+#   include <mozilla-config.h>
+#endif
+#include <nsISupports.h>
+#include <nsMemory.h>
+#include <npapi.h>
+
+#if !defined(XP_MACOSX) && !defined(XP_UNIX) && !defined(XP_WIN)
+#define XP_UNIX 1
+#elif defined(XP_MACOSX)
+#undef XP_UNIX
+#endif
+
 #include "vlcpeer.h"
 #include "vlcplugin.h"
 
 /*****************************************************************************
- * VlcPlugin methods
+ * VlcPlugin constructor and destructor
  *****************************************************************************/
 VlcPlugin::VlcPlugin( NPP instance )
 {
-    p_instance = instance; 
+    p_instance = instance;
     p_peer = NULL;
 }
 
@@ -51,6 +64,9 @@ VlcPlugin::~VlcPlugin()
 }
 
 
+/*****************************************************************************
+ * VlcPlugin methods
+ *****************************************************************************/
 void VlcPlugin::SetInstance( NPP instance )
 {
     p_instance = instance;
@@ -63,9 +79,25 @@ NPP VlcPlugin::GetInstance()
 }
 
 
+VlcIntf* VlcPlugin::GetPeer()
+{
+    if( !p_peer )
+    {
+        p_peer = new VlcPeer( this );
+        if( p_peer == NULL )
+        {
+            return NULL;
+        }
+
+        NS_ADDREF( p_peer );
+    }
+
+    NS_ADDREF( p_peer );
+    return p_peer;
+}
+
 void VlcPlugin::SetFileName(const char * filename)
 {
-fprintf(stderr, "VlcPlugin::SetFilename %s\n", filename);
 #if 0
     FILE * fh;
     fh = fopen(filename, "rb");
@@ -94,38 +126,6 @@ fprintf(stderr, "VlcPlugin::SetFilename %s\n", filename);
     fclose (fh);
     fprintf(stderr, "File loaded\n");
 #endif
-    return; 
-}
-
-void VlcPlugin::Play()
-{
-fprintf(stderr, "VlcPlugin::Play\n");
-}
-
-void VlcPlugin::Pause()
-{
-fprintf(stderr, "VlcPlugin::Pause\n");
-}
-
-void VlcPlugin::Stop()
-{
-fprintf(stderr, "VlcPlugin::Stop\n");
-}
-
-VlcIntf* VlcPlugin::getScriptable()
-{
-    if( !p_peer )
-    {
-        p_peer = new VlcPeer( this );
-        if( p_peer == NULL ) 
-        {
-            return NULL;
-        }
-        
-        NS_ADDREF( p_peer );
-    }
-    // a getter should addref for its caller.
-    NS_ADDREF( p_peer );
-    return p_peer;
+    return;
 }