* modules/misc/freetype.c, modules/codec/subsdec.c, modules/gui/skins2: use iconv from the core.
dnl
VLC_ADD_PLUGINS([dummy rc telnet logger gestures memcpy hotkeys netsync])
VLC_ADD_PLUGINS([mpgv mpga m4v h264 ps pva avi asf aac mp4 rawdv nsv real aiff mjpeg demuxdump])
-VLC_ADD_PLUGINS([cvdsub svcdsub spudec dvbsub mpeg_audio lpcm a52 dts cinepak])
+VLC_ADD_PLUGINS([cvdsub svcdsub spudec subsdec dvbsub mpeg_audio lpcm a52 dts cinepak])
VLC_ADD_PLUGINS([deinterlace invert adjust wall transform distort clone crop motionblur])
VLC_ADD_PLUGINS([float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif dtstospdif fixed32tofloat32 fixed32tos16 s16tofixed32 s16tofloat32 s16tofloat32swab s8tofloat32 u8tofixed32 u8tofloat32 audio_format])
VLC_ADD_PLUGINS([trivial_resampler ugly_resampler linear_resampler bandlimited_resampler])
fi
fi
-dnl
-dnl subsdec support
-dnl
-VLC_ADD_LDFLAGS([subsdec],[${LIBICONV}])
-VLC_ADD_CPPFLAGS([subsdec],[${INCICONV}])
-VLC_ADD_PLUGINS([subsdec])
-
dnl
dnl CMML plugin
dnl
if test "${FREETYPE_CONFIG}" != "no"
then
VLC_ADD_PLUGINS([freetype])
- VLC_ADD_CFLAGS([freetype],[`${FREETYPE_CONFIG} --cflags` ${INCICONV}])
- VLC_ADD_LDFLAGS([freetype],[`${FREETYPE_CONFIG} --libs` ${LIBICONV}])
+ VLC_ADD_CFLAGS([freetype],[`${FREETYPE_CONFIG} --cflags`])
+ VLC_ADD_LDFLAGS([freetype],[`${FREETYPE_CONFIG} --libs`])
AC_CHECK_HEADERS(Carbon/Carbon.h,
[VLC_ADD_LDFLAGS([freetype],[-framework Carbon])])
elif test "${enable_freetype}" = "yes"
dnl freetype
if test "${FREETYPE_CONFIG}" != "no"; then
VLC_ADD_CPPFLAGS([skins2],[`${FREETYPE_CONFIG} --cflags`])
- VLC_ADD_LDFLAGS([skins2],[`${FREETYPE_CONFIG} --libs`])
+ VLC_ADD_LDFLAGS([skins2],[`${FREETYPE_CONFIG} --libs` -lpng])
else
skins2_missing_lib="yes"
if test "${enable_skins2}" = "yes"; then
fi
fi
- dnl iconv
- if test "$am_cv_func_iconv" = "yes"; then
- VLC_ADD_CPPFLAGS([skins2],[${INCICONV}])
- VLC_ADD_LDFLAGS([skins2],[${LIBICONV} -lpng])
- else
- skins2_missing_lib="yes"
- if test "${enable_skins2}" = "yes"; then
- AC_MSG_ERROR([Could not find iconv (required for skins2)])
- fi
- fi
-
dnl libxml2
XML2_PATH="${PATH}"
AC_ARG_WITH(xml2-config-path,
#include "osd.h"
#include "vlc_filter.h"
-#if defined(HAVE_ICONV)
-#include <iconv.h>
-#endif
-
#include "charset.h"
/*****************************************************************************
struct decoder_sys_t
{
int i_align; /* Subtitles alignment on the vout */
-
-#if defined(HAVE_ICONV)
- iconv_t iconv_handle; /* handle to iconv instance */
-#endif
-
+ vlc_iconv_t iconv_handle; /* handle to iconv instance */
};
/*****************************************************************************
/*****************************************************************************
* Module descriptor.
*****************************************************************************/
-#if defined(HAVE_ICONV)
static char *ppsz_encodings[] = { DEFAULT_NAME, "ASCII", "UTF-8", "",
"ISO-8859-1", "CP1252", "MacRoman", "MacIceland","ISO-8859-15", "",
"ISO-8859-2", "CP1250", "MacCentralEurope", "MacCroatian", "MacRomania", "",
"HZ", "GBK", "GB18030", "JOHAB", "ARMSCII-8",
"Georgian-Academy", "Georgian-PS", "TIS-620", "MuleLao-1", "VISCII", "TCVN",
"HPROMAN8", "NEXTSTEP" };
-#endif
static int pi_justification[] = { 0, 1, 2 };
static char *ppsz_justification_text[] = {N_("Center"),N_("Left"),N_("Right")};
add_integer( "subsdec-align", 0, NULL, ALIGN_TEXT, ALIGN_LONGTEXT,
VLC_TRUE );
change_integer_list( pi_justification, ppsz_justification_text, 0 );
-#if defined(HAVE_ICONV)
add_string( "subsdec-encoding", DEFAULT_NAME, NULL,
ENCODING_TEXT, ENCODING_LONGTEXT, VLC_FALSE );
change_string_list( ppsz_encodings, 0, 0 );
-#endif
vlc_module_end();
/*****************************************************************************
var_Get( p_dec, "subsdec-align", &val );
p_sys->i_align = val.i_int;
-#if defined(HAVE_ICONV)
if( p_dec->fmt_in.subs.psz_encoding && *p_dec->fmt_in.subs.psz_encoding )
{
msg_Dbg( p_dec, "using character encoding: %s",
p_dec->fmt_in.subs.psz_encoding );
p_sys->iconv_handle =
- iconv_open( "UTF-8", p_dec->fmt_in.subs.psz_encoding );
+ vlc_iconv_open( "UTF-8", p_dec->fmt_in.subs.psz_encoding );
}
else
{
{
char *psz_charset =(char*)malloc( 100 );
vlc_current_charset( &psz_charset );
- p_sys->iconv_handle = iconv_open( "UTF-8", psz_charset );
+ p_sys->iconv_handle = vlc_iconv_open( "UTF-8", psz_charset );
msg_Dbg( p_dec, "using character encoding: %s", psz_charset );
free( psz_charset );
}
else if( val.psz_string )
{
msg_Dbg( p_dec, "using character encoding: %s", val.psz_string );
- p_sys->iconv_handle = iconv_open( "UTF-8", val.psz_string );
+ p_sys->iconv_handle = vlc_iconv_open( "UTF-8", val.psz_string );
}
- if( p_sys->iconv_handle == (iconv_t)-1 )
+ if( p_sys->iconv_handle == (vlc_iconv_t)-1 )
{
msg_Warn( p_dec, "unable to do requested conversion" );
}
if( val.psz_string ) free( val.psz_string );
}
-#else
-
- msg_Dbg( p_dec, "no iconv support available" );
-#endif
return VLC_SUCCESS;
}
decoder_t *p_dec = (decoder_t *)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
-#if defined(HAVE_ICONV)
- if( p_sys->iconv_handle != (iconv_t)-1 )
+ if( p_sys->iconv_handle != (vlc_iconv_t)-1 )
{
- iconv_close( p_sys->iconv_handle );
+ vlc_iconv_close( p_sys->iconv_handle );
}
-#endif
free( p_sys );
}
i_align_h = p_sys->i_align ? 20 : 0;
i_align_v = 10;
-#if defined(HAVE_ICONV)
- if( p_sys->iconv_handle != (iconv_t)-1 )
+ if( p_sys->iconv_handle != (vlc_iconv_t)-1 )
{
char *psz_new_subtitle;
char *psz_convert_buffer_out;
psz_convert_buffer_in = psz_subtitle;
inbytes_left = strlen( psz_subtitle );
outbytes_left = 6 * inbytes_left;
- ret = iconv( p_sys->iconv_handle, &psz_convert_buffer_in,
- &inbytes_left, &psz_convert_buffer_out, &outbytes_left );
+ ret = vlc_iconv( p_sys->iconv_handle, &psz_convert_buffer_in,
+ &inbytes_left, &psz_convert_buffer_out,
+ &outbytes_left );
*psz_convert_buffer_out = '\0';
if( inbytes_left )
psz_subtitle = psz_new_subtitle;
}
}
-#endif
if( p_dec->fmt_in.i_codec == VLC_FOURCC('s','s','a',' ') )
{
#include <vlc/vlc.h>
-#if defined(HAVE_ICONV)
-#include <iconv.h>
-#include "charset.h"
-#endif
-
#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;
-#ifdef HAVE_ICONV
// Try to guess the current charset
char *pCharset = (char*)malloc( 100 );
vlc_current_charset( &pCharset );
- iconvHandle = iconv_open( "UTF-8", pCharset );
+ iconvHandle = vlc_iconv_open( "UTF-8", pCharset );
msg_Dbg( pIntf, "Using character encoding: %s", pCharset );
free( pCharset );
- if( iconvHandle == (iconv_t)-1 )
+ if( iconvHandle == (vlc_iconv_t)-1 )
{
msg_Warn( pIntf, "Unable to do requested conversion" );
}
-#else
- msg_Dbg( pIntf, "No iconv support available" );
-#endif
buildList();
}
Playlist::~Playlist()
{
-#ifdef HAVE_ICONV
- if( iconvHandle != (iconv_t)-1 )
- {
- iconv_close( iconvHandle );
- }
-#endif
+ if( iconvHandle != (vlc_iconv_t)-1 ) vlc_iconv_close( iconvHandle );
}
UString *Playlist::convertName( const char *pName )
{
-#ifdef HAVE_ICONV
- if( iconvHandle == (iconv_t)-1 )
+ if( iconvHandle == (vlc_iconv_t)-1 )
{
return new UString( getIntf(), pName );
}
inbytesLeft = strlen( pName );
outbytesLeft = 6 * inbytesLeft;
// ICONV_CONST is defined in config.h
- ret = iconv( iconvHandle, (ICONV_CONST char **)&pBufferIn, &inbytesLeft,
- &pBufferOut, &outbytesLeft );
+ ret = vlc_iconv( iconvHandle, (char **)&pBufferIn, &inbytesLeft,
+ &pBufferOut, &outbytesLeft );
*pBufferOut = '\0';
if( inbytesLeft )
free( pNewName );
return pString;
}
-#else
- return new UString( getIntf(), pName );
-#endif
}
* playlist.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: playlist.hpp,v 1.3 2004/01/05 22:17:32 asmax Exp $
+ * $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
#include "../utils/var_list.hpp"
-#ifndef iconv_t
-# define iconv_t libiconv_t
- typedef void* iconv_t;
-#endif
-
/// Variable for VLC playlist
class Playlist: public VarList
{
/// VLC playlist object
playlist_t *m_pPlaylist;
/// Iconv handle
- iconv_t iconvHandle;
+ vlc_iconv_t iconvHandle;
/// Build the list from the VLC playlist
void buildList();
#define DEFAULT_FONT "/usr/share/fonts/truetype/freefont/FreeSerifBold.ttf"
#endif
-#if defined(HAVE_ICONV)
-#include <iconv.h>
-#endif
#if defined(HAVE_FRIBIDI)
#include <fribidi/fribidi.h>
#endif
static void Destroy( vlc_object_t * );
static subpicture_t *RenderText( filter_t *, block_t * );
-
-#if !defined(HAVE_ICONV)
-static int GetUnicodeCharFromUTF8( byte_t ** );
-#endif
-
static line_desc_t *NewLine( byte_t * );
/*****************************************************************************
uint32_t *p_unicode_string, i_char;
int i_string_length;
char *psz_string;
-
-#if defined(HAVE_ICONV)
- iconv_t iconv_handle;
-#endif
+ vlc_iconv_t iconv_handle = (vlc_iconv_t)(-1);
FT_BBox line;
FT_BBox glyph_size;
p_string->p_lines = 0;
p_string->psz_text = strdup( psz_string );
-#if defined(HAVE_ICONV)
p_unicode_string = malloc( ( strlen(psz_string) + 1 ) * sizeof(uint32_t) );
if( p_unicode_string == NULL )
{
goto error;
}
#if defined(WORDS_BIGENDIAN)
- iconv_handle = iconv_open( "UCS-4BE", "UTF-8" );
+ iconv_handle = vlc_iconv_open( "UCS-4BE", "UTF-8" );
#else
- iconv_handle = iconv_open( "UCS-4LE", "UTF-8" );
+ iconv_handle = vlc_iconv_open( "UCS-4LE", "UTF-8" );
#endif
- if( iconv_handle == (iconv_t)-1 )
+ if( iconv_handle == (vlc_iconv_t)-1 )
{
msg_Warn( p_filter, "Unable to do convertion" );
goto error;
i_out_bytes_left = i_out_bytes;
p_in_buffer = psz_string;
p_out_buffer = (char *)p_unicode_string;
- i_ret = iconv( iconv_handle, &p_in_buffer, &i_in_bytes,
- &p_out_buffer, &i_out_bytes_left );
+ i_ret = vlc_iconv( iconv_handle, &p_in_buffer, &i_in_bytes,
+ &p_out_buffer, &i_out_bytes_left );
+
+ vlc_iconv_close( iconv_handle );
+
if( i_in_bytes )
{
msg_Warn( p_filter, "Failed to convert string to unicode (%s), "
p_unicode_string = p_fribidi_string;
p_fribidi_string[ i_string_length ] = 0;
}
-#endif
#endif
/* Calculate relative glyph positions and a bounding box for the
free( p_string );
}
-#if !defined( HAVE_ICONV )
-/* convert one or more utf8 bytes into a unicode character */
-static int GetUnicodeCharFromUTF8( byte_t **ppsz_utf8_string )
-{
- int i_remaining_bytes, i_char = 0;
- if( ( **ppsz_utf8_string & 0xFC ) == 0xFC )
- {
- i_char = **ppsz_utf8_string & 1;
- i_remaining_bytes = 5;
- }
- else if( ( **ppsz_utf8_string & 0xF8 ) == 0xF8 )
- {
- i_char = **ppsz_utf8_string & 3;
- i_remaining_bytes = 4;
- }
- else if( ( **ppsz_utf8_string & 0xF0 ) == 0xF0 )
- {
- i_char = **ppsz_utf8_string & 7;
- i_remaining_bytes = 3;
- }
- else if( ( **ppsz_utf8_string & 0xE0 ) == 0xE0 )
- {
- i_char = **ppsz_utf8_string & 15;
- i_remaining_bytes = 2;
- }
- else if( ( **ppsz_utf8_string & 0xC0 ) == 0xC0 )
- {
- i_char = **ppsz_utf8_string & 31;
- i_remaining_bytes = 1;
- }
- else
- {
- i_char = **ppsz_utf8_string;
- i_remaining_bytes = 0;
- }
- while( i_remaining_bytes )
- {
- (*ppsz_utf8_string)++;
- i_remaining_bytes--;
- i_char = ( i_char << 6 ) + ( **ppsz_utf8_string & 0x3F );
- }
- (*ppsz_utf8_string)++;
- return i_char;
-}
-#endif
-
static line_desc_t *NewLine( byte_t *psz_string )
{
int i_count;
#include <vlc/vlc.h>
+#undef iconv_t
+#undef iconv_open
+#undef iconv
+#undef iconv_close
+
+#if defined(HAVE_ICONV)
+# include <iconv.h>
+#endif
+
/*****************************************************************************
* getenv: just in case, but it should never be called
*****************************************************************************/
{
char * psz_cur1 = p_pos + 1;
char * psz_cur2 = psz_little + 1;
- while( *psz_cur1 && *psz_cur2 && toupper( *psz_cur1 ) == toupper( *psz_cur2 ) )
+ while( *psz_cur1 && *psz_cur2 &&
+ toupper( *psz_cur1 ) == toupper( *psz_cur2 ) )
{
psz_cur1++;
psz_cur2++;
return psz_new_text;
}
+
+/*****************************************************************************
+ * iconv wrapper
+ *****************************************************************************/
+vlc_iconv_t vlc_iconv_open( const char *tocode, const char *fromcode )
+{
+#if defined(HAVE_ICONV)
+ return iconv_open( tocode, fromcode );
+#else
+ return NULL;
+#endif
+}
+
+size_t vlc_iconv( vlc_iconv_t cd, char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft )
+{
+#if defined(HAVE_ICONV)
+ return iconv( cd, inbuf, inbytesleft, outbuf, outbytesleft );
+#else
+ int i_bytes = __MIN(inbytesleft, outbytesleft);
+ if( !inbuf || !outbuf || !i_bytes ) return (size_t)(-1);
+ memcpy( *outbuf, *inbuf, i_bytes );
+ inbuf += i_bytes;
+ outbuf += i_bytes;
+ inbytesleft -= i_bytes;
+ outbytesleft -= i_bytes;
+ return i_bytes;
+#endif
+}
+
+int vlc_iconv_close( vlc_iconv_t cd )
+{
+#if defined(HAVE_ICONV)
+ return iconv_close( cd );
+#else
+ return 0;
+#endif
+}