summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-08-16 14:27:44 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2015-08-16 14:27:44 -0300
commitba5e19706d42287d5e3ab049fab352140d1bb606 (patch)
tree8428494d82b69a473f90b42270f030f1367c1e3f
parente1b6ef320932c79ba6e194a3d430290fbb05de3d (diff)
x264enc: implement accept-caps handling
Implement accept-caps handling without doing caps queries downstream
-rw-r--r--ext/x264/gstx264enc.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c
index 7d5e2b42..d47b2bca 100644
--- a/ext/x264/gstx264enc.c
+++ b/ext/x264/gstx264enc.c
@@ -735,6 +735,39 @@ done:
return fcaps;
}
+static gboolean
+gst_x264_enc_sink_query (GstVideoEncoder * enc, GstQuery * query)
+{
+ GstPad *pad = GST_VIDEO_ENCODER_SINK_PAD (enc);
+ gboolean ret = FALSE;
+
+ GST_DEBUG ("Received %s query on sinkpad, %" GST_PTR_FORMAT,
+ GST_QUERY_TYPE_NAME (query), query);
+
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_ACCEPT_CAPS:{
+ GstCaps *acceptable, *caps;
+
+ acceptable = gst_x264_enc_get_supported_input_caps ();
+ if (!acceptable) {
+ acceptable = gst_pad_get_pad_template_caps (pad);
+ }
+
+ gst_query_parse_accept_caps (query, &caps);
+
+ gst_query_set_accept_caps_result (query,
+ gst_caps_is_subset (caps, acceptable));
+ gst_caps_unref (acceptable);
+ }
+ break;
+ default:
+ ret = GST_VIDEO_ENCODER_CLASS (parent_class)->sink_query (enc, query);
+ break;
+ }
+
+ return ret;
+}
+
static void
gst_x264_enc_class_init (GstX264EncClass * klass)
{
@@ -763,6 +796,7 @@ gst_x264_enc_class_init (GstX264EncClass * klass)
gstencoder_class->getcaps = GST_DEBUG_FUNCPTR (gst_x264_enc_sink_getcaps);
gstencoder_class->propose_allocation =
GST_DEBUG_FUNCPTR (gst_x264_enc_propose_allocation);
+ gstencoder_class->sink_query = GST_DEBUG_FUNCPTR (gst_x264_enc_sink_query);
/* options for which we don't use string equivalents */
g_object_class_install_property (gobject_class, ARG_PASS,