mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
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.
This commit is contained in:
parent
a6dc5e19a2
commit
f2aabb9f89
1 changed files with 29 additions and 0 deletions
|
@ -97,6 +97,8 @@ static GstFlowReturn daala_enc_pre_push (GstVideoEncoder * benc,
|
||||||
static GstFlowReturn daala_enc_finish (GstVideoEncoder * enc);
|
static GstFlowReturn daala_enc_finish (GstVideoEncoder * enc);
|
||||||
static gboolean daala_enc_propose_allocation (GstVideoEncoder * encoder,
|
static gboolean daala_enc_propose_allocation (GstVideoEncoder * encoder,
|
||||||
GstQuery * query);
|
GstQuery * query);
|
||||||
|
static gboolean gst_daala_enc_sink_query (GstVideoEncoder * encoder,
|
||||||
|
GstQuery * query);
|
||||||
|
|
||||||
static GstCaps *daala_enc_getcaps (GstVideoEncoder * encoder, GstCaps * filter);
|
static GstCaps *daala_enc_getcaps (GstVideoEncoder * encoder, GstCaps * filter);
|
||||||
static void daala_enc_get_property (GObject * object, guint prop_id,
|
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->pre_push = GST_DEBUG_FUNCPTR (daala_enc_pre_push);
|
||||||
gstvideo_encoder_class->finish = GST_DEBUG_FUNCPTR (daala_enc_finish);
|
gstvideo_encoder_class->finish = GST_DEBUG_FUNCPTR (daala_enc_finish);
|
||||||
gstvideo_encoder_class->getcaps = GST_DEBUG_FUNCPTR (daala_enc_getcaps);
|
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 =
|
gstvideo_encoder_class->propose_allocation =
|
||||||
GST_DEBUG_FUNCPTR (daala_enc_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);
|
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 *
|
static GstCaps *
|
||||||
daala_enc_getcaps (GstVideoEncoder * encoder, GstCaps * filter)
|
daala_enc_getcaps (GstVideoEncoder * encoder, GstCaps * filter)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue