summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2009-03-12 23:54:12 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-03-13 22:53:21 +0000
commit7a85af3ce6b0c8a57c64891ddd35fba880d8ba20 (patch)
treee70777e9612ca1e6ca5a3cf32928df945527565e /gst
parent4bff4266d51089de0de9c44a1651937821f5fb8b (diff)
downloadgst-plugins-bad-7a85af3ce6b0c8a57c64891ddd35fba880d8ba20.tar.gz
gst-plugins-bad-7a85af3ce6b0c8a57c64891ddd35fba880d8ba20.tar.bz2
gst-plugins-bad-7a85af3ce6b0c8a57c64891ddd35fba880d8ba20.zip
xdgmime: make xdg typefinder more conservative
The whole raison d'etre of this typefinder is to help avoid false positives when used in combination with our main typefinder in -base. Its task is not really to typefind audio/video files, even less so given that it detects *MIME* types, not GStreamer media types. Therefore, if this typefinder detects an audio or video type, don't even suggest it - our own typefinders are hopefully better at this and detect the right type of type on top of that, and even if they're not we really want to know about it and fix it. Fixes #575157.
Diffstat (limited to 'gst')
-rw-r--r--gst/xdgmime/gstxdgmime.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/gst/xdgmime/gstxdgmime.c b/gst/xdgmime/gstxdgmime.c
index 04f86123..74253bfa 100644
--- a/gst/xdgmime/gstxdgmime.c
+++ b/gst/xdgmime/gstxdgmime.c
@@ -36,7 +36,6 @@ xdgmime_typefind (GstTypeFind * find, gpointer user_data)
guint64 tf_length;
gint prio;
guint8 *data;
- GstCaps *caps;
if ((tf_length = gst_type_find_get_length (find)) > 0)
length = MIN (length, tf_length);
@@ -57,8 +56,25 @@ xdgmime_typefind (GstTypeFind * find, gpointer user_data)
GST_DEBUG ("Got mimetype '%s' with prio %d", mimetype, prio);
- caps = gst_caps_new_simple (mimetype, NULL);
- gst_type_find_suggest (find, GST_TYPE_FIND_POSSIBLE, caps);
+ /* Ignore audio/video types:
+ * - our own typefinders in -base are likely to be better at this
+ * (and if they're not, we really want to fix them, that's why we don't
+ * report xdg-detected audio/video types at all, not even with a low
+ * probability)
+ * - we want to detect GStreamer media types and not MIME types
+ * - the purpose of this xdg mime finder is mainly to prevent false
+ * positives of non-media formats, not to typefind audio/video formats */
+ if (g_str_has_prefix (mimetype, "audio/") ||
+ g_str_has_prefix (mimetype, "video/")) {
+ GST_LOG ("Ignoring audio/video mime type");
+ return;
+ }
+
+ /* Again, we mainly want the xdg typefinding to prevent false-positives on
+ * non-media formats, so suggest the type with a probability that trumps
+ * uncertain results of our typefinders, but not more than that. */
+ GST_LOG ("Suggesting '%s' with probability POSSIBLE", mimetype);
+ gst_type_find_suggest_simple (find, GST_TYPE_FIND_POSSIBLE, mimetype, NULL);
}
static gboolean