Changeset bf7985b74afcef9103b35a3c47eeae5845ae681b
- Timestamp:
- 10/14/02 18:46:56 (6 years ago)
- git-parent:
- Files:
-
- Makefile.am (modified) (2 diffs)
- configure.ac.in (modified) (2 diffs)
- include/main.h (modified) (2 diffs)
- include/variables.h (modified) (4 diffs)
- include/vlc/vlc.h (modified) (5 diffs)
- include/vlc_objects.h (modified) (3 diffs)
- modules/control/rc/rc.c (modified) (13 diffs)
- modules/gui/familiar/familiar.c (modified) (2 diffs)
- modules/gui/gtk/gnome.c (modified) (2 diffs)
- modules/gui/gtk/gtk.c (modified) (2 diffs)
- src/libvlc.c (modified) (27 diffs)
- src/misc/messages.c (modified) (3 diffs)
- src/misc/modules.c (modified) (2 diffs)
- src/misc/objects.c (modified) (8 diffs)
- src/misc/variables.c (modified) (10 diffs)
- src/vlc.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Makefile.am
r2328fae rbf7985b 156 156 include/configuration.h \ 157 157 include/darwin_specific.h \ 158 include/error.h \ 158 159 include/input_ext-dec.h \ 159 160 include/input_ext-intf.h \ … … 337 338 src/misc/objects.c \ 338 339 src/misc/variables.c \ 340 src/misc/error.c \ 339 341 src/misc/extras.c \ 340 342 $(SOURCES_libvlc_win32) \ configure.ac.in
r2328fae rbf7985b 2130 2130 if test "x${enable_testsuite}" = "xyes" 2131 2131 then 2132 TESTS="test1 test2 test3" 2132 TESTS="test1 test2 test3 test4" 2133 2133 2134 dnl we define those so that bootstrap sets the right linker 2134 2135 CXXFLAGS_test2="${CXXFLAGS_test2}" … … 2136 2137 dnl this one is needed until automake knows what to do 2137 2138 LDFLAGS_test3="${LDFLAGS_test3} -lobjc" 2139 2138 2140 PLUGINS="${PLUGINS} ${TESTS}" 2139 2141 #BUILTINS="${BUILTINS} ${TESTS}" include/main.h
r89987e1 rbf7985b 4 4 ***************************************************************************** 5 5 * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN 6 * $Id: main.h,v 1.4 8 2002/10/04 18:07:21sam Exp $6 * $Id: main.h,v 1.49 2002/10/14 16:46:55 sam Exp $ 7 7 * 8 8 * Authors: Vincent Seguin <seguin@via.ecp.fr> … … 74 74 VLC_COMMON_MEMBERS 75 75 76 /* The vlc structure status */77 int i_status;78 79 76 /* Global properties */ 80 77 int i_argc; /* command line arguments count */ include/variables.h
rf78e558 rbf7985b 3 3 ***************************************************************************** 4 4 * Copyright (C) 2002 VideoLAN 5 * $Id: variables.h,v 1. 1 2002/10/11 11:05:52sam Exp $5 * $Id: variables.h,v 1.2 2002/10/14 16:46:55 sam Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 31 31 #define VLC_VAR_TIME 0x0500 32 32 #define VLC_VAR_ADDRESS 0x0600 33 #define VLC_VAR_COMMAND 0x0700 33 34 34 35 /***************************************************************************** … … 52 53 * Prototypes 53 54 *****************************************************************************/ 54 VLC_EXPORT( void, __var_Create, ( vlc_object_t *, const char *, int ) );55 VLC_EXPORT( void, __var_Destroy, ( vlc_object_t *, const char * ) );55 VLC_EXPORT( int, __var_Create, ( vlc_object_t *, const char *, int ) ); 56 VLC_EXPORT( int, __var_Destroy, ( vlc_object_t *, const char * ) ); 56 57 58 VLC_EXPORT( int, __var_Type, ( vlc_object_t *, const char * ) ); 57 59 VLC_EXPORT( int, __var_Set, ( vlc_object_t *, const char *, vlc_value_t ) ); 58 60 VLC_EXPORT( int, __var_Get, ( vlc_object_t *, const char *, vlc_value_t * ) ); … … 64 66 __var_Destroy( VLC_OBJECT(a), b ) 65 67 68 #define var_Type(a,b) \ 69 __var_Type( VLC_OBJECT(a), b ) 70 66 71 #define var_Set(a,b,c) \ 67 72 __var_Set( VLC_OBJECT(a), b, c ) include/vlc/vlc.h
r464bd2e rbf7985b 3 3 ***************************************************************************** 4 4 * Copyright (C) 1998, 1999, 2000 VideoLAN 5 * $Id: vlc.h,v 1.1 5 2002/10/11 22:32:56sam Exp $5 * $Id: vlc.h,v 1.16 2002/10/14 16:46:55 sam Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify … … 40 40 void * p_address; 41 41 42 /* Use this to make sure the structure is at least 64bits */42 /* Make sure the structure is at least 64bits */ 43 43 struct { char a, b, c, d, e, f, g, h; } padding; 44 44 … … 50 50 #define VLC_SUCCESS -0 /* No error */ 51 51 #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 57 62 #define VLC_EEXIT -255 /* Program exited */ 58 63 #define VLC_EGENERIC -666 /* Generic error */ … … 63 68 #define VLC_FALSE 0 64 69 #define VLC_TRUE 1 65 66 /*****************************************************************************67 * Main structure status68 *****************************************************************************/69 #define VLC_STATUS_NONE 0x0000000070 #define VLC_STATUS_CREATED 0x0202020271 #define VLC_STATUS_STOPPED 0x1212121272 #define VLC_STATUS_RUNNING 0x4242424273 70 74 71 /***************************************************************************** … … 111 108 * Exported libvlc API 112 109 *****************************************************************************/ 113 char * VLC_Version ( void ); 110 char const * VLC_Version ( void ); 111 char const * VLC_Error ( int ); 114 112 115 int VLC_Create ( void );116 int VLC_Init ( int, int, char *[] );117 int VLC_Die ( int );118 int VLC_Destroy ( int );113 int VLC_Create ( void ); 114 int VLC_Init ( int, int, char *[] ); 115 int VLC_Die ( int ); 116 int VLC_Destroy ( int ); 119 117 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 );118 int VLC_Set ( int, char const *, vlc_value_t ); 119 int VLC_Get ( int, char const *, vlc_value_t * ); 120 int VLC_AddIntf ( int, char const *, vlc_bool_t ); 121 int VLC_AddTarget ( int, char const *, int, int ); 124 122 125 int VLC_Play ( int );126 int VLC_Pause ( int );127 int VLC_Stop ( int );128 int VLC_FullScreen ( int );123 int VLC_Play ( int ); 124 int VLC_Pause ( int ); 125 int VLC_Stop ( int ); 126 int VLC_FullScreen ( int ); 129 127 130 128 # ifdef __cplusplus include/vlc_objects.h
r464bd2e rbf7985b 3 3 ***************************************************************************** 4 4 * Copyright (C) 2002 VideoLAN 5 * $Id: vlc_objects.h,v 1.1 2 2002/10/11 22:32:55 sam Exp $5 * $Id: vlc_objects.h,v 1.13 2002/10/14 16:46:55 sam Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 78 78 VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) ); 79 79 80 VLC_EXPORT( void, __vlc_liststructure, ( vlc_object_t * ) );81 VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) );82 83 80 #define vlc_object_create(a,b) \ 84 81 __vlc_object_create( VLC_OBJECT(a), b ) … … 109 106 __vlc_list_find( VLC_OBJECT(a),b,c) 110 107 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 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: rc.c,v 1. 8 2002/10/11 22:32:56sam Exp $5 * $Id: rc.c,v 1.9 2002/10/14 16:46:55 sam Exp $ 6 6 * 7 7 * Authors: Peter Surda <shurdeek@panorama.sth.ac.at> … … 58 58 static void Run ( intf_thread_t *p_intf ); 59 59 60 static int Playlist ( vlc_object_t *, char *, char * ); 61 static int Quit ( vlc_object_t *, char *, char * ); 62 static int Intf ( vlc_object_t *, char *, char * ); 63 60 64 /***************************************************************************** 61 65 * Module descriptor … … 90 94 { 91 95 msg_Warn( p_intf, "fd 0 is not a TTY" ); 92 return 1;96 return VLC_EGENERIC; 93 97 } 94 98 #endif … … 102 106 103 107 printf( "remote control interface initialized, `h' for help\n" ); 104 return 0;108 return VLC_SUCCESS; 105 109 } 106 110 … … 117 121 118 122 char p_buffer[ MAX_LINE_LENGTH + 1 ]; 119 vlc_bool_t b_complete = 0;120 123 vlc_bool_t b_showpos = config_GetInt( p_intf, "rc-show-pos" ); 121 124 input_info_category_t * p_category; … … 125 128 off_t i_oldpos = 0; 126 129 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; 131 132 132 133 p_input = NULL; 133 134 p_playlist = NULL; 134 135 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 ); 137 152 138 153 while( !p_intf->b_die ) 139 154 { 140 b_complete = 0; 155 fd_set fds; 156 struct timeval tv; 157 vlc_bool_t b_complete = VLC_FALSE; 141 158 142 159 /* Check stdin */ … … 165 182 { 166 183 p_buffer[ i_size ] = 0; 167 b_complete = 1;184 b_complete = VLC_TRUE; 168 185 } 169 186 } … … 216 233 217 234 /* 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" ) ) 295 287 { 296 288 if ( p_input ) … … 320 312 } 321 313 } 322 else switch( p _cmd[0] )314 else switch( psz_cmd[0] ) 323 315 { 324 316 case 'a': 325 317 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, 329 321 PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); 330 322 } … … 357 349 { 358 350 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'; 361 353 i_dummy++ ) 362 354 { … … 364 356 } 365 357 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 ), 368 360 INPUT_SEEK_SECONDS | INPUT_SEEK_SET ); 369 361 /* rcreseek(f_cpos); */ … … 396 388 break; 397 389 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 ); 399 391 break; 400 392 } … … 413 405 p_playlist = NULL; 414 406 } 415 416 var_Destroy( p_intf, "foo" ); 417 } 418 407 } 408 409 static 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 459 static 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 465 static 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 492 static 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 3 3 ***************************************************************************** 4 4 * Copyright (C) 2002 VideoLAN 5 * $Id: familiar.c,v 1. 9 2002/09/15 19:32:02 jpsamanExp $5 * $Id: familiar.c,v 1.10 2002/10/14 16:46:55 sam Exp $ 6 6 * 7 7 * Authors: Jean-Paul Saman <jpsaman@wxs.nl> … … 76 76 { 77 77 free( p_intf->p_sys ); 78 return VLC_E MODULE;78 return VLC_ENOMOD; 79 79 } 80 80 modules/gui/gtk/gnome.c
r2799d36 rbf7985b 3 3 ***************************************************************************** 4 4 * Copyright (C) 2000 VideoLAN 5 * $Id: gnome.c,v 1. 3 2002/09/30 11:05:39sam Exp $5 * $Id: gnome.c,v 1.4 2002/10/14 16:46:55 sam Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 103 103 { 104 104 free( p_intf->p_sys ); 105 return VLC_E MODULE;105 return VLC_ENOMOD; 106 106 } 107 107 modules/gui/gtk/gtk.c
r89987e1 rbf7985b 3 3 ***************************************************************************** 4 4 * Copyright (C) 2000-2001 VideoLAN 5 * $Id: gtk.c,v 1. 5 2002/10/04 18:07:21sam Exp $5 * $Id: gtk.c,v 1.6 2002/10/14 16:46:55 sam Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 101 101 { 102 102 free( p_intf->p_sys ); 103 return VLC_E MODULE;103 return VLC_ENOMOD; 104 104 } 105 105 #endif src/libvlc.c
r464bd2e rbf7985b 3 3 ***************************************************************************** 4 4 * Copyright (C) 1998-2002 VideoLAN 5 * $Id: libvlc.c,v 1.3 8 2002/10/11 22:32:56sam Exp $5 * $Id: libvlc.c,v 1.39 2002/10/14 16:46:55 sam Exp $ 6 6 * 7 7 * Authors: Vincent Seguin <seguin@via.ecp.fr> … … 62 62 #include "os_specific.h" 63 63 64 #include "error.h" 64 65 #include "netutils.h" /* network_ChannelJoin */ 65 66 … … 87 88 *****************************************************************************/ 88 89 static int GetFilenames ( vlc_t *, int, char *[] ); 89 static void Usage ( vlc_t *, c onst char*psz_module_name );90 static void Usage ( vlc_t *, char const *psz_module_name ); 90 91 static void ListModules ( vlc_t * ); 91 92 static void Version ( void ); … … 100 101 * This function returns full version string (numeric version and codename). 101 102 *****************************************************************************/ 102 char * VLC_Version( void )103 char const * VLC_Version( void ) 103 104 { 104 105 return VERSION_MESSAGE; 106 } 107 108 /***************************************************************************** 109 * VLC_Error: strerror() equivalent 110 ***************************************************************************** 111 * This function returns full version string (numeric version and codename). 112 *****************************************************************************/ 113 char const * VLC_Error( int i_err ) 114 { 115 return vlc_error( i_err ); 105 116 } 106 117 … … 183 194 p_static_vlc = p_vlc; 184 195 185 /* Update the handle status */186 p_vlc->i_status = VLC_STATUS_CREATED;187 188 196 return p_vlc->i_object_id; 189 197 } … … 209 217 p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 210 218 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; 216 222 } 217 223 … … 483 489 } 484 490 485 /* Update the handle status */486 p_vlc->i_status = VLC_STATUS_STOPPED;487 488 491 /* 489 492 * Get input filenames given as commandline arguments … … 502 505 * user requests to quit. 503 506 *****************************************************************************/ 504 int VLC_AddIntf( int i_object, c onst char*psz_module, vlc_bool_t b_block )507 int VLC_AddIntf( int i_object, char const *psz_module, vlc_bool_t b_block ) 505 508 { 506 509 int i_err; … … 511 514 p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 512 515 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; 518 519 } 519 520 … … 567 568 p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 568 569 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 } 587 582 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 ); 595 602 596 free( p_vlc->psz_homedir ); 603 /* 604 * System specific cleaning code 605 */ 606 system_End( p_vlc ); 597 607 598 /*599 * XXX: Free module bank !600 */601 //module_EndBank( p_vlc );602 603 /*604 * System specific cleaning code605 */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 615 608 /* Destroy mutexes */ 616 609 vlc_mutex_destroy( &p_vlc->config_lock ); … … 640 633 if( !p_vlc ) 641 634 { 642 fprintf( stderr, "error: invalid status (!EXIST)\n" ); 643 return VLC_ESTATUS; 635 return VLC_ENOOBJ; 644 636 } 645 637 … … 655 647 * not exist, it will create one. 656 648 *****************************************************************************/ 657 int VLC_AddTarget( int i_object, c onst char*psz_target, int i_mode, int i_pos )649 int VLC_AddTarget( int i_object, char const *psz_target, int i_mode, int i_pos ) 658 650 { 659 651 int i_err; … … 663 655 p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; 664 656 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; 670 660 } 671 661 … … 697 687 * 698 688 *****************************************************************************/ 699 int VLC_Set( int i_object, c onst char*psz_var, vlc_value_t value )689 int VLC_Set( int i_object, char const *psz_var, vlc_value_t value ) 700 690 { 701 691 vlc_t *p_vlc; … … 705 695 if( !p_vlc ) 706 696 { 707 fprintf( stderr, "error: invalid status\n" ); 708 return VLC_ESTATUS; 697 return VLC_ENOOBJ; 709 698 } 710 699 … … 714 703 { 715 704 module_config_t *p_item; 716 c onst char*psz_newvar = psz_var + 6;705 char const *psz_newvar = psz_var + 6; 717 706 718 707 p_item = config_FindConfig( VLC_OBJECT(p_vlc), psz_newvar ); … … 747 736 * 748 737 *****************************************************************************/ 749 int VLC_Get( int i_object, c onst char*psz_var, vlc_value_t *p_value )738 int VLC_Get( int i_object, char const *psz_var, vlc_value_t *p_value ) 750 739 { 751 740 vlc_t *p_vlc; … … 755 744 if( !p_vlc ) 756 745 { 757 fprintf( stderr, "error: invalid status\n" ); 758 return VLC_ESTATUS; 746 return VLC_ENOOBJ; 759 747 } 760 748 … … 775 763 776 764 /* 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 } 785 769 786 770 p_playlist = vlc_object_find( p_vlc, VLC_OBJECT_PLAYLIST, FIND_CHILD ); … … 788 772 if( !p_playlist ) 789 773 { 790 return VLC_E OBJECT;774 return VLC_ENOOBJ; 791 775 } 792 776 … … 821 805 822 806 /* 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; 828 810 } 829 811 … … 874 856 } 875 857 876 /* Update the handle status */877 p_vlc->i_status = VLC_STATUS_STOPPED;878 879 858 return VLC_SUCCESS; 880 859 } … … 892 871 if( !p_vlc ) 893 872 { 894 return VLC_E STATUS;873 return VLC_ENOOBJ; 895 874 } 896 875 … … 899 878 if( !p_input ) 900 879 { 901 return VLC_E OBJECT;880 return VLC_ENOOBJ; 902 881 } 903 882 … … 920 899 if( !p_vlc ) 921 900 { 922 return VLC_E STATUS;901 return VLC_ENOOBJ; 923 902 } 924 903 … … 927 906 if( !p_vout ) 928 907 { 929 return VLC_E OBJECT;908 return VLC_ENOOBJ; 930 909 } 931 910
