diff options
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | media_player.c | 16 | ||||
-rw-r--r-- | tools/iconv.h | 92 |
4 files changed, 10 insertions, 107 deletions
@@ -3,6 +3,7 @@ VDR Plugin 'xineliboutput' Revision History ????-??-??: Version 1.1.0 +- Replaced cIConv with VDR's cCharConv. - Supports only for vdr-1.6.0 or later. - Added an option to limit number of remote clients - Added math library (-lm) to vdr-sxfe when building with @@ -4,7 +4,7 @@ # See the main source file 'xineliboutput.c' for copyright information and # how to reach the author. # -# $Id: Makefile,v 1.72 2008-11-20 11:46:30 rofafor Exp $ +# $Id: Makefile,v 1.73 2008-11-24 10:49:29 rofafor Exp $ # # The official name of this plugin. @@ -26,7 +26,6 @@ endif # Override configuration here or in ../../../Make.config # -USE_ICONV = yes #NOSIGNAL_IMAGE_FILE=/usr/share/vdr/xineliboutput/nosignal.mpv #STARTUP_IMAGE_FILE=/usr/share/vdr/xineliboutput/logodisplay.mpv XINELIBOUTPUT_CONFIGURE_OPTS = @@ -183,7 +182,7 @@ LIBS_X11 += -L/usr/X11R6/lib -lXv -lXext ifeq ($(ARCH_APPLE_DARWIN), yes) INCLUDES += -I/sw/include LIBDIRS += -L/sw/lib - LIBS += $(LIBDIRS) -liconv + LIBS += $(LIBDIRS) else LIBS += -lrt endif @@ -196,9 +195,6 @@ ifeq ($(XINELIBOUTPUT_XINEPLUGIN), yes) CFLAGS += $(shell (pkg-config libxine --atleast-version=1.1.90 && pkg-config libxine --cflags) || xine-config --cflags) endif -ifeq ($(USE_ICONV), yes) - DEFINES += -DUSE_ICONV=1 -endif ifdef NOSIGNAL_IMAGE_FILE DEFINES += -DNOSIGNAL_IMAGE_FILE='"$(NOSIGNAL_IMAGE_FILE)"' endif diff --git a/media_player.c b/media_player.c index 00614cf1..76759dd1 100644 --- a/media_player.c +++ b/media_player.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: media_player.c,v 1.65 2008-11-20 11:46:31 rofafor Exp $ + * $Id: media_player.c,v 1.66 2008-11-24 10:49:29 rofafor Exp $ * */ @@ -24,8 +24,6 @@ #include "logdefs.h" -#include "tools/iconv.h" - static void BackToMenu(void) { cRemote::CallPlugin("xineliboutput"); @@ -292,7 +290,7 @@ class cPlaylistMenu : public cOsdMenu, cPlaylistChangeNotify cPlaylist& m_Playlist; bool m_NeedsUpdate; bool& m_RandomPlay; - cIConv ic; + cCharSetConv m_IC; public: @@ -314,9 +312,9 @@ cPlaylistMenu::cPlaylistMenu(cPlaylist &Playlist, bool& RandomPlay) : cOsdMenu(tr("Playlist")), m_Playlist(Playlist), m_RandomPlay(RandomPlay), - ic() + m_IC("UTF-8", cCharSetConv::SystemCharacterTable()) { - SetTitle(cString::sprintf("%s: %s", tr("Playlist"), *ic.Translate(Playlist.Name()))); + SetTitle(cString::sprintf("%s: %s", tr("Playlist"), m_IC.Convert(*Playlist.Name()))); Playlist.Listen(this); Set(true); } @@ -411,7 +409,7 @@ void cPlaylistMenu::Set(bool setCurrentPlaying) for(cPlaylistItem *i = m_Playlist.First(); i; i = m_Playlist.Next(i), j++) { cString Title = cPlaylist::GetEntry(i, true, j==currentPlaying); - Add(new cOsdItem( ic.Translate(Title), (eOSState)(os_User + j))); + Add(new cOsdItem(m_IC.Convert(*Title), (eOSState)(os_User + j))); } if(setCurrentPlaying) @@ -545,8 +543,8 @@ void cXinelibPlayerControl::Show() Current = (m_CurrentPos + 500) / 1000; cString Title = cPlaylist::GetEntry(m_Player->Playlist().Current()); - cIConv ic; - m_DisplayReplay->SetTitle(ic.Translate(Title)); + cCharSetConv ic("UTF-8", cCharSetConv::SystemCharacterTable()); + m_DisplayReplay->SetTitle(ic.Convert(*Title)); m_DisplayReplay->SetProgress(Current, Total); sprintf(t, "%d:%02d:%02d", Total/3600, (Total%3600)/60, Total%60); diff --git a/tools/iconv.h b/tools/iconv.h deleted file mode 100644 index a0462f99..00000000 --- a/tools/iconv.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * iconv.h: iconv library wrapper - * - * See the main source file 'xineliboutput.c' for copyright information and - * how to reach the author. - * - * $Id: iconv.h,v 1.7 2008-11-20 11:46:31 rofafor Exp $ - * - */ - -#ifndef _XINELIBOUTPUT_ICONV_H_ -#define _XINELIBOUTPUT_ICONV_H_ - -#if defined(USE_ICONV) && USE_ICONV == 0 -# undef USE_ICONV -# warning iconv disabled -#endif - -#ifdef USE_ICONV -# include <iconv.h> -#endif - -class cIConv -{ -#ifdef USE_ICONV - private: - iconv_t m_ic; -#endif - - public: - cIConv(const char *SrcCharset = NULL, const char * DstCharset = NULL); - virtual ~cIConv(); - - cString Translate(const char *Text) const; -}; - -cIConv::cIConv(const char *SrcCharset, const char * DstCharset) -{ -#ifdef USE_ICONV - if(!SrcCharset) - SrcCharset = "UTF-8"; - if(!DstCharset) { - DstCharset = cCharSetConv::SystemCharacterTable(); - } - m_ic = (iconv_t)-1; - - if(DstCharset) { - m_ic = iconv_open(DstCharset, SrcCharset); - - if(m_ic == (iconv_t)-1) - LOGERR("cIConv: iconv_open(\"%s\",\"%s\") failed", - SrcCharset, DstCharset); - } -#endif -} - -cIConv::~cIConv() -{ -#ifdef USE_ICONV - if(m_ic != (iconv_t)-1) - iconv_close(m_ic); -#endif -} - -cString cIConv::Translate(const char *Text) const -{ -#ifdef USE_ICONV - if(m_ic == (iconv_t)-1) - return cString(Text); - - size_t inc = strlen(Text); - size_t outc = inc<2048 ? 2048 : inc+1; - char *in = (char*)Text; - char *buf = (char*)malloc(outc+1); - char *out = buf; - - size_t n = iconv(m_ic, &in, &inc, &out, &outc); - - if(n != (size_t)-1) { - *out = 0; - return cString(buf, true); - } - - LOGERR("cIConv: iconv(%s) failed at %d", Text, (int)(in - Text)); - free(buf); -#endif - - return cString(Text); -} - - -#endif // _XINELIBOUTPUT_ICONV_H_ |