summaryrefslogtreecommitdiff
path: root/gst/videoparsers/gsth263parse.c
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2011-11-24 10:09:59 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2011-11-24 10:09:59 +0100
commit61fad46dca27291f59951213625299863b68a722 (patch)
tree193f5634e92a557e08ec37a319b85af552e80cec /gst/videoparsers/gsth263parse.c
parentb10c1f277f2bab2058d398f60f392682083db541 (diff)
downloadgstreamer-plugins-bad-61fad46dca27291f59951213625299863b68a722.tar.gz
h263parse: Implement ::get_sink_caps vfunc to propagate downstream caps constraints upstream
Diffstat (limited to 'gst/videoparsers/gsth263parse.c')
-rw-r--r--gst/videoparsers/gsth263parse.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gst/videoparsers/gsth263parse.c b/gst/videoparsers/gsth263parse.c
index 4a5633f3b..e13a94605 100644
--- a/gst/videoparsers/gsth263parse.c
+++ b/gst/videoparsers/gsth263parse.c
@@ -58,6 +58,7 @@ static gboolean gst_h263_parse_check_valid_frame (GstBaseParse * parse,
GstBaseParseFrame * frame, guint * framesize, gint * skipsize);
static GstFlowReturn gst_h263_parse_parse_frame (GstBaseParse * parse,
GstBaseParseFrame * frame);
+static GstCaps *gst_h263_parse_get_sink_caps (GstBaseParse * parse);
static void
gst_h263_parse_base_init (gpointer g_class)
@@ -89,6 +90,7 @@ gst_h263_parse_class_init (GstH263ParseClass * klass)
parse_class->check_valid_frame =
GST_DEBUG_FUNCPTR (gst_h263_parse_check_valid_frame);
parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_h263_parse_parse_frame);
+ parse_class->get_sink_caps = GST_DEBUG_FUNCPTR (gst_h263_parse_get_sink_caps);
}
static void
@@ -359,3 +361,35 @@ out:
return res;
}
+
+static GstCaps *
+gst_h263_parse_get_sink_caps (GstBaseParse * parse)
+{
+ GstCaps *peercaps;
+ GstCaps *res;
+
+ peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
+ if (peercaps) {
+ guint i, n;
+
+ /* Remove parsed field */
+ peercaps = gst_caps_make_writable (peercaps);
+ n = gst_caps_get_size (peercaps);
+ for (i = 0; i < n; i++) {
+ GstStructure *s = gst_caps_get_structure (peercaps, i);
+ gst_structure_remove_field (s, "parsed");
+ }
+
+ res =
+ gst_caps_intersect_full (peercaps,
+ gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD (parse)),
+ GST_CAPS_INTERSECT_FIRST);
+ gst_caps_unref (peercaps);
+ } else {
+ res =
+ gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
+ (parse)));
+ }
+
+ return res;
+}