Commit 42b8b3a3 authored by Wim Taymans's avatar Wim Taymans

gst/rtp/: Added RFC 2250 MPEG Video Depayloader.

Original commit message from CVS:
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpmpvdepay.c: (gst_rtp_mpv_depay_base_init),
(gst_rtp_mpv_depay_class_init), (gst_rtp_mpv_depay_init),
(gst_rtp_mpv_depay_setcaps), (gst_rtp_mpv_depay_process),
(gst_rtp_mpv_depay_set_property), (gst_rtp_mpv_depay_get_property),
(gst_rtp_mpv_depay_change_state), (gst_rtp_mpv_depay_plugin_init):
* gst/rtp/gstrtpmpvdepay.h:
Added RFC 2250 MPEG Video Depayloader.
* gst/rtp/gstrtpL16depay.h:
* gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_setcaps),
(gst_rtp_h263p_depay_process):
Fix Header file. Small cleanups.
* gst/rtp/gstrtpmp4gdepay.c: (gst_rtp_mp4g_depay_class_init),
(gst_rtp_mp4g_depay_init), (gst_rtp_mp4g_depay_finalize),
(gst_rtp_mp4g_depay_process), (gst_rtp_mp4g_depay_change_state):
* gst/rtp/gstrtpmp4vdepay.c: (gst_rtp_mp4v_depay_class_init),
(gst_rtp_mp4v_depay_init), (gst_rtp_mp4v_depay_finalize),
(gst_rtp_mp4v_depay_setcaps), (gst_rtp_mp4v_depay_process),
(gst_rtp_mp4v_depay_change_state):
Remove usused code. Remove Adapter from state Change. Added debug.
* gst/rtp/gstrtpmpadepay.c: (gst_rtp_mpa_depay_base_init),
(gst_rtp_mpa_depay_class_init), (gst_rtp_mpa_depay_init),
(gst_rtp_mpa_depay_setcaps), (gst_rtp_mpa_depay_process):
* gst/rtp/gstrtpmpadepay.h:
Subclass base depayloader.
Added debug.
Support static payload type assignment as well.
* gst/rtp/gstrtpmpapay.c:
Fix caps.
parent fd185066
2007-01-09 Wim Taymans <wim@fluendo.com>
* gst/rtp/Makefile.am:
* gst/rtp/gstrtp.c: (plugin_init):
* gst/rtp/gstrtpmpvdepay.c: (gst_rtp_mpv_depay_base_init),
(gst_rtp_mpv_depay_class_init), (gst_rtp_mpv_depay_init),
(gst_rtp_mpv_depay_setcaps), (gst_rtp_mpv_depay_process),
(gst_rtp_mpv_depay_set_property), (gst_rtp_mpv_depay_get_property),
(gst_rtp_mpv_depay_change_state), (gst_rtp_mpv_depay_plugin_init):
* gst/rtp/gstrtpmpvdepay.h:
Added RFC 2250 MPEG Video Depayloader.
* gst/rtp/gstrtpL16depay.h:
* gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_setcaps),
(gst_rtp_h263p_depay_process):
Fix Header file. Small cleanups.
* gst/rtp/gstrtpmp4gdepay.c: (gst_rtp_mp4g_depay_class_init),
(gst_rtp_mp4g_depay_init), (gst_rtp_mp4g_depay_finalize),
(gst_rtp_mp4g_depay_process), (gst_rtp_mp4g_depay_change_state):
* gst/rtp/gstrtpmp4vdepay.c: (gst_rtp_mp4v_depay_class_init),
(gst_rtp_mp4v_depay_init), (gst_rtp_mp4v_depay_finalize),
(gst_rtp_mp4v_depay_setcaps), (gst_rtp_mp4v_depay_process),
(gst_rtp_mp4v_depay_change_state):
Remove usused code. Remove Adapter from state Change. Added debug.
* gst/rtp/gstrtpmpadepay.c: (gst_rtp_mpa_depay_base_init),
(gst_rtp_mpa_depay_class_init), (gst_rtp_mpa_depay_init),
(gst_rtp_mpa_depay_setcaps), (gst_rtp_mpa_depay_process):
* gst/rtp/gstrtpmpadepay.h:
Subclass base depayloader.
Added debug.
Support static payload type assignment as well.
* gst/rtp/gstrtpmpapay.c:
Fix caps.
2007-01-08 Tim-Philipp Müller <tim at centricular dot net> 2007-01-08 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Vincent Torri <vtorri at univ-evry fr> Patch by: Vincent Torri <vtorri at univ-evry fr>
......
...@@ -7,6 +7,7 @@ libgstrtp_la_SOURCES = \ ...@@ -7,6 +7,7 @@ libgstrtp_la_SOURCES = \
gstrtpilbcpay.c \ gstrtpilbcpay.c \
gstrtpmpadepay.c \ gstrtpmpadepay.c \
gstrtpmpapay.c \ gstrtpmpapay.c \
gstrtpmpvdepay.c \
gstrtppcmadepay.c \ gstrtppcmadepay.c \
gstrtppcmudepay.c \ gstrtppcmudepay.c \
gstrtppcmupay.c \ gstrtppcmupay.c \
...@@ -62,6 +63,7 @@ noinst_HEADERS = \ ...@@ -62,6 +63,7 @@ noinst_HEADERS = \
gstrtpgsmpay.h \ gstrtpgsmpay.h \
gstrtpmpadepay.h \ gstrtpmpadepay.h \
gstrtpmpapay.h \ gstrtpmpapay.h \
gstrtpmpvdepay.h \
gstrtph263pdepay.h \ gstrtph263pdepay.h \
gstrtph263ppay.h \ gstrtph263ppay.h \
gstrtph263pay.h \ gstrtph263pay.h \
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "gstrtpamrdepay.h" #include "gstrtpamrdepay.h"
#include "gstrtpmpapay.h" #include "gstrtpmpapay.h"
#include "gstrtpmpadepay.h" #include "gstrtpmpadepay.h"
#include "gstrtpmpvdepay.h"
#include "gstrtph263pdepay.h" #include "gstrtph263pdepay.h"
#include "gstrtph263ppay.h" #include "gstrtph263ppay.h"
#include "gstrtph263pay.h" #include "gstrtph263pay.h"
...@@ -94,6 +95,9 @@ plugin_init (GstPlugin * plugin) ...@@ -94,6 +95,9 @@ plugin_init (GstPlugin * plugin)
if (!gst_rtp_mpa_pay_plugin_init (plugin)) if (!gst_rtp_mpa_pay_plugin_init (plugin))
return FALSE; return FALSE;
if (!gst_rtp_mpv_depay_plugin_init (plugin))
return FALSE;
if (!gst_rtp_h263p_pay_plugin_init (plugin)) if (!gst_rtp_h263p_pay_plugin_init (plugin))
return FALSE; return FALSE;
......
...@@ -24,13 +24,24 @@ ...@@ -24,13 +24,24 @@
#include "rtp-packet.h" #include "rtp-packet.h"
#include "gstrtp-common.h" #include "gstrtp-common.h"
#ifdef __cplusplus G_BEGIN_DECLS
extern "C"
{ /* Standard macros for defining types for this element. */
#endif /* __cplusplus */ #define GST_TYPE_RTP_L16_DEPAY \
(gst_rtp_L16depay_get_type())
#define GST_RTP_L16_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_L16_DEPAY,GstRtpL16Depay))
#define GST_RTP_L16_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_L16_DEPAY,GstRtpL16DepayClass))
#define GST_IS_RTP_L16_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_L16_DEPAY))
#define GST_IS_RTP_L16_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_L16_DEPAY))
/* Definition of structure storing data for this element. */
typedef struct _GstRtpL16Depay GstRtpL16Depay; typedef struct _GstRtpL16Depay GstRtpL16Depay;
typedef struct _GstRtpL16DepayClass GstRtpL16DepayClass;
/* Definition of structure storing data for this element. */
struct _GstRtpL16Depay struct _GstRtpL16Depay
{ {
GstElement element; GstElement element;
...@@ -45,29 +56,13 @@ struct _GstRtpL16Depay ...@@ -45,29 +56,13 @@ struct _GstRtpL16Depay
}; };
/* Standard definition defining a class for this element. */ /* Standard definition defining a class for this element. */
typedef struct _GstRtpL16DepayClass GstRtpL16DepayClass;
struct _GstRtpL16DepayClass struct _GstRtpL16DepayClass
{ {
GstElementClass parent_class; GstElementClass parent_class;
}; };
/* Standard macros for defining types for this element. */
#define GST_TYPE_RTP_L16_DEPAY \
(gst_rtp_L16depay_get_type())
#define GST_RTP_L16_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_L16_DEPAY,GstRtpL16Depay))
#define GST_RTP_L16_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_L16_DEPAY,GstRtpL16DepayClass))
#define GST_IS_RTP_L16_DEPAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_L16_DEPAY))
#define GST_IS_RTP_L16_DEPAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_L16_DEPAY))
gboolean gst_rtp_L16depay_plugin_init (GstPlugin * plugin); gboolean gst_rtp_L16depay_plugin_init (GstPlugin * plugin);
#ifdef __cplusplus G_END_DECLS
}
#endif /* __cplusplus */
#endif /* __GST_RTP_L16_DEPAY_H__ */ #endif /* __GST_RTP_L16_DEPAY_H__ */
...@@ -138,18 +138,14 @@ gst_rtp_h263p_depay_finalize (GObject * object) ...@@ -138,18 +138,14 @@ gst_rtp_h263p_depay_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
// only on the sink
gboolean gboolean
gst_rtp_h263p_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps) gst_rtp_h263p_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
{ {
GstStructure *structure = gst_caps_get_structure (caps, 0); GstStructure *structure = gst_caps_get_structure (caps, 0);
gint clock_rate = 90000; // default gint clock_rate = 90000; /* default */
if (gst_structure_has_field (structure, "clock-rate")) {
gst_structure_get_int (structure, "clock-rate", &clock_rate);
}
gst_structure_get_int (structure, "clock-rate", &clock_rate);
filter->clock_rate = clock_rate; filter->clock_rate = clock_rate;
return TRUE; return TRUE;
...@@ -163,18 +159,11 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) ...@@ -163,18 +159,11 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
GstRtpH263PDepay *rtph263pdepay; GstRtpH263PDepay *rtph263pdepay;
GstBuffer *outbuf; GstBuffer *outbuf;
/* GstRTPPayload pt; */
rtph263pdepay = GST_RTP_H263P_DEPAY (depayload); rtph263pdepay = GST_RTP_H263P_DEPAY (depayload);
if (!gst_rtp_buffer_validate (buf)) if (!gst_rtp_buffer_validate (buf))
goto bad_packet; goto bad_packet;
/*
if ((pt = gst_rtp_buffer_get_payload_type (buf)) != 0)
goto bad_payload;
*/
{ {
gint payload_len; gint payload_len;
guint8 *payload; guint8 *payload;
...@@ -249,29 +238,16 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) ...@@ -249,29 +238,16 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
memcpy (GST_BUFFER_DATA (outbuf), payload, payload_len); memcpy (GST_BUFFER_DATA (outbuf), payload, payload_len);
gst_adapter_push (rtph263pdepay->adapter, outbuf); gst_adapter_push (rtph263pdepay->adapter, outbuf);
} }
} }
return NULL; return NULL;
bad_packet: bad_packet:
{ {
GST_ELEMENT_WARNING (rtph263pdepay, STREAM, DECODE, GST_ELEMENT_WARNING (rtph263pdepay, STREAM, DECODE,
("Packet did not validate"), (NULL)); ("Packet did not validate"), (NULL));
return NULL; return NULL;
} }
/*
bad_payload:
{
GST_DEBUG ("Unexpected payload type %u", pt);
gst_buffer_unref (buf);
return GST_FLOW_ERROR;
}
*/
} }
static void static void
......
...@@ -46,7 +46,6 @@ enum ...@@ -46,7 +46,6 @@ enum
enum enum
{ {
ARG_0, ARG_0,
ARG_FREQUENCY
}; };
static GstStaticPadTemplate gst_rtp_mp4g_depay_src_template = static GstStaticPadTemplate gst_rtp_mp4g_depay_src_template =
...@@ -92,6 +91,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", ...@@ -92,6 +91,8 @@ GST_STATIC_PAD_TEMPLATE ("sink",
GST_BOILERPLATE (GstRtpMP4GDepay, gst_rtp_mp4g_depay, GstBaseRTPDepayload, GST_BOILERPLATE (GstRtpMP4GDepay, gst_rtp_mp4g_depay, GstBaseRTPDepayload,
GST_TYPE_BASE_RTP_DEPAYLOAD); GST_TYPE_BASE_RTP_DEPAYLOAD);
static void gst_rtp_mp4g_depay_finalize (GObject * object);
static gboolean gst_rtp_mp4g_depay_setcaps (GstBaseRTPDepayload * depayload, static gboolean gst_rtp_mp4g_depay_setcaps (GstBaseRTPDepayload * depayload,
GstCaps * caps); GstCaps * caps);
static GstBuffer *gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, static GstBuffer *gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload,
...@@ -132,14 +133,15 @@ gst_rtp_mp4g_depay_class_init (GstRtpMP4GDepayClass * klass) ...@@ -132,14 +133,15 @@ gst_rtp_mp4g_depay_class_init (GstRtpMP4GDepayClass * klass)
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
gstbasertpdepayload_class->process = gst_rtp_mp4g_depay_process; gobject_class->finalize = gst_rtp_mp4g_depay_finalize;
gstbasertpdepayload_class->set_caps = gst_rtp_mp4g_depay_setcaps;
gobject_class->set_property = gst_rtp_mp4g_depay_set_property; gobject_class->set_property = gst_rtp_mp4g_depay_set_property;
gobject_class->get_property = gst_rtp_mp4g_depay_get_property; gobject_class->get_property = gst_rtp_mp4g_depay_get_property;
gstelement_class->change_state = gst_rtp_mp4g_depay_change_state; gstelement_class->change_state = gst_rtp_mp4g_depay_change_state;
gstbasertpdepayload_class->process = gst_rtp_mp4g_depay_process;
gstbasertpdepayload_class->set_caps = gst_rtp_mp4g_depay_setcaps;
GST_DEBUG_CATEGORY_INIT (rtpmp4gdepay_debug, "rtpmp4gdepay", 0, GST_DEBUG_CATEGORY_INIT (rtpmp4gdepay_debug, "rtpmp4gdepay", 0,
"MP4-generic RTP Depayloader"); "MP4-generic RTP Depayloader");
} }
...@@ -148,6 +150,20 @@ static void ...@@ -148,6 +150,20 @@ static void
gst_rtp_mp4g_depay_init (GstRtpMP4GDepay * rtpmp4gdepay, gst_rtp_mp4g_depay_init (GstRtpMP4GDepay * rtpmp4gdepay,
GstRtpMP4GDepayClass * klass) GstRtpMP4GDepayClass * klass)
{ {
rtpmp4gdepay->adapter = gst_adapter_new ();
}
static void
gst_rtp_mp4g_depay_finalize (GObject * object)
{
GstRtpMP4GDepay *rtpmp4gdepay;
rtpmp4gdepay = GST_RTP_MP4G_DEPAY (object);
g_object_unref (rtpmp4gdepay->adapter);
rtpmp4gdepay->adapter = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
} }
static gboolean static gboolean
...@@ -299,14 +315,13 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) ...@@ -299,14 +315,13 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
return NULL; return NULL;
} }
} }
return NULL; return NULL;
/* ERRORS */
bad_packet: bad_packet:
{ {
GST_ELEMENT_WARNING (rtpmp4gdepay, STREAM, DECODE, GST_ELEMENT_WARNING (rtpmp4gdepay, STREAM, DECODE,
("Packet did not validate"), (NULL)); ("Packet did not validate."), (NULL));
return NULL; return NULL;
} }
} }
...@@ -351,9 +366,6 @@ gst_rtp_mp4g_depay_change_state (GstElement * element, ...@@ -351,9 +366,6 @@ gst_rtp_mp4g_depay_change_state (GstElement * element,
rtpmp4gdepay = GST_RTP_MP4G_DEPAY (element); rtpmp4gdepay = GST_RTP_MP4G_DEPAY (element);
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
rtpmp4gdepay->adapter = gst_adapter_new ();
break;
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
gst_adapter_clear (rtpmp4gdepay->adapter); gst_adapter_clear (rtpmp4gdepay->adapter);
break; break;
...@@ -364,10 +376,6 @@ gst_rtp_mp4g_depay_change_state (GstElement * element, ...@@ -364,10 +376,6 @@ gst_rtp_mp4g_depay_change_state (GstElement * element,
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
g_object_unref (rtpmp4gdepay->adapter);
rtpmp4gdepay->adapter = NULL;
break;
default: default:
break; break;
} }
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include <string.h> #include <string.h>
#include "gstrtpmp4vdepay.h" #include "gstrtpmp4vdepay.h"
GST_DEBUG_CATEGORY_STATIC (rtpmp4vdepay_debug);
#define GST_CAT_DEFAULT (rtpmp4vdepay_debug)
/* elementfactory information */ /* elementfactory information */
static const GstElementDetails gst_rtp_mp4vdepay_details = static const GstElementDetails gst_rtp_mp4vdepay_details =
GST_ELEMENT_DETAILS ("RTP packet depayloader", GST_ELEMENT_DETAILS ("RTP packet depayloader",
...@@ -72,6 +75,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", ...@@ -72,6 +75,8 @@ GST_STATIC_PAD_TEMPLATE ("sink",
GST_BOILERPLATE (GstRtpMP4VDepay, gst_rtp_mp4v_depay, GstBaseRTPDepayload, GST_BOILERPLATE (GstRtpMP4VDepay, gst_rtp_mp4v_depay, GstBaseRTPDepayload,
GST_TYPE_BASE_RTP_DEPAYLOAD); GST_TYPE_BASE_RTP_DEPAYLOAD);
static void gst_rtp_mp4v_depay_finalize (GObject * object);
static gboolean gst_rtp_mp4v_depay_setcaps (GstBaseRTPDepayload * depayload, static gboolean gst_rtp_mp4v_depay_setcaps (GstBaseRTPDepayload * depayload,
GstCaps * caps); GstCaps * caps);
static GstBuffer *gst_rtp_mp4v_depay_process (GstBaseRTPDepayload * depayload, static GstBuffer *gst_rtp_mp4v_depay_process (GstBaseRTPDepayload * depayload,
...@@ -108,22 +113,39 @@ gst_rtp_mp4v_depay_class_init (GstRtpMP4VDepayClass * klass) ...@@ -108,22 +113,39 @@ gst_rtp_mp4v_depay_class_init (GstRtpMP4VDepayClass * klass)
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass; gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
gstbasertpdepayload_class->process = gst_rtp_mp4v_depay_process; gobject_class->finalize = gst_rtp_mp4v_depay_finalize;
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;
gstelement_class->change_state = gst_rtp_mp4v_depay_change_state; gstelement_class->change_state = gst_rtp_mp4v_depay_change_state;
gstbasertpdepayload_class->process = gst_rtp_mp4v_depay_process;
gstbasertpdepayload_class->set_caps = gst_rtp_mp4v_depay_setcaps;
GST_DEBUG_CATEGORY_INIT (rtpmp4vdepay_debug, "rtpmp4vdepay", 0,
"MPEG4 video RTP Depayloader");
} }
static void static void
gst_rtp_mp4v_depay_init (GstRtpMP4VDepay * rtpmp4vdepay, gst_rtp_mp4v_depay_init (GstRtpMP4VDepay * rtpmp4vdepay,
GstRtpMP4VDepayClass * klass) GstRtpMP4VDepayClass * klass)
{ {
rtpmp4vdepay->adapter = gst_adapter_new ();
}
static void
gst_rtp_mp4v_depay_finalize (GObject * object)
{
GstRtpMP4VDepay *rtpmp4vdepay;
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (object);
g_object_unref (rtpmp4vdepay->adapter);
rtpmp4vdepay->adapter = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
} }
static gboolean static gboolean
...@@ -140,10 +162,7 @@ gst_rtp_mp4v_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) ...@@ -140,10 +162,7 @@ gst_rtp_mp4v_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
if (gst_structure_has_field (structure, "clock-rate")) { gst_structure_get_int (structure, "clock-rate", &clock_rate);
gst_structure_get_int (structure, "clock-rate", &clock_rate);
}
depayload->clock_rate = clock_rate; depayload->clock_rate = clock_rate;
srccaps = gst_caps_new_simple ("video/mpeg", srccaps = gst_caps_new_simple ("video/mpeg",
...@@ -230,7 +249,6 @@ bad_packet: ...@@ -230,7 +249,6 @@ bad_packet:
{ {
GST_ELEMENT_WARNING (rtpmp4vdepay, STREAM, DECODE, GST_ELEMENT_WARNING (rtpmp4vdepay, STREAM, DECODE,
("Packet did not validate"), (NULL)); ("Packet did not validate"), (NULL));
return NULL; return NULL;
} }
} }
...@@ -275,9 +293,6 @@ gst_rtp_mp4v_depay_change_state (GstElement * element, ...@@ -275,9 +293,6 @@ gst_rtp_mp4v_depay_change_state (GstElement * element,
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (element); rtpmp4vdepay = GST_RTP_MP4V_DEPAY (element);
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
rtpmp4vdepay->adapter = gst_adapter_new ();
break;
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
gst_adapter_clear (rtpmp4vdepay->adapter); gst_adapter_clear (rtpmp4vdepay->adapter);
break; break;
...@@ -288,10 +303,6 @@ gst_rtp_mp4v_depay_change_state (GstElement * element, ...@@ -288,10 +303,6 @@ gst_rtp_mp4v_depay_change_state (GstElement * element,
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
g_object_unref (rtpmp4vdepay->adapter);
rtpmp4vdepay->adapter = NULL;
break;
default: default:
break; break;
} }
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include <string.h> #include <string.h>
#include "gstrtpmpadepay.h" #include "gstrtpmpadepay.h"
GST_DEBUG_CATEGORY_STATIC (rtpmpadepay_debug);
#define GST_CAT_DEFAULT (rtpmpadepay_debug)
/* elementfactory information */ /* elementfactory information */
static const GstElementDetails gst_rtp_mpadepay_details = static const GstElementDetails gst_rtp_mpadepay_details =
GST_ELEMENT_DETAILS ("RTP packet depayloader", GST_ELEMENT_DETAILS ("RTP packet depayloader",
...@@ -43,7 +46,6 @@ enum ...@@ -43,7 +46,6 @@ enum
enum enum
{ {
ARG_0, ARG_0,
ARG_FREQUENCY
}; };
static GstStaticPadTemplate gst_rtp_mpa_depay_src_template = static GstStaticPadTemplate gst_rtp_mpa_depay_src_template =
...@@ -54,20 +56,25 @@ GST_STATIC_PAD_TEMPLATE ("src", ...@@ -54,20 +56,25 @@ GST_STATIC_PAD_TEMPLATE ("src",
); );
static GstStaticPadTemplate gst_rtp_mpa_depay_sink_template = static GstStaticPadTemplate gst_rtp_mpa_depay_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-rtp, " GST_STATIC_CAPS ("application/x-rtp, "
"media = (string) \"audio\", " "media = (string) \"audio\", "
"clock-rate = (int) 90000, " "encoding-name = (string) \"MPA\"") "clock-rate = (int) 90000, " "encoding-name = (string) \"MPA\";"
"application/x-rtp, "
"media = (string) \"audio\", "
"payload = (int) " GST_RTP_PAYLOAD_MPA_STRING ", "
"clock-rate = (int) 90000")
); );
GST_BOILERPLATE (GstRtpMPADepay, gst_rtp_mpa_depay, GstBaseRTPDepayload,
GST_TYPE_BASE_RTP_DEPAYLOAD);
static void gst_rtp_mpa_depay_class_init (GstRtpMPADepayClass * klass); static gboolean gst_rtp_mpa_depay_setcaps (GstBaseRTPDepayload * depayload,
static void gst_rtp_mpa_depay_base_init (GstRtpMPADepayClass * klass); GstCaps * caps);
static void gst_rtp_mpa_depay_init (GstRtpMPADepay * rtpmpadepay); static GstBuffer *gst_rtp_mpa_depay_process (GstBaseRTPDepayload * depayload,
GstBuffer * buf);
static GstFlowReturn gst_rtp_mpa_depay_chain (GstPad * pad, GstBuffer * buffer);
static void gst_rtp_mpa_depay_set_property (GObject * object, guint prop_id, static void gst_rtp_mpa_depay_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
...@@ -77,35 +84,8 @@ static void gst_rtp_mpa_depay_get_property (GObject * object, guint prop_id, ...@@ -77,35 +84,8 @@ static void gst_rtp_mpa_depay_get_property (GObject * object, guint prop_id,
static GstStateChangeReturn gst_rtp_mpa_depay_change_state (GstElement * static GstStateChangeReturn gst_rtp_mpa_depay_change_state (GstElement *
element, GstStateChange transition); element, GstStateChange transition);
static GstElementClass *parent_class = NULL;
static GType
gst_rtp_mpa_depay_get_type (void)
{
static GType rtpmpadepay_type = 0;
if (!rtpmpadepay_type) {
static const GTypeInfo rtpmpadepay_info = {
sizeof (GstRtpMPADepayClass),
(GBaseInitFunc) gst_rtp_mpa_depay_base_init,