CVS: main cfg-common.h,1.94,1.95 subreader.c,1.103,1.104 subreader.h,1.27,1.28
Update of /cvsroot/mplayer/main In directory mail:/var/tmp.root/cvs-serv4635 Modified Files: cfg-common.h subreader.c subreader.h Log Message: option for sub match fuzziness level Index: cfg-common.h =================================================================== RCS file: /cvsroot/mplayer/main/cfg-common.h,v retrieving revision 1.94 retrieving revision 1.95 diff -u -r1.94 -r1.95 --- cfg-common.h 8 Apr 2003 20:40:55 -0000 1.94 +++ cfg-common.h 9 Apr 2003 18:04:03 -0000 1.95 @@ -212,7 +212,7 @@ {"sub-bg-color", &sub_bg_color, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL}, {"sub-bg-alpha", &sub_bg_alpha, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL}, {"sub-no-text-pp", &sub_no_text_pp, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {"subfuzzy", &subfuzzy_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL}, + {"sub-fuzziness", &sub_match_fuzziness, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL}, #endif #ifdef USE_OSD {"font", &font_name, CONF_TYPE_STRING, 0, 0, 0, NULL}, Index: subreader.c =================================================================== RCS file: /cvsroot/mplayer/main/subreader.c,v retrieving revision 1.103 retrieving revision 1.104 diff -u -r1.103 -r1.104 --- subreader.c 9 Apr 2003 15:51:37 -0000 1.103 +++ subreader.c 9 Apr 2003 18:04:04 -0000 1.104 @@ -40,7 +40,7 @@ int sub_no_text_pp=0; // 1 => do not apply text post-processing // like {\...} elimination in SSA format. -int subfuzzy_enabled=0; // be _really_ fuzzy when looking for subtitles +int sub_match_fuzziness=0; // level of sub name matching fuzziness /* Use the SUB_* constant defined in the header file */ int sub_format=SUB_INVALID; @@ -1574,7 +1574,10 @@ static int compare_sub_priority(const void *a, const void *b) { - return ((subfn*)a)->priority < ((subfn*)b)->priority; + int ret; + ret = ((subfn*)a)->priority < ((subfn*)b)->priority; + if (ret != 0) return ret; + return strcoll(((subfn*)a)->fname, ((subfn*)b)->fname); } char** sub_filenames(char* path, char *fname) @@ -1663,9 +1666,17 @@ // we have a (likely) subtitle file if (found) { - // does it contain the movie name? - tmp = strstr(tmp_fname_trim, f_fname_trim); - if (tmp) { + if (strcmp(tmp_fname_trim, f_fname_trim) == 0) { + // matches the movie name? + sprintf(tmpresult, "%s%s", f_dir, de->d_name); + if ((f = fopen(tmpresult, "rt"))) { + fclose(f); + result[subcnt].priority = 4; + result[subcnt].fname = strdup(tmpresult); + subcnt++; + } + } else if ((tmp = strstr(tmp_fname_trim, f_fname_trim)) && (sub_match_fuzziness >= 1)) { + // does it contain the movie name? tmp += strlen(f_fname_trim); if (tmp_sub_id && strstr(tmp, tmp_sub_id)) { // with sub_id specified prefer localized subtitles @@ -1698,7 +1709,7 @@ } else { // doesn't contain the movie name // don't try in the mplayer subtitle directory - if ((j == 0) && subfuzzy_enabled) { + if ((j == 0) && (sub_match_fuzziness >= 2)) { sprintf(tmpresult, "%s%s", f_dir, de->d_name); if ((f = fopen(tmpresult, "rt"))) { fclose(f); Index: subreader.h =================================================================== RCS file: /cvsroot/mplayer/main/subreader.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- subreader.h 8 Apr 2003 20:40:55 -0000 1.27 +++ subreader.h 9 Apr 2003 18:04:04 -0000 1.28 @@ -3,7 +3,7 @@ extern int suboverlap_enabled; extern int sub_no_text_pp; // disable text post-processing -extern int subfuzzy_enabled; +extern int sub_match_fuzziness; // subtitle formats #define SUB_INVALID -1
participants (1)
-
Jindrich Makovicka CVS