comparison subreader.c @ 9145:ab8238290141

sub_utf8 handling hopefully fixed
author henry
date Tue, 28 Jan 2003 18:45:58 +0000
parents 6af323788366
children 420e2b2f8e5a
comparison
equal deleted inserted replaced
9144:d33fe13de7ae 9145:ab8238290141
921 icdsc = (iconv_t)(-1); 921 icdsc = (iconv_t)(-1);
922 922
923 if (sub_cp){ 923 if (sub_cp){
924 if ((icdsc = iconv_open (tocp, sub_cp)) != (iconv_t)(-1)){ 924 if ((icdsc = iconv_open (tocp, sub_cp)) != (iconv_t)(-1)){
925 mp_msg(MSGT_SUBREADER,MSGL_V,"SUB: opened iconv descriptor.\n"); 925 mp_msg(MSGT_SUBREADER,MSGL_V,"SUB: opened iconv descriptor.\n");
926 sub_utf8_prev=sub_utf8;
927 sub_utf8 = 2; 926 sub_utf8 = 2;
928 } else 927 } else
929 mp_msg(MSGT_SUBREADER,MSGL_ERR,"SUB: error opening iconv descriptor.\n"); 928 mp_msg(MSGT_SUBREADER,MSGL_ERR,"SUB: error opening iconv descriptor.\n");
930 } 929 }
931 } 930 }
933 void subcp_close (void) 932 void subcp_close (void)
934 { 933 {
935 if (icdsc != (iconv_t)(-1)){ 934 if (icdsc != (iconv_t)(-1)){
936 (void) iconv_close (icdsc); 935 (void) iconv_close (icdsc);
937 icdsc = (iconv_t)(-1); 936 icdsc = (iconv_t)(-1);
938 sub_utf8=sub_utf8_prev;
939 mp_msg(MSGT_SUBREADER,MSGL_V,"SUB: closed iconv descriptor.\n"); 937 mp_msg(MSGT_SUBREADER,MSGL_V,"SUB: closed iconv descriptor.\n");
940 } 938 }
941 } 939 }
942 940
943 #define ICBUFFSIZE 512 941 #define ICBUFFSIZE 512
1098 mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Detected subtitle file format: %s\n", srp->name); 1096 mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Detected subtitle file format: %s\n", srp->name);
1099 1097
1100 rewind (fd); 1098 rewind (fd);
1101 1099
1102 #ifdef USE_ICONV 1100 #ifdef USE_ICONV
1101 sub_utf8_prev=sub_utf8;
1103 subcp_open(); 1102 subcp_open();
1104 #endif 1103 #endif
1105 1104
1106 sub_num=0;n_max=32; 1105 sub_num=0;n_max=32;
1107 first=(subtitle *)malloc(n_max*sizeof(subtitle)); 1106 first=(subtitle *)malloc(n_max*sizeof(subtitle));
1129 #endif 1128 #endif
1130 if ( sub == ERR ) 1129 if ( sub == ERR )
1131 { 1130 {
1132 #ifdef USE_ICONV 1131 #ifdef USE_ICONV
1133 subcp_close(); 1132 subcp_close();
1133 sub_utf8=sub_utf8_prev;
1134 #endif 1134 #endif
1135 if ( first ) free(first); 1135 if ( first ) free(first);
1136 return NULL; 1136 return NULL;
1137 } 1137 }
1138 // Apply any post processing that needs recoding first 1138 // Apply any post processing that needs recoding first