summaryrefslogtreecommitdiff
path: root/ext/daala
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-08-17 14:32:56 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2015-08-17 14:39:44 -0300
commitf2aabb9f892ab76ac19eefb5696e6c9df3fae063 (patch)
tree60e4d62acb0f65e83bba1703645295a86d3c7754 /ext/daala
parenta6dc5e19a288f5e135f3f3a13dc3748a7a250b47 (diff)
downloadgstreamer-plugins-bad-f2aabb9f892ab76ac19eefb5696e6c9df3fae063.tar.gz
daalaenc: add accept-caps handling
Ovewrite default handling to avoid doing a caps query. Check the received caps against the possible formats supported by the daala library.
Diffstat (limited to 'ext/daala')
-rw-r--r--ext/daala/gstdaalaenc.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/daala/gstdaalaenc.c b/ext/daala/gstdaalaenc.c
index 1aa2a78ce..ef3ce4aa4 100644
--- a/ext/daala/gstdaalaenc.c
+++ b/ext/daala/gstdaalaenc.c
@@ -97,6 +97,8 @@ static GstFlowReturn daala_enc_pre_push (GstVideoEncoder * benc,
static GstFlowReturn daala_enc_finish (GstVideoEncoder * enc);
static gboolean daala_enc_propose_allocation (GstVideoEncoder * encoder,
GstQuery * query);
+static gboolean gst_daala_enc_sink_query (GstVideoEncoder * encoder,
+ GstQuery * query);
static GstCaps *daala_enc_getcaps (GstVideoEncoder * encoder, GstCaps * filter);
static void daala_enc_get_property (GObject * object, guint prop_id,
@@ -145,6 +147,7 @@ gst_daala_enc_class_init (GstDaalaEncClass * klass)
gstvideo_encoder_class->pre_push = GST_DEBUG_FUNCPTR (daala_enc_pre_push);
gstvideo_encoder_class->finish = GST_DEBUG_FUNCPTR (daala_enc_finish);
gstvideo_encoder_class->getcaps = GST_DEBUG_FUNCPTR (daala_enc_getcaps);
+ gstvideo_encoder_class->sink_query = GST_DEBUG_FUNCPTR (daala_enc_sink_query);
gstvideo_encoder_class->propose_allocation =
GST_DEBUG_FUNCPTR (daala_enc_propose_allocation);
@@ -292,6 +295,32 @@ daala_enc_get_supported_formats (void)
return string == NULL ? NULL : g_string_free (string, FALSE);
}
+static gboolean
+gst_daala_enc_sink_query (GstVideoEncoder * encoder, GstQuery * query)
+{
+ gboolean res;
+
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_ACCEPT_CAPS:{
+ GstCaps *acceptable, *caps;
+
+ acceptable = daala_enc_get_supported_formats ();
+ 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 (encoder, query);
+ break;
+ }
+
+ return res;
+}
+
static GstCaps *
daala_enc_getcaps (GstVideoEncoder * encoder, GstCaps * filter)
{