comparison subreader.c @ 10353:ee46cdf03028

small correction of sub_utf8 restoring between reading sub files
author atlka
date Tue, 01 Jul 2003 07:16:39 +0000
parents 2eaabacd1429
children 18ad3cda99d4
comparison
equal deleted inserted replaced
10352:536f3ea8d19d 10353:ee46cdf03028
1164 }; 1164 };
1165 struct subreader *srp; 1165 struct subreader *srp;
1166 1166
1167 if(filename==NULL) return NULL; //qnx segfault 1167 if(filename==NULL) return NULL; //qnx segfault
1168 fd=fopen (filename, "r"); if (!fd) return NULL; 1168 fd=fopen (filename, "r"); if (!fd) return NULL;
1169
1170 sub_format=sub_autodetect (fd, &uses_time);
1171 mpsub_multiplier = (uses_time ? 100.0 : 1.0);
1172 if (sub_format==SUB_INVALID) {mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: Could not determine file format\n");return NULL;}
1173 srp=sr+sub_format;
1174 mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Detected subtitle file format: %s\n", srp->name);
1175
1176 rewind (fd);
1177
1178 #ifdef USE_ICONV
1179 sub_utf8_prev=sub_utf8;
1169 { 1180 {
1170 int l; 1181 int l;
1171 if ((l=strlen(filename))>4){ 1182 if ((l=strlen(filename))>4){
1172 int k; 1183 int k;
1173 char *exts[] = {".utf", ".utf8", ".utf-8" }; 1184 char *exts[] = {".utf", ".utf8", ".utf-8" };
1176 sub_utf8 = 1; 1187 sub_utf8 = 1;
1177 break; 1188 break;
1178 } 1189 }
1179 } 1190 }
1180 } 1191 }
1181 sub_format=sub_autodetect (fd, &uses_time); 1192 if (!(sub_utf8 & 1)) subcp_open();
1182 mpsub_multiplier = (uses_time ? 100.0 : 1.0);
1183 if (sub_format==SUB_INVALID) {mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: Could not determine file format\n");return NULL;}
1184 srp=sr+sub_format;
1185 mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Detected subtitle file format: %s\n", srp->name);
1186
1187 rewind (fd);
1188
1189 #ifdef USE_ICONV
1190 sub_utf8_prev=sub_utf8;
1191 subcp_open();
1192 #endif 1193 #endif
1193 1194
1194 sub_num=0;n_max=32; 1195 sub_num=0;n_max=32;
1195 first=(subtitle *)malloc(n_max*sizeof(subtitle)); 1196 first=(subtitle *)malloc(n_max*sizeof(subtitle));
1196 if(!first) return NULL; 1197 if(!first) return NULL;