Commit b19ddef0 authored by Damien Fouilleul's avatar Damien Fouilleul

vlcshell.cpp: prevent browser from downloading SRC URL before passing it to plugin

parent 30b3ac88
...@@ -439,68 +439,41 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window ) ...@@ -439,68 +439,41 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream *stream, NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream *stream,
NPBool seekable, uint16 *stype ) NPBool seekable, uint16 *stype )
{ {
if( instance == NULL ) if( NULL == instance )
{ {
return NPERR_INVALID_INSTANCE_ERROR; return NPERR_INVALID_INSTANCE_ERROR;
} }
#if 0 VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(instance->pdata);
VlcPlugin* p_plugin = (VlcPlugin*)instance->pdata;
#endif
/* fprintf(stderr, "NPP_NewStream - FILE mode !!\n"); */
/* We want a *filename* ! */ /*
*stype = NP_ASFILE; ** Firefox/Mozilla may decide to open a stream from the URL specified
** in the SRC parameter of the EMBED tag and pass it to us
#if 0 **
if( !p_plugin->b_stream ) ** since VLC will open the SRC URL as well, we're not interested in
** that stream. Otherwise, we'll take it and queue it up in the playlist
*/
if( !p_plugin->psz_target || strcmp(stream->url, p_plugin->psz_target) )
{ {
p_plugin->psz_target = strdup( stream->url ); /* TODO: use pipes !!!! */
p_plugin->b_stream = VLC_TRUE; *stype = NP_ASFILEONLY;
return NPERR_NO_ERROR;
} }
#endif return NPERR_GENERIC_ERROR;
return NPERR_NO_ERROR;
} }
int32 STREAMBUFSIZE = 0X0FFFFFFF; /* If we are reading from a file in NPAsFile
* mode so we can take any size stream in our
* write call (since we ignore it) */
#define SARASS_SIZE (1024*1024)
int32 NPP_WriteReady( NPP instance, NPStream *stream ) int32 NPP_WriteReady( NPP instance, NPStream *stream )
{ {
VlcPlugin* p_plugin; /* TODO */
return 8*1024;
/* fprintf(stderr, "NPP_WriteReady\n"); */
if (instance != NULL)
{
p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
/* Muahahahahahahaha */
return STREAMBUFSIZE;
/*return SARASS_SIZE;*/
}
/* Number of bytes ready to accept in NPP_Write() */
return STREAMBUFSIZE;
/*return 0;*/
} }
int32 NPP_Write( NPP instance, NPStream *stream, int32 offset, int32 NPP_Write( NPP instance, NPStream *stream, int32 offset,
int32 len, void *buffer ) int32 len, void *buffer )
{ {
/* fprintf(stderr, "NPP_Write %i\n", (int)len); */ /* TODO */
return len;
if( instance != NULL )
{
/*VlcPlugin* p_plugin = (VlcPlugin*) instance->pdata;*/
}
return len; /* The number of bytes accepted */
} }
...@@ -510,7 +483,6 @@ NPError NPP_DestroyStream( NPP instance, NPStream *stream, NPError reason ) ...@@ -510,7 +483,6 @@ NPError NPP_DestroyStream( NPP instance, NPStream *stream, NPError reason )
{ {
return NPERR_INVALID_INSTANCE_ERROR; return NPERR_INVALID_INSTANCE_ERROR;
} }
return NPERR_NO_ERROR; return NPERR_NO_ERROR;
} }
...@@ -522,14 +494,15 @@ void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname ) ...@@ -522,14 +494,15 @@ void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname )
return; return;
} }
/* fprintf(stderr, "NPP_StreamAsFile %s\n", fname); */ VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(instance->pdata);
#if 0
VlcPlugin* p_plugin = (VlcPlugin*)instance->pdata;
VLC_AddTarget( p_plugin->i_vlc, fname, 0, 0, if( VLC_SUCCESS == libvlc_playlist_add( p_plugin->getVLC(), fname, stream->url, NULL ) )
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); {
#endif /* USE_LIBVLC */ if( p_plugin->b_autoplay )
{
libvlc_playlist_play( p_plugin->getVLC(), 0, 0, NULL, NULL);
}
}
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment