]> git.sesse.net Git - vlc/commitdiff
* src/playlist/*: fixed complete fuckage of playlist_ItemAddOption() and moved it...
authorGildas Bazin <gbazin@videolan.org>
Sun, 8 Feb 2004 18:17:22 +0000 (18:17 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 8 Feb 2004 18:17:22 +0000 (18:17 +0000)
* modules/gui/wxwindows/open.cpp: cleanup.

modules/gui/wxwindows/open.cpp
src/playlist/info.c
src/playlist/item.c

index 4aade5b9dd558c7ad8b9d56590404f023e7d8815..f0a25e619287e386a13ab34a83ab6f69961438c0 100644 (file)
@@ -2,7 +2,7 @@
  * open.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2004 VideoLAN
- * $Id: open.cpp,v 1.67 2004/01/29 17:51:08 zorglub Exp $
+ * $Id: open.cpp,v 1.68 2004/02/08 18:17:22 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -889,23 +889,17 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
 
     for( int i = 0; i < (int)mrl.GetCount(); i++ )
     {
-        int i_options = 0;
+        vlc_bool_t b_start = !i && i_open_arg;
         playlist_item_t *p_item =
-                  playlist_ItemNew( p_intf,
-                                    (const char*)mrl[i].mb_str(),
-                                    (const char *)mrl[i].mb_str() );
-
-        /* Count the input options */
-        while( i + i_options + 1 < (int)mrl.GetCount() &&
-               ((const char *)mrl[i + i_options + 1].mb_str())[0] == ':' )
-        {
-            i_options++;
-        }
+            playlist_ItemNew( p_intf, (const char*)mrl[i].mb_str(),
+                              (const char *)mrl[i].mb_str() );
 
         /* Insert options */
-        for( int j = 0; j < i_options; j++ )
+        while( i + 1 < (int)mrl.GetCount() &&
+               ((const char *)mrl[i + 1].mb_str())[0] == ':' )
         {
-            playlist_ItemAddOption( p_item, mrl[i + j  + 1].mb_str() );
+            playlist_ItemAddOption( p_item, mrl[i + 1].mb_str() );
+            i++;
         }
 
         /* Get the options from the subtitles dialog */
@@ -926,15 +920,14 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
             }
         }
 
-       int i_id = playlist_AddItem( p_playlist, p_item,
-                      PLAYLIST_APPEND, PLAYLIST_END );
+        int i_id = playlist_AddItem( p_playlist, p_item,
+                                     PLAYLIST_APPEND, PLAYLIST_END );
 
-        if( !i && i_open_arg )
+        if( b_start )
         {
             int i_pos = playlist_GetPositionById( p_playlist , i_id );
             playlist_Command( p_playlist, PLAYLIST_GOTO, i_pos );
         }
-        i += i_options;
     }
 
     //TogglePlayButton( PLAYING_S );
index 2dd79357feb2eb002870a02b35243c654f0e5acc..3ecb4aae843b3d9ff8801d97250cee72e7b36879 100644 (file)
@@ -2,7 +2,7 @@
  * info.c : Playlist info management
  *****************************************************************************
  * Copyright (C) 1999-2004 VideoLAN
- * $Id: info.c,v 1.8 2004/01/29 17:51:08 zorglub Exp $
+ * $Id: info.c,v 1.9 2004/02/08 18:17:22 gbazin Exp $
  *
  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
  *
@@ -361,21 +361,3 @@ int playlist_AddOption( playlist_t *p_playlist, int i_pos,
 
     return VLC_SUCCESS;
 }
-
-/**
- *  Add a option to one item ( no need for p_playlist )
- *
- * \param p_item the item on which we want the info
- * \param psz_format the option
- * \return 0 on success
-*/
-int playlist_ItemAddOption( playlist_item_t *p_item,
-                            const char *psz_option )
-{
-    INSERT_ELEM( p_item->ppsz_options,
-                 p_item->i_options,
-                 p_item->i_options,
-                 (char *)psz_option);
-
-    return VLC_SUCCESS;
-}
index 1ede7578aab809cb08866d02a0b05490aedbc9f1..69b0b364974c9b35b50d3428a2e252816060edfa 100644 (file)
@@ -2,7 +2,7 @@
  * item.c : Playlist item functions
  *****************************************************************************
  * Copyright (C) 1999-2004 VideoLAN
- * $Id: item.c,v 1.13 2004/01/29 17:51:08 zorglub Exp $
+ * $Id: item.c,v 1.14 2004/02/08 18:17:22 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -165,3 +165,21 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item,
 
     return p_item->i_id;
 }
+
+/**
+ *  Add a option to one item ( no need for p_playlist )
+ *
+ * \param p_item the item on which we want the info
+ * \param psz_format the option
+ * \return 0 on success
+*/
+int playlist_ItemAddOption( playlist_item_t *p_item,
+                            const char *psz_option )
+{
+    if( !psz_option ) return VLC_EGENERIC;
+
+    INSERT_ELEM( p_item->ppsz_options, p_item->i_options, p_item->i_options,
+                 strdup( psz_option ) );
+
+    return VLC_SUCCESS;
+}