diff options
author | jstebbins <[email protected]> | 2009-08-06 23:00:08 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-08-06 23:00:08 +0000 |
commit | 37928ccabd5066bd35c330609d9f1aea989af301 (patch) | |
tree | dbfb8b7fac88ced98535492051f0c7e95edf24fb | |
parent | bd7f9d53243dde4bd44d50004e0022151b0a2af3 (diff) |
LinGui: use a different method of stripping video file name extensions
before the new destination filename is constructed the original files
extension is stripped. this new method catches a larger variety of
extensions without the need to explicitly list them all.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2749 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | gtk/src/callbacks.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index ab7cb31d8..0d2aa7697 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; } |