Changeset bf7985b74afcef9103b35a3c47eeae5845ae681b

Show
Ignore:
Timestamp:
10/14/02 18:46:56 (6 years ago)
Author:
Sam Hocevar <sam@videolan.org>
git-committer:
Sam Hocevar <sam@videolan.org> 1034614016 +0000
git-parent:

[ebda60f20b1937b279a78ca6ab37f7a1b70b32fd]

git-author:
Sam Hocevar <sam@videolan.org> 1034614016 +0000
Message:
  • ./include/vlc/vlc.h, ./src/libvlc.c: added VLC_Error() to the libvlc API.
  • ./include/main.h: removed p_vlc->i_status because it was not sufficient
    to represent all the possible states of p_vlc; each part should be tested
    separately upon destruction.
  • ./src/misc/objects.c: fixed a signed/unsigned bug that prevented creation
    of VLC_OBJECT_GENERIC objects.
  • ./src/misc/variables.c: added the VLC_VAR_COMMAND type which is simply a
    variable that stores a function pointer, and calls it when var_Get is
    called for it. The function argument is taken in val.psz_string.
  • ./src/misc/objects.c: vlc_dumpstructure and vlc_liststructure are no longer
    exported to the rest of the program; instead, they're VLC_VAR_COMMAND vars
    ("tree" and "list").
  • ./modules/control/rc/rc.c: moved a few commands to VLC_VAR_COMMAND vars.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Makefile.am

    r2328fae rbf7985b  
    156156    include/configuration.h \ 
    157157    include/darwin_specific.h \ 
     158    include/error.h \ 
    158159    include/input_ext-dec.h \ 
    159160    include/input_ext-intf.h \ 
     
    337338    src/misc/objects.c \ 
    338339    src/misc/variables.c \ 
     340    src/misc/error.c \ 
    339341    src/misc/extras.c \ 
    340342    $(SOURCES_libvlc_win32) \ 
  • configure.ac.in

    r2328fae rbf7985b  
    21302130if test "x${enable_testsuite}" = "xyes" 
    21312131then 
    2132   TESTS="test1 test2 test3" 
     2132  TESTS="test1 test2 test3 test4" 
     2133 
    21332134  dnl  we define those so that bootstrap sets the right linker 
    21342135  CXXFLAGS_test2="${CXXFLAGS_test2}" 
     
    21362137  dnl  this one is needed until automake knows what to do 
    21372138  LDFLAGS_test3="${LDFLAGS_test3} -lobjc" 
     2139 
    21382140  PLUGINS="${PLUGINS} ${TESTS}" 
    21392141  #BUILTINS="${BUILTINS} ${TESTS}" 
  • include/main.h

    r89987e1 rbf7985b  
    44 ***************************************************************************** 
    55 * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN 
    6  * $Id: main.h,v 1.48 2002/10/04 18:07:21 sam Exp $ 
     6 * $Id: main.h,v 1.49 2002/10/14 16:46:55 sam Exp $ 
    77 * 
    88 * Authors: Vincent Seguin <seguin@via.ecp.fr> 
     
    7474    VLC_COMMON_MEMBERS 
    7575 
    76     /* The vlc structure status */ 
    77     int                    i_status; 
    78  
    7976    /* Global properties */ 
    8077    int                    i_argc;           /* command line arguments count */ 
  • include/variables.h

    rf78e558 rbf7985b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: variables.h,v 1.1 2002/10/11 11:05:52 sam Exp $ 
     5 * $Id: variables.h,v 1.2 2002/10/14 16:46:55 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    3131#define VLC_VAR_TIME      0x0500 
    3232#define VLC_VAR_ADDRESS   0x0600 
     33#define VLC_VAR_COMMAND   0x0700 
    3334 
    3435/***************************************************************************** 
     
    5253 * Prototypes 
    5354 *****************************************************************************/ 
    54 VLC_EXPORT( void, __var_Create, ( vlc_object_t *, const char *, int ) ); 
    55 VLC_EXPORT( void, __var_Destroy, ( vlc_object_t *, const char * ) ); 
     55VLC_EXPORT( int, __var_Create, ( vlc_object_t *, const char *, int ) ); 
     56VLC_EXPORT( int, __var_Destroy, ( vlc_object_t *, const char * ) ); 
    5657 
     58VLC_EXPORT( int, __var_Type, ( vlc_object_t *, const char * ) ); 
    5759VLC_EXPORT( int, __var_Set, ( vlc_object_t *, const char *, vlc_value_t ) ); 
    5860VLC_EXPORT( int, __var_Get, ( vlc_object_t *, const char *, vlc_value_t * ) ); 
     
    6466    __var_Destroy( VLC_OBJECT(a), b ) 
    6567 
     68#define var_Type(a,b) \ 
     69    __var_Type( VLC_OBJECT(a), b ) 
     70 
    6671#define var_Set(a,b,c) \ 
    6772    __var_Set( VLC_OBJECT(a), b, c ) 
  • include/vlc/vlc.h

    r464bd2e rbf7985b  
    33 ***************************************************************************** 
    44 * Copyright (C) 1998, 1999, 2000 VideoLAN 
    5  * $Id: vlc.h,v 1.15 2002/10/11 22:32:56 sam Exp $ 
     5 * $Id: vlc.h,v 1.16 2002/10/14 16:46:55 sam Exp $ 
    66 * 
    77 * This program is free software; you can redistribute it and/or modify 
     
    4040    void *      p_address; 
    4141 
    42     /* Use this to make sure the structure is at least 64bits */ 
     42    /* Make sure the structure is at least 64bits */ 
    4343    struct { char a, b, c, d, e, f, g, h; } padding; 
    4444 
     
    5050#define VLC_SUCCESS         -0                                   /* No error */ 
    5151#define VLC_ENOMEM          -1                          /* Not enough memory */ 
    52 #define VLC_EMODULE         -2                           /* Module not found */ 
    53 #define VLC_ESTATUS         -3                             /* Invalid status */ 
    54 #define VLC_ETHREAD         -4                     /* Could not spawn thread */ 
    55 #define VLC_EOBJECT         -5                           /* Object not found */ 
    56 #define VLC_EVAR            -6                         /* Variable not found */ 
     52#define VLC_ETHREAD         -2                               /* Thread error */ 
     53 
     54#define VLC_ENOMOD         -10                           /* Module not found */ 
     55 
     56#define VLC_ENOOBJ         -20                           /* Object not found */ 
     57#define VLC_EBADOBJ        -21                            /* Bad object type */ 
     58 
     59#define VLC_ENOVAR         -30                         /* Variable not found */ 
     60#define VLC_EBADVAR        -31                         /* Bad variable value */ 
     61 
    5762#define VLC_EEXIT         -255                             /* Program exited */ 
    5863#define VLC_EGENERIC      -666                              /* Generic error */ 
     
    6368#define VLC_FALSE 0 
    6469#define VLC_TRUE  1 
    65  
    66 /***************************************************************************** 
    67  * Main structure status 
    68  *****************************************************************************/ 
    69 #define VLC_STATUS_NONE     0x00000000 
    70 #define VLC_STATUS_CREATED  0x02020202 
    71 #define VLC_STATUS_STOPPED  0x12121212 
    72 #define VLC_STATUS_RUNNING  0x42424242 
    7370 
    7471/***************************************************************************** 
     
    111108 * Exported libvlc API 
    112109 *****************************************************************************/ 
    113 char *  VLC_Version     ( void ); 
     110char const * VLC_Version ( void ); 
     111char const * VLC_Error   ( int ); 
    114112 
    115 int     VLC_Create      ( void ); 
    116 int     VLC_Init        ( int, int, char *[] ); 
    117 int     VLC_Die         ( int ); 
    118 int     VLC_Destroy     ( int ); 
     113int     VLC_Create      ( void ); 
     114int     VLC_Init        ( int, int, char *[] ); 
     115int     VLC_Die          ( int ); 
     116int     VLC_Destroy      ( int ); 
    119117 
    120 int     VLC_Set         ( int, const char *, vlc_value_t ); 
    121 int     VLC_Get         ( int, const char *, vlc_value_t * ); 
    122 int     VLC_AddIntf     ( int, const char *, vlc_bool_t ); 
    123 int     VLC_AddTarget   ( int, const char *, int, int ); 
     118int     VLC_Set          ( int, char const *, vlc_value_t ); 
     119int     VLC_Get          ( int, char const *, vlc_value_t * ); 
     120int     VLC_AddIntf      ( int, char const *, vlc_bool_t ); 
     121int     VLC_AddTarget    ( int, char const *, int, int ); 
    124122 
    125 int     VLC_Play        ( int ); 
    126 int     VLC_Pause       ( int ); 
    127 int     VLC_Stop        ( int ); 
    128 int     VLC_FullScreen  ( int ); 
     123int     VLC_Play        ( int ); 
     124int     VLC_Pause        ( int ); 
     125int     VLC_Stop        ( int ); 
     126int     VLC_FullScreen  ( int ); 
    129127 
    130128# ifdef __cplusplus 
  • include/vlc_objects.h

    r464bd2e rbf7985b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: vlc_objects.h,v 1.12 2002/10/11 22:32:55 sam Exp $ 
     5 * $Id: vlc_objects.h,v 1.13 2002/10/14 16:46:55 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    7878VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) ); 
    7979 
    80 VLC_EXPORT( void, __vlc_liststructure, ( vlc_object_t * ) ); 
    81 VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) ); 
    82  
    8380#define vlc_object_create(a,b) \ 
    8481    __vlc_object_create( VLC_OBJECT(a), b ) 
     
    109106    __vlc_list_find( VLC_OBJECT(a),b,c) 
    110107 
    111 #define vlc_liststructure(a) \ 
    112     __vlc_liststructure( VLC_OBJECT(a) ) 
    113  
    114 #define vlc_dumpstructure(a) \ 
    115     __vlc_dumpstructure( VLC_OBJECT(a) ) 
    116  
  • modules/control/rc/rc.c

    r464bd2e rbf7985b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: rc.c,v 1.8 2002/10/11 22:32:56 sam Exp $ 
     5 * $Id: rc.c,v 1.9 2002/10/14 16:46:55 sam Exp $ 
    66 * 
    77 * Authors: Peter Surda <shurdeek@panorama.sth.ac.at> 
     
    5858static void Run          ( intf_thread_t *p_intf ); 
    5959 
     60static int  Playlist     ( vlc_object_t *, char *, char * ); 
     61static int  Quit         ( vlc_object_t *, char *, char * ); 
     62static int  Intf         ( vlc_object_t *, char *, char * ); 
     63 
    6064/***************************************************************************** 
    6165 * Module descriptor 
     
    9094    { 
    9195        msg_Warn( p_intf, "fd 0 is not a TTY" ); 
    92         return 1
     96        return VLC_EGENERIC
    9397    } 
    9498#endif 
     
    102106 
    103107    printf( "remote control interface initialized, `h' for help\n" ); 
    104     return 0
     108    return VLC_SUCCESS
    105109} 
    106110 
     
    117121 
    118122    char       p_buffer[ MAX_LINE_LENGTH + 1 ]; 
    119     vlc_bool_t b_complete = 0; 
    120123    vlc_bool_t b_showpos = config_GetInt( p_intf, "rc-show-pos" ); 
    121124    input_info_category_t * p_category; 
     
    125128    off_t      i_oldpos = 0; 
    126129    off_t      i_newpos; 
    127     fd_set     fds;                                        /* stdin changed? */ 
    128     struct timeval tv;                                   /* how long to wait */ 
    129  
    130     double     f_ratio = 1; 
     130 
     131    double     f_ratio = 1.0; 
    131132 
    132133    p_input = NULL; 
    133134    p_playlist = NULL; 
    134135 
    135     var_Create( p_intf, "foo", VLC_VAR_STRING ); 
    136     var_Set( p_intf, "foo", (vlc_value_t)"test" ); 
     136    /* Register commands that will be cleaned up upon object destruction */ 
     137    var_Create( p_intf, "quit", VLC_VAR_COMMAND ); 
     138    var_Set( p_intf, "quit", (vlc_value_t)(void*)Quit ); 
     139    var_Create( p_intf, "intf", VLC_VAR_COMMAND ); 
     140    var_Set( p_intf, "intf", (vlc_value_t)(void*)Intf ); 
     141 
     142    var_Create( p_intf, "play", VLC_VAR_COMMAND ); 
     143    var_Set( p_intf, "play", (vlc_value_t)(void*)Playlist ); 
     144    var_Create( p_intf, "stop", VLC_VAR_COMMAND ); 
     145    var_Set( p_intf, "stop", (vlc_value_t)(void*)Playlist ); 
     146    var_Create( p_intf, "pause", VLC_VAR_COMMAND ); 
     147    var_Set( p_intf, "pause", (vlc_value_t)(void*)Playlist ); 
     148    var_Create( p_intf, "prev", VLC_VAR_COMMAND ); 
     149    var_Set( p_intf, "prev", (vlc_value_t)(void*)Playlist ); 
     150    var_Create( p_intf, "next", VLC_VAR_COMMAND ); 
     151    var_Set( p_intf, "next", (vlc_value_t)(void*)Playlist ); 
    137152 
    138153    while( !p_intf->b_die ) 
    139154    { 
    140         b_complete = 0; 
     155        fd_set         fds; 
     156        struct timeval tv; 
     157        vlc_bool_t     b_complete = VLC_FALSE; 
    141158 
    142159        /* Check stdin */ 
     
    165182            { 
    166183                p_buffer[ i_size ] = 0; 
    167                 b_complete = 1
     184                b_complete = VLC_TRUE
    168185            } 
    169186        } 
     
    216233 
    217234        /* Is there something to do? */ 
    218         if( b_complete == 1 ) 
    219         { 
    220             char *p_cmd = p_buffer; 
    221  
    222             if( !strcmp( p_cmd, "quit" ) ) 
    223             { 
    224                 p_intf->p_vlc->b_die = VLC_TRUE; 
    225             } 
    226             else if( !strcmp( p_cmd, "segfault" ) ) 
    227             { 
    228                 raise( SIGSEGV ); 
    229             } 
    230             else if( !strcmp( p_cmd, "prev" ) ) 
    231             { 
    232                 if( p_playlist ) playlist_Prev( p_playlist ); 
    233             } 
    234             else if( !strcmp( p_cmd, "next" ) ) 
    235             { 
    236                 if( p_playlist ) playlist_Next( p_playlist ); 
    237             } 
    238             else if( !strcmp( p_cmd, "play" ) ) 
    239             { 
    240                 if( p_playlist ) playlist_Play( p_playlist ); 
    241             } 
    242             else if( !strcmp( p_cmd, "stop" ) ) 
    243             { 
    244                 if( p_playlist ) playlist_Stop( p_playlist ); 
    245             } 
    246             else if( !strcmp( p_cmd, "pause" ) ) 
    247             { 
    248                 if( p_input ) input_SetStatus( p_input, INPUT_STATUS_PAUSE ); 
    249             } 
    250             else if( !strcmp( p_cmd, "tree" ) ) 
    251             { 
    252                 vlc_dumpstructure( p_intf->p_vlc ); 
    253             } 
    254             else if( !strcmp( p_cmd, "list" ) ) 
    255             { 
    256                 vlc_liststructure( p_intf->p_vlc ); 
    257             } 
    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 ); 
    269             } 
    270             else if( !strncmp( p_cmd, "intf ", 5 ) ) 
    271             { 
    272                 intf_thread_t *p_newintf; 
    273                 char *psz_oldmodule = config_GetPsz( p_intf->p_vlc, "intf" ); 
    274  
    275                 config_PutPsz( p_intf->p_vlc, "intf", p_cmd + 5 ); 
    276                 p_newintf = intf_Create( p_intf->p_vlc ); 
    277                 config_PutPsz( p_intf->p_vlc, "intf", psz_oldmodule ); 
    278  
    279                 if( psz_oldmodule ) 
    280                 { 
    281                     free( psz_oldmodule ); 
    282                 } 
    283  
    284                 if( p_newintf ) 
    285                 { 
    286                     p_newintf->b_block = VLC_FALSE; 
    287                     if( intf_RunThread( p_newintf ) ) 
    288                     { 
    289                         vlc_object_detach( p_newintf ); 
    290                         intf_Destroy( p_newintf ); 
    291                     } 
    292                 } 
    293             } 
    294             else if( !strcmp( p_cmd, "info" ) ) 
     235        if( b_complete ) 
     236        { 
     237            char *psz_cmd, *psz_arg; 
     238 
     239            /* Skip heading spaces */ 
     240            psz_cmd = p_buffer; 
     241            while( *psz_cmd == ' ' ) 
     242            { 
     243                psz_cmd++; 
     244            } 
     245 
     246            /* Split psz_cmd at the first space and make sure that 
     247             * psz_arg is valid */ 
     248            psz_arg = strchr( psz_cmd, ' ' ); 
     249            if( psz_arg ) 
     250            { 
     251                *psz_arg++ = 0; 
     252                while( *psz_arg == ' ' ) 
     253                { 
     254                    psz_arg++; 
     255                } 
     256            } 
     257            else 
     258            { 
     259                psz_arg = ""; 
     260            } 
     261 
     262            /* If the user typed a registered local command, try it */ 
     263            if( var_Type( p_intf, psz_cmd ) == VLC_VAR_COMMAND ) 
     264            { 
     265                vlc_value_t val; 
     266                int i_ret; 
     267 
     268                val.psz_string = psz_arg; 
     269                i_ret = var_Get( p_intf, psz_cmd, &val ); 
     270                printf( "%s: returned %i (%s)\n", 
     271                        psz_cmd, i_ret, vlc_error( i_ret ) ); 
     272            } 
     273            /* Or maybe it's a global command */ 
     274            else if( var_Type( p_intf->p_libvlc, psz_cmd ) == VLC_VAR_COMMAND ) 
     275            { 
     276                vlc_value_t val; 
     277                int i_ret; 
     278 
     279                val.psz_string = psz_arg; 
     280                /* FIXME: it's a global command, but we should pass the 
     281                 * local object as an argument, not p_intf->p_libvlc. */ 
     282                i_ret = var_Get( p_intf->p_libvlc, psz_cmd, &val ); 
     283                printf( "%s: returned %i (%s)\n", 
     284                        psz_cmd, i_ret, vlc_error( i_ret ) ); 
     285            } 
     286            else if( !strcmp( psz_cmd, "info" ) ) 
    295287            { 
    296288                if ( p_input ) 
     
    320312                } 
    321313            } 
    322             else switch( p_cmd[0] ) 
     314            else switch( psz_cmd[0] ) 
    323315            { 
    324316            case 'a': 
    325317            case 'A': 
    326                 if( p_cmd[1] == ' ' && p_playlist ) 
    327                 { 
    328                     playlist_Add( p_playlist, p_cmd + 2, 
     318                if( psz_cmd[1] == ' ' && p_playlist ) 
     319                { 
     320                    playlist_Add( p_playlist, psz_cmd + 2, 
    329321                                  PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); 
    330322                } 
     
    357349                { 
    358350                    for( i_dummy = 1; 
    359                          i_dummy < MAX_LINE_LENGTH && p_cmd[ i_dummy ] >= '0' 
    360                                                    && p_cmd[ i_dummy ] <= '9'; 
     351                         i_dummy < MAX_LINE_LENGTH && psz_cmd[ i_dummy ] >= '0' 
     352                                                   && psz_cmd[ i_dummy ] <= '9'; 
    361353                         i_dummy++ ) 
    362354                    { 
     
    364356                    } 
    365357 
    366                     p_cmd[ i_dummy ] = 0; 
    367                     input_Seek( p_input, (off_t)atoi( p_cmd + 1 ), 
     358                    psz_cmd[ i_dummy ] = 0; 
     359                    input_Seek( p_input, (off_t)atoi( psz_cmd + 1 ), 
    368360                                INPUT_SEEK_SECONDS | INPUT_SEEK_SET ); 
    369361                    /* rcreseek(f_cpos); */ 
     
    396388                break; 
    397389            default: 
    398                 printf( "unknown command `%s', type `help' for help\n", p_cmd ); 
     390                printf( "unknown command `%s', type `help' for help\n", psz_cmd ); 
    399391                break; 
    400392            } 
     
    413405        p_playlist = NULL; 
    414406    } 
    415  
    416     var_Destroy( p_intf, "foo" ); 
    417 
    418  
     407
     408 
     409static int Playlist( vlc_object_t *p_this, char *psz_cmd, char *psz_arg ) 
     410
     411    input_thread_t * p_input; 
     412    playlist_t *     p_playlist; 
     413 
     414    p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE ); 
     415 
     416    if( !p_input ) 
     417    { 
     418        return VLC_ENOOBJ; 
     419    } 
     420 
     421    /* Parse commands that only require an input */ 
     422    if( !strcmp( psz_cmd, "pause" ) ) 
     423    { 
     424        input_SetStatus( p_input, INPUT_STATUS_PAUSE ); 
     425        vlc_object_release( p_input ); 
     426        return VLC_SUCCESS; 
     427    } 
     428 
     429    p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, 
     430                                           FIND_PARENT ); 
     431    vlc_object_release( p_input ); 
     432 
     433    if( !p_playlist ) 
     434    { 
     435        return VLC_ENOOBJ; 
     436    } 
     437 
     438    /* Parse commands that require a playlist */ 
     439    if( !strcmp( psz_cmd, "prev" ) ) 
     440    { 
     441        playlist_Prev( p_playlist ); 
     442    } 
     443    else if( !strcmp( psz_cmd, "next" ) ) 
     444    { 
     445        playlist_Next( p_playlist ); 
     446    } 
     447    else if( !strcmp( psz_cmd, "play" ) ) 
     448    { 
     449        playlist_Play( p_playlist ); 
     450    } 
     451    else if( !strcmp( psz_cmd, "stop" ) ) 
     452    { 
     453        playlist_Stop( p_playlist ); 
     454    } 
     455 
     456    return VLC_SUCCESS; 
     457
     458 
     459static int Quit( vlc_object_t *p_this, char *psz_cmd, char *psz_arg ) 
     460
     461    p_this->p_vlc->b_die = VLC_TRUE; 
     462    return VLC_SUCCESS; 
     463
     464 
     465static int Intf( vlc_object_t *p_this, char *psz_cmd, char *psz_arg ) 
     466
     467    intf_thread_t *p_newintf; 
     468    char *psz_oldmodule = config_GetPsz( p_this->p_vlc, "intf" ); 
     469 
     470    config_PutPsz( p_this->p_vlc, "intf", psz_arg ); 
     471    p_newintf = intf_Create( p_this->p_vlc ); 
     472    config_PutPsz( p_this->p_vlc, "intf", psz_oldmodule ); 
     473 
     474    if( psz_oldmodule ) 
     475    { 
     476        free( psz_oldmodule ); 
     477    } 
     478 
     479    if( p_newintf ) 
     480    { 
     481        p_newintf->b_block = VLC_FALSE; 
     482        if( intf_RunThread( p_newintf ) ) 
     483        { 
     484            vlc_object_detach( p_newintf ); 
     485            intf_Destroy( p_newintf ); 
     486        } 
     487    } 
     488 
     489    return VLC_SUCCESS; 
     490
     491 
     492static int Signal( vlc_object_t *p_this, char *psz_cmd, char *psz_arg ) 
     493
     494    raise( atoi(psz_arg) ); 
     495    return VLC_SUCCESS; 
     496
     497 
     498 
  • modules/gui/familiar/familiar.c

    r00fdbca rbf7985b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: familiar.c,v 1.9 2002/09/15 19:32:02 jpsaman Exp $ 
     5 * $Id: familiar.c,v 1.10 2002/10/14 16:46:55 sam Exp $ 
    66 * 
    77 * Authors: Jean-Paul Saman <jpsaman@wxs.nl> 
     
    7676    { 
    7777        free( p_intf->p_sys ); 
    78         return VLC_EMODULE
     78        return VLC_ENOMOD
    7979    } 
    8080 
  • modules/gui/gtk/gnome.c

    r2799d36 rbf7985b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000 VideoLAN 
    5  * $Id: gnome.c,v 1.3 2002/09/30 11:05:39 sam Exp $ 
     5 * $Id: gnome.c,v 1.4 2002/10/14 16:46:55 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    103103    { 
    104104        free( p_intf->p_sys ); 
    105         return VLC_EMODULE
     105        return VLC_ENOMOD
    106106    } 
    107107 
  • modules/gui/gtk/gtk.c

    r89987e1 rbf7985b  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000-2001 VideoLAN 
    5  * $Id: gtk.c,v 1.5 2002/10/04 18:07:21 sam Exp $ 
     5 * $Id: gtk.c,v 1.6 2002/10/14 16:46:55 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    101101    { 
    102102        free( p_intf->p_sys ); 
    103         return VLC_EMODULE
     103        return VLC_ENOMOD
    104104    } 
    105105#endif 
  • src/libvlc.c

    r464bd2e rbf7985b  
    33 ***************************************************************************** 
    44 * Copyright (C) 1998-2002 VideoLAN 
    5  * $Id: libvlc.c,v 1.38 2002/10/11 22:32:56 sam Exp $ 
     5 * $Id: libvlc.c,v 1.39 2002/10/14 16:46:55 sam Exp $ 
    66 * 
    77 * Authors: Vincent Seguin <seguin@via.ecp.fr> 
     
    6262#include "os_specific.h" 
    6363 
     64#include "error.h" 
    6465#include "netutils.h"                                 /* network_ChannelJoin */ 
    6566 
     
    8788 *****************************************************************************/ 
    8889static int  GetFilenames  ( vlc_t *, int, char *[] ); 
    89 static void Usage         ( vlc_t *, const char *psz_module_name ); 
     90static void Usage         ( vlc_t *, char const *psz_module_name ); 
    9091static void ListModules   ( vlc_t * ); 
    9192static void Version       ( void ); 
     
    100101 * This function returns full version string (numeric version and codename). 
    101102 *****************************************************************************/ 
    102 char * VLC_Version( void ) 
     103char const * VLC_Version( void ) 
    103104{ 
    104105    return VERSION_MESSAGE; 
     106} 
     107 
     108/***************************************************************************** 
     109 * VLC_Error: strerror() equivalent 
     110 ***************************************************************************** 
     111 * This function returns full version string (numeric version and codename). 
     112 *****************************************************************************/ 
     113char const * VLC_Error( int i_err ) 
     114{ 
     115    return vlc_error( i_err ); 
    105116} 
    106117 
     
    183194    p_static_vlc = p_vlc; 
    184195 
    185     /* Update the handle status */ 
    186     p_vlc->i_status = VLC_STATUS_CREATED; 
    187  
    188196    return p_vlc->i_object_id; 
    189197} 
     
    209217    p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 
    210218 
    211     /* Check that the handle is valid */ 
    212     if( !p_vlc || p_vlc->i_status != VLC_STATUS_CREATED ) 
    213     { 
    214         fprintf( stderr, "error: invalid status (!CREATED)\n" ); 
    215         return VLC_ESTATUS; 
     219    if( !p_vlc ) 
     220    { 
     221        return VLC_ENOOBJ; 
    216222    } 
    217223 
     
    483489    } 
    484490 
    485     /* Update the handle status */ 
    486     p_vlc->i_status = VLC_STATUS_STOPPED; 
    487  
    488491    /* 
    489492     * Get input filenames given as commandline arguments 
     
    502505 * user requests to quit. 
    503506 *****************************************************************************/ 
    504 int VLC_AddIntf( int i_object, const char *psz_module, vlc_bool_t b_block ) 
     507int VLC_AddIntf( int i_object, char const *psz_module, vlc_bool_t b_block ) 
    505508{ 
    506509    int i_err; 
     
    511514    p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 
    512515 
    513     /* Check that the handle is valid */ 
    514     if( !p_vlc || p_vlc->i_status != VLC_STATUS_RUNNING ) 
    515     { 
    516         fprintf( stderr, "error: invalid status (!RUNNING)\n" ); 
    517         return VLC_ESTATUS; 
     516    if( !p_vlc ) 
     517    { 
     518        return VLC_ENOOBJ; 
    518519    } 
    519520 
     
    567568    p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 
    568569 
    569     /* Check that the handle is valid */ 
    570     if( !p_vlc || (p_vlc->i_status != VLC_STATUS_STOPPED 
    571                     && p_vlc->i_status != VLC_STATUS_CREATED) ) 
    572     { 
    573         fprintf( stderr, "error: invalid status " 
    574                          "(!STOPPED&&!CREATED)\n" ); 
    575         return VLC_ESTATUS; 
    576     } 
    577  
    578     if( p_vlc->i_status == VLC_STATUS_STOPPED ) 
    579     { 
    580         /* 
    581          * Go back into channel 0 which is the network 
    582          */ 
    583         if( config_GetInt( p_vlc, "network-channel" ) && p_vlc->p_channel ) 
    584         { 
    585             network_ChannelJoin( p_vlc, COMMON_CHANNEL ); 
    586         } 
     570    if( !p_vlc ) 
     571    { 
     572        return VLC_ENOOBJ; 
     573    } 
     574 
     575    /* 
     576     * Go back into channel 0 which is the network 
     577     */ 
     578    if( config_GetInt( p_vlc, "network-channel" ) && p_vlc->p_channel ) 
     579    { 
     580        network_ChannelJoin( p_vlc, COMMON_CHANNEL ); 
     581    } 
    587582     
    588         /* 
    589          * Free allocated memory 
    590          */ 
    591         if( p_vlc->p_memcpy_module != NULL ) 
    592         { 
    593             module_Unneed( p_vlc, p_vlc->p_memcpy_module ); 
    594         } 
     583    /* 
     584     * Free allocated memory 
     585     */ 
     586    if( p_vlc->p_memcpy_module ) 
     587    { 
     588        module_Unneed( p_vlc, p_vlc->p_memcpy_module ); 
     589        p_vlc->p_memcpy_module = NULL; 
     590    } 
     591 
     592    if( p_vlc->psz_homedir ) 
     593    { 
     594        free( p_vlc->psz_homedir ); 
     595        p_vlc->psz_homedir = NULL; 
     596    } 
     597 
     598    /* 
     599     * XXX: Free module bank ! 
     600     */ 
     601    //module_EndBank( p_vlc ); 
    595602     
    596         free( p_vlc->psz_homedir ); 
     603    /* 
     604     * System specific cleaning code 
     605     */ 
     606    system_End( p_vlc ); 
    597607     
    598         /* 
    599          * XXX: Free module bank ! 
    600          */ 
    601         //module_EndBank( p_vlc ); 
    602      
    603         /* 
    604          * System specific cleaning code 
    605          */ 
    606         system_End( p_vlc ); 
    607      
    608         /* Update the handle status */ 
    609         p_vlc->i_status = VLC_STATUS_CREATED; 
    610     } 
    611  
    612     /* Update the handle status, just in case */ 
    613     p_vlc->i_status = VLC_STATUS_NONE; 
    614  
    615608    /* Destroy mutexes */ 
    616609    vlc_mutex_destroy( &p_vlc->config_lock ); 
     
    640633    if( !p_vlc ) 
    641634    { 
    642         fprintf( stderr, "error: invalid status (!EXIST)\n" ); 
    643         return VLC_ESTATUS; 
     635        return VLC_ENOOBJ; 
    644636    } 
    645637 
     
    655647 * not exist, it will create one. 
    656648 *****************************************************************************/ 
    657 int VLC_AddTarget( int i_object, const char *psz_target, int i_mode, int i_pos ) 
     649int VLC_AddTarget( int i_object, char const *psz_target, int i_mode, int i_pos ) 
    658650{ 
    659651    int i_err; 
     
    663655    p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 
    664656 
    665     if( !p_vlc || ( p_vlc->i_status != VLC_STATUS_STOPPED 
    666                      && p_vlc->i_status != VLC_STATUS_RUNNING ) ) 
    667     { 
    668         fprintf( stderr, "error: invalid status (!STOPPED&&!RUNNING)\n" ); 
    669         return VLC_ESTATUS; 
     657    if( !p_vlc ) 
     658    { 
     659        return VLC_ENOOBJ; 
    670660    } 
    671661 
     
    697687 * 
    698688 *****************************************************************************/ 
    699 int VLC_Set( int i_object, const char *psz_var, vlc_value_t value ) 
     689int VLC_Set( int i_object, char const *psz_var, vlc_value_t value ) 
    700690{ 
    701691    vlc_t *p_vlc; 
     
    705695    if( !p_vlc ) 
    706696    { 
    707         fprintf( stderr, "error: invalid status\n" ); 
    708         return VLC_ESTATUS; 
     697        return VLC_ENOOBJ; 
    709698    } 
    710699 
     
    714703    { 
    715704        module_config_t *p_item; 
    716         const char *psz_newvar = psz_var + 6; 
     705        char const *psz_newvar = psz_var + 6; 
    717706 
    718707        p_item = config_FindConfig( VLC_OBJECT(p_vlc), psz_newvar ); 
     
    747736 * 
    748737 *****************************************************************************/ 
    749 int VLC_Get( int i_object, const char *psz_var, vlc_value_t *p_value ) 
     738int VLC_Get( int i_object, char const *psz_var, vlc_value_t *p_value ) 
    750739{ 
    751740    vlc_t *p_vlc; 
     
    755744    if( !p_vlc ) 
    756745    { 
    757         fprintf( stderr, "error: invalid status\n" ); 
    758         return VLC_ESTATUS; 
     746        return VLC_ENOOBJ; 
    759747    } 
    760748 
     
    775763 
    776764    /* Check that the handle is valid */ 
    777     if( !p_vlc || p_vlc->i_status != VLC_STATUS_STOPPED ) 
    778     { 
    779         fprintf( stderr, "error: invalid status (!STOPPED)\n" ); 
    780         return VLC_ESTATUS; 
    781     } 
    782  
    783     /* Update the handle status */ 
    784     p_vlc->i_status = VLC_STATUS_RUNNING; 
     765    if( !p_vlc ) 
     766    { 
     767        return VLC_ENOOBJ; 
     768    } 
    785769 
    786770    p_playlist = vlc_object_find( p_vlc, VLC_OBJECT_PLAYLIST, FIND_CHILD ); 
     
    788772    if( !p_playlist ) 
    789773    { 
    790         return VLC_EOBJECT
     774        return VLC_ENOOBJ
    791775    } 
    792776 
     
    821805 
    822806    /* Check that the handle is valid */ 
    823     if( !p_vlc || ( p_vlc->i_status != VLC_STATUS_STOPPED 
    824                      && p_vlc->i_status != VLC_STATUS_RUNNING ) ) 
    825     { 
    826         fprintf( stderr, "error: invalid status (!STOPPED&&!RUNNING)\n" ); 
    827         return VLC_ESTATUS; 
     807    if( !p_vlc ) 
     808    { 
     809        return VLC_ENOOBJ; 
    828810    } 
    829811 
     
    874856    } 
    875857 
    876     /* Update the handle status */ 
    877     p_vlc->i_status = VLC_STATUS_STOPPED; 
    878  
    879858    return VLC_SUCCESS; 
    880859} 
     
    892871    if( !p_vlc ) 
    893872    { 
    894         return VLC_ESTATUS
     873        return VLC_ENOOBJ
    895874    } 
    896875 
     
    899878    if( !p_input ) 
    900879    { 
    901         return VLC_EOBJECT
     880        return VLC_ENOOBJ
    902881    } 
    903882 
     
    920899    if( !p_vlc ) 
    921900    { 
    922         return VLC_ESTATUS
     901        return VLC_ENOOBJ
    923902    } 
    924903 
     
    927906    if( !p_vout ) 
    928907    { 
    929         return VLC_EOBJECT
     908        return VLC_ENOOBJ
    930909    } 
    931910