mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
gst/rtp/gstrtpmp2tdepay.*: Add support to strip off proprietary headers. Fixes #350278.
Original commit message from CVS: Patch by: Thijs Vermeir <thijsvermeir at gmail dot com> * gst/rtp/gstrtpmp2tdepay.c: (gst_rtp_mp2t_depay_class_init), (gst_rtp_mp2t_depay_init), (gst_rtp_mp2t_depay_process), (gst_rtp_mp2t_depay_set_property), (gst_rtp_mp2t_depay_get_property): * gst/rtp/gstrtpmp2tdepay.h: Add support to strip off proprietary headers. Fixes #350278.
This commit is contained in:
parent
56004b0df6
commit
fe901ccec7
3 changed files with 51 additions and 11 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2007-03-02 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
Patch by: Thijs Vermeir <thijsvermeir at gmail dot com>
|
||||
|
||||
* gst/rtp/gstrtpmp2tdepay.c: (gst_rtp_mp2t_depay_class_init),
|
||||
(gst_rtp_mp2t_depay_init), (gst_rtp_mp2t_depay_process),
|
||||
(gst_rtp_mp2t_depay_set_property),
|
||||
(gst_rtp_mp2t_depay_get_property):
|
||||
* gst/rtp/gstrtpmp2tdepay.h:
|
||||
Add support to strip off proprietary headers. Fixes #350278.
|
||||
|
||||
2007-03-02 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* ext/hal/hal.c:
|
||||
|
|
|
@ -31,7 +31,8 @@ static const GstElementDetails gst_rtp_mp2tdepay_details =
|
|||
GST_ELEMENT_DETAILS ("RTP packet depayloader",
|
||||
"Codec/Depayloader/Network",
|
||||
"Extracts MPEG2 TS from RTP packets (RFC 2250)",
|
||||
"Wim Taymans <wim@fluendo.com>");
|
||||
"Wim Taymans <wim@fluendo.com>\n"
|
||||
"Thijs Vermeir <thijs.vermeir@barco.com>");
|
||||
|
||||
/* RtpMP2TDepay signals and args */
|
||||
enum
|
||||
|
@ -40,10 +41,12 @@ enum
|
|||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
#define DEFAULT_SKIP_FIRST_BYTES 0
|
||||
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_FREQUENCY
|
||||
PROP_0,
|
||||
PROP_SKIP_FIRST_BYTES
|
||||
};
|
||||
|
||||
static GstStaticPadTemplate gst_rtp_mp2t_depay_src_template =
|
||||
|
@ -123,13 +126,24 @@ gst_rtp_mp2t_depay_class_init (GstRtpMP2TDepayClass * klass)
|
|||
gobject_class->set_property = gst_rtp_mp2t_depay_set_property;
|
||||
gobject_class->get_property = gst_rtp_mp2t_depay_get_property;
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_SKIP_FIRST_BYTES,
|
||||
g_param_spec_uint ("skip-first-bytes",
|
||||
"Skip first bytes",
|
||||
"The amount of bytes that need to be skipped at the beginning of the payload",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
|
||||
gstelement_class->change_state = gst_rtp_mp2t_depay_change_state;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtp_mp2t_depay_init (GstRtpMP2TDepay * rtpmp2tdepay,
|
||||
gst_rtp_mp2t_depay_init (GstRtpMP2TDepay * depayload,
|
||||
GstRtpMP2TDepayClass * klass)
|
||||
{
|
||||
GstRtpMP2TDepay *rtpmp2tdepay;
|
||||
|
||||
rtpmp2tdepay = GST_RTP_MP2T_DEPAY (depayload);
|
||||
|
||||
rtpmp2tdepay->skip_first_bytes = DEFAULT_SKIP_FIRST_BYTES;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -159,21 +173,22 @@ gst_rtp_mp2t_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
GstRtpMP2TDepay *rtpmp2tdepay;
|
||||
GstBuffer *outbuf;
|
||||
gint payload_len;
|
||||
guint8 *payload;
|
||||
guint32 timestamp;
|
||||
|
||||
rtpmp2tdepay = GST_RTP_MP2T_DEPAY (depayload);
|
||||
|
||||
if (!gst_rtp_buffer_validate (buf))
|
||||
if (G_UNLIKELY (!gst_rtp_buffer_validate (buf)))
|
||||
goto bad_packet;
|
||||
|
||||
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||
payload = gst_rtp_buffer_get_payload (buf);
|
||||
|
||||
if (G_UNLIKELY (payload_len <= rtpmp2tdepay->skip_first_bytes))
|
||||
goto empty_packet;
|
||||
|
||||
timestamp = gst_rtp_buffer_get_timestamp (buf);
|
||||
|
||||
outbuf = gst_buffer_new_and_alloc (payload_len);
|
||||
memcpy (GST_BUFFER_DATA (outbuf), payload, payload_len);
|
||||
outbuf =
|
||||
gst_rtp_buffer_get_payload_subbuffer (rtpmp2tdepay->skip_first_bytes, -1);
|
||||
|
||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
|
||||
GST_BUFFER_TIMESTAMP (outbuf) =
|
||||
|
@ -184,10 +199,17 @@ gst_rtp_mp2t_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
return outbuf;
|
||||
|
||||
/* ERRORS */
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmp2tdepay, STREAM, DECODE,
|
||||
("Packet did not validate"), (NULL));
|
||||
(NULL), ("Packet did not validate"));
|
||||
return NULL;
|
||||
}
|
||||
empty_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmp2tdepay, STREAM, DECODE,
|
||||
(NULL), ("Packet was empty"));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -201,6 +223,9 @@ gst_rtp_mp2t_depay_set_property (GObject * object, guint prop_id,
|
|||
rtpmp2tdepay = GST_RTP_MP2T_DEPAY (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_SKIP_FIRST_BYTES:
|
||||
rtpmp2tdepay->skip_first_bytes = g_value_get_uint (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -216,6 +241,9 @@ gst_rtp_mp2t_depay_get_property (GObject * object, guint prop_id,
|
|||
rtpmp2tdepay = GST_RTP_MP2T_DEPAY (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_SKIP_FIRST_BYTES:
|
||||
g_value_set_uint (value, rtpmp2tdepay->skip_first_bytes);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
|
@ -36,13 +36,14 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MP2T_DEPAY))
|
||||
#define GST_IS_RTP_MP2T_DEPAY_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MP2T_DEPAY))
|
||||
|
||||
typedef struct _GstRtpMP2TDepay GstRtpMP2TDepay;
|
||||
typedef struct _GstRtpMP2TDepayClass GstRtpMP2TDepayClass;
|
||||
|
||||
struct _GstRtpMP2TDepay
|
||||
{
|
||||
GstBaseRTPDepayload depayload;
|
||||
|
||||
guint8 skip_first_bytes;
|
||||
};
|
||||
|
||||
struct _GstRtpMP2TDepayClass
|
||||
|
|
Loading…
Reference in a new issue