diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-03-22 06:39:17 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-03-22 06:39:17 +0100 |
commit | 3253d99365813f2d2ffd05e10cbb8c11f53d746e (patch) | |
tree | 0ab6f04d9051dc4ada1c4f977a01308227767234 /src/VideoSupport.vala | |
parent | e69c1b746d63bf794316669471474ab57c8cd40a (diff) |
New upstream version 0.26.0upstream/0.26.0
Diffstat (limited to 'src/VideoSupport.vala')
-rw-r--r-- | src/VideoSupport.vala | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/VideoSupport.vala b/src/VideoSupport.vala index 540aad4..5076a31 100644 --- a/src/VideoSupport.vala +++ b/src/VideoSupport.vala @@ -53,9 +53,24 @@ public class VideoReader { } public static bool is_supported_video_file(File file) { + var mime_type = ContentType.guess(file.get_basename(), new uchar[0], null); + // special case: deep-check content-type of files ending with .ogg + if (mime_type == "audio/ogg" && file.has_uri_scheme("file")) { + try { + var info = file.query_info(FileAttribute.STANDARD_CONTENT_TYPE, + FileQueryInfoFlags.NONE); + var content_type = info.get_content_type(); + if (content_type != null && content_type.has_prefix ("video/")) { + return true; + } + } catch (Error error) { + debug("Failed to query content type: %s", error.message); + } + } + return is_supported_video_filename(file.get_basename()); } - + public static bool is_supported_video_filename(string filename) { string mime_type; mime_type = ContentType.guess(filename, new uchar[0], null); @@ -63,7 +78,7 @@ public class VideoReader { string? extension = null; string? name = null; disassemble_filename(filename, out name, out extension); - + if (extension == null) return true; @@ -71,9 +86,10 @@ public class VideoReader { if (utf8_ci_compare(s, extension) == 0) return false; } - + return true; } else { + debug("Skipping %s, unsupported mime type %s", filename, mime_type); return false; } } |