summaryrefslogtreecommitdiff
path: root/ext/x265
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2014-12-17 22:01:23 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2014-12-17 22:13:17 -0300
commit77388f9d83a4f5162667964a97c4f642c2e4f934 (patch)
treeaf03df792e93cf54871a78206d6d17849983c040 /ext/x265
parent4c883e4ad25c9d8d29f0282a425a5ee3c8720ef4 (diff)
x265enc: reuse the gstvideo proxy getcaps
The caps query is implementing the same logic as the default handler from the base class. Reuse it to simplify code.
Diffstat (limited to 'ext/x265')
-rw-r--r--ext/x265/gstx265enc.c63
1 files changed, 5 insertions, 58 deletions
diff --git a/ext/x265/gstx265enc.c b/ext/x265/gstx265enc.c
index 64d64cc7c..e1621e922 100644
--- a/ext/x265/gstx265enc.c
+++ b/ext/x265/gstx265enc.c
@@ -276,67 +276,14 @@ static GstCaps *
gst_x265_enc_sink_getcaps (GstVideoEncoder * enc, GstCaps * filter)
{
GstCaps *supported_incaps;
- GstCaps *allowed;
- GstCaps *filter_caps, *fcaps;
- gint i, j;
+ GstCaps *ret;
supported_incaps = gst_x265_enc_get_supported_input_caps ();
- if (!supported_incaps)
- supported_incaps = gst_pad_get_pad_template_caps (enc->sinkpad);
- allowed = gst_pad_get_allowed_caps (enc->srcpad);
-
- if (!allowed || gst_caps_is_empty (allowed) || gst_caps_is_any (allowed)) {
- fcaps = supported_incaps;
- goto done;
- }
-
- GST_LOG_OBJECT (enc, "template caps %" GST_PTR_FORMAT, supported_incaps);
- GST_LOG_OBJECT (enc, "allowed caps %" GST_PTR_FORMAT, allowed);
-
- filter_caps = gst_caps_new_empty ();
-
- for (i = 0; i < gst_caps_get_size (supported_incaps); i++) {
- GQuark q_name =
- gst_structure_get_name_id (gst_caps_get_structure (supported_incaps,
- i));
-
- for (j = 0; j < gst_caps_get_size (allowed); j++) {
- const GstStructure *allowed_s = gst_caps_get_structure (allowed, j);
- const GValue *val;
- GstStructure *s;
-
- s = gst_structure_new_id_empty (q_name);
- if ((val = gst_structure_get_value (allowed_s, "width")))
- gst_structure_set_value (s, "width", val);
- if ((val = gst_structure_get_value (allowed_s, "height")))
- gst_structure_set_value (s, "height", val);
- if ((val = gst_structure_get_value (allowed_s, "framerate")))
- gst_structure_set_value (s, "framerate", val);
- if ((val = gst_structure_get_value (allowed_s, "pixel-aspect-ratio")))
- gst_structure_set_value (s, "pixel-aspect-ratio", val);
-
- filter_caps = gst_caps_merge_structure (filter_caps, s);
- }
- }
-
- fcaps = gst_caps_intersect (filter_caps, supported_incaps);
- gst_caps_unref (filter_caps);
- gst_caps_unref (supported_incaps);
-
- if (filter) {
- GST_LOG_OBJECT (enc, "intersecting with %" GST_PTR_FORMAT, filter);
- filter_caps = gst_caps_intersect (fcaps, filter);
- gst_caps_unref (fcaps);
- fcaps = filter_caps;
- }
-
-done:
- gst_caps_replace (&allowed, NULL);
-
- GST_LOG_OBJECT (enc, "proxy caps %" GST_PTR_FORMAT, fcaps);
-
- return fcaps;
+ ret = gst_video_encoder_proxy_getcaps (enc, supported_incaps, filter);
+ if (supported_incaps)
+ gst_caps_unref (supported_incaps);
+ return ret;
}
static void