-int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
- playlist_item_t **pp_items, int i_mode,
- int i_type );
-
-
-/**
- * Sort the playlist.
- * \param p_playlist the playlist
- * \param i_mode: SORT_ID, SORT_TITLE, SORT_AUTHOR, SORT_RANDOM
- * \param i_type: ORDER_NORMAL or ORDER_REVERSE (reversed order)
- * \return VLC_SUCCESS on success
- */
-int playlist_Sort( playlist_t * p_playlist , int i_mode, int i_type )
-{
- int i_id = -1;
- vlc_value_t val;
- val.b_bool = VLC_TRUE;
-
- vlc_mutex_lock( &p_playlist->object_lock );
-
- p_playlist->i_sort = i_mode;
- p_playlist->i_order = i_type;
-
- if( p_playlist->i_index >= 0 )
- {
- i_id = p_playlist->pp_items[p_playlist->i_index]->input.i_id;
- }
-
- playlist_ItemArraySort( p_playlist, p_playlist->i_size,
- p_playlist->pp_items, i_mode, i_type );
-
- if( i_id != -1 )
- {
- p_playlist->i_index = playlist_GetPositionById( p_playlist, i_id );
- }
-
- /* ensure we are in no-view mode */
- p_playlist->status.i_view = -1;
-
- vlc_mutex_unlock( &p_playlist->object_lock );
-
- /* Notify the interfaces */
- var_Set( p_playlist, "intf-change", val );
-
- return VLC_SUCCESS;
-}
+static int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
+ playlist_item_t **pp_items, int i_mode,
+ int i_type );
+static int playlist_cmp(const void *, const void *);