summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2017-12-19 23:13:34 -0500
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2017-12-20 14:01:56 -0500
commit191c8742d3cfde62ef837760fb5ca6d4bc226f1e (patch)
tree29d7c47f8927d2b53881a236a15bcd8eab05aed6 /gst
parent12f8410cd20eaa4e1da1674d20c0a5ac5fc37488 (diff)
festival: Don't forward all queries
This fixes issues where wavparse would query the file size upstream and assert because the file size is way smaller then what the WAVE header says. This patch disable or cane a handful of queries that make no sense to forward. https://bugzilla.gnome.org/show_bug.cgi?id=791811
Diffstat (limited to 'gst')
-rw-r--r--gst/festival/gstfestival.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gst/festival/gstfestival.c b/gst/festival/gstfestival.c
index 73d492ab8..407fa3bc2 100644
--- a/gst/festival/gstfestival.c
+++ b/gst/festival/gstfestival.c
@@ -112,6 +112,8 @@ static void gst_festival_finalize (GObject * object);
static GstFlowReturn gst_festival_chain (GstPad * pad, GstObject * parent,
GstBuffer * buf);
+static gboolean gst_festival_src_query (GstPad * pad, GstObject * parent,
+ GstQuery * query);
static GstStateChangeReturn gst_festival_change_state (GstElement * element,
GstStateChange transition);
@@ -184,6 +186,7 @@ gst_festival_init (GstFestival * festival)
festival->srcpad =
gst_pad_new_from_static_template (&src_template_factory, "src");
+ gst_pad_set_query_function (festival->srcpad, gst_festival_src_query);
gst_element_add_pad (GST_ELEMENT (festival), festival->srcpad);
festival->info = festival_default_info ();
@@ -496,6 +499,29 @@ gst_festival_change_state (GstElement * element, GstStateChange transition)
}
static gboolean
+gst_festival_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
+{
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_POSITION:
+ /* Not supported */
+ return FALSE;
+ case GST_QUERY_DURATION:
+ gst_query_set_duration (query, GST_FORMAT_BYTES, -1);
+ return TRUE;
+ case GST_QUERY_SEEKING:
+ gst_query_set_seeking (query, GST_FORMAT_BYTES, FALSE, 0, -1);
+ return TRUE;
+ case GST_QUERY_FORMATS:
+ gst_query_set_formats (query, 1, GST_FORMAT_BYTES);
+ return TRUE;
+ default:
+ break;
+ }
+
+ return gst_pad_query_default (pad, parent, query);
+}
+
+static gboolean
plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (festival_debug, "festival",