X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fskins2%2Fvars%2Fplaylist.cpp;h=80d77d78096018f4df4bce5d65583eeebffc03dc;hb=806edd25dcb922c430ac5b99aac14326b00c7829;hp=bbefcf54c7d5a3ce2cfa5b2c552a59ba8ec2dde9;hpb=fe087a38282e93addb25fa9598393e40ea233b09;p=vlc diff --git a/modules/gui/skins2/vars/playlist.cpp b/modules/gui/skins2/vars/playlist.cpp index bbefcf54c7..80d77d7809 100644 --- a/modules/gui/skins2/vars/playlist.cpp +++ b/modules/gui/skins2/vars/playlist.cpp @@ -18,7 +18,7 @@ * * 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 @@ -26,32 +26,17 @@ #include "playlist.hpp" #include "../utils/ustring.hpp" -#include "charset.h" - Playlist::Playlist( intf_thread_t *pIntf ): VarList( pIntf ) { // Get the playlist VLC object m_pPlaylist = pIntf->p_sys->p_playlist; - // Try to guess the current charset - char *pCharset; - vlc_current_charset( &pCharset ); - iconvHandle = vlc_iconv_open( "UTF-8", pCharset ); - msg_Dbg( pIntf, "Using character encoding: %s", pCharset ); - free( pCharset ); - - if( iconvHandle == (vlc_iconv_t)-1 ) - { - msg_Warn( pIntf, "Unable to do requested conversion" ); - } - buildList(); } Playlist::~Playlist() { - if( iconvHandle != (vlc_iconv_t)-1 ) vlc_iconv_close( iconvHandle ); } @@ -111,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]->input.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 @@ -120,40 +106,3 @@ void Playlist::buildList() vlc_mutex_unlock( &m_pPlaylist->object_lock ); } - -UString *Playlist::convertName( const char *pName ) -{ - if( iconvHandle == (vlc_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 = vlc_iconv( iconvHandle, (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; - } -} -