]> git.sesse.net Git - vlc/blobdiff - mozilla/vlcshell.cpp
* aac.c : big clean up and use ninput.h
[vlc] / mozilla / vlcshell.cpp
index e14f97efe4d0536d96a2d5d5da94f3453633d8be..bf9bed99e3044aaab77b41025946d4a48d63e7f3 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
- * vlcshell.c: a VideoLAN Client plugin for Mozilla
+ * vlcshell.cpp: a VLC plugin for Mozilla
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: vlcshell.cpp,v 1.6 2002/10/25 18:17:59 sam Exp $
+ * $Id: vlcshell.cpp,v 1.15 2003/07/23 01:13:48 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+/* XXX: disable VLC here */
+#define USE_LIBVLC 1
+
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 
 /* vlc stuff */
-#include <vlc/vlc.h>
+#ifdef USE_LIBVLC
+#   include <vlc/vlc.h>
+#endif
 
 /* Mozilla stuff */
+#include <nsISupports.h>
+#include <nsMemory.h>
 #include <npapi.h>
 
 #ifdef XP_WIN
 #   include <X11/StringDefs.h>
 #endif
 
+#ifdef XP_MAC
+    /* Mac OS X stuff */
+#   include <QuickDraw.h>
+#endif
+
 #include "vlcpeer.h"
 #include "vlcplugin.h"
 
-/* XXX: disable VLC */
-#define USE_LIBVLC 1
-
 #if USE_LIBVLC
 #   define WINDOW_TEXT "(no picture)"
 #else
@@ -61,7 +71,7 @@
 ******************************************************************************/
 #ifdef XP_UNIX
 #   define VOUT_PLUGINS "xvideo,x11,dummy"
-#   define AOUT_PLUGINS "dsp,dummy"
+#   define AOUT_PLUGINS "oss,dummy"
 
 static void Redraw( Widget w, XtPointer closure, XEvent *event );
 #endif
@@ -163,6 +173,31 @@ NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
     return NPERR_NO_ERROR;
 }
 
+/******************************************************************************
+ * Mac-only API calls
+ *****************************************************************************/
+#ifdef XP_MAC
+int16 NPP_HandleEvent( NPP instance, void * event )
+{
+    if( instance == NULL )
+    {
+        return false;
+    }
+
+    Boolean eventHandled = false;
+
+#if 0
+    TPlugin *pPlugin = (TPlugin*)instance->pdata;
+    if( pPlugin != NULL && event != NULL )
+    {
+        eventHandled = pPlugin->HandleEvent( *(EventRecord*)event );
+    }
+#endif
+
+    return eventHandled;
+}
+#endif
+
 /******************************************************************************
  * General Plug-in Calls
  *****************************************************************************/
@@ -274,6 +309,22 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
                 p_plugin->b_autoplay = 1;
             }
         }
+        else if( !strcmp( argn[i], "autostart" ) )
+        {
+            if( !strcmp( argv[i], "1" ) || !strcmp( argv[i], "true" ) )
+            {
+                p_plugin->b_autoplay = 1;
+            }
+        }
+        else if( !strcmp( argn[i], "filename" ) )
+        {
+            p_plugin->psz_target = argv[i];
+        }
+        else if( !strcmp( argn[i], "src" ) )
+        {
+            p_plugin->psz_target = argv[i];
+        }
+
 #if USE_LIBVLC
         else if( !strcmp( argn[i], "loop" ) )
         {
@@ -343,11 +394,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
 
     /* FIXME: this cast sucks */
     value.i_int = (int) (ptrdiff_t) (void *) window->window;
-    VLC_Set( p_plugin->i_vlc, "conf::x11-drawable", value );
-    VLC_Set( p_plugin->i_vlc, "conf::xvideo-drawable", value );
-
-    value.i_int = (int) (ptrdiff_t) (void *) window->window;
-    VLC_Set( p_plugin->i_vlc, "conf::directx-window", value );
+    VLC_Set( p_plugin->i_vlc, "drawable", value );
 #endif
 
     /*
@@ -432,7 +479,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
         {
 #if USE_LIBVLC
             VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target,
-                           i_mode, PLAYLIST_END );
+                           0, 0, i_mode, PLAYLIST_END );
 #endif
             p_plugin->b_stream = VLC_TRUE;
         }
@@ -453,7 +500,7 @@ NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream *stream,
     VlcPlugin* p_plugin = (VlcPlugin*)instance->pdata;
 #endif
 
-    fprintf(stderr, "NPP_NewStream - FILE mode !!\n");
+    /* fprintf(stderr, "NPP_NewStream - FILE mode !!\n"); */
 
     /* We want a *filename* ! */
     *stype = NP_ASFILE;
@@ -479,7 +526,7 @@ int32 NPP_WriteReady( NPP instance, NPStream *stream )
 {
     VlcPlugin* p_plugin;
 
-    fprintf(stderr, "NPP_WriteReady\n");
+    /* fprintf(stderr, "NPP_WriteReady\n"); */
 
     if (instance != NULL)
     {
@@ -498,7 +545,7 @@ int32 NPP_WriteReady( NPP instance, NPStream *stream )
 int32 NPP_Write( NPP instance, NPStream *stream, int32 offset,
                  int32 len, void *buffer )
 {
-    fprintf(stderr, "NPP_Write %i\n", (int)len);
+    /* fprintf(stderr, "NPP_Write %i\n", (int)len); */
 
     if( instance != NULL )
     {
@@ -527,12 +574,12 @@ void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname )
         return;
     }
 
-    fprintf(stderr, "NPP_StreamAsFile %s\n", fname);
+    /* fprintf(stderr, "NPP_StreamAsFile %s\n", fname); */
 
 #if USE_LIBVLC
     VlcPlugin* p_plugin = (VlcPlugin*)instance->pdata;
 
-    VLC_AddTarget( p_plugin->i_vlc, fname,
+    VLC_AddTarget( p_plugin->i_vlc, fname, 0, 0,
                    PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
 #endif
 }