[tracker] extract-gstreamer: Rely better on the GstDiscoverer than mimetype sniffing
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] extract-gstreamer: Rely better on the GstDiscoverer than mimetype sniffing
- Date: Mon, 13 Jul 2015 22:12:07 +0000 (UTC)
commit 2cac6417bb00d0d08f4ad664f1022737f7270b52
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jul 13 21:31:11 2015 +0200
extract-gstreamer: Rely better on the GstDiscoverer than mimetype sniffing
There's mimetypes that easily fool mimetype detection (eg. OGG videos with
.ogg extension instead of .ogv will be detected as audio/ogg), the
GstDiscoverer will however find out correctly whether there's audio and/or
video information, so we should rely on it as a last resort, rather than
(weaker) mimetype sniffing.
This prevents .ogg suffixed videos from being played by gnome-music (oddly,
with success, in a separate window).
src/tracker-extract/tracker-extract-gstreamer.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index ac4a2e3..7679ed0 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -1155,6 +1155,20 @@ extract_metadata (MetadataExtractor *extractor,
if (extractor->mime == EXTRACT_MIME_GUESS && !gst_tag_list_is_empty (extractor->tagcache)) {
extractor_guess_content_type (extractor);
+ } else {
+ /* Rely on the information from the discoverer rather than the
+ * mimetype, this is a safety net for those formats that fool
+ * mimetype sniffing (eg. .ogg suffixed OGG videos being detected
+ * as audio/ogg.
+ */
+ if (extractor->mime == EXTRACT_MIME_AUDIO && extractor->has_video) {
+ g_debug ("mimetype says its audio, but has video frames. Falling back to video
extraction.");
+ extractor->mime = EXTRACT_MIME_VIDEO;
+ } else if (extractor->mime == EXTRACT_MIME_VIDEO &&
+ !extractor->has_video && extractor->has_audio) {
+ g_debug ("mimetype says its video, but has only audio. Falling back to audio
extraction.");
+ extractor->mime = EXTRACT_MIME_AUDIO;
+ }
}
if (extractor->mime == EXTRACT_MIME_GUESS) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]