From abdfbd9be3e0978506fc174ff135097cfbb70efd Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 29 May 2003 18:50:03 +0000 Subject: [PATCH] Removed the --sub-type switch as all text subtitles will be stored in UTF-8 format. Made iconv mandatory in the configure checks for this very reason. --- ChangeLog | 4 ++++ acinclude-2.1.m4 | 8 ++++---- acinclude-2.5.m4 | 8 ++++---- mkvmerge.1 | 11 +---------- mkvmerge.cpp | 21 +-------------------- p_textsubs.cpp | 20 +++++++------------- pr_generic.h | 3 +-- 7 files changed, 22 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index d0274df9c..5cd688094 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2003-05-29 Moritz Bunkus + * Removed the '--sub-type' switch as all text subtitles will be + stored in UTF-8 format. Made iconv mandatory in the configure + checks for this very reason. + * Added a GUI to mkvinfo. 2003-05-23 Moritz Bunkus diff --git a/acinclude-2.1.m4 b/acinclude-2.1.m4 index 932a05058..c8f4e38b5 100644 --- a/acinclude-2.1.m4 +++ b/acinclude-2.1.m4 @@ -557,16 +557,13 @@ AC_DEFUN(PATH_CYGWIN, CYGWIN="`uname -s`" case "$CYGWIN" in CYGWIN*) - ICONV_LIBS="-liconv" AC_MSG_RESULT(yes) CXXVER_CFLAGS="$CXXVER_CFLAGS -DNO_WSTRING" ;; *) - ICONV_LIBS="" AC_MSG_RESULT(no) ;; esac - AC_SUBST(ICONV_LIBS) ]) dnl This macros shamelessly stolen from @@ -609,7 +606,6 @@ AC_DEFUN(PATH_ICONV, fi ]) if test "$am_cv_func_iconv" = yes; then -dnl AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) AC_MSG_CHECKING([for iconv declaration]) AC_CACHE_VAL(am_cv_proto_iconv, [ AC_TRY_COMPILE([ @@ -631,6 +627,10 @@ size_t iconv(); }[$]am_cv_proto_iconv) dnl AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, dnl [Define as const if the declaration of iconv() needs const.]) + else + echo '*** The iconv library is needed but could not be found.' + echo '*** Please install it and re-run configure.' + exit 1 fi ICONV_LIBS= if test "$am_cv_lib_iconv" = yes; then diff --git a/acinclude-2.5.m4 b/acinclude-2.5.m4 index 724b45f49..72e5f1b28 100644 --- a/acinclude-2.5.m4 +++ b/acinclude-2.5.m4 @@ -557,16 +557,13 @@ AC_DEFUN(PATH_CYGWIN, CYGWIN="`uname -s`" case "$CYGWIN" in CYGWIN*) -dnl ICONV_LIBS="-liconv" AC_MSG_RESULT(yes) CXXVER_CFLAGS="$CXXVER_CFLAGS -DNO_WSTRING" ;; *) -dnl ICONV_LIBS="" AC_MSG_RESULT(no) ;; esac -dnl AC_SUBST(ICONV_LIBS) ]) dnl This macros shamelessly stolen from @@ -609,7 +606,6 @@ AC_DEFUN(PATH_ICONV, fi ]) if test "$am_cv_func_iconv" = yes; then -dnl AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) AC_MSG_CHECKING([for iconv declaration]) AC_CACHE_VAL(am_cv_proto_iconv, [ AC_TRY_COMPILE([ @@ -631,6 +627,10 @@ size_t iconv(); }[$]am_cv_proto_iconv) dnl AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, dnl [Define as const if the declaration of iconv() needs const.]) + else + echo '*** The iconv library is needed but could not be found.' + echo '*** Please install it and re-run configure.' + exit 1 fi ICONV_LIBS= if test "$am_cv_lib_iconv" = yes; then diff --git a/mkvmerge.1 b/mkvmerge.1 index 56e6a805e..c2d873c35 100644 --- a/mkvmerge.1 +++ b/mkvmerge.1 @@ -123,16 +123,7 @@ Forces the FourCC to the specified value. Works only for video tracks. Sets the aspect ratio for the track. The ratio can be given either as a floating point number or as 'widht/height', e.g. 16/9. .LP -Options that only apply to text subtitle tracks: -.TP -\fB\-\-sub\-format\fR <\fIutf8\fR|\fIascii\fR> -If the format chosen is \fIutf8\fR then text subtitles will be recoded to -UTF-8, and the track's codec ID will be set to S_TEXT/UTF8. \fIascii\fR does -no conversion, and S_TEXT/ASCII will be used instead. \fBmkvmerge\fR uses the -current locale to determine the charset from which to convert which can be -overridden with \fB\-\-sub\-charset\fR. -.br -The default is utf8. +Options that only apply to subtitle tracks: .TP \fB\-\-sub\-charset\fR Sets the charset for the conversion to UTF-8 for UTF-8 subtitles. If not diff --git a/mkvmerge.cpp b/mkvmerge.cpp index 9a702ec9f..a8356529e 100644 --- a/mkvmerge.cpp +++ b/mkvmerge.cpp @@ -13,7 +13,7 @@ /*! \file - \version \$Id: mkvmerge.cpp,v 1.81 2003/05/25 15:35:39 mosu Exp $ + \version \$Id: mkvmerge.cpp,v 1.82 2003/05/29 18:50:03 mosu Exp $ \brief command line parameter parsing, looping, output handling \author Moritz Bunkus */ @@ -211,9 +211,6 @@ static void usage(void) { " Works only for video tracks.\n" " --aspect-ratio Sets the aspect ratio.\n" "\n Options that only apply to text subtitle tracks:\n" - " --sub-format keeps them as they are and assumes ASCII\n" - " encoding.\n" " --sub-charset Sets the charset the text subtitles are\n" " written in for the conversion to UTF-8.\n" "\n\n Other options:\n" @@ -754,22 +751,6 @@ static void parse_args(int argc, char **argv) { } else if (!strcmp(argv[i], "--default-track")) ti.default_track = 1; - else if (!strcmp(argv[i], "--sub-type")) { - if ((i + 1) >= argc) { - fprintf(stderr, "Error: --sub-type lacks its argument.\n"); - exit(1); - } - if (!strcmp(argv[i + 1], "utf8")) - ti.no_utf8_subs = 0; - else if (!strcmp(argv[i + 1], "ascii")) - ti.no_utf8_subs = 1; - else { - fprintf(stderr, "Error: '%s' is an unsupported subtitle type.\n", - argv[i + 1]); - exit(1); - } - } - else if (!strcmp(argv[i], "--language")) { if ((i + 1) >= argc) { fprintf(stderr, "Error: --language lacks its argument.\n"); diff --git a/p_textsubs.cpp b/p_textsubs.cpp index 5d8aba2e1..ec5aaa0e9 100644 --- a/p_textsubs.cpp +++ b/p_textsubs.cpp @@ -13,7 +13,7 @@ /*! \file - \version \$Id: p_textsubs.cpp,v 1.20 2003/05/25 15:35:39 mosu Exp $ + \version \$Id: p_textsubs.cpp,v 1.21 2003/05/29 18:50:03 mosu Exp $ \brief Subripper subtitle reader \author Moritz Bunkus */ @@ -43,10 +43,7 @@ textsubs_packetizer_c::~textsubs_packetizer_c() { } void textsubs_packetizer_c::set_headers() { - if (ti->no_utf8_subs) - set_codec_id(MKV_S_TEXTASCII); - else - set_codec_id(MKV_S_TEXTUTF8); + set_codec_id(MKV_S_TEXTUTF8); generic_packetizer_c::set_headers(); @@ -56,7 +53,7 @@ void textsubs_packetizer_c::set_headers() { int textsubs_packetizer_c::process(unsigned char *_subs, int, int64_t start, int64_t length, int64_t, int64_t) { int num_newlines; - char *subs, *idx1, *idx2; + char *subs, *idx1, *idx2, *utf8_subs; int64_t end; end = start + length; @@ -112,13 +109,10 @@ int textsubs_packetizer_c::process(unsigned char *_subs, int, int64_t start, } *idx2 = 0; - if (!ti->no_utf8_subs) { - char *utf8_subs = to_utf8(cc_utf8, subs); - add_packet((unsigned char *)utf8_subs, strlen(utf8_subs), start, length, - 1, -1, -1); - safefree(utf8_subs); - } else - add_packet((unsigned char *)subs, strlen(subs), start, length, 1, -1, -1); + utf8_subs = to_utf8(cc_utf8, subs); + add_packet((unsigned char *)utf8_subs, strlen(utf8_subs), start, length, + 1, -1, -1); + safefree(utf8_subs); safefree(subs); diff --git a/pr_generic.h b/pr_generic.h index 248ab0004..0e28507b8 100644 --- a/pr_generic.h +++ b/pr_generic.h @@ -13,7 +13,7 @@ /*! \file - \version \$Id: pr_generic.h,v 1.44 2003/05/25 15:35:39 mosu Exp $ + \version \$Id: pr_generic.h,v 1.45 2003/05/29 18:50:03 mosu Exp $ \brief class definition for the generic reader and packetizer \author Moritz Bunkus */ @@ -61,7 +61,6 @@ typedef struct { // Options used by the packetizers. unsigned char *private_data; int private_size; - int no_utf8_subs; char fourcc[5]; float aspect_ratio;