return TRUE;
}
-static GstCaps *
-gst_type_find_guess_by_extension (GstTypeFindElement * typefind, GstPad * pad,
- GstTypeFindProbability * probability)
+static gchar *
+gst_type_find_get_extension (GstTypeFindElement * typefind, GstPad * pad)
{
GstQuery *query;
- gchar *uri;
+ gchar *uri, *result;
size_t len;
gint find;
- GstCaps *caps;
query = gst_query_new_uri ();
if (find < 0)
goto no_extension;
- GST_DEBUG_OBJECT (typefind, "found extension %s", &uri[find + 1]);
-
- caps =
- gst_type_find_helper_for_extension (GST_OBJECT_CAST (typefind),
- &uri[find + 1]);
- if (caps)
- *probability = GST_TYPE_FIND_MAXIMUM;
+ result = g_strdup (&uri[find + 1]);
+ GST_DEBUG_OBJECT (typefind, "found extension %s", result);
gst_query_unref (query);
- return caps;
+ return result;
/* ERRORS */
peer_query_failed:
}
}
+static GstCaps *
+gst_type_find_guess_by_extension (GstTypeFindElement * typefind, GstPad * pad,
+ GstTypeFindProbability * probability)
+{
+ gchar *ext;
+ GstCaps *caps;
+
+ ext = gst_type_find_get_extension (typefind, pad);
+ if (!ext)
+ return NULL;
+
+ caps = gst_type_find_helper_for_extension (GST_OBJECT_CAST (typefind), ext);
+ if (caps)
+ *probability = GST_TYPE_FIND_MAXIMUM;
+
+ g_free (ext);
+
+ return caps;
+}
+
static GstFlowReturn
gst_type_find_element_chain (GstPad * pad, GstBuffer * buffer)
{
if (peer) {
gint64 size;
GstFormat format = GST_FORMAT_BYTES;
+ gchar *ext;
if (!gst_pad_query_duration (peer, &format, &size)) {
GST_WARNING_OBJECT (typefind, "Could not query upstream length!");
gst_object_unref (peer);
return FALSE;
}
+ ext = gst_type_find_get_extension (typefind, pad);
- found_caps = gst_type_find_helper_get_range (GST_OBJECT_CAST (peer),
+ found_caps = gst_type_find_helper_get_range_ext (GST_OBJECT_CAST (peer),
(GstTypeFindHelperGetRangeFunction) (GST_PAD_GETRANGEFUNC (peer)),
- (guint64) size, &probability);
+ (guint64) size, ext, &probability);
+ g_free (ext);
gst_object_unref (peer);
}