Changeset 464bd2e5b4a533b2b232b472390abd0bdab5b93d

Show
Ignore:
Timestamp:
12/10/02 00:32:56 (6 years ago)
Author:
Sam Hocevar <sam@videolan.org>
git-committer:
Sam Hocevar <sam@videolan.org> 1034375576 +0000
git-parent:

[37741cf811763f13a752a742431c6af2976863fa]

git-author:
Sam Hocevar <sam@videolan.org> 1034375576 +0000
Message:

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().
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Makefile.am

    r66bbe48 r464bd2e  
    172172    include/stream_control.h \ 
    173173    include/stream_output.h \ 
     174    include/variables.h \ 
    174175    include/video.h \ 
    175176    include/video_output.h \ 
     
    335336    src/misc/messages.c \ 
    336337    src/misc/objects.c \ 
     338    src/misc/variables.c \ 
    337339    src/misc/extras.c \ 
    338340    $(SOURCES_libvlc_win32) \ 
  • configure.ac.in

    rcc5919a r464bd2e  
    21272127  LDFLAGS_test3="${LDFLAGS_test3} -lobjc" 
    21282128  PLUGINS="${PLUGINS} ${TESTS}" 
    2129   BUILTINS="${BUILTINS} ${TESTS}" 
     2129  #BUILTINS="${BUILTINS} ${TESTS}" 
    21302130fi 
    21312131 
     
    22012201dnl  Stuff used by the program 
    22022202dnl 
    2203 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "vlc ${VERSION} ${CODENAME} Copyright 1996-2002 VideoLAN", [Simple version string]) 
     2203AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version string]) 
    22042204AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VideoLAN Client - version ${VERSION} ${CODENAME} - (c) 1996-2002 VideoLAN", [Copyright string]) 
    22052205AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line]) 
  • include/interface.h

    r80b1569 r464bd2e  
    55 ***************************************************************************** 
    66 * Copyright (C) 1999, 2000 VideoLAN 
    7  * $Id: interface.h,v 1.35 2002/10/04 12:01:40 gbazin Exp $ 
     7 * $Id: interface.h,v 1.36 2002/10/11 22:32:55 sam Exp $ 
    88 * 
    99 * Authors: Vincent Seguin <seguin@via.ecp.fr> 
     
    5656#define intf_Create(a) __intf_Create(VLC_OBJECT(a)) 
    5757VLC_EXPORT( intf_thread_t *, __intf_Create,     ( vlc_object_t * ) ); 
    58 VLC_EXPORT( vlc_error_t,       intf_RunThread,  ( intf_thread_t * ) ); 
     58VLC_EXPORT( int,               intf_RunThread,  ( intf_thread_t * ) ); 
    5959VLC_EXPORT( void,              intf_StopThread, ( intf_thread_t * ) ); 
    6060VLC_EXPORT( void,              intf_Destroy,    ( intf_thread_t * ) ); 
     
    6969         freopen( "CONOUT$", "w", stderr ); \ 
    7070         freopen( "CONIN$", "r", stdin ); \ 
    71          msg_Info( p_intf, VERSION_MESSAGE ); \ 
     71         msg_Info( p_intf, COPYRIGHT_MESSAGE ); \ 
    7272         msg_Info( p_intf, _("\nWarning: if you can't access the GUI " \ 
    7373                             "anymore, open a dos command box, go to the " \ 
  • include/vlc/vlc.h

    r1354358 r464bd2e  
    33 ***************************************************************************** 
    44 * Copyright (C) 1998, 1999, 2000 VideoLAN 
    5  * $Id: vlc.h,v 1.14 2002/09/29 18:19:53 sam Exp $ 
     5 * $Id: vlc.h,v 1.15 2002/10/11 22:32:56 sam Exp $ 
    66 * 
    77 * This program is free software; you can redistribute it and/or modify 
     
    3030 * Our custom types 
    3131 *****************************************************************************/ 
    32 typedef struct vlc_t vlc_t; 
    33 typedef struct vlc_list_t vlc_list_t; 
    34 typedef struct vlc_object_t vlc_object_t; 
     32typedef int vlc_bool_t; 
    3533 
    36 typedef signed int vlc_error_t; 
    37 typedef int        vlc_bool_t; 
    38 typedef int        vlc_status_t; 
     34typedef union 
     35
     36    int         i_int; 
     37    vlc_bool_t  b_bool; 
     38    float       f_float; 
     39    char *      psz_string; 
     40    void *      p_address; 
     41 
     42    /* Use this to make sure the structure is at least 64bits */ 
     43    struct { char a, b, c, d, e, f, g, h; } padding; 
     44 
     45} vlc_value_t; 
    3946 
    4047/***************************************************************************** 
     
    4754#define VLC_ETHREAD         -4                     /* Could not spawn thread */ 
    4855#define VLC_EOBJECT         -5                           /* Object not found */ 
     56#define VLC_EVAR            -6                         /* Variable not found */ 
    4957#define VLC_EEXIT         -255                             /* Program exited */ 
    5058#define VLC_EGENERIC      -666                              /* Generic error */ 
     
    103111 * Exported libvlc API 
    104112 *****************************************************************************/ 
    105 vlc_status_t    vlc_status       ( void ); 
     113char *  VLC_Version     ( void ); 
    106114 
    107 vlc_error_t     vlc_create       ( void ); 
    108 vlc_error_t     vlc_init         ( int, char *[] ); 
    109 vlc_error_t     vlc_die          ( void ); 
    110 vlc_error_t     vlc_destroy      ( void ); 
     115int     VLC_Create      ( void ); 
     116int     VLC_Init        ( int, int, char *[] ); 
     117int     VLC_Die         ( int ); 
     118int     VLC_Destroy     ( int ); 
    111119 
    112 vlc_error_t     vlc_set          ( const char *, const char * ); 
    113 vlc_error_t     vlc_add_intf     ( const char *, vlc_bool_t ); 
    114 vlc_error_t     vlc_add_target   ( const char *, int, int ); 
     120int     VLC_Set         ( int, const char *, vlc_value_t ); 
     121int     VLC_Get         ( int, const char *, vlc_value_t * ); 
     122int     VLC_AddIntf     ( int, const char *, vlc_bool_t ); 
     123int     VLC_AddTarget   ( int, const char *, int, int ); 
    115124 
    116 vlc_error_t     vlc_play         ( ); 
    117 vlc_error_t     vlc_pause        ( ); 
    118 vlc_error_t     vlc_stop         ( void ); 
    119 vlc_error_t     vlc_fullscreen   ( ); 
    120  
    121 /***************************************************************************** 
    122  * Exported libvlc reentrant API 
    123  *****************************************************************************/ 
    124 vlc_status_t    vlc_status_r     ( vlc_t * ); 
    125  
    126 vlc_t *         vlc_create_r     ( void ); 
    127 vlc_error_t     vlc_init_r       ( vlc_t *, int, char *[] ); 
    128 vlc_error_t     vlc_die_r        ( vlc_t * ); 
    129 vlc_error_t     vlc_destroy_r    ( vlc_t * ); 
    130  
    131 vlc_error_t     vlc_set_r        ( vlc_t *, const char *, const char * ); 
    132 vlc_error_t     vlc_add_intf_r   ( vlc_t *, const char *, vlc_bool_t ); 
    133 vlc_error_t     vlc_add_target_r ( vlc_t *, const char *, int, int ); 
    134  
    135 vlc_error_t     vlc_play_r       ( vlc_t * ); 
    136 vlc_error_t     vlc_pause_r      ( vlc_t * ); 
    137 vlc_error_t     vlc_stop_r       ( vlc_t * ); 
    138 vlc_error_t     vlc_fullscreen_r ( vlc_t * ); 
     125int     VLC_Play        ( int ); 
     126int     VLC_Pause       ( int ); 
     127int     VLC_Stop        ( int ); 
     128int     VLC_FullScreen  ( int ); 
    139129 
    140130# ifdef __cplusplus 
  • include/vlc_common.h

    r145b196 r464bd2e  
    44 ***************************************************************************** 
    55 * Copyright (C) 1998, 1999, 2000 VideoLAN 
    6  * $Id: vlc_common.h,v 1.28 2002/10/03 13:21:54 sam Exp $ 
     6 * $Id: vlc_common.h,v 1.29 2002/10/11 22:32:55 sam Exp $ 
    77 * 
    88 * Authors: Samuel Hocevar <sam@via.ecp.fr> 
     
    157157/* Internal types */ 
    158158typedef struct libvlc_t libvlc_t; 
     159typedef struct vlc_t vlc_t; 
     160typedef struct vlc_list_t vlc_list_t; 
     161typedef struct vlc_object_t vlc_object_t; 
     162typedef struct variable_t variable_t; 
    159163 
    160164/* Messages */ 
     
    272276    vlc_cond_t   object_wait;                                               \ 
    273277                                                                            \ 
     278    /* Object properties */                                                 \ 
    274279    volatile vlc_bool_t b_error;                    /* set by the object */ \ 
    275280    volatile vlc_bool_t b_die;                     /* set by the outside */ \ 
     
    277282    volatile vlc_bool_t b_attached;                 /* set by the object */ \ 
    278283                                                                            \ 
     284    /* Object variables */                                                  \ 
     285    vlc_mutex_t     var_lock;                                               \ 
     286    int             i_vars;                                                 \ 
     287    variable_t *    p_vars;                                                 \ 
     288                                                                            \ 
     289    /* Stuff related to the libvlc structure */                             \ 
    279290    libvlc_t *      p_libvlc;                        /* root of all evil */ \ 
    280291    vlc_t *         p_vlc;                     /* (root of all evil) - 1 */ \ 
     
    290301    /* Just a reminder so that people don't cast garbage */                 \ 
    291302    int be_sure_to_add_VLC_COMMON_MEMBERS_to_struct;                        \ 
    292  
    293 /* The real vlc_object_t type. Yes, it's that simple :-) */ 
    294 struct vlc_object_t 
    295 { 
    296     VLC_COMMON_MEMBERS 
    297 }; 
    298  
    299 /* The object list */ 
    300 struct vlc_list_t 
    301 { 
    302     int             i_count; 
    303     vlc_object_t ** pp_objects; 
    304  
    305     /* Private */ 
    306     int             _i_extra; 
    307     vlc_object_t *  _p_first; 
    308 };   
    309303 
    310304/* VLC_OBJECT: attempt at doing a clever cast */ 
     
    509503#include "os_specific.h" 
    510504#include "vlc_messages.h" 
     505#include "variables.h" 
     506#include "vlc_objects.h" 
    511507#include "vlc_threads_funcs.h" 
    512508#include "mtime.h" 
     
    514510#include "main.h" 
    515511#include "configuration.h" 
    516 #include "vlc_objects.h" 
    517512 
    518513#if defined( __BORLANDC__ ) 
  • include/vlc_objects.h

    r145b196 r464bd2e  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: vlc_objects.h,v 1.11 2002/10/03 13:21:54 sam Exp $ 
     5 * $Id: vlc_objects.h,v 1.12 2002/10/11 22:32:55 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    4444 
    4545/***************************************************************************** 
     46 * The vlc_object_t type. Yes, it's that simple :-) 
     47 *****************************************************************************/ 
     48struct vlc_object_t 
     49{ 
     50    VLC_COMMON_MEMBERS 
     51}; 
     52 
     53/***************************************************************************** 
     54 * The vlc_list_t object list type 
     55 *****************************************************************************/ 
     56struct vlc_list_t 
     57{ 
     58    int             i_count; 
     59    vlc_object_t ** pp_objects; 
     60 
     61    /* Private */ 
     62    int             _i_extra; 
     63    vlc_object_t *  _p_first; 
     64};   
     65 
     66/***************************************************************************** 
    4667 * Prototypes 
    4768 *****************************************************************************/ 
     
    5071VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) ); 
    5172VLC_EXPORT( void, __vlc_object_detach, ( vlc_object_t * ) ); 
     73VLC_EXPORT( void *, __vlc_object_get, ( vlc_object_t *, int ) ); 
    5274VLC_EXPORT( void *, __vlc_object_find, ( vlc_object_t *, int, int ) ); 
    5375VLC_EXPORT( void, __vlc_object_yield, ( vlc_object_t * ) ); 
     
    7294    __vlc_object_attach( VLC_OBJECT(a), VLC_OBJECT(b) ) 
    7395 
     96#define vlc_object_get(a,b) \ 
     97    __vlc_object_get( VLC_OBJECT(a),b) 
     98 
    7499#define vlc_object_find(a,b,c) \ 
    75100    __vlc_object_find( VLC_OBJECT(a),b,c) 
  • modules/control/rc/rc.c

    r6dafa41 r464bd2e  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: rc.c,v 1.7 2002/10/03 17:01:59 gbazin Exp $ 
     5 * $Id: rc.c,v 1.8 2002/10/11 22:32:56 sam Exp $ 
    66 * 
    77 * Authors: Peter Surda <shurdeek@panorama.sth.ac.at> 
     
    7070    add_category_hint( N_("Remote control"), NULL ); 
    7171    add_bool( "rc-show-pos", 0, NULL, POS_TEXT, POS_LONGTEXT ); 
     72#ifdef HAVE_ISATTY 
    7273    add_bool( "fake-tty", 0, NULL, TTY_TEXT, TTY_LONGTEXT ); 
     74#endif 
    7375    set_description( _("remote control interface module") ); 
    7476    set_capability( "interface", 20 ); 
     
    131133    p_playlist = NULL; 
    132134 
     135    var_Create( p_intf, "foo", VLC_VAR_STRING ); 
     136    var_Set( p_intf, "foo", (vlc_value_t)"test" ); 
     137 
    133138    while( !p_intf->b_die ) 
    134139    { 
     
    214219        { 
    215220            char *p_cmd = p_buffer; 
    216             char *p_tmp; 
    217221 
    218222            if( !strcmp( p_cmd, "quit" ) ) 
     
    252256                vlc_liststructure( p_intf->p_vlc ); 
    253257            } 
    254             else if( !strncmp( p_cmd, "set ", 4 ) ) 
    255             { 
    256 //                vlc_set_r( p_intf->p_vlc, p_cmd + 4, strstr( p_cmd + 4, " " ) ); 
    257                 p_tmp = strstr( p_cmd + 4, " " ); 
    258                 p_tmp[0] = '\0'; 
    259                 config_PutPsz( p_intf->p_vlc, p_cmd + 4, p_tmp + 1 ); 
    260                 config_PutInt( p_intf->p_vlc, p_cmd + 4, atoi(p_tmp + 1) ); 
     258            else if( !strncmp( p_cmd, "setfoo ", 7 ) ) 
     259            { 
     260                vlc_value_t value; 
     261                value.psz_string = p_cmd + 7; 
     262                var_Set( p_intf, "foo", value ); 
     263            } 
     264            else if( !strncmp( p_cmd, "getfoo", 6 ) ) 
     265            { 
     266                vlc_value_t value; 
     267                var_Get( p_intf, "foo", &value ); 
     268                printf( "current value is '%s'\n", value.psz_string ); 
    261269            } 
    262270            else if( !strncmp( p_cmd, "intf ", 5 ) ) 
     
    392400            } 
    393401        } 
    394  
    395         msleep( INTF_IDLE_SLEEP ); 
    396402    } 
    397403 
     
    407413        p_playlist = NULL; 
    408414    } 
     415 
     416    var_Destroy( p_intf, "foo" ); 
    409417} 
    410418 
  • mozilla/vlcpeer.cpp

    r2799d36 r464bd2e  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: vlcpeer.cpp,v 1.2 2002/09/30 11:05:41 sam Exp $ 
     5 * $Id: vlcpeer.cpp,v 1.3 2002/10/11 22:32:56 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    7171        if( !p_plugin->b_stream && p_plugin->psz_target ) 
    7272        { 
    73             vlc_add_target_r( p_plugin->p_vlc, p_plugin->psz_target, 
    74                               PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); 
     73            VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target, 
     74                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); 
    7575            p_plugin->b_stream = 1; 
    7676        } 
    7777 
    78         vlc_play_r( p_plugin->p_vlc ); 
     78        VLC_Play( p_plugin->i_vlc ); 
    7979    } 
    8080    return NS_OK; 
     
    8585    if( p_plugin ) 
    8686    { 
    87         vlc_pause_r( p_plugin->p_vlc ); 
     87        VLC_Pause( p_plugin->i_vlc ); 
    8888    } 
    8989    return NS_OK; 
     
    9494    if( p_plugin ) 
    9595    { 
    96         vlc_stop_r( p_plugin->p_vlc ); 
     96        VLC_Stop( p_plugin->i_vlc ); 
    9797        p_plugin->b_stream = 0; 
    9898    } 
     
    104104    if( p_plugin ) 
    105105    { 
    106         vlc_fullscreen_r( p_plugin->p_vlc ); 
     106        VLC_FullScreen( p_plugin->i_vlc ); 
    107107    } 
    108108    return NS_OK; 
  • mozilla/vlcplugin.h

    r2799d36 r464bd2e  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: vlcplugin.h,v 1.4 2002/09/30 11:05:41 sam Exp $ 
     5 * $Id: vlcplugin.h,v 1.5 2002/10/11 22:32:56 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    4848 
    4949    /* vlc data members */ 
    50     vlc_t *  p_vlc; 
     50    int      i_vlc; 
    5151    int      b_stream; 
    5252    int      b_autoplay; 
     
    6565    "VideoLAN Client Multimedia Player Plugin <br>" \ 
    6666    " <br>" \ 
    67     /*COPYRIGHT_MESSAGE*/ " <br>" \ 
     67    "version %s <br>" \ 
    6868    "VideoLAN WWW: <a href=\"http://www.videolan.org/\">http://www.videolan.org/</a>" 
    6969 
  • mozilla/vlcshell.cpp

    rf501554 r464bd2e  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: vlcshell.cpp,v 1.3 2002/10/03 18:56:09 sam Exp $ 
     5 * $Id: vlcshell.cpp,v 1.4 2002/10/11 22:32:56 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    3030/* vlc stuff */ 
    3131#include <vlc/vlc.h> 
    32 #include "config.h" 
    3332 
    3433/* Mozilla stuff */ 
     
    8988{ 
    9089    static nsIID nsid = VLCINTF_IID; 
     90    static char psz_desc[1000]; 
    9191 
    9292    switch( variable ) 
     
    9797 
    9898        case NPPVpluginDescriptionString: 
    99             *((char **)value) = PLUGIN_DESCRIPTION; 
     99            snprintf( psz_desc, 1000-1, PLUGIN_DESCRIPTION, VLC_Version() ); 
     100            psz_desc[1000-1] = 0; 
     101            *((char **)value) = psz_desc; 
    100102            return NPERR_NO_ERROR; 
     103 
     104        default: 
     105            /* go on... */ 
     106            break; 
    101107    } 
    102108 
     
    155161                 char* argn[], char* argv[], NPSavedData* saved ) 
    156162{ 
     163    vlc_value_t value; 
    157164    int i_ret; 
    158165    int i; 
     
    186193    p_plugin->window = 0; 
    187194 
    188     p_plugin->p_vlc = vlc_create_r(); 
    189     if( p_plugin->p_vlc == NULL ) 
    190     { 
     195    p_plugin->i_vlc = VLC_Create(); 
     196    if( p_plugin->i_vlc < 0 ) 
     197    { 
     198        p_plugin->i_vlc = 0; 
    191199        delete p_plugin; 
    192200        p_plugin = NULL; 
     
    194202    } 
    195203 
    196     i_ret = vlc_init_r( p_plugin->p_vlc, sizeof(ppsz_foo)/sizeof(char*), ppsz_foo ); 
     204    i_ret = VLC_Init( p_plugin->i_vlc, sizeof(ppsz_foo)/sizeof(char*), ppsz_foo ); 
    197205    if( i_ret ) 
    198206    { 
    199         vlc_destroy_r( p_plugin->p_vlc ); 
    200         p_plugin->p_vlc = NULL
     207        VLC_Destroy( p_plugin->i_vlc ); 
     208        p_plugin->i_vlc = 0
    201209        delete p_plugin; 
    202210        p_plugin = NULL; 
     
    204212    } 
    205213 
    206     vlc_set_r( p_plugin->p_vlc, "vout", "xvideo,x11,dummy" ); 
    207     vlc_set_r( p_plugin->p_vlc, "intf", "dummy" ); 
     214    value.psz_string = "xvideo,x11,dummy"; 
     215    VLC_Set( p_plugin->i_vlc, "conf::vout", value ); 
     216    value.psz_string = "dummy"; 
     217    VLC_Set( p_plugin->i_vlc, "conf::intf", value ); 
    208218 
    209219    p_plugin->b_stream = 0; 
     
    228238            if( !strcmp( argv[i], "yes" ) ) 
    229239            { 
    230                 vlc_set_r( p_plugin->p_vlc, "loop", "1" ); 
     240                value.b_bool = VLC_TRUE; 
     241                VLC_Set( p_plugin->i_vlc, "conf::loop", value ); 
    231242            } 
    232243        } 
     
    252263    if( p_plugin != NULL ) 
    253264    { 
    254         if( p_plugin->p_vlc != NULL
    255         { 
    256             vlc_stop_r( p_plugin->p_vlc ); 
    257             vlc_destroy_r( p_plugin->p_vlc ); 
    258             p_plugin->p_vlc = NULL
     265        if( p_plugin->i_vlc
     266        { 
     267            VLC_Stop( p_plugin->i_vlc ); 
     268            VLC_Destroy( p_plugin->i_vlc ); 
     269            p_plugin->i_vlc = 0
    259270        } 
    260271 
     
    275286NPError NPP_SetWindow( NPP instance, NPWindow* window ) 
    276287{ 
    277     char psz_window[32]
     288    vlc_value_t value
    278289 
    279290    if( instance == NULL ) 
     
    285296 
    286297    /* Write the window ID for vlc */ 
    287     sprintf( psz_window, "%li", (long int)window->window ); 
    288     vlc_set_r( p_plugin->p_vlc, "x11-drawable", psz_window ); 
    289     vlc_set_r( p_plugin->p_vlc, "xvideo-drawable", psz_window ); 
     298    value.p_address = (void*)window->window; 
     299    VLC_Set( p_plugin->i_vlc, "drawable", value ); 
    290300 
    291301    /* 
     
    324334        if( p_plugin->psz_target ) 
    325335        { 
    326             vlc_add_target_r( p_plugin->p_vlc, p_plugin->psz_target, 
    327                               i_mode, PLAYLIST_END ); 
     336            VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target, 
     337                           i_mode, PLAYLIST_END ); 
    328338            p_plugin->b_stream = 1; 
    329339        } 
     
    423433 
    424434    fprintf(stderr, "NPP_StreamAsFile\n"); 
    425     vlc_add_target_r( p_plugin->p_vlc, fname, 
    426                       PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); 
     435    VLC_AddTarget( p_plugin->i_vlc, fname, 
     436                   PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); 
    427437} 
    428438 
  • src/interface/interface.c

    r7d2f6de r464bd2e  
    55 ***************************************************************************** 
    66 * Copyright (C) 1998-2001 VideoLAN 
    7  * $Id: interface.c,v 1.99 2002/08/29 23:53:22 massiot Exp $ 
     7 * $Id: interface.c,v 1.100 2002/10/11 22:32:56 sam Exp $ 
    88 * 
    99 * Authors: Vincent Seguin <seguin@via.ecp.fr> 
     
    7979 
    8080    /* Initialize structure */ 
    81     p_intf->b_menu        = 0
    82     p_intf->b_menu_change = 0
     81    p_intf->b_menu        = VLC_FALSE
     82    p_intf->b_menu_change = VLC_FALSE
    8383 
    8484    /* Initialize mutexes */ 
     
    9999 * or runs the interface in the current thread, depending on b_block. 
    100100 *****************************************************************************/ 
    101 vlc_error_t intf_RunThread( intf_thread_t *p_intf ) 
     101int intf_RunThread( intf_thread_t *p_intf ) 
    102102{ 
    103103    if( p_intf->b_block ) 
     
    113113        p_intf->pf_run( p_intf ); 
    114114 
    115         p_intf->b_die = 1
     115        p_intf->b_die = VLC_TRUE
    116116 
    117117        /* Do not join the thread... intf_StopThread will do it for us */ 
     
    141141    if( !p_intf->b_block ) 
    142142    { 
    143         p_intf->b_die = 1
     143        p_intf->b_die = VLC_TRUE
    144144    } 
    145145 
     
    181181        if( p_intf->p_vlc->b_die ) 
    182182        { 
    183             p_intf->b_die = 1
     183            p_intf->b_die = VLC_TRUE
    184184            return; 
    185185        } 
  • src/libvlc.c

    r9de9dd0 r464bd2e  
    33 ***************************************************************************** 
    44 * Copyright (C) 1998-2002 VideoLAN 
    5  * $Id: libvlc.c,v 1.37 2002/10/08 18:10:09 sam Exp $ 
     5 * $Id: libvlc.c,v 1.38 2002/10/11 22:32:56 sam Exp $ 
    66 * 
    77 * Authors: Vincent Seguin <seguin@via.ecp.fr> 
     
    8181 *****************************************************************************/ 
    8282static libvlc_t libvlc; 
    83  
    84 //#define GLOBAL_VLC NULL 
    85 #define GLOBAL_VLC ((vlc_t*)libvlc.pp_children[1]) 
     83static vlc_t *  p_static_vlc; 
    8684 
    8785/***************************************************************************** 
     
    9896 
    9997/***************************************************************************** 
    100  * vlc_create: allocate a vlc_t structure, and initialize libvlc if needed. 
    101  ***************************************************************************** 
    102  * This function allocates a vlc_t structure and returns NULL in case of 
    103  * failure. Also, the thread system is initialized. 
    104  *****************************************************************************/ 
    105 vlc_error_t vlc_create( void ) 
    106 
    107     vlc_t * p_vlc; 
    108     vlc_bool_t b_failed = VLC_FALSE; 
    109  
    110     /* This call should be thread-safe, but an additional check will be 
    111      * necessary afterwards to check that only one p_vlc is created. */ 
    112     p_vlc = vlc_create_r(); 
    113  
    114     if( p_vlc == NULL ) 
    115     { 
    116         return VLC_EGENERIC; 
    117     } 
    118  
    119     /* We have created an object, which ensures us that p_global_lock has 
    120      * been properly initialized. We can now atomically check that we are 
    121      * the only p_vlc object. */ 
    122 #if 0 
    123     vlc_mutex_lock( libvlc.p_global_lock ); 
    124     if( libvlc.i_children != 1 ) /* FIXME !!! FIXME */ 
    125     { 
    126         b_failed = VLC_TRUE; 
    127     } 
    128     vlc_mutex_unlock( libvlc.p_global_lock ); 
    129 #endif 
    130  
    131     /* There can be only one */ 
    132     if( b_failed ) 
    133     { 
    134         vlc_destroy_r( p_vlc ); 
    135         return VLC_EGENERIC; 
    136     } 
    137  
    138     return VLC_SUCCESS; 
    139 
    140  
    141 vlc_t * vlc_create_r( void ) 
     98 * VLC_Version: return the libvlc version. 
     99 ***************************************************************************** 
     100 * This function returns full version string (numeric version and codename). 
     101 *****************************************************************************/ 
     102char * VLC_Version( void ) 
     103
     104    return VERSION_MESSAGE; 
     105
     106 
     107/***************************************************************************** 
     108 * VLC_Create: allocate a vlc_t structure, and initialize libvlc if needed. 
     109 ***************************************************************************** 
     110 * This function allocates a vlc_t structure and returns a negative value 
     111 * in case of failure. Also, the thread system is initialized. 
     112 *****************************************************************************/ 
     113int VLC_Create( void ) 
    142114{ 
    143115    int i_ret; 
     
    148120     * allowed before the thread system has been initialized. */ 
    149121    i_ret = vlc_threads_init( &libvlc ); 
    150     if( i_ret
    151     { 
    152         return NULL
     122    if( i_ret < 0
     123    { 
     124        return i_ret
    153125    } 
    154126 
     
    197169    if( p_vlc == NULL ) 
    198170    { 
    199         return NULL
     171        return VLC_EGENERIC
    200172    } 
    201173 
     
    208180    vlc_object_attach( p_vlc, &libvlc ); 
    209181 
     182    /* Store data for the non-reentrant API */ 
     183    p_static_vlc = p_vlc; 
     184 
    210185    /* Update the handle status */ 
    211186    p_vlc->i_status = VLC_STATUS_CREATED; 
    212187 
    213     return p_vlc
    214 } 
    215  
    216 /***************************************************************************** 
    217  * vlc_init: initialize a vlc_t structure. 
     188    return p_vlc->i_object_id
     189} 
     190 
     191/***************************************************************************** 
     192 * VLC_Init: initialize a vlc_t structure. 
    218193 ***************************************************************************** 
    219194 * This function initializes a previously allocated vlc_t structure: 
     
    223198 *  - configuration and commandline parsing 
    224199 *****************************************************************************/ 
    225 vlc_error_t vlc_init( int i_argc, char *ppsz_argv[] ) 
    226 
    227     return vlc_init_r( GLOBAL_VLC, i_argc, ppsz_argv ); 
    228 
    229  
    230 vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] ) 
     200int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) 
    231201{ 
    232202    char         p_capabilities[200]; 
    233203    char *       p_tmp; 
    234204    vlc_bool_t   b_exit; 
     205    vlc_t *      p_vlc; 
    235206    module_t    *p_help_module; 
    236207    playlist_t  *p_playlist; 
     208 
     209    p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 
    237210 
    238211    /* Check that the handle is valid */ 
     
    522495 
    523496/***************************************************************************** 
    524  * vlc_add_intf: add an interface 
     497 * VLC_AddIntf: add an interface 
    525498 ***************************************************************************** 
    526499 * This function opens an interface plugin and runs it. If b_block is set 
    527  * to 0, vlc_add_intf will return immediately and let the interface run in a 
    528  * separate thread. If b_block is set to 1, vlc_add_intf will continue until 
     500 * to 0, VLC_AddIntf will return immediately and let the interface run in a 
     501 * separate thread. If b_block is set to 1, VLC_AddIntf will continue until 
    529502 * user requests to quit. 
    530503 *****************************************************************************/ 
    531 vlc_error_t vlc_add_intf( const char *psz_module, vlc_bool_t b_block ) 
    532 
    533     return vlc_add_intf_r( GLOBAL_VLC, 
    534                            psz_module, b_block ); 
    535 
    536  
    537 vlc_error_t vlc_add_intf_r( vlc_t *p_vlc, const char *psz_module, 
    538                                           vlc_bool_t b_block ) 
    539 
    540     vlc_error_t err; 
     504int VLC_AddIntf( int i_object, const char *psz_module, vlc_bool_t b_block ) 
     505
     506    int i_err; 
    541507    intf_thread_t *p_intf; 
     508    vlc_t *p_vlc; 
    542509    char *psz_oldmodule = NULL; 
     510 
     511    p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 
    543512 
    544513    /* Check that the handle is valid */ 
     
    575544    /* Try to run the interface */ 
    576545    p_intf->b_block = b_block; 
    577     err = intf_RunThread( p_intf ); 
    578     if( err ) 
     546    i_err = intf_RunThread( p_intf ); 
     547    if( i_err ) 
    579548    { 
    580549        vlc_object_detach( p_intf ); 
    581550        intf_Destroy( p_intf ); 
    582         return err; 
     551        return i_err; 
    583552    } 
    584553 
     
    587556 
    588557/***************************************************************************** 
    589  * vlc_destroy: stop playing and destroy everything. 
     558 * VLC_Destroy: stop playing and destroy everything. 
    590559 ***************************************************************************** 
    591560 * This function requests the running threads to finish, waits for their 
    592561 * termination, and destroys their structure. 
    593562 *****************************************************************************/ 
    594 vlc_error_t vlc_destroy( void ) 
    595 
    596     return vlc_destroy_r( GLOBAL_VLC ); 
    597 
    598  
    599 vlc_error_t vlc_destroy_r( vlc_t *p_vlc ) 
    600 
     563int VLC_Destroy( int i_object ) 
     564
     565    vlc_t *p_vlc; 
     566 
     567    p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 
     568 
    601569    /* Check that the handle is valid */ 
    602570    if( !p_vlc || (p_vlc->i_status != VLC_STATUS_STOPPED 
     
    659627 
    660628/***************************************************************************** 
    661  * vlc_die: ask vlc to die. 
     629 * VLC_Die: ask vlc to die. 
    662630 ***************************************************************************** 
    663631 * This function sets p_vlc->b_die to VLC_TRUE, but does not do any other 
    664  * task. It is your duty to call vlc_end and vlc_destroy afterwards. 
    665  *****************************************************************************/ 
    666 vlc_error_t vlc_die( void ) 
    667 
    668     return vlc_die_r( GLOBAL_VLC ); 
    669 
    670  
    671 vlc_error_t vlc_die_r( vlc_t *p_vlc ) 
    672 
     632 * task. It is your duty to call vlc_end and VLC_Destroy afterwards. 
     633 *****************************************************************************/ 
     634int VLC_Die( int i_object ) 
     635
     636    vlc_t *p_vlc; 
     637 
     638    p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 
     639 
    673640    if( !p_vlc ) 
    674641    { 
     
    683650 
    684651/***************************************************************************** 
    685  * vlc_status: return the current vlc status. 
    686  ***************************************************************************** 
    687  * This function returns the current value of p_vlc->i_status. 
    688  *****************************************************************************/ 
    689 vlc_status_t vlc_status( void ) 
    690 
    691     return vlc_status_r( GLOBAL_VLC ); 
    692 
    693  
    694 vlc_status_t vlc_status_r( vlc_t *p_vlc ) 
    695 
    696     if( !p_vlc ) 
    697     { 
    698         return VLC_STATUS_NONE; 
    699     } 
    700  
    701     return p_vlc->i_status; 
    702 
    703  
    704 /***************************************************************************** 
    705  * vlc_add_target: adds a target for playing. 
     652 * VLC_AddTarget: adds a target for playing. 
    706653 ***************************************************************************** 
    707654 * This function adds psz_target to the current playlist. If a playlist does 
    708655 * not exist, it will create one. 
    709656 *****************************************************************************/ 
    710 vlc_error_t vlc_add_target( const char *psz_target, int i_mode, int i_pos ) 
    711 
    712     return vlc_add_target_r( GLOBAL_VLC, 
    713                              psz_target, i_mode, i_pos ); 
    714 
    715  
    716 vlc_error_t vlc_add_target_r( vlc_t *p_vlc, const char *psz_target, 
    717                                             int i_mode, int i_pos ) 
    718 
    719     vlc_error_t err; 
     657int VLC_AddTarget( int i_object, const char *psz_target, int i_mode, int i_pos ) 
     658
     659    int i_err; 
    720660    playlist_t *p_playlist; 
     661    vlc_t *p_vlc; 
     662 
     663    p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 
    721664 
    722665    if( !p_vlc || ( p_vlc->i_status != VLC_STATUS_STOPPED 
     
    742685    } 
    743686 
    744     err = playlist_Add( p_playlist, psz_target, i_mode, i_pos ); 
     687    i_err = playlist_Add( p_playlist, psz_target, i_mode, i_pos ); 
    745688 
    746689    vlc_object_release( p_playlist ); 
    747690 
    748     return err; 
    749 } 
    750  
    751 /***************************************************************************** 
    752  * vlc_set: set a vlc variable 
     691    return i_err; 
     692} 
     693 
     694/***************************************************************************** 
     695 * VLC_Set: set a vlc variable 
    753696 ***************************************************************************** 
    754697 * 
    755698 *****************************************************************************/ 
    756 vlc_error_t vlc_set( const char *psz_var, const char *psz_val ) 
    757 
    758     return vlc_set_r( GLOBAL_VLC, psz_var, psz_val ); 
    759 
    760  
    761