Changeset 24a43144ff5055f2a1b96f3d70a1f681583394bd

Show
Ignore:
Timestamp:
25/09/06 17:51:22 (2 years ago)
Author:
Olivier Aubert <olivier.aubert@liris.cnrs.fr>
git-committer:
Olivier Aubert <olivier.aubert@liris.cnrs.fr> 1159199482 +0000
git-parent:

[f8ba1a1175ce01b5510d6fea1e23218025a118e6]

git-author:
Olivier Aubert <olivier.aubert@liris.cnrs.fr> 1159199482 +0000
Message:

src/control/core.c: prepend a dummy argv[0] to libvlc_new() argv, so
that users of the API can simply pass parameters

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/control/core.c

    re85a5a6 r24a4314  
    8484{ 
    8585    libvlc_instance_t *p_new; 
     86    int i_index; 
     87    char** ppsz_argv = NULL; 
    8688 
    8789    libvlc_int_t *p_libvlc_int = libvlc_InternalCreate(); 
     
    9294 
    9395    /** \todo Look for interface settings. If we don't have any, add -I dummy */ 
    94     /* Because we probably don't want a GUI by default */ 
     96    /* Because we probably don't want a GUI by default */     
    9597 
    96     if( libvlc_InternalInit( p_libvlc_int, argc, argv ) ) 
     98    /* Prepend a dummy argv[0] so that users of the libvlc API do not have to  
     99       do it themselves, and can simply provide the args list. */ 
     100    ppsz_argv = malloc( ( argc + 2 ) * sizeof( char * ) ) ; 
     101    if( ! ppsz_argv )  
     102        RAISENULL( "Out of memory" ); 
     103 
     104    ppsz_argv[0] = strdup("vlc"); 
     105    for ( i_index = 0; i_index < argc; i_index++ ) 
     106        ppsz_argv[i_index + 1] = argv[i_index]; 
     107    ppsz_argv[argc + 1] = NULL; 
     108     
     109    if( libvlc_InternalInit( p_libvlc_int, argc + 1, ppsz_argv ) ) 
    97110        RAISENULL( "VLC initialization failed" ); 
    98111 
    99112    p_new->p_libvlc_int = p_libvlc_int; 
    100113    p_new->p_vlm = NULL; 
     114 
    101115    return p_new; 
    102116}