diff --git a/cfg-mplayer.h b/cfg-mplayer.h index b9e133f887..96b1e3c9c4 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -43,7 +43,6 @@ extern char *lirc_configfile; extern char *vo_geometry; extern int stop_xscreensaver; -extern char *mp_msg_charset; extern int mp_msg_color; extern int mp_msg_module; @@ -365,9 +364,6 @@ const m_option_t common_opts[] = { {"msglevel", (void *) msgl_config, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL}, {"msgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL}, {"msgmodule", &mp_msg_module, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL}, -#ifdef CONFIG_ICONV - {"msgcharset", &mp_msg_charset, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, -#endif #ifdef CONFIG_PRIORITY {"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL}, #endif diff --git a/command.c b/command.c index 9a696348da..d90d3ee76b 100644 --- a/command.c +++ b/command.c @@ -2738,8 +2738,7 @@ static void remove_subtitle_range(MPContext *mpctx, int start, int count) filename = ass_tracks[idx]->name; #endif mp_msg(MSGT_CPLAYER, MSGL_STATUS, - "SUB: Removed subtitle file (%d): %s\n", idx + 1, - filename_recode(filename)); + "SUB: Removed subtitle file (%d): %s\n", idx + 1, filename); sub_free(subd); subs[idx] = NULL; #ifdef CONFIG_ASS diff --git a/configure b/configure index 0b7d3690f7..2fdab8cb63 100755 --- a/configure +++ b/configure @@ -292,7 +292,6 @@ Optional features: --enable-termcap use termcap database for key codes [autodetect] --enable-termios use termios database for key codes [autodetect] --disable-iconv disable iconv for encoding conversion [autodetect] - --disable-langinfo do not use langinfo [autodetect] --enable-lirc enable LIRC (remote control) support [autodetect] --enable-lircc enable LIRCCD (LIRC client daemon) input [autodetect] --enable-joystick enable joystick support [disable] @@ -394,7 +393,6 @@ Audio output: Language options: --enable-translation enable support for translated output [disable] - --charset=charset convert the console messages to this character set --language-doc=lang language to use for the documentation [en] --language-man=lang language to use for the man pages [en] --language-msg=lang extra languages for program messages [all] @@ -475,7 +473,6 @@ _caca=auto _dvb=auto _v4l2=auto _iconv=auto -_langinfo=auto _ossaudio=auto _rsound=auto _pulse=auto @@ -537,7 +534,6 @@ _directfb=auto #language=en _shm=auto _translation=no -_charset="UTF-8" _libdv=auto _cdda=auto _cddb=auto @@ -635,9 +631,6 @@ for ac_option do --windres=*) _windres=$(echo $ac_option | cut -d '=' -f 2) ;; - --charset=*) - _charset=$(echo $ac_option | cut -d '=' -f 2) - ;; --language-doc=*) language_doc=$(echo $ac_option | cut -d '=' -f 2) ;; @@ -716,8 +709,6 @@ for ac_option do --disable-v4l2) _v4l2=no ;; --enable-iconv) _iconv=yes ;; --disable-iconv) _iconv=no ;; - --enable-langinfo) _langinfo=yes ;; - --disable-langinfo) _langinfo=no ;; --enable-libdv) _libdv=yes ;; --disable-libdv) _libdv=no ;; --enable-ossaudio) _ossaudio=yes ;; @@ -1388,19 +1379,6 @@ else fi -echocheck "langinfo" -if test "$_langinfo" = auto ; then - _langinfo=no - statement_check langinfo.h 'nl_langinfo(CODESET)' && _langinfo=yes -fi -if test "$_langinfo" = yes ; then - def_langinfo='#define HAVE_LANGINFO 1' -else - def_langinfo='#undef HAVE_LANGINFO' -fi -echores "$_langinfo" - - echocheck "translation support" if test "$_translation" = yes; then def_translation="#define CONFIG_TRANSLATION 1" @@ -3939,13 +3917,6 @@ fi echores "$_sortsub" -if test "$_charset" != "noconv" ; then - def_charset="#define MSG_CHARSET \"$_charset\"" -else - def_charset="#undef MSG_CHARSET" - _charset="UTF-8" -fi - ############################################################################# echocheck "compiler support for noexecstack" @@ -4087,7 +4058,6 @@ export LC_ALL = C CONFIGURATION = $configuration -CHARSET = $_charset DOC_LANGS = $language_doc DOC_LANG_ALL = $doc_lang_all MAN_LANGS = $language_man @@ -4334,7 +4304,6 @@ $def_winsock2_h $def_gethostbyname2 $def_gettimeofday $def_glob -$def_langinfo $def_lrintf $def_nanosleep $def_posix_select @@ -4366,7 +4335,6 @@ $def_restrict_keyword /* configurable options */ -$def_charset $def_debug $def_sortsub $def_stream_cache diff --git a/mp_msg.c b/mp_msg.c index 6ad39a0416..d9c28688a4 100644 --- a/mp_msg.c +++ b/mp_msg.c @@ -30,11 +30,6 @@ #include #endif -#ifdef CONFIG_ICONV -#include -#include -#endif - #include "mp_msg.h" /* maximum message length of mp_msg */ @@ -66,42 +61,6 @@ int mp_msg_level_all = MSGL_STATUS; int verbose = 0; int mp_msg_color = 0; int mp_msg_module = 0; -#ifdef CONFIG_ICONV -char *mp_msg_charset = NULL; -static char *old_charset = NULL; -static iconv_t msgiconv; -#endif - -const char* filename_recode(const char* filename) -{ -#if !defined(CONFIG_ICONV) || !defined(MSG_CHARSET) - return filename; -#else - static iconv_t inv_msgiconv = (iconv_t)(-1); - static char recoded_filename[MSGSIZE_MAX]; - size_t filename_len, max_path; - char* precoded; - if (!mp_msg_charset || - !strcasecmp(mp_msg_charset, MSG_CHARSET) || - !strcasecmp(mp_msg_charset, "noconv")) - return filename; - if (inv_msgiconv == (iconv_t)(-1)) { - inv_msgiconv = iconv_open(MSG_CHARSET, mp_msg_charset); - if (inv_msgiconv == (iconv_t)(-1)) - return filename; - } - filename_len = strlen(filename); - max_path = MSGSIZE_MAX - 4; - precoded = recoded_filename; - if (iconv(inv_msgiconv, (char **)&filename, &filename_len, - &precoded, &max_path) == (size_t)(-1) && errno == E2BIG) { - precoded[0] = precoded[1] = precoded[2] = '.'; - precoded += 3; - } - *precoded = '\0'; - return recoded_filename; -#endif -} void mp_msg_init(void){ #ifdef _WIN32 @@ -120,15 +79,6 @@ void mp_msg_init(void){ verbose = atoi(env); for(i=0;idemuxer->desc->name); if (mpctx->sh_video) { @@ -968,7 +968,7 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps, if (!asst && !subd) { mp_tmsg(MSGT_CPLAYER, noerr ? MSGL_WARN : MSGL_ERR, - "Cannot load subtitles: %s\n", filename_recode(filename)); + "Cannot load subtitles: %s\n", filename); return; } @@ -977,11 +977,10 @@ void add_subtitles(struct MPContext *mpctx, char *filename, float fps, mpctx->track_was_native_ass[mpctx->set_of_sub_size] = is_native_ass; mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FILE_SUB_ID=%d\n", mpctx->set_of_sub_size); - mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FILE_SUB_FILENAME=%s\n", - filename_recode(filename)); + mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FILE_SUB_FILENAME=%s\n", filename); ++mpctx->set_of_sub_size; mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "SUB: Added subtitle file (%d): %s\n", - mpctx->set_of_sub_size, filename_recode(filename)); + mpctx->set_of_sub_size, filename); } void init_vo_spudec(struct MPContext *mpctx) @@ -3862,8 +3861,7 @@ play_next_file: vo_control(mpctx->video_out, VOCTRL_RESUME, NULL); if (mpctx->filename) { - mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Playing %s.\n", - filename_recode(mpctx->filename)); + mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Playing %s.\n", mpctx->filename); if (use_filename_title && opts->vo_wintitle == NULL) opts->vo_wintitle = talloc_strdup(NULL, mp_basename(mpctx->filename)); @@ -3875,7 +3873,7 @@ play_next_file: if ((edl_fd = fopen(edl_output_filename, "w")) == NULL) { mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "Can't open EDL file [%s] for writing.\n", - filename_recode(edl_output_filename)); + edl_output_filename); } } @@ -3885,7 +3883,7 @@ play_next_file: vo_vobsub = vobsub_open(opts->vobsub_name, spudec_ifo, 1, &vo_spudec); if (vo_vobsub == NULL) mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "Cannot load subtitles: %s\n", - filename_recode(opts->vobsub_name)); + opts->vobsub_name); } else if (opts->sub_auto && mpctx->filename) { char **vob = find_vob_subtitles(opts, mpctx->filename); for (int i = 0; i < MP_TALLOC_ELEMS(vob); i++) { @@ -3932,7 +3930,7 @@ play_next_file: play_tree_t *entry; // Handle playlist mp_msg(MSGT_CPLAYER, MSGL_V, "Parsing playlist %s...\n", - filename_recode(mpctx->filename)); + mpctx->filename); entry = parse_playtree(mpctx->stream, mpctx->mconfig, 0); mpctx->eof = playtree_add_playlist(mpctx, entry); goto goto_next_file; @@ -3997,7 +3995,7 @@ goto_enable_cache: const char *bname; mp_msg(MSGT_CPLAYER, MSGL_V, "Adding file %s to element entry.\n", - filename_recode(playlist_entry)); + playlist_entry); bname = mp_basename(playlist_entry); if ((strlen(bname) > 10) && !strncmp(bname, "qt", 2) && @@ -4072,7 +4070,7 @@ goto_enable_cache: mp_msg(MSGT_CPLAYER, MSGL_V, "Source files:\n"); for (int i = 0; i < mpctx->num_sources; i++) mp_msg(MSGT_CPLAYER, MSGL_V, "%d: %s\n", i, - filename_recode(mpctx->sources[i].demuxer->filename)); + mpctx->sources[i].demuxer->filename); mp_msg(MSGT_CPLAYER, MSGL_V, "Timeline parts: (number, start, " "source_start, source):\n"); for (int i = 0; i < part_count; i++) { diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c index f1ccea6359..de886182c9 100644 --- a/osdep/getch2-win.c +++ b/osdep/getch2-win.c @@ -183,43 +183,3 @@ void getch2_disable(void) if(!getch2_status) return; // already disabled / never enabled getch2_status=0; } - -#ifdef CONFIG_ICONV -static const struct { - unsigned cp; - char* alias; -} cp_alias[] = { - { 20127, "ASCII" }, - { 20866, "KOI8-R" }, - { 21866, "KOI8-RU" }, - { 28591, "ISO-8859-1" }, - { 28592, "ISO-8859-2" }, - { 28593, "ISO-8859-3" }, - { 28594, "ISO-8859-4" }, - { 28595, "ISO-8859-5" }, - { 28596, "ISO-8859-6" }, - { 28597, "ISO-8859-7" }, - { 28598, "ISO-8859-8" }, - { 28599, "ISO-8859-9" }, - { 28605, "ISO-8859-15" }, - { 65001, "UTF-8" }, - { 0, NULL } -}; - -char* get_term_charset(void) -{ - char codepage[10]; - unsigned i, cpno = GetConsoleOutputCP(); - if (!cpno) - cpno = GetACP(); - if (!cpno) - return NULL; - - for (i = 0; cp_alias[i].cp; i++) - if (cpno == cp_alias[i].cp) - return strdup(cp_alias[i].alias); - - snprintf(codepage, sizeof(codepage), "CP%u", cpno); - return strdup(codepage); -} -#endif diff --git a/osdep/getch2.c b/osdep/getch2.c index f0aa19a2cc..cd8a198737 100644 --- a/osdep/getch2.c +++ b/osdep/getch2.c @@ -50,11 +50,6 @@ #endif #endif -#if defined(HAVE_LANGINFO) && defined(CONFIG_ICONV) -#include -#include -#endif - #include #include @@ -325,16 +320,3 @@ void getch2_disable(void){ tcsetattr(0,TCSANOW,&tio_orig); #endif } - -#ifdef CONFIG_ICONV -char* get_term_charset(void) -{ - char* charset = NULL; -#ifdef HAVE_LANGINFO - setlocale(LC_CTYPE, ""); - charset = strdup(nl_langinfo(CODESET)); - setlocale(LC_CTYPE, "C"); -#endif - return charset; -} -#endif diff --git a/osdep/getch2.h b/osdep/getch2.h index 4442f1181d..85899b3ce3 100644 --- a/osdep/getch2.h +++ b/osdep/getch2.h @@ -49,17 +49,6 @@ void getch2_disable(void); struct mp_fifo; bool getch2(struct mp_fifo *fifo); -#ifdef CONFIG_ICONV -/** - * \brief gets the name of the system's terminal character set - * \return a malloced string indicating the system charset - * - * Be warned that this function on many systems is in no way thread-safe - * since it modifies global data - */ -char *get_term_charset(void); -#endif - #if defined(__MINGW32__) // slave cmd function for Windows int mp_input_slave_cmd_func(int fd,char* dest,int size); diff --git a/timeline/tl_matroska.c b/timeline/tl_matroska.c index 562b1bda1f..15067644a5 100644 --- a/timeline/tl_matroska.c +++ b/timeline/tl_matroska.c @@ -135,8 +135,7 @@ static int find_ordered_chapter_sources(struct MPContext *mpctx, int num_left = num_sources - 1; for (int i = 0; i < num_filenames && num_left > 0; i++) { - mp_msg(MSGT_CPLAYER, MSGL_INFO, "Checking file %s\n", - filename_recode(filenames[i])); + mp_msg(MSGT_CPLAYER, MSGL_INFO, "Checking file %s\n", filenames[i]); int format = 0; struct stream *s = open_stream(filenames[i], &mpctx->opts, &format); if (!s) @@ -157,7 +156,7 @@ static int find_ordered_chapter_sources(struct MPContext *mpctx, continue; if (!memcmp(uid_map[i], d->matroska_data.segment_uid, 16)) { mp_msg(MSGT_CPLAYER, MSGL_INFO,"Match for source %d: %s\n", - i, filename_recode(d->filename)); + i, d->filename); sources[i].stream = s; sources[i].demuxer = d; num_left--;