]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/vars/playlist.cpp
* skins2/win32/win32_factory.cpp: msg_Err --> msg_Dbg
[vlc] / modules / gui / skins2 / vars / playlist.cpp
index d61359252daf9a37bc323ec01ae9976a05506f2b..80d77d78096018f4df4bce5d65583eeebffc03dc 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * playlist.cpp
  *****************************************************************************
- * Copyright (C) 2003 VideoLAN
- * $Id: playlist.cpp,v 1.6 2004/01/05 22:17:32 asmax Exp $
+ * Copyright (C) 2003 the VideoLAN team
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #include <vlc/vlc.h>
 
-#if defined(HAVE_ICONV)
-#include <iconv.h>
-#include "charset.h"
-#endif
-
 #include "playlist.hpp"
 #include "../utils/ustring.hpp"
 
-
 Playlist::Playlist( intf_thread_t *pIntf ): VarList( pIntf )
 {
     // Get the playlist VLC object
     m_pPlaylist = pIntf->p_sys->p_playlist;
 
-#ifdef HAVE_ICONV
-    // Try to guess the current charset
-    char *pCharset = (char*)malloc( 100 );
-    vlc_current_charset( &pCharset );
-    iconvHandle = iconv_open( "UTF-8", pCharset );
-    msg_Dbg( pIntf, "Using character encoding: %s", pCharset );
-    free( pCharset );
-
-    if( iconvHandle == (iconv_t)-1 )
-    {
-        msg_Warn( pIntf, "Unable to do requested conversion" );
-    }
-#else
-    msg_Dbg( p_dec, "No iconv support available" );
-#endif
-
     buildList();
 }
 
 
 Playlist::~Playlist()
 {
-#ifdef HAVE_ICONV
-    if( iconvHandle != (iconv_t)-1 )
-    {
-        iconv_close( iconvHandle );
-    }
-#endif
 }
 
 
@@ -77,7 +49,9 @@ void Playlist::delSelected()
     {
         if( (*it).m_selected )
         {
-            playlist_Delete( m_pPlaylist, index );
+            playlist_item_t *p_item = playlist_LockItemGetByPos( m_pPlaylist,
+                                                                 index );
+            playlist_LockDelete( m_pPlaylist, p_item->input.i_id );
         }
         else
         {
@@ -122,7 +96,8 @@ void Playlist::buildList()
     for( int i = 0; i < m_pPlaylist->i_size; i++ )
     {
         // Get the name of the playlist item
-        UString *pName = convertName( m_pPlaylist->pp_items[i]->psz_name );
+        UString *pName =
+            new UString( getIntf(), m_pPlaylist->pp_items[i]->input.psz_name );
         // Is it the played stream ?
         bool playing = (i == m_pPlaylist->i_index );
         // Add the item in the list
@@ -131,44 +106,3 @@ void Playlist::buildList()
     vlc_mutex_unlock( &m_pPlaylist->object_lock );
 }
 
-
-UString *Playlist::convertName( const char *pName )
-{
-#ifdef HAVE_ICONV
-    if( iconvHandle == (iconv_t)-1 )
-    {
-        return new UString( getIntf(), pName );
-    }
-
-    char *pNewName, *pBufferOut;
-    const char *pBufferIn;
-    size_t ret, inbytesLeft, outbytesLeft;
-
-    // Try to convert the playlist item into UTF8
-    pNewName = (char*)malloc( 6 * strlen( pName ) );
-    pBufferOut = pNewName;
-    pBufferIn = pName;
-    inbytesLeft = strlen( pName );
-    outbytesLeft = 6 * inbytesLeft;
-    // ICONV_CONST is defined in config.h
-    ret = iconv( iconvHandle, (ICONV_CONST char **)&pBufferIn, &inbytesLeft,
-                 &pBufferOut, &outbytesLeft );
-    *pBufferOut = '\0';
-
-    if( inbytesLeft )
-    {
-        msg_Warn( getIntf(), "Failed to convert the playlist item into UTF8" );
-        free( pNewName );
-        return new UString( getIntf(), pName );
-    }
-    else
-    {
-        UString *pString = new UString( getIntf(), pNewName );
-        free( pNewName );
-        return pString;
-    }
-#else
-    return new UString( getIntf(), pName );
-#endif
-}
-