[tracker/tracker-1.4] extract-gstreamer: Rely better on the GstDiscoverer than mimetype sniffing
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-1.4] extract-gstreamer: Rely better on the GstDiscoverer than mimetype sniffing
- Date: Fri, 31 Jul 2015 16:53:29 +0000 (UTC)
commit 1e918d8f29c003cc94e5fa792ee1f4445fccdde6
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 2ce25ae..ac94a9e 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]