]> git.sesse.net Git - vlc/commitdiff
* ALL: changes to the playlist_Add() and VLC_AddTarget() proto to include a list...
authorGildas Bazin <gbazin@videolan.org>
Wed, 23 Jul 2003 01:13:48 +0000 (01:13 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 23 Jul 2003 01:13:48 +0000 (01:13 +0000)
* src/input/input.c: parses the input options list before spawning the input and create object variables for these options. Options are of the form "[no[-]]foo[=bar]" where foo is the option name and bar is its value.
* src/input/input.c, src/input/input_dec.c: use the object var api to get the value of the "sout", "sout-video" and "sout-audio" options.
* src/libvlc.c: extended the command line parser to parse input options. Input options must always follow the input they apply to and begin with a ':'.

All these changes allow you to specify input specific options.
eg: ./vlc --no-sout-audio yourvideo.mpeg :sout=udp/http::8080 :sout-audio yourvideo2.mpeg
Here the ":sout" option will only apply to yourvideo.mpeg.
"--no-sout-audio" will be a global option so will apply to yourvideo2.mpeg but the global behaviour is overriden by ":sout-audio" for yourvideo.mpeg.

TODO: - the interfaces need to be modified to benefit from the new playlist_Add() api.
      - only "sout", "sout-video", "sout-audio" implemented for now. To make it work with other options, we need to get rid of all the config_GetFoo() and replace them with var_Create()/var_Change()/var_Get().

30 files changed:
include/configuration.h
include/vlc/vlc.h
include/vlc_playlist.h
modules/access/http.c
modules/access/slp.c
modules/control/corba/corba.c
modules/control/http.c
modules/control/rc/rc.c
modules/demux/m3u.c
modules/demux/mp4/mp4.c
modules/gui/beos/VlcWrapper.cpp
modules/gui/familiar/callbacks.c
modules/gui/gtk/open.c
modules/gui/gtk/playlist.c
modules/gui/kde/interface.cpp
modules/gui/macosx/applescript.m
modules/gui/macosx/playlist.m
modules/gui/qt/intf.cpp
modules/gui/skins/src/vlcproc.cpp
modules/gui/wxwindows/dialogs.cpp
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/open.cpp
modules/misc/sap.c
mozilla/vlcpeer.cpp
mozilla/vlcshell.cpp
src/input/input.c
src/input/input_dec.c
src/libvlc.c
src/misc/configuration.c
src/playlist/playlist.c

index 76e61ad4abe44f36a1abfd4119cce6c275fa2d7c..a325f472d1ea664aac8263778d8c796a45996a7c 100644 (file)
@@ -4,7 +4,7 @@
  * It includes functions allowing to declare, get or set configuration options.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: configuration.h,v 1.27 2003/05/12 17:33:19 gbazin Exp $
+ * $Id: configuration.h,v 1.28 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -82,6 +82,7 @@ struct module_config_t
  * Prototypes - these methods are used to get, set or manipulate configuration
  * data.
  *****************************************************************************/
+VLC_EXPORT( int,    __config_GetType,  (vlc_object_t *, const char *) );
 VLC_EXPORT( int,    __config_GetInt,   (vlc_object_t *, const char *) );
 VLC_EXPORT( void,   __config_PutInt,   (vlc_object_t *, const char *, int) );
 VLC_EXPORT( float,  __config_GetFloat, (vlc_object_t *, const char *) );
@@ -103,6 +104,7 @@ VLC_EXPORT( void, config_Duplicate, ( module_t *, module_config_t * ) );
 VLC_EXPORT( void, config_SetCallbacks, ( module_config_t *, module_config_t * ) );
 VLC_EXPORT( void, config_UnsetCallbacks, ( module_config_t * ) );
 
+#define config_GetType(a,b) __config_GetType(VLC_OBJECT(a),b)
 #define config_GetInt(a,b) __config_GetInt(VLC_OBJECT(a),b)
 #define config_PutInt(a,b,c) __config_PutInt(VLC_OBJECT(a),b,c)
 #define config_GetFloat(a,b) __config_GetFloat(VLC_OBJECT(a),b)
index a431d00f7e279b1419298262fd524d8698185dba..d746d38ef0bc5717c51bc4760758d66d10ec9c6a 100644 (file)
@@ -2,7 +2,7 @@
  * vlc.h: global header for vlc
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vlc.h,v 1.23 2003/05/05 15:21:28 sigmunau Exp $
+ * $Id: vlc.h,v 1.24 2003/07/23 01:13:47 gbazin Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -42,7 +42,9 @@ typedef union
     void *          p_address;
     vlc_object_t *  p_object;
     vlc_list_t *    p_list;
+
     struct { int i_low, i_high; } time;
+    struct { char *psz_name; int i_object_id; } var;
 
     /* Make sure the structure is at least 64bits */
     struct { char a, b, c, d, e, f, g, h; } padding;
@@ -133,7 +135,7 @@ int     VLC_Destroy      ( int );
 int     VLC_Set          ( int, char const *, vlc_value_t );
 int     VLC_Get          ( int, char const *, vlc_value_t * );
 int     VLC_AddIntf      ( int, char const *, vlc_bool_t );
-int     VLC_AddTarget    ( int, char const *, int, int );
+int     VLC_AddTarget    ( int, char const *, const char **, int, int, int );
 
 int     VLC_Play         ( int );
 int     VLC_Pause        ( int );
index 09abad0635d0308958263d6aaf59c1e22a3eedea..4fa587cf4c163e2eac0fd2004cfe9fa82b7bc5a4 100644 (file)
@@ -2,7 +2,7 @@
  * vlc_playlist.h : Playlist functions
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
- * $Id: vlc_playlist.h,v 1.10 2003/06/27 10:31:02 zorglub Exp $
+ * $Id: vlc_playlist.h,v 1.11 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -28,6 +28,8 @@ struct playlist_item_t
 {
     char *     psz_name;
     char *     psz_uri; 
+    char **    ppsz_options;
+    int        i_options;
     int        i_type;   /* unused yet */
     int        i_status; /* unused yet */
     vlc_bool_t b_autodeletion;
@@ -76,8 +78,8 @@ void           playlist_Destroy  ( playlist_t * );
 #define playlist_Goto(p,i) playlist_Command(p,PLAYLIST_GOTO,i)
 VLC_EXPORT( void, playlist_Command, ( playlist_t *, int, int ) );
 
-VLC_EXPORT( int,  playlist_Add,    ( playlist_t *, const char *, int, int ) );
-VLC_EXPORT( int,  playlist_AddName, (playlist_t *,const char *,const char *, int,int ) );
+VLC_EXPORT( int,  playlist_Add,    ( playlist_t *, const char *, const char **, int, int, int ) );
+VLC_EXPORT( int,  playlist_AddName, (playlist_t *,const char *,const char *, const char **, int, int,int ) );
 VLC_EXPORT( int,  playlist_AddItem, ( playlist_t *, playlist_item_t *, int, int ) );
 VLC_EXPORT( int,  playlist_Delete, ( playlist_t *, int ) );
 VLC_EXPORT( int,  playlist_Move, ( playlist_t *, int, int ) );
index d312d33ced5bce54bc5b5c1c91c3b3d666ce031e..269ef6f2c21ca997ffe3dce6d33e83ce7663dde3 100644 (file)
@@ -2,7 +2,7 @@
  * http.c: HTTP access plug-in
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: http.c,v 1.37 2003/07/16 15:32:40 sam Exp $
+ * $Id: http.c,v 1.38 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -341,7 +341,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
                               i_code, psz_answer, psz_value );
             p_playlist->pp_items[p_playlist->i_index]->b_autodeletion
                                                                   = VLC_TRUE;
-            playlist_Add( p_playlist, psz_value,
+            playlist_Add( p_playlist, psz_value, NULL, 0,
                           PLAYLIST_INSERT | PLAYLIST_GO,
                           p_playlist->i_index + 1 );
             vlc_object_release( p_playlist );
index 39cadd3e365ca8176f878a8d9bf2660039eda63c..de05f1abdfd0e72c8b27795c1d84f45398465949 100644 (file)
@@ -2,7 +2,7 @@
  * slp.c: SLP access plugin
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: slp.c,v 1.12 2003/06/17 16:09:16 gbazin Exp $
+ * $Id: slp.c,v 1.13 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Loïc Minier <lool@videolan.org>
  *
@@ -184,6 +184,8 @@ static SLPBoolean SrvUrlCallback( SLPHandle slph_slp,
     p_playlist_item->i_type = 0;
     p_playlist_item->i_status = 0;
     p_playlist_item->b_autodeletion = VLC_FALSE;
+    p_playlist_item->i_options = 0;
+    p_playlist_item->ppsz_options = 0;
 
     /* search the description of the stream */
     if( SLPOpen( config_GetPsz( p_input, "slp-lang" ),
index 4288183f2cb112b0e2ad25ced1e6fc353e66fbe6..a8b22b2873b5e07e2746f6b3a4e886ed3ff2f5f3 100644 (file)
@@ -2,7 +2,7 @@
  * corba.c : CORBA (ORBit) remote control plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: corba.c,v 1.1 2003/07/07 16:59:00 sam Exp $
+ * $Id: corba.c,v 1.2 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Olivier Aubert <oaubert at lisi dot univ-lyon1 dot fr>
  *
@@ -560,7 +560,7 @@ impl_VLC_MediaControl_add_to_playlist(impl_POA_VLC_MediaControl * servant,
       return;
     }
 
-  playlist_Add (p_playlist, psz_file, PLAYLIST_REPLACE, 0);
+  playlist_Add (p_playlist, psz_file, 0, 0, PLAYLIST_REPLACE, 0);
   vlc_object_release( p_playlist );
 
   return;
index 8a679e4dc3d15928049bbc96e3e8c1390e5208b8..624de5ebc1861d5cffb94d43658bbad138283310 100644 (file)
@@ -2,7 +2,7 @@
  * http.c :  http mini-server ;)
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: http.c,v 1.16 2003/07/21 23:53:55 fenrir Exp $
+ * $Id: http.c,v 1.17 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -1399,7 +1399,7 @@ static void MacroDo( httpd_file_callback_args_t *p_args,
                     char mrl[512];
                     uri_extract_value( p_request, "mrl", mrl, 512 );
                     uri_decode_url_encoded( mrl );
-                    playlist_Add( p_sys->p_playlist, mrl,
+                    playlist_Add( p_sys->p_playlist, mrl, NULL, 0,
                                   PLAYLIST_APPEND, PLAYLIST_END );
                     msg_Dbg( p_intf, "requested playlist add: %s", mrl );
                     break;
index 8aac150ff2243c32e318f3f90a62cd11c9ff83c1..b70e08cc821c25f2a832d6129e83c743110ea307 100644 (file)
@@ -2,7 +2,7 @@
  * rc.c : remote control stdin/stdout plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: rc.c,v 1.35 2003/07/01 12:56:47 sam Exp $
+ * $Id: rc.c,v 1.36 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
  *
@@ -675,7 +675,7 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
     else if( !strcmp( psz_cmd, "add" ) )
     {
         printf( "trying to add %s to playlist\n", newval.psz_string );
-        playlist_Add( p_playlist, newval.psz_string,
+        playlist_Add( p_playlist, newval.psz_string, NULL, 0,
                       PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END );
     }
     else if( !strcmp( psz_cmd, "playlist" ) )
index c97699c92f524828695ced1bef282bee71793762..e3dd77eb5a7926dd8b0ec09d06074a4bbd30ed10 100644 (file)
@@ -2,7 +2,7 @@
  * m3u.c: a meta demux to parse pls, m3u, asx et b4s playlists
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: m3u.c,v 1.22 2003/06/29 19:15:04 fenrir Exp $
+ * $Id: m3u.c,v 1.23 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -552,9 +552,8 @@ static void ProcessLine ( input_thread_t *p_input, playlist_t *p_playlist,
     if( b_next && *ppsz_uri )
     {
         playlist_AddName( p_playlist,
-                          *ppsz_name ? *ppsz_name : *ppsz_uri,
-                          *ppsz_uri,
-                          PLAYLIST_INSERT, *pi_position );
+                          *ppsz_name ? *ppsz_name : *ppsz_uri, *ppsz_uri,
+                          0, 0, PLAYLIST_INSERT, *pi_position );
         (*pi_position)++;
         if( *ppsz_name )
         {
@@ -645,7 +644,8 @@ static int Demux ( input_thread_t *p_input )
             psz_line[i_linepos] = '\0';
             i_linepos = 0;
 
-            ProcessLine( p_input, p_playlist, psz_line, &psz_uri, &psz_name, &i_position );
+            ProcessLine( p_input, p_playlist, psz_line, &psz_uri, &psz_name,
+                         &i_position );
         }
 
         input_DeletePacket( p_input->p_method_data, p_data );
@@ -655,11 +655,13 @@ static int Demux ( input_thread_t *p_input )
     {
         psz_line[i_linepos] = '\0';
 
-        ProcessLine( p_input, p_playlist, psz_line, &psz_uri, &psz_name, &i_position );
+        ProcessLine( p_input, p_playlist, psz_line, &psz_uri, &psz_name,
+                     &i_position );
         /* is there a pendding uri without b_next */
         if( psz_uri )
         {
-            playlist_Add( p_playlist, psz_uri, PLAYLIST_INSERT, i_position );
+            playlist_Add( p_playlist, psz_uri, 0, 0,
+                          PLAYLIST_INSERT, i_position );
         }
     }
 
index 257cc5cd1e57bc3d240c722f65e5962d916cb19c..bcf370368d957933347be4f672a8914002e5754f 100644 (file)
@@ -2,7 +2,7 @@
  * mp4.c : MP4 file input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: mp4.c,v 1.33 2003/05/24 02:48:55 hartman Exp $
+ * $Id: mp4.c,v 1.34 2003/07/23 01:13:47 gbazin Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -257,7 +257,8 @@ static int MP4Init( vlc_object_t * p_this )
                         !strncmp( psz_ref, "rtsp://", 7 ) )
                     {
                         msg_Dbg( p_input, "adding ref = `%s'", psz_ref );
-                        playlist_Add( p_playlist, psz_ref, PLAYLIST_APPEND, PLAYLIST_END );
+                        playlist_Add( p_playlist, psz_ref, 0, 0,
+                                      PLAYLIST_APPEND, PLAYLIST_END );
                     }
                     else
                     {
@@ -278,7 +279,8 @@ static int MP4Init( vlc_object_t * p_this )
                         }
                         strcat( psz_absolute, psz_ref );
                         msg_Dbg( p_input, "adding ref = `%s'", psz_absolute );
-                        playlist_Add( p_playlist, psz_absolute, PLAYLIST_APPEND, PLAYLIST_END );
+                        playlist_Add( p_playlist, psz_absolute, 0, 0,
+                                      PLAYLIST_APPEND, PLAYLIST_END );
                     }
                 }
                 else
index 9528d5c44cfff2662c987dfbcf53f75035c3e576..8accd59383a2b9440cb7a631684f4bd2e9ebd519 100644 (file)
@@ -2,7 +2,7 @@
  * VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: VlcWrapper.cpp,v 1.35 2003/06/22 00:40:18 titer Exp $
+ * $Id: VlcWrapper.cpp,v 1.36 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -358,7 +358,7 @@ void VlcWrapper::OpenFiles( BList* o_files, bool replace, int32 index )
                if ( BString* o_file = (BString *)o_files->RemoveItem( i ) )
                {
                        playlist_Add( p_playlist, o_file->String(),
-                                     mode, index );
+                                     0, 0, mode, index );
                        if ( mode == PLAYLIST_INSERT )
                                index++;
                        delete o_file;
@@ -381,7 +381,7 @@ void VlcWrapper::OpenDisc(BString o_type, BString o_device, int i_title, int i_c
         o_device.Prepend( "dvdplay:" );
     else
         o_device.Prepend( "dvdold:" );
-    playlist_Add( p_playlist, o_device.String(),
+    playlist_Add( p_playlist, o_device.String(), 0, 0,
                   PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
 }
 
index 7f40b11547bde38c1cfe24da162158183ecf61b9..26a8ffaa214e6149bb66f2238c0de53815387406 100644 (file)
@@ -2,7 +2,7 @@
  * callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: callbacks.c,v 1.22 2003/03/13 15:50:17 marcari Exp $
+ * $Id: callbacks.c,v 1.23 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
  *
@@ -105,7 +105,7 @@ void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url )
     {
         if (p_intf->p_sys->b_autoplayfile)
         {
-            playlist_Add( p_playlist, (char*)psz_url,
+           playlist_Add( p_playlist, (char*)psz_url, 0, 0,
                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
         }
         else
index 5b3c9f8d5838665e6653dd08400c6e5f8d979f56..5ce40307dec90e53e16961b8185fd1497d6dd4e2 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_open.c : functions to handle file/disc/network open widgets.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: open.c,v 1.14 2003/05/05 16:09:39 gbazin Exp $
+ * $Id: open.c,v 1.15 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -550,7 +550,7 @@ void GtkOpenOk( GtkButton * button, gpointer user_data )
 
     psz_target = gtk_entry_get_text( GTK_ENTRY( lookup_widget(
                                        GTK_WIDGET(button), "entry_open" ) ) );
-    playlist_Add( p_playlist, (char*)psz_target,
+    playlist_Add( p_playlist, (char*)psz_target, 0, 0,
                   PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
 
     /* catch the GTK CList */
index d161fb1893f9c8b56c13991c890af4c231a47858..25b60302f6273cde019a238c6870d2f4cf95b5ae 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_playlist.c : Interface for the playlist dialog
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: playlist.c,v 1.3 2003/01/23 15:52:04 sam Exp $
+ * $Id: playlist.c,v 1.4 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Pierre Baillet <oct@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -622,7 +622,7 @@ int GtkAppendList( playlist_t * p_playlist, int i_pos, GList * p_list )
                 /* ok; this is a really nasty trick to insert
                    the item where they are suppose to go but, hey
                    this works :P (btw, you are really nasty too) */
-               g_list_nth_data( p_list, i_dummy ),
+               g_list_nth_data( p_list, i_dummy ), 0, 0,
                i_dummy == 0 ? PLAYLIST_INSERT | PLAYLIST_GO : PLAYLIST_INSERT,
                i_pos == PLAYLIST_END ? PLAYLIST_END : ( i_pos + i_dummy ) );
     }
index 7a9c91f463c5cdf56dab8905cf0c07e5746fc92e..27a303acffe835e0314f8ad8d687d7dc66a90f30 100644 (file)
@@ -208,7 +208,7 @@ void KInterface::slotFileOpen()
         if( p_playlist )
         {
             fileOpenRecent->addURL( url );
-            playlist_Add( p_playlist, url.path(),
+            playlist_Add( p_playlist, url.path(), 0, 0,
                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
             vlc_object_release( p_playlist );
         }
@@ -536,7 +536,7 @@ void KInterface::slotOpenDisk()
         if( p_playlist )
         {
             // add it to playlist
-            playlist_Add( p_playlist, source.latin1(),
+            playlist_Add( p_playlist, source.latin1(), 0, 0,
                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
             vlc_object_release( p_playlist );
         }
@@ -562,7 +562,7 @@ void KInterface::slotOpenStream()
         if( p_playlist )
         {
             // add it to playlist
-            playlist_Add( p_playlist, source.latin1(),
+            playlist_Add( p_playlist, source.latin1(), 0, 0,
                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
             vlc_object_release( p_playlist );
         }
@@ -664,7 +664,7 @@ void KInterface::dropEvent( QDropEvent *event )
             if( !(*i).isEmpty() )
             {
                 fileOpenRecent->addURL( *i );
-                playlist_Add( p_playlist, (*i).path(),
+                playlist_Add( p_playlist, (*i).path(), 0, 0,
                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
             }
         }
index 8cc131d257ae76d73dc0dad4e1410618551bebaf..6fc5528381a48fea09f5e0719af7b9e76407a8a1 100644 (file)
@@ -2,7 +2,7 @@
  * applescript.m: MacOS X AppleScript support
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: applescript.m,v 1.3 2003/06/15 15:20:21 hartman Exp $
+ * $Id: applescript.m,v 1.4 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
  *
@@ -56,7 +56,7 @@
             int i_mode = PLAYLIST_INSERT | PLAYLIST_GO;
             
             playlist_Add( p_playlist, [o_urlString fileSystemRepresentation],
-                                                    i_mode, PLAYLIST_END );
+                          0, 0, i_mode, PLAYLIST_END );
 
             o_url = [NSURL fileURLWithPath: o_urlString];
             if( o_url != nil )
     return nil;
 }
 
-@end
\ No newline at end of file
+@end
index 0b5138af8c8bdb3d6352cb25756feb74caceee8d..d382b6082da25d61fcd67cd2607a2eaf052d671a 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: playlist.m,v 1.27 2003/06/30 01:51:10 hartman Exp $
+ * $Id: playlist.m,v 1.28 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Derk-Jan Hartman <thedj@users.sourceforge.net>
@@ -312,7 +312,7 @@ int MacVersion102 = -1;
             i_mode |= PLAYLIST_GO;
 
         playlist_Add( p_playlist, [o_value fileSystemRepresentation],
-            i_mode, i_pos == -1 ? PLAYLIST_END : i_pos + i_items );
+            0, 0, i_mode, i_pos == -1 ? PLAYLIST_END : i_pos + i_items );
 
         o_url = [NSURL fileURLWithPath: o_value];
         if( o_url != nil )
index 6c14797f5c30fe339ba1d1c860a975b2ff79a9f8..8a338ad3402c37d08655183fc737d2284a05e6b3 100644 (file)
@@ -2,7 +2,7 @@
  * intf.cpp: Qt interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: intf.cpp,v 1.3 2002/09/30 11:05:39 sam Exp $
+ * $Id: intf.cpp,v 1.4 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -299,7 +299,7 @@ void IntfWindow::FileOpen( void )
             return;
         }
 
-        playlist_Add( p_playlist, file.latin1(),
+        playlist_Add( p_playlist, file.latin1(), 0, 0,
                       PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
         vlc_object_release( p_playlist );
     }
index 0823b6025f5db5481d447a8fcef20cc80e6256ce..7b59d9874d1fddc2722301aec509e3fa99ac38dc 100644 (file)
@@ -2,7 +2,7 @@
  * vlcproc.cpp: VlcProc class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.42 2003/07/20 20:42:23 ipkiss Exp $
+ * $Id: vlcproc.cpp,v 1.43 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -414,12 +414,12 @@ void VlcProc::DropFile( unsigned int param )
     {
         if( config_GetInt( p_intf, "enqueue" ) )
         {
-            playlist_Add( p_intf->p_sys->p_playlist, FileName,
+            playlist_Add( p_intf->p_sys->p_playlist, FileName, 0, 0,
                           PLAYLIST_APPEND, PLAYLIST_END );
         }
         else
         {
-            playlist_Add( p_intf->p_sys->p_playlist, FileName,
+            playlist_Add( p_intf->p_sys->p_playlist, FileName, 0, 0,
                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
         }
     }
index 1d01a63d8cd026b346c1a2dfd891d59041a7f78d..bc8479a8a8fbefbce3e79fccf9f5822def1f5fb9 100644 (file)
@@ -2,7 +2,7 @@
  * dialogs.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: dialogs.cpp,v 1.4 2003/07/20 10:38:49 gbazin Exp $
+ * $Id: dialogs.cpp,v 1.5 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -277,11 +277,12 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
         for( size_t i = 0; i < paths.GetCount(); i++ )
             if( event.GetInt() )
                 playlist_Add( p_playlist, (const char *)paths[i].mb_str(),
+                              0, 0,
                               PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO),
                               PLAYLIST_END );
             else
                 playlist_Add( p_playlist, (const char *)paths[i].mb_str(),
-                              PLAYLIST_APPEND, PLAYLIST_END );
+                              0, 0, PLAYLIST_APPEND, PLAYLIST_END );
     }
 
     vlc_object_release( p_playlist );
index d2cc37cf0b0e1b53c8cf38f11ee00921f821048a..0d953a817cd3026ee2b8a2d454f44cd942f044f4 100644 (file)
@@ -2,7 +2,7 @@
  * interface.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: interface.cpp,v 1.52 2003/07/22 15:59:06 gbazin Exp $
+ * $Id: interface.cpp,v 1.53 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -833,7 +833,7 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
     }
 
     for( size_t i = 0; i < filenames.GetCount(); i++ )
-        playlist_Add( p_playlist, (const char *)filenames[i].mb_str(),
+        playlist_Add( p_playlist, (const char *)filenames[i].mb_str(), 0, 0,
                       PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
 
     vlc_object_release( p_playlist );
index 8e168e34c008b3ab6ce5b205ce1de86089c6d364..eba926c2c6c534201ac259d342f1d8e32ebe4fc7 100644 (file)
@@ -2,7 +2,7 @@
  * open.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: open.cpp,v 1.28 2003/07/17 17:30:40 gbazin Exp $
+ * $Id: open.cpp,v 1.29 2003/07/23 01:13:47 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -660,7 +660,8 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
     for( size_t i = 0; i < mrl.GetCount(); i++ )
     {
         playlist_Add( p_playlist, (const char *)mrl[i].mb_str(),
-                     PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
+                     0, 0,
+                      PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
     }
 
     //TogglePlayButton( PLAYING_S );
index 7865943e2c8e5468295346908ad29479d2611743..fa580cb655de39be9ee5c734b90c07b4f6b4ef60 100644 (file)
@@ -2,7 +2,7 @@
  * sap.c :  SAP interface module
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: sap.c,v 1.18 2003/07/05 15:00:28 zorglub Exp $
+ * $Id: sap.c,v 1.19 2003/07/23 01:13:48 gbazin Exp $
  *
  * Authors: Arnaud Schauly <gitan@via.ecp.fr>
  *          Clément Stenac <zorglub@via.ecp.fr>
@@ -413,7 +413,7 @@ static int sess_toitem( intf_thread_t * p_intf, sess_descr_t * p_sd )
             p_playlist = vlc_object_find( p_intf,
             VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
 
-            playlist_AddItem ( p_playlist, p_item,
+            playlist_AddItem ( p_playlist, p_item, 0, 0,
             PLAYLIST_CHECK_INSERT, PLAYLIST_END);
             vlc_object_release( p_playlist );
         }
index 339d4d0aa07bd38ebeeb3ef805716a06721da239..c797a29f21db25e1540ee06de1efadf25f336305 100644 (file)
@@ -2,7 +2,7 @@
  * vlcpeer.cpp: scriptable peer descriptor
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: vlcpeer.cpp,v 1.5 2003/07/16 16:33:59 sam Exp $
+ * $Id: vlcpeer.cpp,v 1.6 2003/07/23 01:13:48 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -71,7 +71,7 @@ NS_IMETHODIMP VlcPeer::Play()
     {
         if( !p_plugin->b_stream && p_plugin->psz_target )
         {
-            VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target,
+            VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target, 0, 0,
                            PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
             p_plugin->b_stream = 1;
         }
index 70ed05adb8484c3ad46790e4bd959882c691c42a..bf9bed99e3044aaab77b41025946d4a48d63e7f3 100644 (file)
@@ -2,7 +2,7 @@
  * vlcshell.cpp: a VLC plugin for Mozilla
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: vlcshell.cpp,v 1.14 2003/07/16 16:33:59 sam Exp $
+ * $Id: vlcshell.cpp,v 1.15 2003/07/23 01:13:48 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -479,7 +479,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
         {
 #if USE_LIBVLC
             VLC_AddTarget( p_plugin->i_vlc, p_plugin->psz_target,
-                           i_mode, PLAYLIST_END );
+                           0, 0, i_mode, PLAYLIST_END );
 #endif
             p_plugin->b_stream = VLC_TRUE;
         }
@@ -579,7 +579,7 @@ void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* fname )
 #if USE_LIBVLC
     VlcPlugin* p_plugin = (VlcPlugin*)instance->pdata;
 
-    VLC_AddTarget( p_plugin->i_vlc, fname,
+    VLC_AddTarget( p_plugin->i_vlc, fname, 0, 0,
                    PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
 #endif
 }
index 9db30ae7eb0bc294336b52795c29a17d8fb09da7..06516976123a5389f6f9d04655f47f2e2aaef9fb 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: input.c,v 1.233 2003/06/28 21:27:35 fenrir Exp $
+ * $Id: input.c,v 1.234 2003/07/23 01:13:48 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -56,6 +56,9 @@ static  int InitThread      ( input_thread_t *p_input );
 static void ErrorThread     ( input_thread_t *p_input );
 static void EndThread       ( input_thread_t *p_input );
 
+static void ParseOption     ( input_thread_t *p_input,
+                              const char *psz_option );
+
 /*****************************************************************************
  * input_CreateThread: creates a new input thread
  *****************************************************************************
@@ -67,6 +70,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
 {
     input_thread_t *    p_input;                        /* thread descriptor */
     input_info_category_t * p_info;
+    int i;
 
     /* Allocate descriptor */
     p_input = vlc_object_create( p_parent, VLC_OBJECT_INPUT );
@@ -76,6 +80,29 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
         return NULL;
     }
 
+    /* Parse input options */
+    for( i = 0; i < p_item->i_options; i++ )
+    {
+        ParseOption( p_input, p_item->ppsz_options[i] );
+    }
+
+    /* Create a few object variables we'll need later */
+    if( !var_Type( p_input, "sout" ) )
+    {
+        var_Create( p_input, "sout", VLC_VAR_STRING );
+        var_Change( p_input, "sout", VLC_VAR_INHERITVALUE, NULL, NULL );
+    }
+    if( !var_Type( p_input, "sout-audio" ) )
+    {
+        var_Create( p_input, "sout-audio", VLC_VAR_BOOL );
+        var_Change( p_input, "sout-audio", VLC_VAR_INHERITVALUE, NULL, NULL );
+    }
+    if( !var_Type( p_input, "sout-video" ) )
+    {
+        var_Create( p_input, "sout-video", VLC_VAR_BOOL );
+        var_Change( p_input, "sout-video", VLC_VAR_INHERITVALUE, NULL, NULL );
+    }
+
     /* Initialize thread properties */
     p_input->b_eof      = 0;
 
@@ -371,6 +398,7 @@ static int InitThread( input_thread_t * p_input )
 {
     /* Parse source string. Syntax : [[<access>][/<demux>]:][<source>] */
     char * psz_parser = p_input->psz_dupsource = strdup(p_input->psz_source);
+    vlc_value_t val;
 
     /* Skip the plug-in names */
     while( *psz_parser && *psz_parser != ':' )
@@ -518,21 +546,20 @@ static int InitThread( input_thread_t * p_input )
     }
 
     /* Initialize optional stream output. */
-    psz_parser = config_GetPsz( p_input, "sout" );
-    if ( psz_parser != NULL )
+    var_Get( p_input, "sout", &val );
+    if ( val.psz_string != NULL )
     {
-        if ( *psz_parser &&
-             (p_input->stream.p_sout = sout_NewInstance( p_input, psz_parser ))
-               == NULL )
+        if ( *val.psz_string && (p_input->stream.p_sout =
+             sout_NewInstance( p_input, val.psz_string )) == NULL )
         {
             msg_Err( p_input, "cannot start stream output instance, aborting" );
-            free( psz_parser );
+            free( val.psz_string );
             module_Unneed( p_input, p_input->p_access );
             module_Unneed( p_input, p_input->p_demux );
             return -1;
         }
 
-        free( psz_parser );
+        free( val.psz_string );
     }
 
     return 0;
@@ -609,3 +636,98 @@ static void EndThread( input_thread_t * p_input )
     p_input->b_dead = 1;
 }
 
+/*****************************************************************************
+ * ParseOption: parses the options for the input
+ *****************************************************************************
+ * This function parses the input (config) options and creates their associated
+ * object variables.
+ * Options are of the form "[no[-]]foo[=bar]" where foo is the option name and
+ * bar is the value of the option.
+ *****************************************************************************/
+static void ParseOption( input_thread_t *p_input, const char *psz_option )
+{
+    char *psz_name = (char *)psz_option;
+    char *psz_value = strchr( psz_option, '=' );
+    int  i_name_len, i_type;
+    vlc_bool_t b_isno = VLC_FALSE;
+    vlc_value_t val;
+
+    if( psz_value ) i_name_len = psz_value - psz_option;
+    else i_name_len = strlen( psz_option );
+
+    /* It's too much of an hassle to remove the ':' when we parse
+     * the cmd line :) */
+    if( i_name_len && *psz_name == ':' )
+    {
+        psz_name++;
+        i_name_len--;
+    }
+
+    if( i_name_len == 0 ) return;
+
+    psz_name = strndup( psz_name, i_name_len );
+    if( psz_value ) psz_value++;
+
+    i_type = config_GetType( p_input, psz_name );
+
+    if( !i_type && !psz_value )
+    {
+        /* check for "no-foo" or "nofoo" */
+        if( !strncmp( psz_name, "no-", 3 ) )
+        {
+            memmove( psz_name, psz_name + 3, strlen(psz_name) + 1 - 3 );
+        }
+        else if( !strncmp( psz_name, "no", 2 ) )
+        {
+            memmove( psz_name, psz_name + 2, strlen(psz_name) + 1 - 2 );
+        }
+        else goto cleanup;           /* Option doesn't exist */
+
+        b_isno = VLC_TRUE;
+        i_type = config_GetType( p_input, psz_name );
+
+        if( !i_type ) goto cleanup;  /* Option doesn't exist */
+    }
+    else if( !i_type ) goto cleanup; /* Option doesn't exist */
+
+    if( ( i_type != VLC_VAR_BOOL ) &&
+        ( !psz_value || !*psz_value ) ) goto cleanup; /* Invalid value */
+
+    /* Create the variable in the input object.
+     * Children of the input object will be able to retreive this value
+     * thanks to the inheritance property of the object variables. */
+    var_Create( p_input, psz_name, i_type );
+
+    switch( i_type )
+    {
+    case VLC_VAR_BOOL:
+        val.b_bool = !b_isno;
+        break;
+
+    case VLC_VAR_INTEGER:
+        val.i_int = atoi( psz_value );
+        break;
+
+    case VLC_VAR_FLOAT:
+        val.f_float = atof( psz_value );
+        break;
+
+    case VLC_VAR_STRING:
+    case VLC_VAR_FILE:
+    case VLC_VAR_DIRECTORY:
+        val.psz_string = psz_value;
+        break;
+
+    default:
+        goto cleanup;
+        break;
+    }
+
+    var_Set( p_input, psz_name, val );
+
+    msg_Dbg( p_input, "set input option: %s to %s", psz_name, psz_value );
+
+  cleanup:
+    if( psz_name ) free( psz_name );
+    return;
+}
index 0ee1d03a661c38eec0c00f8199cf512c4739dec3..8c65f5f35e9df5767bc099b0f1a75fa8b0c137ec 100644 (file)
@@ -2,7 +2,7 @@
  * input_dec.c: Functions for the management of decoders
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: input_dec.c,v 1.60 2003/04/13 20:00:21 fenrir Exp $
+ * $Id: input_dec.c,v 1.61 2003/07/23 01:13:48 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -44,7 +44,7 @@ static void             DeleteDecoderFifo( decoder_fifo_t * );
 decoder_fifo_t * input_RunDecoder( input_thread_t * p_input,
                                    es_descriptor_t * p_es )
 {
-    char           *psz_sout;
+    vlc_value_t    val;
     decoder_fifo_t *p_fifo;
     int i_priority;
 
@@ -58,22 +58,24 @@ decoder_fifo_t * input_RunDecoder( input_thread_t * p_input,
     }
 
     p_fifo->p_module = NULL;
+
     /* If we are in sout mode, search for packetizer module */
-    psz_sout = config_GetPsz( p_input, "sout" );
-    if( !p_es->b_force_decoder && psz_sout != NULL && *psz_sout != 0 )
+    var_Get( p_input, "sout", &val );
+    if( !p_es->b_force_decoder && val.psz_string && *val.psz_string )
     {
-        vlc_bool_t b_sout = VLC_TRUE;
+        free( val.psz_string );
+        val.b_bool = VLC_TRUE;
 
         if( p_es->i_cat == AUDIO_ES )
         {
-            b_sout = config_GetInt( p_input, "sout-audio" );
+            var_Get( p_input, "sout-audio", &val );
         }
         else if( p_es->i_cat == VIDEO_ES )
         {
-            b_sout = config_GetInt( p_input, "sout-video" );
+            var_Get( p_input, "sout-video", &val );
         }
 
-        if( b_sout )
+        if( val.b_bool )
         {
             p_fifo->p_module =
                 module_Need( p_fifo, "packetizer", "$packetizer" );
@@ -83,11 +85,8 @@ decoder_fifo_t * input_RunDecoder( input_thread_t * p_input,
     {
         /* default Get a suitable decoder module */
         p_fifo->p_module = module_Need( p_fifo, "decoder", "$codec" );
-    }
 
-    if( psz_sout )
-    {
-        free( psz_sout );
+        if( val.psz_string ) free( val.psz_string );
     }
 
     if( p_fifo->p_module == NULL )
index f56f840716513328ed1459c2655ebd28c17b3ada..cc0de610a32db324c9b4dcff92025f43469f8818 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.c: main libvlc source
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.c,v 1.93 2003/07/19 14:22:08 gbazin Exp $
+ * $Id: libvlc.c,v 1.94 2003/07/23 01:13:48 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -710,7 +710,9 @@ int VLC_Die( int i_object )
  * This function adds psz_target to the current playlist. If a playlist does
  * not exist, it will create one.
  *****************************************************************************/
-int VLC_AddTarget( int i_object, char const *psz_target, int i_mode, int i_pos )
+int VLC_AddTarget( int i_object, char const *psz_target,
+                   char const **ppsz_options, int i_options,
+                   int i_mode, int i_pos )
 {
     int i_err;
     playlist_t *p_playlist;
@@ -739,7 +741,8 @@ int VLC_AddTarget( int i_object, char const *psz_target, int i_mode, int i_pos )
         vlc_object_yield( p_playlist );
     }
 
-    i_err = playlist_Add( p_playlist, psz_target, i_mode, i_pos );
+    i_err = playlist_Add( p_playlist, psz_target, ppsz_options, i_options,
+                          i_mode, i_pos );
 
     vlc_object_release( p_playlist );
 
@@ -1073,26 +1076,33 @@ static void SetLanguage ( char const *psz_lang )
 /*****************************************************************************
  * GetFilenames: parse command line options which are not flags
  *****************************************************************************
- * Parse command line for input files.
+ * Parse command line for input files as well as their associated options.
+ * An option always follows its associated input and begins with a ":".
  *****************************************************************************/
 static int GetFilenames( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
 {
-    int i_opt;
+    int i_opt, i_options;
 
-    /* We assume that the remaining parameters are filenames */
-    for( i_opt = i_argc - 1; i_opt > optind; i_opt-- )
+    /* We assume that the remaining parameters are filenames
+     * and their input options */
+    for( i_opt = i_argc - 1; i_opt >= optind; i_opt-- )
     {
+        i_options = 0;
+
+        /* Count the input options */
+        while( *ppsz_argv[ i_opt ] == ':' && i_opt > optind )
+        {
+            i_options++;
+            i_opt--;
+        }
+
         /* TODO: write an internal function of this one, to avoid
          *       unnecessary lookups. */
         VLC_AddTarget( p_vlc->i_object_id, ppsz_argv[ i_opt ],
-                       PLAYLIST_INSERT, 0 );
-    }
-
-    /* If there is at least one target, play it */
-    if( i_argc > optind )
-    {
-        VLC_AddTarget( p_vlc->i_object_id, ppsz_argv[ optind ],
-                       PLAYLIST_INSERT | PLAYLIST_GO, 0 );
+                       (char const **)( i_options ? &ppsz_argv[i_opt + 1] :
+                                        NULL ), i_options,
+                       PLAYLIST_INSERT | (i_opt == optind ? PLAYLIST_GO : 0),
+                       0 );
     }
 
     return VLC_SUCCESS;
index 4990fdf9b68de0e643b00a16180b0c8788ba4006..20c695f2497a88f77fad3645ad5d4938ff1f087f 100644 (file)
@@ -2,7 +2,7 @@
  * configuration.c management of the modules configuration
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: configuration.c,v 1.59 2003/07/18 20:06:00 gbazin Exp $
+ * $Id: configuration.c,v 1.60 2003/07/23 01:13:48 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
 #   include <direct.h>
 #endif
 
+/*****************************************************************************
+ * config_GetType: get the type of a variable (bool, int, float, string)
+ *****************************************************************************
+ * This function is used to get the type of a variable from its name.
+ * Beware, this is quite slow.
+ *****************************************************************************/
+int __config_GetType( vlc_object_t *p_this, const char *psz_name )
+{
+    module_config_t *p_config;
+    int i_type;
+
+    p_config = config_FindConfig( p_this, psz_name );
+
+    /* sanity checks */
+    if( !p_config )
+    {
+        return 0;
+    }
+
+    switch( p_config->i_type )
+    {
+    case CONFIG_ITEM_BOOL:
+        i_type = VLC_VAR_BOOL;
+        break;
+
+    case CONFIG_ITEM_INTEGER:
+        i_type = VLC_VAR_INTEGER;
+        break;
+
+    case CONFIG_ITEM_FLOAT:
+        i_type = VLC_VAR_FLOAT;
+        break;
+
+    case CONFIG_ITEM_MODULE:
+    case CONFIG_ITEM_STRING:
+        i_type = VLC_VAR_STRING;
+        break;
+
+    case CONFIG_ITEM_FILE:
+        i_type = VLC_VAR_FILE;
+        break;
+
+    case CONFIG_ITEM_DIRECTORY:
+        i_type = VLC_VAR_DIRECTORY;
+        break;
+
+    default:
+        i_type = 0;
+        break;
+    }
+
+    return i_type;
+}
+
 /*****************************************************************************
  * config_GetInt: get the value of an int variable
  *****************************************************************************
index b7bc6fcd5e76aa49ed068fff41260706da5eebb1..44cc83365c44fc4b10e29333b59a0f49931a28a0 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.c : Playlist management functions
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: playlist.c,v 1.42 2003/07/17 22:54:40 gbazin Exp $
+ * $Id: playlist.c,v 1.43 2003/07/23 01:13:48 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -112,24 +112,12 @@ void playlist_Destroy( playlist_t * p_playlist )
  * Add an item to the playlist at position i_pos. If i_pos is PLAYLIST_END,
  * add it at the end regardless of the playlist current size.
  *****************************************************************************/
-int playlist_Add( playlist_t *p_playlist, const char * psz_target,
-                                          int i_mode, int i_pos )
+int playlist_Add( playlist_t *p_playlist, const char *psz_target,
+                  const char **ppsz_options, int i_options,
+                  int i_mode, int i_pos )
 {
-    playlist_item_t * p_item;
-
-    p_item = malloc( sizeof( playlist_item_t ) );
-    if( p_item == NULL )
-    {
-        msg_Err( p_playlist, "out of memory" );
-    }
-
-    p_item->psz_name = strdup( psz_target );
-    p_item->psz_uri  = strdup( psz_target );
-    p_item->i_type = 0;
-    p_item->i_status = 0;
-    p_item->b_autodeletion = VLC_FALSE;
-
-    return playlist_AddItem( p_playlist, p_item, i_mode, i_pos );
+    return playlist_AddName( p_playlist, psz_target, psz_target,
+                             ppsz_options, i_options, i_mode, i_pos );
 }
 
 /*****************************************************************************
@@ -138,9 +126,10 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_target,
  * Add an item to the playlist at position i_pos. If i_pos is PLAYLIST_END,
  * add it at the end regardless of the playlist current size.
  *****************************************************************************/
-int playlist_AddName( playlist_t *p_playlist, const char * psz_name, 
-                                          const char *psz_uri,
-                                          int i_mode, int i_pos )
+int playlist_AddName( playlist_t *p_playlist, const char *psz_name, 
+                      const char *psz_uri,
+                      const char **ppsz_options, int i_options,
+                      int i_mode, int i_pos )
 {
     playlist_item_t * p_item;
 
@@ -156,6 +145,19 @@ int playlist_AddName( playlist_t *p_playlist, const char * psz_name,
     p_item->i_status = 0;
     p_item->b_autodeletion = VLC_FALSE;
 
+    p_item->ppsz_options = NULL;
+    p_item->i_options = i_options;
+
+    if( i_options )
+    {
+        int i;
+
+        p_item->ppsz_options = (char **)malloc( i_options * sizeof(char *) );
+        for( i = 0; i < i_options; i++ )
+            p_item->ppsz_options[i] = strdup( ppsz_options[i] );
+
+    }
+
     return playlist_AddItem( p_playlist, p_item, i_mode, i_pos );
 }
 
@@ -301,6 +303,15 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos )
         {
             free( p_playlist->pp_items[i_pos]->psz_uri );
         }
+        if( p_playlist->pp_items[i_pos]->i_options )
+        {
+            int i;
+
+            for( i = 0; i < p_playlist->pp_items[i_pos]->i_options; i++ )
+                free( p_playlist->pp_items[i_pos]->ppsz_options[i] );
+
+            free( p_playlist->pp_items[i_pos]->ppsz_options );
+        }
 
         /* XXX: what if the item is still in use? */
         free( p_playlist->pp_items[i_pos] );
@@ -749,7 +760,8 @@ int playlist_LoadFile( playlist_t * p_playlist, const char *psz_filename )
            if( line[strlen(line)-1] == '\r' ) line[strlen(line)-1] = (char)0;
        }
 
-       playlist_Add ( p_playlist , (char*) &line , PLAYLIST_APPEND , PLAYLIST_END );
+       playlist_Add ( p_playlist , (char *)&line ,
+                      0, 0, PLAYLIST_APPEND , PLAYLIST_END );
     }
 
     /* start playing */