/*****************************************************************************
- * 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
******************************************************************************/
#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
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
*****************************************************************************/
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" ) )
{
/* 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
/*
{
#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;
}
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;
{
VlcPlugin* p_plugin;
- fprintf(stderr, "NPP_WriteReady\n");
+ /* fprintf(stderr, "NPP_WriteReady\n"); */
if (instance != NULL)
{
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 )
{
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
}