mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
gstdepay: use the capsversion
Take the caps from the input caps and store it in the slot given by capsversion.
This commit is contained in:
parent
936c3819b5
commit
d78ff07f7d
1 changed files with 26 additions and 10 deletions
|
@ -21,9 +21,9 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gst/rtp/gstrtpbuffer.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "gstrtpgstdepay.h"
|
#include "gstrtpgstdepay.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (rtpgstdepay_debug);
|
GST_DEBUG_CATEGORY_STATIC (rtpgstdepay_debug);
|
||||||
|
@ -134,11 +134,9 @@ gst_rtp_gst_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstRtpGSTDepay *rtpgstdepay;
|
GstRtpGSTDepay *rtpgstdepay;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstCaps *outcaps;
|
|
||||||
gint clock_rate;
|
gint clock_rate;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
const gchar *capsenc;
|
const gchar *capsenc;
|
||||||
gchar *capsstr;
|
|
||||||
|
|
||||||
rtpgstdepay = GST_RTP_GST_DEPAY (depayload);
|
rtpgstdepay = GST_RTP_GST_DEPAY (depayload);
|
||||||
|
|
||||||
|
@ -150,21 +148,37 @@ gst_rtp_gst_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
|
||||||
|
|
||||||
capsenc = gst_structure_get_string (structure, "caps");
|
capsenc = gst_structure_get_string (structure, "caps");
|
||||||
if (capsenc) {
|
if (capsenc) {
|
||||||
|
GstCaps *outcaps;
|
||||||
gsize out_len;
|
gsize out_len;
|
||||||
|
gchar *capsstr;
|
||||||
|
const gchar *capsver;
|
||||||
|
guint CV;
|
||||||
|
|
||||||
|
/* decode caps */
|
||||||
capsstr = (gchar *) g_base64_decode (capsenc, &out_len);
|
capsstr = (gchar *) g_base64_decode (capsenc, &out_len);
|
||||||
outcaps = gst_caps_from_string (capsstr);
|
outcaps = gst_caps_from_string (capsstr);
|
||||||
g_free (capsstr);
|
g_free (capsstr);
|
||||||
|
|
||||||
/* we have the SDP caps as output caps */
|
/* parse version */
|
||||||
rtpgstdepay->current_CV = 0;
|
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);
|
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 {
|
} 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;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -252,6 +266,8 @@ gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
||||||
goto too_small;
|
goto too_small;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (rtpgstdepay, "parsing caps %s", &map.data[offset]);
|
||||||
|
|
||||||
/* parse and store in cache */
|
/* parse and store in cache */
|
||||||
outcaps = gst_caps_from_string ((gchar *) & map.data[offset]);
|
outcaps = gst_caps_from_string ((gchar *) & map.data[offset]);
|
||||||
store_cache (rtpgstdepay, CV, outcaps);
|
store_cache (rtpgstdepay, CV, outcaps);
|
||||||
|
|
Loading…
Reference in a new issue