Commit 0c241465 authored by Philippe Khalaf's avatar Philippe Khalaf

gst-plugins-good/gst/rtp/: Making these depayloaders (H263+ and mpeg4 video) inherit from

Original commit message from CVS:
2005-12-22  Philippe Khalaf  <burger@speedy.org>

* gst-plugins-good/gst/rtp/gstrtph263pdepay.h:
* gst-plugins-good/gst/rtp/gstrtph263pdepay.c:
* gst-plugins-good/gst/rtp/gstrtpmp4vdepay.h:
* gst-plugins-good/gst/rtp/gstrtpmp4vdepay.c:
Making these depayloaders (H263+ and mpeg4 video) inherit from
RtpBaseDepayloaderClass. Fixes bugs #323922 and #323908.
parent dccf2f0e
2005-12-22 Philippe Khalaf <burger@speedy.org>
* gst-plugins-good/gst/rtp/gstrtph263pdepay.h:
* gst-plugins-good/gst/rtp/gstrtph263pdepay.c:
* gst-plugins-good/gst/rtp/gstrtpmp4vdepay.h:
* gst-plugins-good/gst/rtp/gstrtpmp4vdepay.c:
Making these depayloaders (H263+ and mpeg4 video) inherit from
RtpBaseDepayloaderClass. Fixes bugs #323922 and #323908.
2005-12-21 Jan Schmidt <thaytan@mad.scientist.com> 2005-12-21 Jan Schmidt <thaytan@mad.scientist.com>
* docs/plugins/gst-plugins-good-plugins.args: * docs/plugins/gst-plugins-good-plugins.args:
......
...@@ -58,15 +58,10 @@ GST_STATIC_PAD_TEMPLATE ("sink", ...@@ -58,15 +58,10 @@ GST_STATIC_PAD_TEMPLATE ("sink",
"clock-rate = (int) 90000, " "encoding-name = (string) \"H263-1998\"") "clock-rate = (int) 90000, " "encoding-name = (string) \"H263-1998\"")
); );
GST_BOILERPLATE (GstRtpH263PDepay, gst_rtp_h263p_depay, GstBaseRTPDepayload,
GST_TYPE_BASE_RTP_DEPAYLOAD);
static void gst_rtp_h263p_depay_class_init (GstRtpH263PDepayClass * klass);
static void gst_rtp_h263p_depay_base_init (GstRtpH263PDepayClass * klass);
static void gst_rtp_h263p_depay_init (GstRtpH263PDepay * rtph263pdepay);
static void gst_rtp_h263p_depay_finalize (GObject * object); static void gst_rtp_h263p_depay_finalize (GObject * object);
static GstFlowReturn gst_rtp_h263p_depay_chain (GstPad * pad,
GstBuffer * buffer);
static void gst_rtp_h263p_depay_set_property (GObject * object, guint prop_id, static void gst_rtp_h263p_depay_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
static void gst_rtp_h263p_depay_get_property (GObject * object, guint prop_id, static void gst_rtp_h263p_depay_get_property (GObject * object, guint prop_id,
...@@ -75,35 +70,13 @@ static void gst_rtp_h263p_depay_get_property (GObject * object, guint prop_id, ...@@ -75,35 +70,13 @@ static void gst_rtp_h263p_depay_get_property (GObject * object, guint prop_id,
static GstStateChangeReturn gst_rtp_h263p_depay_change_state (GstElement * static GstStateChangeReturn gst_rtp_h263p_depay_change_state (GstElement *
element, GstStateChange transition); element, GstStateChange transition);
static GstElementClass *parent_class = NULL; static GstBuffer *gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload,
GstBuffer * buf);
static GType gboolean gst_rtp_h263p_depay_setcaps (GstBaseRTPDepayload * filter,
gst_rtp_h263p_depay_get_type (void) GstCaps * caps);
{
static GType rtph263pdepay_type = 0;
if (!rtph263pdepay_type) {
static const GTypeInfo rtph263pdepay_info = {
sizeof (GstRtpH263PDepayClass),
(GBaseInitFunc) gst_rtp_h263p_depay_base_init,
NULL,
(GClassInitFunc) gst_rtp_h263p_depay_class_init,
NULL,
NULL,
sizeof (GstRtpH263PDepay),
0,
(GInstanceInitFunc) gst_rtp_h263p_depay_init,
};
rtph263pdepay_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpH263PDepay",
&rtph263pdepay_info, 0);
}
return rtph263pdepay_type;
}
static void static void
gst_rtp_h263p_depay_base_init (GstRtpH263PDepayClass * klass) gst_rtp_h263p_depay_base_init (gpointer klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
...@@ -112,6 +85,7 @@ gst_rtp_h263p_depay_base_init (GstRtpH263PDepayClass * klass) ...@@ -112,6 +85,7 @@ gst_rtp_h263p_depay_base_init (GstRtpH263PDepayClass * klass)
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_rtp_h263p_depay_sink_template)); gst_static_pad_template_get (&gst_rtp_h263p_depay_sink_template));
gst_element_class_set_details (element_class, &gst_rtp_h263pdepay_details); gst_element_class_set_details (element_class, &gst_rtp_h263pdepay_details);
} }
...@@ -120,11 +94,16 @@ gst_rtp_h263p_depay_class_init (GstRtpH263PDepayClass * klass) ...@@ -120,11 +94,16 @@ gst_rtp_h263p_depay_class_init (GstRtpH263PDepayClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
parent_class = g_type_class_ref (GST_TYPE_BASE_RTP_DEPAYLOAD);
parent_class = g_type_class_ref (GST_TYPE_ELEMENT); gstbasertpdepayload_class->process = gst_rtp_h263p_depay_process;
gstbasertpdepayload_class->set_caps = gst_rtp_h263p_depay_setcaps;
gobject_class->finalize = gst_rtp_h263p_depay_finalize; gobject_class->finalize = gst_rtp_h263p_depay_finalize;
...@@ -135,20 +114,9 @@ gst_rtp_h263p_depay_class_init (GstRtpH263PDepayClass * klass) ...@@ -135,20 +114,9 @@ gst_rtp_h263p_depay_class_init (GstRtpH263PDepayClass * klass)
} }
static void static void
gst_rtp_h263p_depay_init (GstRtpH263PDepay * rtph263pdepay) gst_rtp_h263p_depay_init (GstRtpH263PDepay * rtph263pdepay,
GstRtpH263PDepayClass * klass)
{ {
rtph263pdepay->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gst_rtp_h263p_depay_src_template), "src");
gst_element_add_pad (GST_ELEMENT (rtph263pdepay), rtph263pdepay->srcpad);
rtph263pdepay->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gst_rtp_h263p_depay_sink_template), "sink");
gst_pad_set_chain_function (rtph263pdepay->sinkpad,
gst_rtp_h263p_depay_chain);
gst_element_add_pad (GST_ELEMENT (rtph263pdepay), rtph263pdepay->sinkpad);
rtph263pdepay->adapter = gst_adapter_new (); rtph263pdepay->adapter = gst_adapter_new ();
} }
...@@ -165,16 +133,34 @@ gst_rtp_h263p_depay_finalize (GObject * object) ...@@ -165,16 +133,34 @@ gst_rtp_h263p_depay_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
static GstFlowReturn // only on the sink
gst_rtp_h263p_depay_chain (GstPad * pad, GstBuffer * buf) gboolean
gst_rtp_h263p_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
{
GstStructure *structure = gst_caps_get_structure (caps, 0);
gint clock_rate = 90000; // default
if (gst_structure_has_field (structure, "clock-rate")) {
gst_structure_get_int (structure, "clock-rate", &clock_rate);
}
filter->clock_rate = clock_rate;
return TRUE;
}
static GstBuffer *
gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{ {
GstRtpH263PDepay *rtph263pdepay; GstRtpH263PDepay *rtph263pdepay;
GstBuffer *outbuf; GstBuffer *outbuf;
GstFlowReturn ret;
/* GstRTPPayload pt; */ /* GstRTPPayload pt; */
rtph263pdepay = GST_RTP_H263P_DEPAY (GST_OBJECT_PARENT (pad)); rtph263pdepay = GST_RTP_H263P_DEPAY (depayload);
if (!gst_rtp_buffer_validate (buf)) if (!gst_rtp_buffer_validate (buf))
goto bad_packet; goto bad_packet;
...@@ -223,12 +209,16 @@ gst_rtp_h263p_depay_chain (GstPad * pad, GstBuffer * buf) ...@@ -223,12 +209,16 @@ gst_rtp_h263p_depay_chain (GstPad * pad, GstBuffer * buf)
if (M) { if (M) {
/* frame is completed: append to previous, push it out */ /* frame is completed: append to previous, push it out */
guint len;
guint avail; guint avail;
guint8 *data; guint8 *data;
avail = gst_adapter_available (rtph263pdepay->adapter); avail = gst_adapter_available (rtph263pdepay->adapter);
outbuf = gst_buffer_new_and_alloc (avail + payload_len); len = avail + payload_len;
outbuf = gst_buffer_new_and_alloc (len + (len % 4) + 4);
memset (GST_BUFFER_DATA (outbuf) + len, 0, (len % 4) + 4);
GST_BUFFER_SIZE (outbuf) = len;
/* prepend previous data */ /* prepend previous data */
if (avail > 0) { if (avail > 0) {
...@@ -238,11 +228,14 @@ gst_rtp_h263p_depay_chain (GstPad * pad, GstBuffer * buf) ...@@ -238,11 +228,14 @@ gst_rtp_h263p_depay_chain (GstPad * pad, GstBuffer * buf)
} }
memcpy (GST_BUFFER_DATA (outbuf) + avail, payload, payload_len); memcpy (GST_BUFFER_DATA (outbuf) + avail, payload, payload_len);
GST_BUFFER_TIMESTAMP (outbuf) = timestamp * GST_SECOND / 90000; GST_BUFFER_TIMESTAMP (outbuf) =
timestamp * GST_SECOND / depayload->clock_rate;
gst_buffer_set_caps (outbuf, gst_buffer_set_caps (outbuf,
(GstCaps *) gst_pad_get_pad_template_caps (rtph263pdepay->srcpad)); (GstCaps *) gst_pad_get_pad_template_caps (depayload->srcpad));
return outbuf;
ret = gst_pad_push (rtph263pdepay->srcpad, outbuf);
} else { } else {
/* frame not completed: store in adapter */ /* frame not completed: store in adapter */
outbuf = gst_buffer_new_and_alloc (payload_len); outbuf = gst_buffer_new_and_alloc (payload_len);
...@@ -251,19 +244,18 @@ gst_rtp_h263p_depay_chain (GstPad * pad, GstBuffer * buf) ...@@ -251,19 +244,18 @@ gst_rtp_h263p_depay_chain (GstPad * pad, GstBuffer * buf)
gst_adapter_push (rtph263pdepay->adapter, outbuf); gst_adapter_push (rtph263pdepay->adapter, outbuf);
ret = GST_FLOW_OK;
} }
gst_buffer_unref (buf);
} }
return ret; return NULL;
bad_packet: bad_packet:
{ {
GST_DEBUG ("Packet does not validate"); GST_ELEMENT_WARNING (rtph263pdepay, STREAM, DECODE,
gst_buffer_unref (buf); ("Packet did not validate"), (NULL));
return GST_FLOW_ERROR;
return NULL;
} }
/* /*
bad_payload: bad_payload:
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/base/gstadapter.h> #include <gst/base/gstadapter.h>
#include <gst/rtp/gstbasertpdepayload.h>
G_BEGIN_DECLS G_BEGIN_DECLS
...@@ -41,10 +42,7 @@ typedef struct _GstRtpH263PDepayClass GstRtpH263PDepayClass; ...@@ -41,10 +42,7 @@ typedef struct _GstRtpH263PDepayClass GstRtpH263PDepayClass;
struct _GstRtpH263PDepay struct _GstRtpH263PDepay
{ {
GstElement element; GstBaseRTPDepayload depayload;
GstPad *sinkpad;
GstPad *srcpad;
GstAdapter *adapter; GstAdapter *adapter;
...@@ -53,7 +51,7 @@ struct _GstRtpH263PDepay ...@@ -53,7 +51,7 @@ struct _GstRtpH263PDepay
struct _GstRtpH263PDepayClass struct _GstRtpH263PDepayClass
{ {
GstElementClass parent_class; GstBaseRTPDepayloadClass parent_class;
}; };
gboolean gst_rtp_h263p_depay_plugin_init (GstPlugin * plugin); gboolean gst_rtp_h263p_depay_plugin_init (GstPlugin * plugin);
......
...@@ -65,14 +65,13 @@ GST_STATIC_PAD_TEMPLATE ("sink", ...@@ -65,14 +65,13 @@ GST_STATIC_PAD_TEMPLATE ("sink",
) )
); );
GST_BOILERPLATE (GstRtpMP4VDepay, gst_rtp_mp4v_depay, GstBaseRTPDepayload,
GST_TYPE_BASE_RTP_DEPAYLOAD);
static void gst_rtp_mp4v_depay_class_init (GstRtpMP4VDepayClass * klass); static gboolean gst_rtp_mp4v_depay_setcaps (GstBaseRTPDepayload * depayload,
static void gst_rtp_mp4v_depay_base_init (GstRtpMP4VDepayClass * klass); GstCaps * caps);
static void gst_rtp_mp4v_depay_init (GstRtpMP4VDepay * rtpmp4vdepay); static GstBuffer *gst_rtp_mp4v_depay_process (GstBaseRTPDepayload * depayload,
GstBuffer * buf);
static gboolean gst_rtp_mp4v_depay_setcaps (GstPad * pad, GstCaps * caps);
static GstFlowReturn gst_rtp_mp4v_depay_chain (GstPad * pad,
GstBuffer * buffer);
static void gst_rtp_mp4v_depay_set_property (GObject * object, guint prop_id, static void gst_rtp_mp4v_depay_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
...@@ -82,35 +81,9 @@ static void gst_rtp_mp4v_depay_get_property (GObject * object, guint prop_id, ...@@ -82,35 +81,9 @@ static void gst_rtp_mp4v_depay_get_property (GObject * object, guint prop_id,
static GstStateChangeReturn gst_rtp_mp4v_depay_change_state (GstElement * static GstStateChangeReturn gst_rtp_mp4v_depay_change_state (GstElement *
element, GstStateChange transition); element, GstStateChange transition);
static GstElementClass *parent_class = NULL;
static GType
gst_rtp_mp4v_depay_get_type (void)
{
static GType rtpmp4vdepay_type = 0;
if (!rtpmp4vdepay_type) {
static const GTypeInfo rtpmp4vdepay_info = {
sizeof (GstRtpMP4VDepayClass),
(GBaseInitFunc) gst_rtp_mp4v_depay_base_init,
NULL,
(GClassInitFunc) gst_rtp_mp4v_depay_class_init,
NULL,
NULL,
sizeof (GstRtpMP4VDepay),
0,
(GInstanceInitFunc) gst_rtp_mp4v_depay_init,
};
rtpmp4vdepay_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpMP4VDepay",
&rtpmp4vdepay_info, 0);
}
return rtpmp4vdepay_type;
}
static void static void
gst_rtp_mp4v_depay_base_init (GstRtpMP4VDepayClass * klass) gst_rtp_mp4v_depay_base_init (gpointer klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
...@@ -127,11 +100,17 @@ gst_rtp_mp4v_depay_class_init (GstRtpMP4VDepayClass * klass) ...@@ -127,11 +100,17 @@ gst_rtp_mp4v_depay_class_init (GstRtpMP4VDepayClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT); gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
parent_class = g_type_class_ref (GST_TYPE_BASE_RTP_DEPAYLOAD);
gstbasertpdepayload_class->process = gst_rtp_mp4v_depay_process;
gstbasertpdepayload_class->set_caps = gst_rtp_mp4v_depay_setcaps;
gobject_class->set_property = gst_rtp_mp4v_depay_set_property; gobject_class->set_property = gst_rtp_mp4v_depay_set_property;
gobject_class->get_property = gst_rtp_mp4v_depay_get_property; gobject_class->get_property = gst_rtp_mp4v_depay_get_property;
...@@ -140,42 +119,35 @@ gst_rtp_mp4v_depay_class_init (GstRtpMP4VDepayClass * klass) ...@@ -140,42 +119,35 @@ gst_rtp_mp4v_depay_class_init (GstRtpMP4VDepayClass * klass)
} }
static void static void
gst_rtp_mp4v_depay_init (GstRtpMP4VDepay * rtpmp4vdepay) gst_rtp_mp4v_depay_init (GstRtpMP4VDepay * rtpmp4vdepay,
GstRtpMP4VDepayClass * klass)
{ {
rtpmp4vdepay->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gst_rtp_mp4v_depay_src_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpmp4vdepay), rtpmp4vdepay->srcpad);
rtpmp4vdepay->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gst_rtp_mp4v_depay_sink_template), "sink");
gst_pad_set_setcaps_function (rtpmp4vdepay->sinkpad,
gst_rtp_mp4v_depay_setcaps);
gst_pad_set_chain_function (rtpmp4vdepay->sinkpad, gst_rtp_mp4v_depay_chain);
gst_element_add_pad (GST_ELEMENT (rtpmp4vdepay), rtpmp4vdepay->sinkpad);
} }
static gboolean static gboolean
gst_rtp_mp4v_depay_setcaps (GstPad * pad, GstCaps * caps) gst_rtp_mp4v_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
{ {
GstStructure *structure; GstStructure *structure;
GstRtpMP4VDepay *rtpmp4vdepay; GstRtpMP4VDepay *rtpmp4vdepay;
GstCaps *srccaps; GstCaps *srccaps;
const gchar *str; const gchar *str;
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (GST_OBJECT_PARENT (pad)); rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload);
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
if (!gst_structure_get_int (structure, "clock-rate", &rtpmp4vdepay->rate)) gint clock_rate = 90000; // default
rtpmp4vdepay->rate = 90000;
if (gst_structure_has_field (structure, "clock-rate")) {
gst_structure_get_int (structure, "clock-rate", &clock_rate);
}
depayload->clock_rate = clock_rate;
srccaps = gst_caps_new_simple ("video/mpeg", srccaps = gst_caps_new_simple ("video/mpeg",
"mpegversion", G_TYPE_INT, 4, "mpegversion", G_TYPE_INT, 4,
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL); "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
gst_pad_set_caps (rtpmp4vdepay->srcpad, srccaps);
gst_caps_unref (srccaps);
if ((str = gst_structure_get_string (structure, "config"))) { if ((str = gst_structure_get_string (structure, "config"))) {
GValue v = { 0 }; GValue v = { 0 };
...@@ -188,9 +160,11 @@ gst_rtp_mp4v_depay_setcaps (GstPad * pad, GstCaps * caps) ...@@ -188,9 +160,11 @@ gst_rtp_mp4v_depay_setcaps (GstPad * pad, GstCaps * caps)
gst_buffer_ref (buffer); gst_buffer_ref (buffer);
g_value_unset (&v); g_value_unset (&v);
gst_buffer_set_caps (buffer, GST_PAD_CAPS (rtpmp4vdepay->srcpad)); gst_buffer_set_caps (buffer, srccaps);
gst_caps_unref (srccaps);
gst_pad_push (rtpmp4vdepay->srcpad, buffer); gst_pad_push (depayload->srcpad, buffer);
} else { } else {
g_warning ("cannot convert config to buffer"); g_warning ("cannot convert config to buffer");
} }
...@@ -199,14 +173,13 @@ gst_rtp_mp4v_depay_setcaps (GstPad * pad, GstCaps * caps) ...@@ -199,14 +173,13 @@ gst_rtp_mp4v_depay_setcaps (GstPad * pad, GstCaps * caps)
return TRUE; return TRUE;
} }
static GstFlowReturn static GstBuffer *
gst_rtp_mp4v_depay_chain (GstPad * pad, GstBuffer * buf) gst_rtp_mp4v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{ {
GstRtpMP4VDepay *rtpmp4vdepay; GstRtpMP4VDepay *rtpmp4vdepay;
GstBuffer *outbuf; GstBuffer *outbuf;
GstFlowReturn ret;
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (gst_pad_get_parent (pad)); rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload);
if (!gst_rtp_buffer_validate (buf)) if (!gst_rtp_buffer_validate (buf))
goto bad_packet; goto bad_packet;
...@@ -233,32 +206,31 @@ gst_rtp_mp4v_depay_chain (GstPad * pad, GstBuffer * buf) ...@@ -233,32 +206,31 @@ gst_rtp_mp4v_depay_chain (GstPad * pad, GstBuffer * buf)
avail = gst_adapter_available (rtpmp4vdepay->adapter); avail = gst_adapter_available (rtpmp4vdepay->adapter);
outbuf = gst_buffer_new_and_alloc (avail); outbuf = gst_buffer_new_and_alloc (avail);
GST_BUFFER_MALLOCDATA (outbuf) = GST_BUFFER_MALLOCDATA (outbuf) =
gst_adapter_take (rtpmp4vdepay->adapter, avail); gst_adapter_take (rtpmp4vdepay->adapter, avail);
GST_BUFFER_DATA (outbuf) = GST_BUFFER_MALLOCDATA (outbuf); GST_BUFFER_DATA (outbuf) = GST_BUFFER_MALLOCDATA (outbuf);
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (rtpmp4vdepay->srcpad)); gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (outbuf) =
timestamp * GST_SECOND / rtpmp4vdepay->rate; timestamp * GST_SECOND / depayload->clock_rate;
GST_DEBUG ("gst_rtp_mp4v_depay_chain: pushing buffer of size %d", GST_DEBUG ("gst_rtp_mp4v_depay_chain: pushing buffer of size %d",
GST_BUFFER_SIZE (outbuf)); GST_BUFFER_SIZE (outbuf));
ret = gst_pad_push (rtpmp4vdepay->srcpad, outbuf); return outbuf;
} else { } else {
ret = GST_FLOW_OK; return NULL;
} }
gst_buffer_unref (buf);
} }
gst_object_unref (rtpmp4vdepay);
return ret; return NULL;
bad_packet: bad_packet:
{ {
GST_DEBUG ("Packet did not validate"); GST_ELEMENT_WARNING (rtpmp4vdepay, STREAM, DECODE,
gst_buffer_unref (buf); ("Packet did not validate"), (NULL));
gst_object_unref (rtpmp4vdepay);
return GST_FLOW_ERROR; return NULL;
} }
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/base/gstadapter.h> #include <gst/base/gstadapter.h>
#include <gst/rtp/gstbasertpdepayload.h>
G_BEGIN_DECLS G_BEGIN_DECLS
...@@ -41,19 +42,14 @@ typedef struct _GstRtpMP4VDepayClass GstRtpMP4VDepayClass; ...@@ -41,19 +42,14 @@ typedef struct _GstRtpMP4VDepayClass GstRtpMP4VDepayClass;
struct _GstRtpMP4VDepay struct _GstRtpMP4VDepay
{ {
GstElement element; GstBaseRTPDepayload depayload;
GstPad *sinkpad;
GstPad *srcpad;
GstAdapter *adapter; GstAdapter *adapter;
gint rate;