]> git.sesse.net Git - vlc/blobdiff - src/playlist/item.c
Renamed playlist "item-append/deleted" to "playlist-item-append/deleted".
[vlc] / src / playlist / item.c
index 780ebfc59fcc9c8ae0908802680c405367e5fd85..6cee468e5e2475937ffd5b787272fbc6183c65ed 100644 (file)
@@ -38,6 +38,8 @@ static void ChangeToNode( playlist_t *p_playlist, playlist_item_t *p_item );
 static int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item,
                         bool b_stop );
 
+static playlist_item_t *ItemToNode( playlist_t *, playlist_item_t *, bool );
+
 /*****************************************************************************
  * An input item has gained a subitem (Event Callback)
  *****************************************************************************/
@@ -86,7 +88,7 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
         /* If this item is already a node don't transform it */
         if( p_item_in_category->i_children == -1 )
         {
-            p_item_in_category = playlist_ItemToNode( p_playlist,
+            p_item_in_category = ItemToNode( p_playlist,
                     p_item_in_category, pl_Locked );
             p_item_in_category->p_input->i_type = ITEM_TYPE_PLAYLIST;
         }
@@ -113,9 +115,9 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
 static void input_item_changed( const vlc_event_t * p_event,
                                 void * user_data )
 {
-    (void)p_event;
-    playlist_item_t * p_item = user_data;
-    var_SetInteger( p_item->p_playlist, "item-change", p_item->i_id );
+    playlist_item_t *p_item = user_data;
+    VLC_UNUSED( p_event );
+    var_SetInteger( p_item->p_playlist, "item-change", p_item->p_input->i_id );
 }
 
 /*****************************************************************************
@@ -183,21 +185,6 @@ playlist_item_t *playlist_ItemNewFromInput( playlist_t *p_playlist,
     return p_item;
 }
 
-playlist_item_t * playlist_ItemNewWithType( playlist_t *p_playlist,
-                                            const char *psz_uri,
-                                            const char *psz_name,
-                                            int i_options,
-                                            const char *const *ppsz_options,
-                                            int i_duration, int i_type )
-{
-    input_item_t *p_input;
-    if( psz_uri == NULL ) return NULL;
-    p_input = input_item_NewWithType( VLC_OBJECT(p_playlist), psz_uri,
-                                     psz_name, i_options, ppsz_options,
-                                     i_duration, i_type );
-    return playlist_ItemNewFromInput( p_playlist, p_input );
-}
-
 /***************************************************************************
  * Playlist item destruction
  ***************************************************************************/
@@ -330,8 +317,7 @@ void playlist_Clear( playlist_t * p_playlist, bool b_locked )
 int playlist_DeleteFromItemId( playlist_t *p_playlist, int i_id )
 {
     PL_ASSERT_LOCKED;
-    playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id,
-                                                    pl_Locked );
+    playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id );
     if( !p_item ) return VLC_EGENERIC;
     return DeleteInner( p_playlist, p_item, true );
 }
@@ -359,7 +345,7 @@ int playlist_Add( playlist_t *p_playlist, const char *psz_uri,
                   bool b_playlist, bool b_locked )
 {
     return playlist_AddExt( p_playlist, psz_uri, psz_name,
-                            i_mode, i_pos, -1, NULL, 0, b_playlist, b_locked );
+                            i_mode, i_pos, -1, 0, NULL, 0, b_playlist, b_locked );
 }
 
 /**
@@ -373,20 +359,22 @@ int playlist_Add( playlist_t *p_playlist, const char *psz_uri,
  *        PLAYLIST_END the item will be added at the end of the playlist
  *        regardless of its size
  * \param i_duration length of the item in milliseconds.
- * \param ppsz_options an array of options
  * \param i_options the number of options
+ * \param ppsz_options an array of options
+ * \param i_option_flags options flags
  * \param b_playlist TRUE for playlist, FALSE for media library
  * \param b_locked TRUE if the playlist is locked
  * \return The id of the playlist item
 */
 int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri,
                      const char *psz_name, int i_mode, int i_pos,
-                     mtime_t i_duration, const char *const *ppsz_options,
-                     int i_options, bool b_playlist, bool b_locked )
+                     mtime_t i_duration,
+                     int i_options, const char *const *ppsz_options, unsigned i_option_flags,
+                     bool b_playlist, bool b_locked )
 {
     int i_ret;
     input_item_t *p_input = input_item_NewExt( p_playlist, psz_uri, psz_name,
-                                              i_options, ppsz_options,
+                                              i_options, ppsz_options, i_option_flags,
                                               i_duration );
 
     i_ret = playlist_AddInput( p_playlist, p_input, i_mode, i_pos, b_playlist,
@@ -561,9 +549,9 @@ playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist,
  * \param b_locked TRUE if the playlist is locked
  * \return the item transform in a node
  */
-playlist_item_t *playlist_ItemToNode( playlist_t *p_playlist,
-                                      playlist_item_t *p_item,
-                                      bool b_locked )
+static playlist_item_t *ItemToNode( playlist_t *p_playlist,
+                                    playlist_item_t *p_item,
+                                    bool b_locked )
 {
 
     playlist_item_t *p_item_in_category;
@@ -636,8 +624,7 @@ playlist_item_t *playlist_ItemToNode( playlist_t *p_playlist,
         }
         pl_priv(p_playlist)->b_reset_currently_playing = true;
         vlc_cond_signal( &pl_priv(p_playlist)->signal );
-        var_SetInteger( p_playlist, "item-change", p_item_in_category->
-                                                        p_input->i_id );
+        var_SetInteger( p_playlist, "item-change", p_item_in_category->p_input->i_id );
         PL_UNLOCK_IF( !b_locked );
         return p_item_in_category;
     }
@@ -802,7 +789,7 @@ void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id,
     if( b_signal )
         vlc_cond_signal( &pl_priv(p_playlist)->signal );
 
-    var_Set( p_playlist, "item-append", val );
+    var_Set( p_playlist, "playlist-item-append", val );
     free( p_add );
 }
 
@@ -901,7 +888,7 @@ static int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item,
         return playlist_NodeDelete( p_playlist, p_item, true, false );
     }
     pl_priv(p_playlist)->b_reset_currently_playing = true;
-    var_SetInteger( p_playlist, "item-deleted", i_id );
+    var_SetInteger( p_playlist, "playlist-item-deleted", i_id );
 
     /* Remove the item from the bank */
     ARRAY_BSEARCH( p_playlist->all_items,->i_id, int, i_id, i );