Commit 464bd2e5 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 37741cf8
...@@ -171,6 +171,7 @@ HEADERS_include = \ ...@@ -171,6 +171,7 @@ HEADERS_include = \
include/os_specific.h \ include/os_specific.h \
include/stream_control.h \ include/stream_control.h \
include/stream_output.h \ include/stream_output.h \
include/variables.h \
include/video.h \ include/video.h \
include/video_output.h \ include/video_output.h \
include/vlc_common.h \ include/vlc_common.h \
...@@ -334,6 +335,7 @@ SOURCES_libvlc = \ ...@@ -334,6 +335,7 @@ SOURCES_libvlc = \
src/misc/iso-639.def \ src/misc/iso-639.def \
src/misc/messages.c \ src/misc/messages.c \
src/misc/objects.c \ src/misc/objects.c \
src/misc/variables.c \
src/misc/extras.c \ src/misc/extras.c \
$(SOURCES_libvlc_win32) \ $(SOURCES_libvlc_win32) \
$(SOURCES_libvlc_beos) \ $(SOURCES_libvlc_beos) \
......
...@@ -2126,7 +2126,7 @@ then ...@@ -2126,7 +2126,7 @@ then
dnl this one is needed until automake knows what to do dnl this one is needed until automake knows what to do
LDFLAGS_test3="${LDFLAGS_test3} -lobjc" LDFLAGS_test3="${LDFLAGS_test3} -lobjc"
PLUGINS="${PLUGINS} ${TESTS}" PLUGINS="${PLUGINS} ${TESTS}"
BUILTINS="${BUILTINS} ${TESTS}" #BUILTINS="${BUILTINS} ${TESTS}"
fi fi
dnl dnl
...@@ -2200,7 +2200,7 @@ dnl do not touch this line (bootstrap needs it) ...@@ -2200,7 +2200,7 @@ dnl do not touch this line (bootstrap needs it)
dnl dnl
dnl Stuff used by the program dnl Stuff used by the program
dnl dnl
AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "vlc ${VERSION} ${CODENAME} Copyright 1996-2002 VideoLAN", [Simple version string]) AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version string])
AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VideoLAN Client - version ${VERSION} ${CODENAME} - (c) 1996-2002 VideoLAN", [Copyright string]) AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VideoLAN Client - version ${VERSION} ${CODENAME} - (c) 1996-2002 VideoLAN", [Copyright string])
AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line]) AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* interface, such as message output. * interface, such as message output.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: interface.h,v 1.35 2002/10/04 12:01:40 gbazin Exp $ * $Id: interface.h,v 1.36 2002/10/11 22:32:55 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -55,7 +55,7 @@ struct intf_thread_t ...@@ -55,7 +55,7 @@ struct intf_thread_t
*****************************************************************************/ *****************************************************************************/
#define intf_Create(a) __intf_Create(VLC_OBJECT(a)) #define intf_Create(a) __intf_Create(VLC_OBJECT(a))
VLC_EXPORT( intf_thread_t *, __intf_Create, ( vlc_object_t * ) ); VLC_EXPORT( intf_thread_t *, __intf_Create, ( vlc_object_t * ) );
VLC_EXPORT( vlc_error_t, intf_RunThread, ( intf_thread_t * ) ); VLC_EXPORT( int, intf_RunThread, ( intf_thread_t * ) );
VLC_EXPORT( void, intf_StopThread, ( intf_thread_t * ) ); VLC_EXPORT( void, intf_StopThread, ( intf_thread_t * ) );
VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) ); VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) );
...@@ -68,7 +68,7 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) ); ...@@ -68,7 +68,7 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) );
freopen( "CONOUT$", "w", stdout ); \ freopen( "CONOUT$", "w", stdout ); \
freopen( "CONOUT$", "w", stderr ); \ freopen( "CONOUT$", "w", stderr ); \
freopen( "CONIN$", "r", stdin ); \ freopen( "CONIN$", "r", stdin ); \
msg_Info( p_intf, VERSION_MESSAGE ); \ msg_Info( p_intf, COPYRIGHT_MESSAGE ); \
msg_Info( p_intf, _("\nWarning: if you can't access the GUI " \ msg_Info( p_intf, _("\nWarning: if you can't access the GUI " \
"anymore, open a dos command box, go to the " \ "anymore, open a dos command box, go to the " \
"directory where you installed VLC and run " \ "directory where you installed VLC and run " \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlc.h: global header for vlc * vlc.h: global header for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc.h,v 1.14 2002/09/29 18:19:53 sam Exp $ * $Id: vlc.h,v 1.15 2002/10/11 22:32:56 sam Exp $
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -29,13 +29,20 @@ extern "C" { ...@@ -29,13 +29,20 @@ extern "C" {
/***************************************************************************** /*****************************************************************************
* Our custom types * Our custom types
*****************************************************************************/ *****************************************************************************/
typedef struct vlc_t vlc_t;
typedef struct vlc_list_t vlc_list_t;
typedef struct vlc_object_t vlc_object_t;
typedef signed int vlc_error_t;
typedef int vlc_bool_t; typedef int vlc_bool_t;
typedef int vlc_status_t;
typedef union
{
int i_int;
vlc_bool_t b_bool;
float f_float;
char * psz_string;
void * p_address;
/* Use this to make sure the structure is at least 64bits */
struct { char a, b, c, d, e, f, g, h; } padding;
} vlc_value_t;
/***************************************************************************** /*****************************************************************************
* Error values * Error values
...@@ -46,6 +53,7 @@ typedef int vlc_status_t; ...@@ -46,6 +53,7 @@ typedef int vlc_status_t;
#define VLC_ESTATUS -3 /* Invalid status */ #define VLC_ESTATUS -3 /* Invalid status */
#define VLC_ETHREAD -4 /* Could not spawn thread */ #define VLC_ETHREAD -4 /* Could not spawn thread */
#define VLC_EOBJECT -5 /* Object not found */ #define VLC_EOBJECT -5 /* Object not found */
#define VLC_EVAR -6 /* Variable not found */
#define VLC_EEXIT -255 /* Program exited */ #define VLC_EEXIT -255 /* Program exited */
#define VLC_EGENERIC -666 /* Generic error */ #define VLC_EGENERIC -666 /* Generic error */
...@@ -102,40 +110,22 @@ typedef int vlc_status_t; ...@@ -102,40 +110,22 @@ typedef int vlc_status_t;
/***************************************************************************** /*****************************************************************************
* Exported libvlc API * Exported libvlc API
*****************************************************************************/ *****************************************************************************/
vlc_status_t vlc_status ( void ); char * VLC_Version ( void );
vlc_error_t vlc_create ( void ); int VLC_Create ( void );
vlc_error_t vlc_init ( int, char *[] ); int VLC_Init ( int, int, char *[] );
vlc_error_t vlc_die ( void ); int VLC_Die ( int );
vlc_error_t vlc_destroy ( void ); int VLC_Destroy ( int );
vlc_error_t vlc_set ( const char *, const char * ); int VLC_Set ( int, const char *, vlc_value_t );
vlc_error_t vlc_add_intf ( const char *, vlc_bool_t ); int VLC_Get ( int, const char *, vlc_value_t * );
vlc_error_t vlc_add_target ( const char *, int, int ); int VLC_AddIntf ( int, const char *, vlc_bool_t );
int VLC_AddTarget ( int, const char *, int, int );
vlc_error_t vlc_play ( );
vlc_error_t vlc_pause ( ); int VLC_Play ( int );
vlc_error_t vlc_stop ( void ); int VLC_Pause ( int );
vlc_error_t vlc_fullscreen ( ); int VLC_Stop ( int );
int VLC_FullScreen ( int );
/*****************************************************************************
* Exported libvlc reentrant API
*****************************************************************************/
vlc_status_t vlc_status_r ( vlc_t * );
vlc_t * vlc_create_r ( void );
vlc_error_t vlc_init_r ( vlc_t *, int, char *[] );
vlc_error_t vlc_die_r ( vlc_t * );
vlc_error_t vlc_destroy_r ( vlc_t * );
vlc_error_t vlc_set_r ( vlc_t *, const char *, const char * );
vlc_error_t vlc_add_intf_r ( vlc_t *, const char *, vlc_bool_t );
vlc_error_t vlc_add_target_r ( vlc_t *, const char *, int, int );
vlc_error_t vlc_play_r ( vlc_t * );
vlc_error_t vlc_pause_r ( vlc_t * );
vlc_error_t vlc_stop_r ( vlc_t * );
vlc_error_t vlc_fullscreen_r ( vlc_t * );
# ifdef __cplusplus # ifdef __cplusplus
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.28 2002/10/03 13:21:54 sam Exp $ * $Id: vlc_common.h,v 1.29 2002/10/11 22:32:55 sam Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -156,6 +156,10 @@ typedef u32 vlc_fourcc_t; ...@@ -156,6 +156,10 @@ typedef u32 vlc_fourcc_t;
/* Internal types */ /* Internal types */
typedef struct libvlc_t libvlc_t; typedef struct libvlc_t libvlc_t;
typedef struct vlc_t vlc_t;
typedef struct vlc_list_t vlc_list_t;
typedef struct vlc_object_t vlc_object_t;
typedef struct variable_t variable_t;
/* Messages */ /* Messages */
typedef struct msg_bank_t msg_bank_t; typedef struct msg_bank_t msg_bank_t;
...@@ -271,11 +275,18 @@ typedef struct iso639_lang_t iso639_lang_t; ...@@ -271,11 +275,18 @@ typedef struct iso639_lang_t iso639_lang_t;
vlc_mutex_t object_lock; \ vlc_mutex_t object_lock; \
vlc_cond_t object_wait; \ vlc_cond_t object_wait; \
\ \
/* Object properties */ \
volatile vlc_bool_t b_error; /* set by the object */ \ volatile vlc_bool_t b_error; /* set by the object */ \
volatile vlc_bool_t b_die; /* set by the outside */ \ volatile vlc_bool_t b_die; /* set by the outside */ \
volatile vlc_bool_t b_dead; /* set by the object */ \ volatile vlc_bool_t b_dead; /* set by the object */ \
volatile vlc_bool_t b_attached; /* set by the object */ \ volatile vlc_bool_t b_attached; /* set by the object */ \
\ \
/* Object variables */ \
vlc_mutex_t var_lock; \
int i_vars; \
variable_t * p_vars; \
\
/* Stuff related to the libvlc structure */ \
libvlc_t * p_libvlc; /* root of all evil */ \ libvlc_t * p_libvlc; /* root of all evil */ \
vlc_t * p_vlc; /* (root of all evil) - 1 */ \ vlc_t * p_vlc; /* (root of all evil) - 1 */ \
\ \
...@@ -290,23 +301,6 @@ typedef struct iso639_lang_t iso639_lang_t; ...@@ -290,23 +301,6 @@ typedef struct iso639_lang_t iso639_lang_t;
/* Just a reminder so that people don't cast garbage */ \ /* Just a reminder so that people don't cast garbage */ \
int be_sure_to_add_VLC_COMMON_MEMBERS_to_struct; \ int be_sure_to_add_VLC_COMMON_MEMBERS_to_struct; \
/* The real vlc_object_t type. Yes, it's that simple :-) */
struct vlc_object_t
{
VLC_COMMON_MEMBERS
};
/* The object list */
struct vlc_list_t
{
int i_count;
vlc_object_t ** pp_objects;
/* Private */
int _i_extra;
vlc_object_t * _p_first;
};
/* VLC_OBJECT: attempt at doing a clever cast */ /* VLC_OBJECT: attempt at doing a clever cast */
#define VLC_OBJECT( x ) \ #define VLC_OBJECT( x ) \
((vlc_object_t *)(x))+0*(x)->be_sure_to_add_VLC_COMMON_MEMBERS_to_struct ((vlc_object_t *)(x))+0*(x)->be_sure_to_add_VLC_COMMON_MEMBERS_to_struct
...@@ -508,12 +502,13 @@ typedef __int64 off_t; ...@@ -508,12 +502,13 @@ typedef __int64 off_t;
#include "vlc_symbols.h" #include "vlc_symbols.h"
#include "os_specific.h" #include "os_specific.h"
#include "vlc_messages.h" #include "vlc_messages.h"
#include "variables.h"
#include "vlc_objects.h"
#include "vlc_threads_funcs.h" #include "vlc_threads_funcs.h"
#include "mtime.h" #include "mtime.h"
#include "modules.h" #include "modules.h"
#include "main.h" #include "main.h"
#include "configuration.h" #include "configuration.h"
#include "vlc_objects.h"
#if defined( __BORLANDC__ ) #if defined( __BORLANDC__ )
# undef PACKAGE # undef PACKAGE
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlc_objects.h: vlc_object_t definition. * vlc_objects.h: vlc_object_t definition.
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: vlc_objects.h,v 1.11 2002/10/03 13:21:54 sam Exp $ * $Id: vlc_objects.h,v 1.12 2002/10/11 22:32:55 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -42,6 +42,27 @@ ...@@ -42,6 +42,27 @@
#define FIND_STRICT 0x0010 #define FIND_STRICT 0x0010
/*****************************************************************************
* The vlc_object_t type. Yes, it's that simple :-)
*****************************************************************************/
struct vlc_object_t
{
VLC_COMMON_MEMBERS
};
/*****************************************************************************
* The vlc_list_t object list type
*****************************************************************************/
struct vlc_list_t
{
int i_count;
vlc_object_t ** pp_objects;
/* Private */
int _i_extra;
vlc_object_t * _p_first;
};
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -49,6 +70,7 @@ VLC_EXPORT( void *, __vlc_object_create, ( vlc_object_t *, int ) ); ...@@ -49,6 +70,7 @@ VLC_EXPORT( void *, __vlc_object_create, ( vlc_object_t *, int ) );
VLC_EXPORT( void, __vlc_object_destroy, ( vlc_object_t * ) ); VLC_EXPORT( void, __vlc_object_destroy, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) ); VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_detach, ( vlc_object_t * ) ); VLC_EXPORT( void, __vlc_object_detach, ( vlc_object_t * ) );
VLC_EXPORT( void *, __vlc_object_get, ( vlc_object_t *, int ) );
VLC_EXPORT( void *, __vlc_object_find, ( vlc_object_t *, int, int ) ); VLC_EXPORT( void *, __vlc_object_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( void, __vlc_object_yield, ( vlc_object_t * ) ); VLC_EXPORT( void, __vlc_object_yield, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_release, ( vlc_object_t * ) ); VLC_EXPORT( void, __vlc_object_release, ( vlc_object_t * ) );
...@@ -71,6 +93,9 @@ VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) ); ...@@ -71,6 +93,9 @@ VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) );
#define vlc_object_attach(a,b) \ #define vlc_object_attach(a,b) \
__vlc_object_attach( VLC_OBJECT(a), VLC_OBJECT(b) ) __vlc_object_attach( VLC_OBJECT(a), VLC_OBJECT(b) )
#define vlc_object_get(a,b) \
__vlc_object_get( VLC_OBJECT(a),b)
#define vlc_object_find(a,b,c) \ #define vlc_object_find(a,b,c) \
__vlc_object_find( VLC_OBJECT(a),b,c) __vlc_object_find( VLC_OBJECT(a),b,c)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* rc.c : remote control stdin/stdout plugin for vlc * rc.c : remote control stdin/stdout plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: rc.c,v 1.7 2002/10/03 17:01:59 gbazin Exp $ * $Id: rc.c,v 1.8 2002/10/11 22:32:56 sam Exp $
* *
* Authors: Peter Surda <shurdeek@panorama.sth.ac.at> * Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
* *
...@@ -69,7 +69,9 @@ static void Run ( intf_thread_t *p_intf ); ...@@ -69,7 +69,9 @@ static void Run ( intf_thread_t *p_intf );
vlc_module_begin(); vlc_module_begin();
add_category_hint( N_("Remote control"), NULL ); add_category_hint( N_("Remote control"), NULL );
add_bool( "rc-show-pos", 0, NULL, POS_TEXT, POS_LONGTEXT ); add_bool( "rc-show-pos", 0, NULL, POS_TEXT, POS_LONGTEXT );
#ifdef HAVE_ISATTY
add_bool( "fake-tty", 0, NULL, TTY_TEXT, TTY_LONGTEXT ); add_bool( "fake-tty", 0, NULL, TTY_TEXT, TTY_LONGTEXT );
#endif
set_description( _("remote control interface module") ); set_description( _("remote control interface module") );
set_capability( "interface", 20 ); set_capability( "interface", 20 );
set_callbacks( Activate, NULL ); set_callbacks( Activate, NULL );
...@@ -130,6 +132,9 @@ static void Run( intf_thread_t *p_intf ) ...@@ -130,6 +132,9 @@ static void Run( intf_thread_t *p_intf )
p_input = NULL; p_input = NULL;
p_playlist = NULL; p_playlist = NULL;
var_Create( p_intf, "foo", VLC_VAR_STRING );
var_Set( p_intf, "foo", (vlc_value_t)"test" );
while( !p_intf->b_die ) while( !p_intf->b_die )
{ {
b_complete = 0; b_complete = 0;
...@@ -213,7 +218,6 @@ static void Run( intf_thread_t *p_intf ) ...@@ -213,7 +218,6 @@ static void Run( intf_thread_t *p_intf )
if( b_complete == 1 ) if( b_complete == 1 )
{ {
char *p_cmd = p_buffer; char *p_cmd = p_buffer;
char *p_tmp;
if( !strcmp( p_cmd, "quit" ) ) if( !strcmp( p_cmd, "quit" ) )
{ {
...@@ -251,13 +255,17 @@ static void Run( intf_thread_t *p_intf ) ...@@ -251,13 +255,17 @@ static void Run( intf_thread_t *p_intf )
{ {
vlc_liststructure( p_intf->p_vlc ); vlc_liststructure( p_intf->p_vlc );
} }
else if( !strncmp( p_cmd, "set ", 4 ) ) else if( !strncmp( p_cmd, "setfoo ", 7 ) )
{ {
// vlc_set_r( p_intf->p_vlc, p_cmd + 4, strstr( p_cmd + 4, " " ) ); vlc_value_t value;
p_tmp = strstr( p_cmd + 4, " " ); value.psz_string = p_cmd + 7;
p_tmp[0] = '\0'; var_Set( p_intf, "foo", value );
config_PutPsz( p_intf->p_vlc, p_cmd + 4, p_tmp + 1 ); }
config_PutInt( p_intf->p_vlc, p_cmd + 4, atoi(p_tmp + 1) ); else if( !strncmp( p_cmd, "getfoo", 6 ) )
{
vlc_value_t value;
var_Get( p_intf, "foo", &value );
printf( "current value is '%s'\n", value.psz_string );
} }
else if( !strncmp( p_cmd, "intf ", 5 ) ) else if( !strncmp( p_cmd, "intf ", 5 ) )
{ {
...@@ -391,8 +399,6 @@ static void Run( intf_thread_t *p_intf ) ...@@ -391,8 +399,6 @@ static void Run( intf_thread_t *p_intf )
break; break;
} }
} }
msleep( INTF_IDLE_SLEEP );
} }
if( p_input ) if( p_input )
...@@ -406,5 +412,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -406,5 +412,7 @@ static void Run( intf_thread_t *p_intf )
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
p_playlist = NULL; p_playlist = NULL;
} }
var_Destroy( p_intf, "foo" );
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlcpeer.cpp: scriptable peer descriptor * vlcpeer.cpp: scriptable peer descriptor
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -70,12 +70,12 @@ NS_IMETHODIMP VlcPeer::Play() ...@@ -70,12 +70,12 @@ NS_IMETHODIMP VlcPeer::Play()
{ {
if( !p_plugin->b_stream && p_plugin->psz_target ) if( !p_plugin->b_stream && p_plugin->psz_target )
{ {
vlc_add_target_r( p_plugin->p_vlc, p_plugin->psz_target, VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
p_plugin->b_stream = 1; p_plugin->b_stream = 1;
} }
vlc_play_r( p_plugin->p_vlc ); VLC_Play( p_plugin->i_vlc );
} }
return NS_OK; return NS_OK;
} }
...@@ -84,7 +84,7 @@ NS_IMETHODIMP VlcPeer::Pause() ...@@ -84,7 +84,7 @@ NS_IMETHODIMP VlcPeer::Pause()
{ {
if( p_plugin ) if( p_plugin )
{ {
vlc_pause_r( p_plugin->p_vlc ); VLC_Pause( p_plugin->i_vlc );
} }
return NS_OK; return NS_OK;
} }
...@@ -93,7 +93,7 @@ NS_IMETHODIMP VlcPeer::Stop() ...@@ -93,7 +93,7 @@ NS_IMETHODIMP VlcPeer::Stop()
{ {
if( p_plugin ) if( p_plugin )
{ {
vlc_stop_r( p_plugin->p_vlc ); VLC_Stop( p_plugin->i_vlc );
p_plugin->b_stream = 0; p_plugin->b_stream = 0;
} }
return NS_OK; return NS_OK;
...@@ -103,7 +103,7 @@ NS_IMETHODIMP VlcPeer::Fullscreen() ...@@ -103,7 +103,7 @@ NS_IMETHODIMP VlcPeer::Fullscreen()
{ {
if( p_plugin ) if( p_plugin )
{ {
vlc_fullscreen_r( p_plugin->p_vlc ); VLC_FullScreen( p_plugin->i_vlc );
} }
return NS_OK; return NS_OK;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlcplugin.h: a VideoLAN plugin for Mozilla * vlcplugin.h: a VideoLAN plugin for Mozilla
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -47,7 +47,7 @@ public: ...@@ -47,7 +47,7 @@ public:
uint32 width, height; uint32 width, height;
/* vlc data members */ /* vlc data members */
vlc_t * p_vlc; int i_vlc;
int b_stream; int b_stream;
int b_autoplay; int b_autoplay;
char * psz_target; char * psz_target;
...@@ -64,7 +64,7 @@ private: ...@@ -64,7 +64,7 @@ private:
#define PLUGIN_DESCRIPTION \ #define PLUGIN_DESCRIPTION \
"VideoLAN Client Multimedia Player Plugin <br>" \ "VideoLAN Client Multimedia Player Plugin <br>" \
" <br>" \ " <br>" \
/*COPYRIGHT_MESSAGE*/ " <br>" \ "version %s <br>" \
"VideoLAN WWW: <a href=\"http://www.videolan.org/\">http://www.videolan.org/</a>" "VideoLAN WWW: <a href=\"http://www.videolan.org/\">http://www.videolan.org/</a>"
#define PLUGIN_MIMETYPES \ #define PLUGIN_MIMETYPES \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlcshell.c: a VideoLAN Client plugin for Mozilla * vlcshell.c: a VideoLAN Client plugin for Mozilla
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
/* vlc stuff */ /* vlc stuff */
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include "config.h"
/* Mozilla stuff */ /* Mozilla stuff */
#include <npapi.h> #include <npapi.h>
...@@ -88,6 +87,7 @@ char * NPP_GetMIMEDescription( void ) ...@@ -88,6 +87,7 @@ char * NPP_GetMIMEDescription( void )
NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value ) NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
{ {
static nsIID nsid = VLCINTF_IID; static nsIID nsid = VLCINTF_IID;
static char psz_desc[1000];
switch( variable ) switch( variable )
{ {
...@@ -96,8 +96,14 @@ NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value ) ...@@ -96,8 +96,14 @@ NPError NPP_GetValue( NPP instance, NPPVariable variable, void *value )
return NPERR_NO_ERROR; return NPERR_NO_ERROR;
case NPPVpluginDescriptionString: 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; return NPERR_NO_ERROR;
default:
/* go on... */
break;
} }
if( instance == NULL ) if( instance == NULL )
...@@ -154,6 +160,7 @@ void NPP_Shutdown( void ) ...@@ -154,6 +160,7 @@ void NPP_Shutdown( void )
NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
char* argn[], char* argv[], NPSavedData* saved ) char* argn[], char* argv[], NPSavedData* saved )
{ {
vlc_value_t value;
int i_ret; int i_ret;
int i; int i;
...@@ -185,26 +192,29 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ...@@ -185,26 +192,29 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
p_plugin->fWindow = NULL; p_plugin->fWindow = NULL;
p_plugin->window = 0; p_plugin->window = 0;
p_plugin->p_vlc = vlc_create_r(); p_plugin->i_vlc = VLC_Create();
if( p_plugin->p_vlc == NULL ) if( p_plugin->i_vlc < 0 )
{ {
p_plugin->i_vlc = 0;
delete p_plugin; delete p_plugin;
p_plugin = NULL; p_plugin = NULL;
return NPERR_GENERIC_ERROR; 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 ) if( i_ret )
{ {
vlc_destroy_r( p_plugin->p_vlc ); VLC_Destroy( p_plugin->i_vlc );
p_plugin->p_vlc = NULL; p_plugin->i_vlc = 0;
delete p_plugin; delete p_plugin;
p_plugin = NULL; p_plugin = NULL;
return NPERR_GENERIC_ERROR; return NPERR_GENERIC_ERROR;
} }
vlc_set_r( p_plugin->p_vlc, "vout", "xvideo,x11,dummy" ); value.psz_string = "xvideo,x11,dummy";
vlc_set_r( p_plugin->p_vlc, "intf", "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_stream = 0;
p_plugin->b_autoplay = 0; p_plugin->b_autoplay = 0;
...@@ -227,7 +237,8 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ...@@ -227,7 +237,8 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
{ {
if( !strcmp( argv[i], "yes" ) ) 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 ) ...@@ -251,11 +262,11 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save )
if( p_plugin != NULL ) if( p_plugin != NULL )
{ {
if( p_plugin->p_vlc != NULL ) if( p_plugin->i_vlc )
{ {
vlc_stop_r( p_plugin->p_vlc ); VLC_Stop( p_plugin->i_vlc );
vlc_destroy_r( p_plugin->p_vlc ); VLC_Destroy( p_plugin->i_vlc );
p_plugin->p_vlc = NULL; p_plugin->i_vlc = 0;
} }
if( p_plugin->psz_target ) if( p_plugin->psz_target )
...@@ -274,7 +285,7 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save ) ...@@ -274,7 +285,7 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save )
NPError NPP_SetWindow( NPP instance, NPWindow* window ) NPError NPP_SetWindow( NPP instance, NPWindow* window )
{ {
char psz_window[32]; vlc_value_t value;
if( instance == NULL ) if( instance == NULL )
{ {
...@@ -284,9 +295,8 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window ) ...@@ -284,9 +295,8 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
VlcPlugin* p_plugin = (VlcPlugin*)instance->pdata; VlcPlugin* p_plugin = (VlcPlugin*)instance->pdata;
/* Write the window ID for vlc */ /* Write the window ID for vlc */
sprintf( psz_window, "%li", (long int)window->window ); value.p_address = (void*)window->window;
vlc_set_r( p_plugin->p_vlc, "x11-drawable", psz_window ); VLC_Set( p_plugin->i_vlc, "drawable", value );
vlc_set_r( p_plugin->p_vlc, "xvideo-drawable", psz_window );
/* /*
* PLUGIN DEVELOPERS: * PLUGIN DEVELOPERS:
...@@ -323,7 +333,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window ) ...@@ -323,7 +333,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
if( p_plugin->psz_target ) if( p_plugin->psz_target )
{ {
vlc_add_target_r( p_plugin->p_vlc, p_plugin->psz_target, VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target,
i_mode, PLAYLIST_END ); i_mode, PLAYLIST_END );
p_plugin->b_stream = 1; p_plugin->b_stream = 1;
} }
...@@ -422,7 +432,7 @@ void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname ) ...@@ -422,7 +432,7 @@ void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname )
VlcPlugin* p_plugin = (VlcPlugin*)instance->pdata; VlcPlugin* p_plugin = (VlcPlugin*)instance->pdata;
fprintf(stderr, "NPP_StreamAsFile\n"); fprintf(stderr, "NPP_StreamAsFile\n");
vlc_add_target_r( p_plugin->p_vlc, fname, VLC_AddTarget( p_plugin->i_vlc, fname,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* interface, such as command line. * interface, such as command line.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: interface.c,v 1.99 2002/08/29 23:53:22 massiot Exp $ * $Id: interface.c,v 1.100 2002/10/11 22:32:56 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -78,8 +78,8 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this ) ...@@ -78,8 +78,8 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this )
} }
/* Initialize structure */ /* Initialize structure */
p_intf->b_menu = 0; p_intf->b_menu = VLC_FALSE;
p_intf->b_menu_change = 0; p_intf->b_menu_change = VLC_FALSE;
/* Initialize mutexes */ /* Initialize mutexes */
vlc_mutex_init( p_intf, &p_intf->change_lock ); vlc_mutex_init( p_intf, &p_intf->change_lock );
...@@ -98,7 +98,7 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this ) ...@@ -98,7 +98,7 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this )
* This function either creates a new thread and runs the interface in it, * This function either creates a new thread and runs the interface in it,
* or runs the interface in the current thread, depending on b_block. * or runs the interface in the current thread, depending on b_block.
*****************************************************************************/ *****************************************************************************/
vlc_error_t intf_RunThread( intf_thread_t *p_intf ) int intf_RunThread( intf_thread_t *p_intf )
{ {
if( p_intf->b_block ) if( p_intf->b_block )
{ {
...@@ -112,7 +112,7 @@ vlc_error_t intf_RunThread( intf_thread_t *p_intf ) ...@@ -112,7 +112,7 @@ vlc_error_t intf_RunThread( intf_thread_t *p_intf )
p_intf->pf_run( p_intf ); p_intf->pf_run( p_intf );
p_intf->b_die = 1; p_intf->b_die = VLC_TRUE;
/* Do not join the thread... intf_StopThread will do it for us */ /* Do not join the thread... intf_StopThread will do it for us */
} }
...@@ -140,7 +140,7 @@ void intf_StopThread( intf_thread_t *p_intf ) ...@@ -140,7 +140,7 @@ void intf_StopThread( intf_thread_t *p_intf )
/* Tell the interface to die */ /* Tell the interface to die */
if( !p_intf->b_block ) if( !p_intf->b_block )
{ {
p_intf->b_die = 1; p_intf->b_die = VLC_TRUE;
} }
/* Wait for the thread to exit */ /* Wait for the thread to exit */
...@@ -180,7 +180,7 @@ static void Manager( intf_thread_t *p_intf ) ...@@ -180,7 +180,7 @@ static void Manager( intf_thread_t *p_intf )
if( p_intf->p_vlc->b_die ) if( p_intf->p_vlc->b_die )
{ {
p_intf->b_die = 1; p_intf->b_die = VLC_TRUE;
return; return;
} }
} }
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* objects.c: vlc_object_t handling * objects.c: vlc_object_t handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: objects.c,v 1.23 2002/10/04 18:07:22 sam Exp $ * $Id: objects.c,v 1.24 2002/10/11 22:32:56 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -141,12 +141,20 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type ) ...@@ -141,12 +141,20 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
p_new->psz_object_name = NULL; p_new->psz_object_name = NULL;
p_new->i_refcount = 0;
p_new->b_die = VLC_FALSE; p_new->b_die = VLC_FALSE;
p_new->b_error = VLC_FALSE; p_new->b_error = VLC_FALSE;
p_new->b_dead = VLC_FALSE; p_new->b_dead = VLC_FALSE;
p_new->b_attached = VLC_FALSE; p_new->b_attached = VLC_FALSE;
p_new->i_vars = 0;
p_new->p_vars = (variable_t *)malloc( 16 * sizeof( variable_t ) );
if( !p_new->p_vars )
{
free( p_new );
return NULL;
}
if( i_type == VLC_OBJECT_ROOT ) if( i_type == VLC_OBJECT_ROOT )
{ {
/* If i_type is root, then p_new is actually p_libvlc */ /* If i_type is root, then p_new is actually p_libvlc */
...@@ -183,6 +191,7 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type ) ...@@ -183,6 +191,7 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
vlc_mutex_unlock( &structure_lock ); vlc_mutex_unlock( &structure_lock );
} }
p_new->i_refcount = 0;
p_new->p_parent = NULL; p_new->p_parent = NULL;
p_new->pp_children = NULL; p_new->pp_children = NULL;
p_new->i_children = 0; p_new->i_children = 0;
...@@ -192,6 +201,7 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type ) ...@@ -192,6 +201,7 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
/* Initialize mutexes and condvars */ /* Initialize mutexes and condvars */
vlc_mutex_init( p_new, &p_new->object_lock ); vlc_mutex_init( p_new, &p_new->object_lock );
vlc_cond_init( p_new, &p_new->object_wait ); vlc_cond_init( p_new, &p_new->object_wait );
vlc_mutex_init( p_new, &p_new->var_lock );
if( i_type == VLC_OBJECT_ROOT ) if( i_type == VLC_OBJECT_ROOT )
{ {
...@@ -250,6 +260,16 @@ void __vlc_object_destroy( vlc_object_t *p_this ) ...@@ -250,6 +260,16 @@ void __vlc_object_destroy( vlc_object_t *p_this )
msleep( 100000 ); msleep( 100000 );
} }
/* Destroy the associated variables, starting from the end so that
* no memmove calls have to be done. */
while( p_this->i_vars )
{
var_Destroy( p_this, p_this->p_vars[p_this->i_vars - 1].psz_name );
}
free( p_this->p_vars );
vlc_mutex_destroy( &p_this->var_lock );
if( p_this->i_object_type == VLC_OBJECT_ROOT ) if( p_this->i_object_type == VLC_OBJECT_ROOT )
{ {
/* We are the root object ... no need to lock. */ /* We are the root object ... no need to lock. */
...@@ -288,6 +308,66 @@ void __vlc_object_destroy( vlc_object_t *p_this ) ...@@ -288,6 +308,66 @@ void __vlc_object_destroy( vlc_object_t *p_this )
free( p_this ); free( p_this );
} }
/*****************************************************************************
* vlc_object_get: find an object given its ID
*****************************************************************************
* This function looks for the object whose i_object_id field is i_id. We
* use a dichotomy so that lookups are in log2(n).
*****************************************************************************/
void * __vlc_object_get( vlc_object_t *p_this, int i_id )
{
int i_max, i_middle;
vlc_object_t **pp_objects;
vlc_mutex_lock( &structure_lock );
pp_objects = p_this->p_libvlc->pp_objects;
/* Perform our dichotomy */
for( i_max = p_this->p_libvlc->i_objects - 1 ; ; )
{
i_middle = i_max / 2;
if( pp_objects[i_middle]->i_object_id > i_id )
{
i_max = i_middle;
}
else if( pp_objects[i_middle]->i_object_id < i_id )
{
if( i_middle )
{
pp_objects += i_middle;
i_max -= i_middle;
}
else
{
/* This happens when there are only two remaining objects */
if( pp_objects[i_middle+1]->i_object_id == i_id )
{
vlc_mutex_unlock( &structure_lock );
return pp_objects[i_middle+1];
}
break;
}
}
else
{
vlc_mutex_unlock( &structure_lock );
return pp_objects[i_middle];
}
if( i_max == 0 )
{
/* this means that i_max == i_middle, and since we have already
* tested pp_objects[i_middle]), p_found is properly set. */
break;
}
}
vlc_mutex_unlock( &structure_lock );
return NULL;
}
/***************************************************************************** /*****************************************************************************
* vlc_object_find: find a typed object and increment its refcount * vlc_object_find: find a typed object and increment its refcount
***************************************************************************** *****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlc.c: the vlc player * vlc.c: the vlc player
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: vlc.c,v 1.13 2002/10/08 18:10:09 sam Exp $ * $Id: vlc.c,v 1.14 2002/10/11 22:32:56 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include "config.h"
/***************************************************************************** /*****************************************************************************
* Local prototypes. * Local prototypes.
*****************************************************************************/ *****************************************************************************/
...@@ -46,9 +44,9 @@ static void SigHandler ( int i_signal ); ...@@ -46,9 +44,9 @@ static void SigHandler ( int i_signal );
*****************************************************************************/ *****************************************************************************/
int main( int i_argc, char *ppsz_argv[] ) int main( int i_argc, char *ppsz_argv[] )
{ {
vlc_error_t err; int i_ret;
fprintf( stderr, COPYRIGHT_MESSAGE "\n" ); fprintf( stderr, "VideoLAN Client %s\n", VLC_Version() );
#ifdef HAVE_PUTENV #ifdef HAVE_PUTENV
# ifdef DEBUG # ifdef DEBUG
...@@ -67,10 +65,10 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -67,10 +65,10 @@ int main( int i_argc, char *ppsz_argv[] )
#endif #endif
/* Create a libvlc structure */ /* Create a libvlc structure */
err = vlc_create(); i_ret = VLC_Create();
if( err != VLC_SUCCESS ) if( i_ret < 0 )
{ {
return err; return i_ret;
} }
#ifndef WIN32 #ifndef WIN32
...@@ -88,37 +86,37 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -88,37 +86,37 @@ int main( int i_argc, char *ppsz_argv[] )
#endif #endif
/* Initialize libvlc */ /* Initialize libvlc */
err = vlc_init( i_argc, ppsz_argv ); i_ret = VLC_Init( 0, i_argc, ppsz_argv );
if( err != VLC_SUCCESS ) if( i_ret < 0 )
{ {
vlc_destroy(); VLC_Destroy( 0 );
return err; return i_ret;
} }
/* Run libvlc, in non-blocking mode */ /* Run libvlc, in non-blocking mode */
err = vlc_play(); i_ret = VLC_Play( 0 );
/* Add background interfaces */ /* Add background interfaces */
#if 0 #if 0
{ int i; for( i=10; i--; ) vlc_add_intf( NULL, "dummy", 0 ); } { int i; for( i=10; i--; ) VLC_AddIntf( 0, "dummy", 0 ); }
vlc_add_intf( NULL, "dummy", VLC_FALSE ); VLC_AddIntf( 0, "dummy", VLC_FALSE );
vlc_add_intf( NULL, "logger", VLC_FALSE ); VLC_AddIntf( 0, "logger", VLC_FALSE );
vlc_add_intf( NULL, "xosd", VLC_FALSE ); VLC_AddIntf( 0, "xosd", VLC_FALSE );
vlc_add_intf( NULL, "gtk", VLC_FALSE ); VLC_AddIntf( 0, "gtk", VLC_FALSE );
vlc_add_intf( NULL, "kde", VLC_FALSE ); VLC_AddIntf( 0, "kde", VLC_FALSE );
vlc_add_intf( "rc", VLC_FALSE ); VLC_AddIntf( 0, "rc", VLC_FALSE );
#endif #endif
/* Add a blocking interface and keep the return value */ /* Add a blocking interface and keep the return value */
err = vlc_add_intf( NULL, VLC_TRUE ); i_ret = VLC_AddIntf( 0, NULL, VLC_TRUE );
/* Finish the threads */ /* Finish the threads */
vlc_stop(); VLC_Stop( 0 );
/* Destroy the libvlc structure */ /* Destroy the libvlc structure */
vlc_destroy(); VLC_Destroy( 0 );
return err; return i_ret;
} }
#ifndef WIN32 #ifndef WIN32
...@@ -146,7 +144,7 @@ static void SigHandler( int i_signal ) ...@@ -146,7 +144,7 @@ static void SigHandler( int i_signal )
"again in case it gets stuck\n", i_signal ); "again in case it gets stuck\n", i_signal );
/* Acknowledge the signal received */ /* Acknowledge the signal received */
vlc_die(); VLC_Die( 0 );
} }
else if( time( NULL ) > abort_time + 2 ) else if( time( NULL ) > abort_time + 2 )
{ {
......
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