X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=gtk%2Fsrc%2Fcallbacks.c;h=0d2aa7697b16a70deb4f8d2e48d039c011a703d5;hb=44946a6f8be82a70e65ca534541183a26fdb804b;hp=ab7cb31d8634c2c1ca5693dc29b599f4c997db1a;hpb=ed5a81836cbf7880f751d04a00558cd35a401600;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index ab7cb31d..0d2aa769 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -599,21 +599,17 @@ set_destination(signal_user_data_t *ud) static gchar* get_file_label(const gchar *filename) { - static gchar *containers[] = - {".vob", ".mpg", ".m2ts", ".mkv", ".mp4", ".m4v", ".avi", ".ogm", NULL}; - gchar *base; - gint ii; + gchar *base, *pos, *end; base = g_path_get_basename(filename); - for (ii = 0; containers[ii] != NULL; ii++) + pos = strrchr(base, '.'); + if (pos != NULL) { - if (g_str_has_suffix(base, containers[ii])) - { - gchar *pos; - pos = strrchr(base, '.'); + // If the last '.' is within 4 chars of end of name, assume + // there is an extension we want to strip. + end = &base[strlen(base) - 1]; + if (end - pos <= 4) *pos = 0; - break; - } } return base; }