Commit 00085366 authored by Sam Hocevar's avatar Sam Hocevar

Changes to the libvlc API:

  * ./include/vlc/vlc.h: changed the naming conventions for libvlc. Now
    exported functions start with VLC_ instead of vlc_ to avoid conflicts.
  * ./include/vlc/vlc.h: removed the vlc_object_t, vlc_list_t, vlc_error_t
    and vlc_t types; they are now internal types only.
  * ./include/vlc/vlc.h: merged the reentrant and non-reentrant libvlc
    calls. In non-reentrant mode, we just use 0 as the first argument. In
    reentrant mode, we use an object's ID. (see below)

Internal changes:
  * ./src/libvlc.c, ./src/misc/objects.c: instead of manipulating vlc_object_t
    pointers, we manipulate their i_object_id. When needed, an object is
    retrieved using vlc_object_get (I hope the lookup isn't too expensive,
    that's why I designed the pp_objects layout to allow log2(n) seeks).
  * ./src/misc/objects.c: activated the per-object variable storage. Unused
    yet, unless you want to try "getfoo" and "setfoo blablah" in vlc -I rc.
  * ./include/vlc_objects.h: moved the vlc_object_t and vlc_list_t definitions
    here.

Misc:
  * ./src/vlc.c, ./mozilla/vlcshell.cpp: removed inclusion of config.h in
    code portions not part of libvlc; it was just required for the
    COPYRIGHT_MESSAGE string which is now available from VLC_Version().
parent 634eb9dd
......@@ -2,7 +2,7 @@
* vlcpeer.cpp: scriptable peer descriptor
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlcpeer.cpp,v 1.2 2002/09/30 11:05:41 sam Exp $
* $Id: vlcpeer.cpp,v 1.3 2002/10/11 22:32:56 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -70,12 +70,12 @@ NS_IMETHODIMP VlcPeer::Play()
{
if( !p_plugin->b_stream && p_plugin->psz_target )
{
vlc_add_target_r( p_plugin->p_vlc, p_plugin->psz_target,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
p_plugin->b_stream = 1;
}
vlc_play_r( p_plugin->p_vlc );
VLC_Play( p_plugin->i_vlc );
}
return NS_OK;
}
......@@ -84,7 +84,7 @@ NS_IMETHODIMP VlcPeer::Pause()
{
if( p_plugin )
{
vlc_pause_r( p_plugin->p_vlc );
VLC_Pause( p_plugin->i_vlc );
}
return NS_OK;
}
......@@ -93,7 +93,7 @@ NS_IMETHODIMP VlcPeer::Stop()
{
if( p_plugin )
{
vlc_stop_r( p_plugin->p_vlc );
VLC_Stop( p_plugin->i_vlc );
p_plugin->b_stream = 0;
}
return NS_OK;
......@@ -103,7 +103,7 @@ NS_IMETHODIMP VlcPeer::Fullscreen()
{
if( p_plugin )
{
vlc_fullscreen_r( p_plugin->p_vlc );
VLC_FullScreen( p_plugin->i_vlc );
}
return NS_OK;
}
......
......@@ -2,7 +2,7 @@
* vlcplugin.h: a VideoLAN plugin for Mozilla
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlcplugin.h,v 1.4 2002/09/30 11:05:41 sam Exp $
* $Id: vlcplugin.h,v 1.5 2002/10/11 22:32:56 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -47,7 +47,7 @@ public:
uint32 width, height;
/* vlc data members */
vlc_t * p_vlc;
int i_vlc;
int b_stream;
int b_autoplay;
char * psz_target;
......@@ -64,7 +64,7 @@ private:
#define PLUGIN_DESCRIPTION \
"VideoLAN Client Multimedia Player Plugin <br>" \
" <br>" \
/*COPYRIGHT_MESSAGE*/ " <br>" \
"version %s <br>" \
"VideoLAN WWW: <a href=\"http://www.videolan.org/\">http://www.videolan.org/</a>"
#define PLUGIN_MIMETYPES \
......
......@@ -2,7 +2,7 @@
* vlcshell.c: a VideoLAN Client plugin for Mozilla
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlcshell.cpp,v 1.3 2002/10/03 18:56:09 sam Exp $
* $Id: vlcshell.cpp,v 1.4 2002/10/11 22:32:56 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -29,7 +29,6 @@
/* vlc stuff */
#include <vlc/vlc.h>
#include "config.h"
/* Mozilla stuff */
#include <npapi.h>
......@@ -88,6 +87,7 @@ char * NPP_GetMIMEDescription( void )
NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
{
static nsIID nsid = VLCINTF_IID;
static char psz_desc[1000];
switch( variable )
{
......@@ -96,8 +96,14 @@ NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
return NPERR_NO_ERROR;
case NPPVpluginDescriptionString:
*((char **)value) = PLUGIN_DESCRIPTION;
snprintf( psz_desc, 1000-1, PLUGIN_DESCRIPTION, VLC_Version() );
psz_desc[1000-1] = 0;
*((char **)value) = psz_desc;
return NPERR_NO_ERROR;
default:
/* go on... */
break;
}
if( instance == NULL )
......@@ -154,6 +160,7 @@ void NPP_Shutdown( void )
NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
char* argn[], char* argv[], NPSavedData* saved )
{
vlc_value_t value;
int i_ret;
int i;
......@@ -185,26 +192,29 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
p_plugin->fWindow = NULL;
p_plugin->window = 0;
p_plugin->p_vlc = vlc_create_r();
if( p_plugin->p_vlc == NULL )
p_plugin->i_vlc = VLC_Create();
if( p_plugin->i_vlc < 0 )
{
p_plugin->i_vlc = 0;
delete p_plugin;
p_plugin = NULL;
return NPERR_GENERIC_ERROR;
}
i_ret = vlc_init_r( p_plugin->p_vlc, sizeof(ppsz_foo)/sizeof(char*), ppsz_foo );
i_ret = VLC_Init( p_plugin->i_vlc, sizeof(ppsz_foo)/sizeof(char*), ppsz_foo );
if( i_ret )
{
vlc_destroy_r( p_plugin->p_vlc );
p_plugin->p_vlc = NULL;
VLC_Destroy( p_plugin->i_vlc );
p_plugin->i_vlc = 0;
delete p_plugin;
p_plugin = NULL;
return NPERR_GENERIC_ERROR;
}
vlc_set_r( p_plugin->p_vlc, "vout", "xvideo,x11,dummy" );
vlc_set_r( p_plugin->p_vlc, "intf", "dummy" );
value.psz_string = "xvideo,x11,dummy";
VLC_Set( p_plugin->i_vlc, "conf::vout", value );
value.psz_string = "dummy";
VLC_Set( p_plugin->i_vlc, "conf::intf", value );
p_plugin->b_stream = 0;
p_plugin->b_autoplay = 0;
......@@ -227,7 +237,8 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
{
if( !strcmp( argv[i], "yes" ) )
{
vlc_set_r( p_plugin->p_vlc, "loop", "1" );
value.b_bool = VLC_TRUE;
VLC_Set( p_plugin->i_vlc, "conf::loop", value );
}
}
}
......@@ -251,11 +262,11 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save )
if( p_plugin != NULL )
{
if( p_plugin->p_vlc != NULL )
if( p_plugin->i_vlc )
{
vlc_stop_r( p_plugin->p_vlc );
vlc_destroy_r( p_plugin->p_vlc );
p_plugin->p_vlc = NULL;
VLC_Stop( p_plugin->i_vlc );
VLC_Destroy( p_plugin->i_vlc );
p_plugin->i_vlc = 0;
}
if( p_plugin->psz_target )
......@@ -274,7 +285,7 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save )
NPError NPP_SetWindow( NPP instance, NPWindow* window )
{
char psz_window[32];
vlc_value_t value;
if( instance == NULL )
{
......@@ -284,9 +295,8 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
VlcPlugin* p_plugin = (VlcPlugin*)instance->pdata;
/* Write the window ID for vlc */
sprintf( psz_window, "%li", (long int)window->window );
vlc_set_r( p_plugin->p_vlc, "x11-drawable", psz_window );
vlc_set_r( p_plugin->p_vlc, "xvideo-drawable", psz_window );
value.p_address = (void*)window->window;
VLC_Set( p_plugin->i_vlc, "drawable", value );
/*
* PLUGIN DEVELOPERS:
......@@ -323,8 +333,8 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
if( p_plugin->psz_target )
{
vlc_add_target_r( p_plugin->p_vlc, p_plugin->psz_target,
i_mode, PLAYLIST_END );
VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target,
i_mode, PLAYLIST_END );
p_plugin->b_stream = 1;
}
}
......@@ -422,8 +432,8 @@ void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname )
VlcPlugin* p_plugin = (VlcPlugin*)instance->pdata;
fprintf(stderr, "NPP_StreamAsFile\n");
vlc_add_target_r( p_plugin->p_vlc, fname,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
VLC_AddTarget( p_plugin->i_vlc, fname,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
}
#if 0
......
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