baseparse, typefind: only activate in pull mode if upstream is seekable

Upstream might support pull mode, but only sequential pulls,
which isn't gonna do much for us.

https://bugzilla.gnome.org/show_bug.cgi?id=634927
This commit is contained in:
Tim-Philipp Müller 2012-09-10 21:39:32 +01:00
parent 6c1294f54a
commit a85991eeb8
3 changed files with 22 additions and 2 deletions

View file

@ -2096,6 +2096,16 @@ gst_query_parse_nth_scheduling_mode (GstQuery * query, guint index)
*
* Check if @query has scheduling mode set.
*
* <note>
* <para>
* When checking if upstream supports pull mode, it is usually not
* enough to just check for GST_PAD_MODE_PULL with this function, you
* also want to check whether the scheduling flags returned by
* gst_query_parse_scheduling() have the seeking flag set (meaning
* random access is supported, not only sequential pulls).
* </para>
* </note>
*
* Returns: TRUE when @mode is in the list of scheduling modes.
*/
gboolean

View file

@ -2966,6 +2966,7 @@ pause:
static gboolean
gst_base_parse_sink_activate (GstPad * sinkpad, GstObject * parent)
{
GstSchedulingFlags sched_flags;
GstBaseParse *parse;
GstQuery *query;
gboolean pull_mode;
@ -2980,7 +2981,11 @@ gst_base_parse_sink_activate (GstPad * sinkpad, GstObject * parent)
goto baseparse_push;
}
pull_mode = gst_query_has_scheduling_mode (query, GST_PAD_MODE_PULL);
gst_query_parse_scheduling (query, &sched_flags, NULL, NULL, NULL);
pull_mode = gst_query_has_scheduling_mode (query, GST_PAD_MODE_PULL)
&& ((sched_flags & GST_SCHEDULING_FLAG_SEEKABLE) != 0);
gst_query_unref (query);
if (!pull_mode)

View file

@ -1165,6 +1165,7 @@ gst_type_find_element_activate_sink (GstPad * pad, GstObject * parent)
gboolean pull_mode;
GstCaps *found_caps = NULL;
GstTypeFindProbability probability = GST_TYPE_FIND_NONE;
GstSchedulingFlags sched_flags;
typefind = GST_TYPE_FIND_ELEMENT (parent);
@ -1196,7 +1197,11 @@ gst_type_find_element_activate_sink (GstPad * pad, GstObject * parent)
goto typefind_push;
}
pull_mode = gst_query_has_scheduling_mode (query, GST_PAD_MODE_PULL);
gst_query_parse_scheduling (query, &sched_flags, NULL, NULL, NULL);
pull_mode = gst_query_has_scheduling_mode (query, GST_PAD_MODE_PULL)
&& ((sched_flags & GST_SCHEDULING_FLAG_SEEKABLE) != 0);
gst_query_unref (query);
if (!pull_mode)