diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2012-11-01 10:55:03 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2012-11-01 10:57:19 +0000 |
commit | abef8ee9e4d6eb4ee8c20630d0291fe8fbc0fe82 (patch) | |
tree | 1b9d7ec32ae024c3ab9db726b3063e9dd691625f | |
parent | 7f46a80cf0d9145a05674ae3b64b3ee36d5e6f08 (diff) |
gstdepay: use the capsversion
Take the caps from the input caps and store it in the slot given
by capsversion.
-rw-r--r-- | gst/rtp/gstrtpgstdepay.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/gst/rtp/gstrtpgstdepay.c b/gst/rtp/gstrtpgstdepay.c index 42dac7e24..c992abf0b 100644 --- a/gst/rtp/gstrtpgstdepay.c +++ b/gst/rtp/gstrtpgstdepay.c @@ -21,9 +21,9 @@ # include "config.h" #endif -#include <gst/rtp/gstrtpbuffer.h> - #include <string.h> +#include <stdlib.h> + #include "gstrtpgstdepay.h" GST_DEBUG_CATEGORY_STATIC (rtpgstdepay_debug); @@ -141,11 +141,9 @@ gst_rtp_gst_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) { GstRtpGSTDepay *rtpgstdepay; GstStructure *structure; - GstCaps *outcaps; gint clock_rate; gboolean res; const gchar *capsenc; - gchar *capsstr; rtpgstdepay = GST_RTP_GST_DEPAY (depayload); @@ -157,21 +155,37 @@ gst_rtp_gst_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) capsenc = gst_structure_get_string (structure, "caps"); if (capsenc) { + GstCaps *outcaps; gsize out_len; + gchar *capsstr; + const gchar *capsver; + guint CV; + /* decode caps */ capsstr = (gchar *) g_base64_decode (capsenc, &out_len); outcaps = gst_caps_from_string (capsstr); g_free (capsstr); - /* we have the SDP caps as output caps */ - rtpgstdepay->current_CV = 0; + /* parse version */ + capsver = gst_structure_get_string (structure, "capsversion"); + if (capsver) { + CV = atoi (capsver); + } else { + /* no version, assume 0 */ + CV = 0; + } + /* store in cache */ + rtpgstdepay->current_CV = CV; gst_caps_ref (outcaps); - store_cache (rtpgstdepay, 0, outcaps); + store_cache (rtpgstdepay, CV, outcaps); + + res = gst_pad_set_caps (depayload->srcpad, outcaps); + gst_caps_unref (outcaps); } else { - outcaps = gst_caps_new_any (); + GST_WARNING_OBJECT (depayload, "no caps given"); + rtpgstdepay->current_CV = -1; + res = TRUE; } - res = gst_pad_set_caps (depayload->srcpad, outcaps); - gst_caps_unref (outcaps); return res; } @@ -252,6 +266,8 @@ gst_rtp_gst_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) if (size < csize) goto too_small; + GST_DEBUG_OBJECT (rtpgstdepay, "parsing caps %s", &data[offset]); + /* parse and store in cache */ outcaps = gst_caps_from_string ((gchar *) & data[offset]); store_cache (rtpgstdepay, CV, outcaps); |