gboolean at_eos, gboolean new_buffer);
static gboolean gst_video_decoder_negotiate_unlocked (GstVideoDecoder *
decoder);
+static gboolean gst_video_decoder_sink_query_default (GstVideoDecoder * decoder,
+ GstQuery * query);
+static gboolean gst_video_decoder_src_query_default (GstVideoDecoder * decoder,
+ GstQuery * query);
/* we can't use G_DEFINE_ABSTRACT_TYPE because we need the klass in the _init
* method to get to the padtemplates */
klass->decide_allocation = gst_video_decoder_decide_allocation_default;
klass->propose_allocation = gst_video_decoder_propose_allocation_default;
klass->negotiate = gst_video_decoder_negotiate_default;
+ klass->sink_query = gst_video_decoder_sink_query_default;
+ klass->src_query = gst_video_decoder_src_query_default;
}
static void
}
static gboolean
-gst_video_decoder_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
+gst_video_decoder_src_query_default (GstVideoDecoder * dec, GstQuery * query)
{
- GstVideoDecoder *dec;
+ GstPad *pad = GST_VIDEO_DECODER_SRC_PAD (dec);
gboolean res = TRUE;
- dec = GST_VIDEO_DECODER (parent);
-
GST_LOG_OBJECT (dec, "handling query: %" GST_PTR_FORMAT, query);
switch (GST_QUERY_TYPE (query)) {
GstFormat format;
/* upstream in any case */
- if ((res = gst_pad_query_default (pad, parent, query)))
+ if ((res = gst_pad_query_default (pad, GST_OBJECT (dec), query)))
break;
gst_query_parse_duration (query, &format, NULL);
}
break;
default:
- res = gst_pad_query_default (pad, parent, query);
+ res = gst_pad_query_default (pad, GST_OBJECT (dec), query);
}
return res;
}
static gboolean
-gst_video_decoder_sink_query (GstPad * pad, GstObject * parent,
- GstQuery * query)
+gst_video_decoder_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstVideoDecoder *decoder;
+ GstVideoDecoderClass *decoder_class;
+ gboolean ret = FALSE;
+
+ decoder = GST_VIDEO_DECODER (parent);
+ decoder_class = GST_VIDEO_DECODER_GET_CLASS (decoder);
+
+ GST_DEBUG_OBJECT (decoder, "received query %d, %s", GST_QUERY_TYPE (query),
+ GST_QUERY_TYPE_NAME (query));
+
+ if (decoder_class->src_query)
+ ret = decoder_class->src_query (decoder, query);
+
+ return ret;
+}
+
+static gboolean
+gst_video_decoder_sink_query_default (GstVideoDecoder * decoder,
+ GstQuery * query)
+{
+ GstPad *pad = GST_VIDEO_DECODER_SINK_PAD (decoder);
GstVideoDecoderPrivate *priv;
gboolean res = FALSE;
- decoder = GST_VIDEO_DECODER (parent);
priv = decoder->priv;
GST_LOG_OBJECT (decoder, "handling query: %" GST_PTR_FORMAT, query);
break;
}
default:
- res = gst_pad_query_default (pad, parent, query);
+ res = gst_pad_query_default (pad, GST_OBJECT (decoder), query);
break;
}
done:
error:
GST_DEBUG_OBJECT (decoder, "query failed");
goto done;
+
+}
+
+static gboolean
+gst_video_decoder_sink_query (GstPad * pad, GstObject * parent,
+ GstQuery * query)
+{
+ GstVideoDecoder *decoder;
+ GstVideoDecoderClass *decoder_class;
+ gboolean ret = FALSE;
+
+ decoder = GST_VIDEO_DECODER (parent);
+ decoder_class = GST_VIDEO_DECODER_GET_CLASS (decoder);
+
+ GST_DEBUG_OBJECT (decoder, "received query %d, %s", GST_QUERY_TYPE (query),
+ GST_QUERY_TYPE_NAME (query));
+
+ if (decoder_class->sink_query)
+ ret = decoder_class->sink_query (decoder, query);
+
+ return ret;
}
typedef struct _Timestamp Timestamp;
* @flush: Optional.
* Flush all remaining data from the decoder without
* pushing it downstream. Since: 1.2
+ * @sink_query: Optional.
+ * Query handler on the sink pad. This function should
+ * return TRUE if the query could be performed. Subclasses
+ * should chain up to the parent implementation to invoke the
+ * default handler. Since 1.4
+ * @src_query: Optional.
+ * Query handler on the source pad. This function should
+ * return TRUE if the query could be performed. Subclasses
+ * should chain up to the parent implementation to invoke the
+ * default handler. Since 1.4
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At minimum @handle_frame needs to be overridden, and @set_format
gboolean (*flush) (GstVideoDecoder *decoder);
+ gboolean (*sink_query) (GstVideoDecoder *decoder,
+ GstQuery *query);
+
+ gboolean (*src_query) (GstVideoDecoder *decoder,
+ GstQuery *query);
+
+
/*< private >*/
- void *padding[GST_PADDING_LARGE-1];
+ void *padding[GST_PADDING_LARGE-3];
};
GType gst_video_decoder_get_type (void);