summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-08-17 14:38:52 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2015-08-17 14:39:44 -0300
commit9e99102b48201abba60e6fee0c00518bcb2a3dba (patch)
treee27456b5cd378902a86af97846a4c6f2876e1004
parentf2aabb9f892ab76ac19eefb5696e6c9df3fae063 (diff)
x265enc: add accept-caps handling
Ovewrite default handling to avoid doing a caps query. Check the received caps against the possible formats supported by the x265 library.
-rw-r--r--ext/x265/gstx265enc.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/ext/x265/gstx265enc.c b/ext/x265/gstx265enc.c
index be516a28c..08a4a3e04 100644
--- a/ext/x265/gstx265enc.c
+++ b/ext/x265/gstx265enc.c
@@ -297,6 +297,32 @@ gst_x265_enc_get_supported_input_caps (void)
return caps;
}
+static gboolean
+gst_x265_enc_sink_query (GstVideoEncoder * enc, GstQuery * query)
+{
+ gboolean res;
+
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_ACCEPT_CAPS:{
+ GstCaps *acceptable, *caps;
+
+ acceptable = gst_x265_enc_get_supported_input_caps ();
+ gst_query_parse_accept_caps (query, &caps);
+
+ gst_query_set_accept_caps_result (query,
+ gst_caps_is_subset (caps, acceptable));
+ gst_caps_unref (acceptable);
+ res = TRUE;
+ }
+ break;
+ default:
+ res = GST_VIDEO_ENCODER_CLASS (parent_class)->sink_query (enc, query);
+ break;
+ }
+
+ return res;
+}
+
static GstCaps *
gst_x265_enc_sink_getcaps (GstVideoEncoder * enc, GstCaps * filter)
{
@@ -336,6 +362,7 @@ gst_x265_enc_class_init (GstX265EncClass * klass)
gstencoder_class->flush = GST_DEBUG_FUNCPTR (gst_x265_enc_flush);
gstencoder_class->finish = GST_DEBUG_FUNCPTR (gst_x265_enc_finish);
gstencoder_class->getcaps = GST_DEBUG_FUNCPTR (gst_x265_enc_sink_getcaps);
+ gstencoder_class->sink_query = GST_DEBUG_FUNCPTR (gst_x265_enc_sink_query);
gstencoder_class->propose_allocation =
GST_DEBUG_FUNCPTR (gst_x265_enc_propose_allocation);