)
);
-GST_BOILERPLATE (GstRtpG722Depay, gst_rtp_g722_depay, GstBaseRTPDepayload,
+#define gst_rtp_g722_depay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpG722Depay, gst_rtp_g722_depay,
GST_TYPE_BASE_RTP_DEPAYLOAD);
static gboolean gst_rtp_g722_depay_setcaps (GstBaseRTPDepayload * depayload,
GstBuffer * buf);
static void
-gst_rtp_g722_depay_base_init (gpointer klass)
+gst_rtp_g722_depay_class_init (GstRtpG722DepayClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstElementClass *gstelement_class;
+ GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
+
+ GST_DEBUG_CATEGORY_INIT (rtpg722depay_debug, "rtpg722depay", 0,
+ "G722 RTP Depayloader");
- gst_element_class_add_pad_template (element_class,
+ gstelement_class = (GstElementClass *) klass;
+ gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
+
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_g722_depay_src_template));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_g722_depay_sink_template));
- gst_element_class_set_details_simple (element_class, "RTP audio depayloader",
- "Codec/Depayloader/Network/RTP",
+ gst_element_class_set_details_simple (gstelement_class,
+ "RTP audio depayloader", "Codec/Depayloader/Network/RTP",
"Extracts G722 audio from RTP packets",
"Wim Taymans <wim.taymans@gmail.com>");
-}
-
-static void
-gst_rtp_g722_depay_class_init (GstRtpG722DepayClass * klass)
-{
- GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
-
- gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
gstbasertpdepayload_class->set_caps = gst_rtp_g722_depay_setcaps;
gstbasertpdepayload_class->process = gst_rtp_g722_depay_process;
-
- GST_DEBUG_CATEGORY_INIT (rtpg722depay_debug, "rtpg722depay", 0,
- "G722 RTP Depayloader");
}
static void
-gst_rtp_g722_depay_init (GstRtpG722Depay * rtpg722depay,
- GstRtpG722DepayClass * klass)
+gst_rtp_g722_depay_init (GstRtpG722Depay * rtpg722depay)
{
- /* needed because of GST_BOILERPLATE */
}
static gint
GstBuffer *outbuf;
gint payload_len;
gboolean marker;
+ GstRTPBuffer rtp = { NULL };
rtpg722depay = GST_RTP_G722_DEPAY (depayload);
- payload_len = gst_rtp_buffer_get_payload_len (buf);
+ gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
+
+ payload_len = gst_rtp_buffer_get_payload_len (&rtp);
if (payload_len <= 0)
goto empty_packet;
GST_DEBUG_OBJECT (rtpg722depay, "got payload of %d bytes", payload_len);
- outbuf = gst_rtp_buffer_get_payload_buffer (buf);
- marker = gst_rtp_buffer_get_marker (buf);
+ outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
+ marker = gst_rtp_buffer_get_marker (&rtp);
+ gst_rtp_buffer_unmap (&rtp);
if (marker) {
/* mark talk spurt with DISCONT */
{
GST_ELEMENT_WARNING (rtpg722depay, STREAM, DECODE,
("Empty Payload."), (NULL));
+ gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}
static GstCaps *gst_rtp_g722_pay_getcaps (GstBaseRTPPayload * rtppayload,
GstPad * pad);
-GST_BOILERPLATE (GstRtpG722Pay, gst_rtp_g722_pay, GstBaseRTPAudioPayload,
+#define gst_rtp_g722_pay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpG722Pay, gst_rtp_g722_pay,
GST_TYPE_BASE_RTP_AUDIO_PAYLOAD);
static void
-gst_rtp_g722_pay_base_init (gpointer klass)
+gst_rtp_g722_pay_class_init (GstRtpG722PayClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstElementClass *gstelement_class;
+ GstBaseRTPPayloadClass *gstbasertppayload_class;
+
+ GST_DEBUG_CATEGORY_INIT (rtpg722pay_debug, "rtpg722pay", 0,
+ "G722 RTP Payloader");
- gst_element_class_add_pad_template (element_class,
+ gstelement_class = (GstElementClass *) klass;
+ gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
+
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_g722_pay_src_template));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_g722_pay_sink_template));
- gst_element_class_set_details_simple (element_class, "RTP audio payloader",
+ gst_element_class_set_details_simple (gstelement_class, "RTP audio payloader",
"Codec/Payloader/Network/RTP",
"Payload-encode Raw audio into RTP packets (RFC 3551)",
"Wim Taymans <wim.taymans@gmail.com>");
-}
-
-static void
-gst_rtp_g722_pay_class_init (GstRtpG722PayClass * klass)
-{
- GstBaseRTPPayloadClass *gstbasertppayload_class;
-
- gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
gstbasertppayload_class->set_caps = gst_rtp_g722_pay_setcaps;
gstbasertppayload_class->get_caps = gst_rtp_g722_pay_getcaps;
-
- GST_DEBUG_CATEGORY_INIT (rtpg722pay_debug, "rtpg722pay", 0,
- "G722 RTP Payloader");
}
static void
-gst_rtp_g722_pay_init (GstRtpG722Pay * rtpg722pay, GstRtpG722PayClass * klass)
+gst_rtp_g722_pay_init (GstRtpG722Pay * rtpg722pay)
{
GstBaseRTPAudioPayload *basertpaudiopayload;
static GstBuffer *gst_rtp_g723_depay_process (GstBaseRTPDepayload * depayload,
GstBuffer * buf);
-GST_BOILERPLATE (GstRtpG723Depay, gst_rtp_g723_depay, GstBaseRTPDepayload,
+#define gst_rtp_g723_depay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpG723Depay, gst_rtp_g723_depay,
GST_TYPE_BASE_RTP_DEPAYLOAD);
static void
-gst_rtp_g723_depay_base_init (gpointer klass)
+gst_rtp_g723_depay_class_init (GstRtpG723DepayClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstElementClass *gstelement_class;
+ GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
+
+ GST_DEBUG_CATEGORY_INIT (rtpg723depay_debug, "rtpg723depay", 0,
+ "G.723 RTP Depayloader");
- gst_element_class_add_pad_template (element_class,
+ gstelement_class = (GstElementClass *) klass;
+ gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
+
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_g723_depay_src_template));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_g723_depay_sink_template));
- gst_element_class_set_details_simple (element_class, "RTP G.723 depayloader",
- "Codec/Depayloader/Network/RTP",
+ gst_element_class_set_details_simple (gstelement_class,
+ "RTP G.723 depayloader", "Codec/Depayloader/Network/RTP",
"Extracts G.723 audio from RTP packets (RFC 3551)",
"Wim Taymans <wim.taymans@gmail.com>");
- GST_DEBUG_CATEGORY_INIT (rtpg723depay_debug, "rtpg723depay", 0,
- "G.723 RTP Depayloader");
-}
-
-static void
-gst_rtp_g723_depay_class_init (GstRtpG723DepayClass * klass)
-{
- GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
-
- gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
-
gstbasertpdepayload_class->process = gst_rtp_g723_depay_process;
gstbasertpdepayload_class->set_caps = gst_rtp_g723_depay_setcaps;
}
static void
-gst_rtp_g723_depay_init (GstRtpG723Depay * rtpg723depay,
- GstRtpG723DepayClass * klass)
+gst_rtp_g723_depay_init (GstRtpG723Depay * rtpg723depay)
{
GstBaseRTPDepayload *depayload;
GstBuffer *outbuf = NULL;
gint payload_len;
gboolean marker;
+ GstRTPBuffer rtp = { NULL };
rtpg723depay = GST_RTP_G723_DEPAY (depayload);
- payload_len = gst_rtp_buffer_get_payload_len (buf);
+ gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
+
+ payload_len = gst_rtp_buffer_get_payload_len (&rtp);
/* At least 4 bytes */
if (payload_len < 4)
GST_LOG_OBJECT (rtpg723depay, "payload len %d", payload_len);
- outbuf = gst_rtp_buffer_get_payload_buffer (buf);
- marker = gst_rtp_buffer_get_marker (buf);
+ outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
+ marker = gst_rtp_buffer_get_marker (&rtp);
+ gst_rtp_buffer_unmap (&rtp);
if (marker) {
/* marker bit starts talkspurt */
}
GST_LOG_OBJECT (depayload, "pushing buffer of size %d",
- GST_BUFFER_SIZE (outbuf));
+ gst_buffer_get_size (outbuf));
return outbuf;
bad_packet:
{
/* no fatal error */
+ gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}
static GstStateChangeReturn gst_rtp_g723_pay_change_state (GstElement * element,
GstStateChange transition);
-GST_BOILERPLATE (GstRTPG723Pay, gst_rtp_g723_pay, GstBaseRTPPayload,
- GST_TYPE_BASE_RTP_PAYLOAD);
-
-static void
-gst_rtp_g723_pay_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_g723_pay_sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_g723_pay_src_template));
- gst_element_class_set_details_simple (element_class, "RTP G.723 payloader",
- "Codec/Payloader/Network/RTP",
- "Packetize G.723 audio into RTP packets",
- "Wim Taymans <wim.taymans@gmail.com>");
-}
+#define gst_rtp_g723_pay_parent_class parent_class
+G_DEFINE_TYPE (GstRTPG723Pay, gst_rtp_g723_pay, GST_TYPE_BASE_RTP_PAYLOAD);
static void
gst_rtp_g723_pay_class_init (GstRTPG723PayClass * klass)
gstelement_class->change_state = gst_rtp_g723_pay_change_state;
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_rtp_g723_pay_sink_template));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_rtp_g723_pay_src_template));
+
+ gst_element_class_set_details_simple (gstelement_class, "RTP G.723 payloader",
+ "Codec/Payloader/Network/RTP",
+ "Packetize G.723 audio into RTP packets",
+ "Wim Taymans <wim.taymans@gmail.com>");
+
payload_class->set_caps = gst_rtp_g723_pay_set_caps;
payload_class->handle_buffer = gst_rtp_g723_pay_handle_buffer;
}
static void
-gst_rtp_g723_pay_init (GstRTPG723Pay * pay, GstRTPG723PayClass * klass)
+gst_rtp_g723_pay_init (GstRTPG723Pay * pay)
{
GstBaseRTPPayload *payload = GST_BASE_RTP_PAYLOAD (pay);
GstFlowReturn ret;
guint8 *payload;
guint avail;
+ GstRTPBuffer rtp = { NULL };
avail = gst_adapter_available (pay->adapter);
outbuf = gst_rtp_buffer_new_allocate (avail, 0, 0);
- payload = gst_rtp_buffer_get_payload (outbuf);
+
+ gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
+ payload = gst_rtp_buffer_get_payload (&rtp);
GST_BUFFER_TIMESTAMP (outbuf) = pay->timestamp;
GST_BUFFER_DURATION (outbuf) = pay->duration;
/* set discont and marker */
if (pay->discont) {
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
- gst_rtp_buffer_set_marker (outbuf, TRUE);
+ gst_rtp_buffer_set_marker (&rtp, TRUE);
pay->discont = FALSE;
}
+ gst_rtp_buffer_unmap (&rtp);
ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (pay), outbuf);
{
GstFlowReturn ret = GST_FLOW_OK;
guint8 *data;
- guint size;
+ gsize size;
guint8 HDR;
GstRTPG723Pay *pay;
GstClockTime packet_dur, timestamp;
pay = GST_RTP_G723_PAY (payload);
- size = GST_BUFFER_SIZE (buf);
- data = GST_BUFFER_DATA (buf);
+ data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
timestamp = GST_BUFFER_TIMESTAMP (buf);
if (GST_BUFFER_IS_DISCONT (buf)) {
else
pay->timestamp = 0;
}
+ gst_buffer_unmap (buf, data, size);
/* add packet to the queue */
gst_adapter_push (pay->adapter, buf);
GST_ELEMENT_WARNING (pay, STREAM, WRONG_TYPE,
("Invalid input buffer size"),
("Input size should be 4, 20 or 24, got %u", size));
+ gst_buffer_unmap (buf, data, size);
gst_buffer_unref (buf);
return GST_FLOW_OK;
}
GST_ELEMENT_WARNING (pay, STREAM, WRONG_TYPE,
("Wrong input buffer size"),
("Expected input buffer size %u but got %u", size_tab[HDR], size));
+ gst_buffer_unmap (buf, data, size);
gst_buffer_unref (buf);
return GST_FLOW_OK;
}
static gboolean gst_rtp_g726_depay_setcaps (GstBaseRTPDepayload * depayload,
GstCaps * caps);
-GST_BOILERPLATE (GstRtpG726Depay, gst_rtp_g726_depay, GstBaseRTPDepayload,
+#define gst_rtp_g726_depay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpG726Depay, gst_rtp_g726_depay,
GST_TYPE_BASE_RTP_DEPAYLOAD);
static void
-gst_rtp_g726_depay_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_g726_depay_src_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_g726_depay_sink_template));
- gst_element_class_set_details_simple (element_class, "RTP G.726 depayloader",
- "Codec/Depayloader/Network/RTP",
- "Extracts G.726 audio from RTP packets",
- "Axis Communications <dev-gstreamer@axis.com>");
-}
-
-static void
gst_rtp_g726_depay_class_init (GstRtpG726DepayClass * klass)
{
GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
+ GST_DEBUG_CATEGORY_INIT (rtpg726depay_debug, "rtpg726depay", 0,
+ "G.726 RTP Depayloader");
+
gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
gobject_class->set_property = gst_rtp_g726_depay_set_property;
"Force AAL2 decoding for compatibility with bad payloaders",
DEFAULT_FORCE_AAL2, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_rtp_g726_depay_src_template));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_rtp_g726_depay_sink_template));
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "RTP G.726 depayloader", "Codec/Depayloader/Network/RTP",
+ "Extracts G.726 audio from RTP packets",
+ "Axis Communications <dev-gstreamer@axis.com>");
+
gstbasertpdepayload_class->process = gst_rtp_g726_depay_process;
gstbasertpdepayload_class->set_caps = gst_rtp_g726_depay_setcaps;
-
- GST_DEBUG_CATEGORY_INIT (rtpg726depay_debug, "rtpg726depay", 0,
- "G.726 RTP Depayloader");
}
static void
-gst_rtp_g726_depay_init (GstRtpG726Depay * rtpG726depay,
- GstRtpG726DepayClass * klass)
+gst_rtp_g726_depay_init (GstRtpG726Depay * rtpG726depay)
{
GstBaseRTPDepayload *depayload;
GstRtpG726Depay *depay;
GstBuffer *outbuf = NULL;
gboolean marker;
+ GstRTPBuffer rtp = { NULL };
depay = GST_RTP_G726_DEPAY (depayload);
- marker = gst_rtp_buffer_get_marker (buf);
+ gst_rtp_buffer_map (buf, GST_MAP_READWRITE, &rtp);
+
+ marker = gst_rtp_buffer_get_marker (&rtp);
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
- GST_BUFFER_SIZE (buf), marker,
- gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
+ gst_buffer_get_size (buf), marker,
+ gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp));
if (depay->aal2 || depay->force_aal2) {
/* AAL2, we can just copy the bytes */
- outbuf = gst_rtp_buffer_get_payload_buffer (buf);
+ outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
} else {
- guint8 *in, *out, tmp;
+ guint8 *in, *out, tmp, *odata;
guint len;
+ gsize osize;
- in = gst_rtp_buffer_get_payload (buf);
- len = gst_rtp_buffer_get_payload_len (buf);
+ in = gst_rtp_buffer_get_payload (&rtp);
+ len = gst_rtp_buffer_get_payload_len (&rtp);
- if (gst_buffer_is_writable (buf)) {
- outbuf = gst_rtp_buffer_get_payload_buffer (buf);
- } else {
- GstBuffer *copy;
+ outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
+ outbuf = gst_buffer_make_writable (outbuf);
- /* copy buffer */
- copy = gst_buffer_copy (buf);
- outbuf = gst_rtp_buffer_get_payload_buffer (copy);
- gst_buffer_unref (copy);
- }
- out = GST_BUFFER_DATA (outbuf);
+ odata = gst_buffer_map (outbuf, &osize, NULL, GST_MAP_WRITE);
+ out = odata;
/* we need to reshuffle the bytes, input is always of the form
* A B C D ... with the number of bits depending on the bitrate. */
break;
}
}
+ gst_buffer_unmap (outbuf, odata, osize);
}
if (marker) {
static GstFlowReturn gst_rtp_g726_pay_handle_buffer (GstBaseRTPPayload *
payload, GstBuffer * buffer);
-GST_BOILERPLATE (GstRtpG726Pay, gst_rtp_g726_pay, GstBaseRTPAudioPayload,
+#define gst_rtp_g726_pay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpG726Pay, gst_rtp_g726_pay,
GST_TYPE_BASE_RTP_AUDIO_PAYLOAD);
static void
-gst_rtp_g726_pay_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_g726_pay_sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_g726_pay_src_template));
- gst_element_class_set_details_simple (element_class, "RTP G.726 payloader",
- "Codec/Payloader/Network/RTP",
- "Payload-encodes G.726 audio into a RTP packet",
- "Axis Communications <dev-gstreamer@axis.com>");
-}
-
-static void
gst_rtp_g726_pay_class_init (GstRtpG726PayClass * klass)
{
GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
GstBaseRTPPayloadClass *gstbasertppayload_class;
gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
gobject_class->set_property = gst_rtp_g726_pay_set_property;
"Force AAL2 encoding for compatibility with bad depayloaders",
DEFAULT_FORCE_AAL2, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_rtp_g726_pay_sink_template));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_rtp_g726_pay_src_template));
+
+ gst_element_class_set_details_simple (gstelement_class, "RTP G.726 payloader",
+ "Codec/Payloader/Network/RTP",
+ "Payload-encodes G.726 audio into a RTP packet",
+ "Axis Communications <dev-gstreamer@axis.com>");
+
gstbasertppayload_class->set_caps = gst_rtp_g726_pay_setcaps;
gstbasertppayload_class->handle_buffer = gst_rtp_g726_pay_handle_buffer;
}
static void
-gst_rtp_g726_pay_init (GstRtpG726Pay * rtpg726pay, GstRtpG726PayClass * klass)
+gst_rtp_g726_pay_init (GstRtpG726Pay * rtpg726pay)
{
GstBaseRTPAudioPayload *basertpaudiopayload;
if (!pay->aal2) {
guint8 *data, tmp;
- guint len;
+ gsize len;
/* for non AAL2, we need to reshuffle the bytes, we can do this in-place
* when the buffer is writable. */
buffer = gst_buffer_make_writable (buffer);
- data = GST_BUFFER_DATA (buffer);
- len = GST_BUFFER_SIZE (buffer);
+ data = gst_buffer_map (buffer, &len, NULL, GST_MAP_READWRITE);
GST_LOG_OBJECT (pay, "packing %u bytes of data", len);
break;
}
}
+ gst_buffer_unmap (buffer, data, len);
}
res =
static GstBuffer *gst_rtp_g729_depay_process (GstBaseRTPDepayload * depayload,
GstBuffer * buf);
-GST_BOILERPLATE (GstRtpG729Depay, gst_rtp_g729_depay, GstBaseRTPDepayload,
+#define gst_rtp_g729_depay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpG729Depay, gst_rtp_g729_depay,
GST_TYPE_BASE_RTP_DEPAYLOAD);
static void
-gst_rtp_g729_depay_base_init (gpointer klass)
+gst_rtp_g729_depay_class_init (GstRtpG729DepayClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstElementClass *gstelement_class;
+ GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
+
+ GST_DEBUG_CATEGORY_INIT (rtpg729depay_debug, "rtpg729depay", 0,
+ "G.729 RTP Depayloader");
- gst_element_class_add_pad_template (element_class,
+ gstelement_class = (GstElementClass *) klass;
+ gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
+
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_g729_depay_src_template));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_g729_depay_sink_template));
- gst_element_class_set_details_simple (element_class, "RTP G.729 depayloader",
- "Codec/Depayloader/Network/RTP",
+ gst_element_class_set_details_simple (gstelement_class,
+ "RTP G.729 depayloader", "Codec/Depayloader/Network/RTP",
"Extracts G.729 audio from RTP packets (RFC 3551)",
"Laurent Glayal <spglegle@yahoo.fr>");
- GST_DEBUG_CATEGORY_INIT (rtpg729depay_debug, "rtpg729depay", 0,
- "G.729 RTP Depayloader");
-}
-
-static void
-gst_rtp_g729_depay_class_init (GstRtpG729DepayClass * klass)
-{
- GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
-
- gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
-
gstbasertpdepayload_class->process = gst_rtp_g729_depay_process;
gstbasertpdepayload_class->set_caps = gst_rtp_g729_depay_setcaps;
}
static void
-gst_rtp_g729_depay_init (GstRtpG729Depay * rtpg729depay,
- GstRtpG729DepayClass * klass)
+gst_rtp_g729_depay_init (GstRtpG729Depay * rtpg729depay)
{
GstBaseRTPDepayload *depayload;
}
}
-
static GstBuffer *
gst_rtp_g729_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{
GstBuffer *outbuf = NULL;
gint payload_len;
gboolean marker;
+ GstRTPBuffer rtp = { NULL };
rtpg729depay = GST_RTP_G729_DEPAY (depayload);
- payload_len = gst_rtp_buffer_get_payload_len (buf);
+ gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
+
+ payload_len = gst_rtp_buffer_get_payload_len (&rtp);
/* At least 2 bytes (CNG from G729 Annex B) */
if (payload_len < 2) {
GST_LOG_OBJECT (rtpg729depay, "G729 payload contains CNG frame");
}
- outbuf = gst_rtp_buffer_get_payload_buffer (buf);
- marker = gst_rtp_buffer_get_marker (buf);
+ outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
+ marker = gst_rtp_buffer_get_marker (&rtp);
+
+ gst_rtp_buffer_unmap (&rtp);
if (marker) {
/* marker bit starts talkspurt */
}
GST_LOG_OBJECT (depayload, "pushing buffer of size %d",
- GST_BUFFER_SIZE (outbuf));
+ gst_buffer_get_size (outbuf));
return outbuf;
"clock-rate = (int) 8000, " "encoding-name = (string) \"G729\"")
);
-GST_BOILERPLATE (GstRTPG729Pay, gst_rtp_g729_pay, GstBaseRTPPayload,
- GST_TYPE_BASE_RTP_PAYLOAD);
-
-static void
-gst_rtp_g729_pay_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_g729_pay_sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_g729_pay_src_template));
- gst_element_class_set_details_simple (element_class, "RTP G.729 payloader",
- "Codec/Payloader/Network/RTP",
- "Packetize G.729 audio into RTP packets",
- "Olivier Crete <olivier.crete@collabora.co.uk>");
-
- GST_DEBUG_CATEGORY_INIT (rtpg729pay_debug, "rtpg729pay", 0,
- "G.729 RTP Payloader");
-}
+#define gst_rtp_g729_pay_parent_class parent_class
+G_DEFINE_TYPE (GstRTPG729Pay, gst_rtp_g729_pay, GST_TYPE_BASE_RTP_PAYLOAD);
static void
gst_rtp_g729_pay_finalize (GObject * object)
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstBaseRTPPayloadClass *payload_class = GST_BASE_RTP_PAYLOAD_CLASS (klass);
+ GST_DEBUG_CATEGORY_INIT (rtpg729pay_debug, "rtpg729pay", 0,
+ "G.729 RTP Payloader");
+
gobject_class->finalize = gst_rtp_g729_pay_finalize;
gstelement_class->change_state = gst_rtp_g729_pay_change_state;
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_rtp_g729_pay_sink_template));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_rtp_g729_pay_src_template));
+
+ gst_element_class_set_details_simple (gstelement_class, "RTP G.729 payloader",
+ "Codec/Payloader/Network/RTP",
+ "Packetize G.729 audio into RTP packets",
+ "Olivier Crete <olivier.crete@collabora.co.uk>");
+
payload_class->set_caps = gst_rtp_g729_pay_set_caps;
payload_class->handle_buffer = gst_rtp_g729_pay_handle_buffer;
}
static void
-gst_rtp_g729_pay_init (GstRTPG729Pay * pay, GstRTPG729PayClass * klass)
+gst_rtp_g729_pay_init (GstRTPG729Pay * pay)
{
GstBaseRTPPayload *payload = GST_BASE_RTP_PAYLOAD (pay);
GstBuffer *outbuf;
guint8 *payload;
GstFlowReturn ret;
+ GstRTPBuffer rtp = { NULL };
basepayload = GST_BASE_RTP_PAYLOAD (rtpg729pay);
/* create buffer to hold the payload */
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
+ gst_rtp_buffer_map (outbuf, GST_MAP_READWRITE, &rtp);
+
/* copy payload */
- payload = gst_rtp_buffer_get_payload (outbuf);
+ payload = gst_rtp_buffer_get_payload (&rtp);
memcpy (payload, data, payload_len);
/* set metadata */
if (G_UNLIKELY (rtpg729pay->discont)) {
GST_DEBUG_OBJECT (basepayload, "discont, setting marker bit");
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
- gst_rtp_buffer_set_marker (outbuf, TRUE);
+ gst_rtp_buffer_set_marker (&rtp, TRUE);
rtpg729pay->discont = FALSE;
}
+ gst_rtp_buffer_unmap (&rtp);
ret = gst_basertppayload_push (basepayload, outbuf);
guint minptime_octets = 0;
guint min_payload_len;
guint max_payload_len;
+ gsize size;
+ GstClockTime timestamp;
- available = GST_BUFFER_SIZE (buf);
+ size = gst_buffer_get_size (buf);
- if (available % G729_FRAME_SIZE != 0 &&
- available % G729_FRAME_SIZE != G729B_CN_FRAME_SIZE)
+ if (size % G729_FRAME_SIZE != 0 &&
+ size % G729_FRAME_SIZE != G729B_CN_FRAME_SIZE)
goto invalid_size;
/* max number of bytes based on given ptime, has to be multiple of
adapter = rtpg729pay->adapter;
available = gst_adapter_available (adapter);
+ timestamp = GST_BUFFER_TIMESTAMP (buf);
+
/* resync rtp time on discont or a discontinuous cn packet */
if (GST_BUFFER_IS_DISCONT (buf)) {
/* flush remainder */
available = 0;
}
rtpg729pay->discont = TRUE;
- gst_rtp_g729_pay_recalc_rtp_time (rtpg729pay, GST_BUFFER_TIMESTAMP (buf));
+ gst_rtp_g729_pay_recalc_rtp_time (rtpg729pay, timestamp);
}
- if (GST_BUFFER_SIZE (buf) < G729_FRAME_SIZE)
- gst_rtp_g729_pay_recalc_rtp_time (rtpg729pay, GST_BUFFER_TIMESTAMP (buf));
+ if (size < G729_FRAME_SIZE)
+ gst_rtp_g729_pay_recalc_rtp_time (rtpg729pay, timestamp);
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (rtpg729pay->first_ts))) {
- rtpg729pay->first_ts = GST_BUFFER_TIMESTAMP (buf);
+ rtpg729pay->first_ts = timestamp;
rtpg729pay->first_rtp_time = rtpg729pay->next_rtp_time;
}
/* let's reset the base timestamp when the adapter is empty */
if (available == 0)
- rtpg729pay->next_ts = GST_BUFFER_TIMESTAMP (buf);
+ rtpg729pay->next_ts = timestamp;
- if (available == 0 &&
- GST_BUFFER_SIZE (buf) >= min_payload_len &&
- GST_BUFFER_SIZE (buf) <= max_payload_len) {
- ret = gst_rtp_g729_pay_push (rtpg729pay,
- GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
+ if (available == 0 && size >= min_payload_len && size <= max_payload_len) {
+ guint8 *data;
+
+ data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+ ret = gst_rtp_g729_pay_push (rtpg729pay, data, size);
+ gst_buffer_unmap (buf, data, size);
gst_buffer_unref (buf);
return ret;
}
("Invalid input buffer size"),
("Invalid buffer size, should be a multiple of"
" G729_FRAME_SIZE(10) with an optional G729B_CN_FRAME_SIZE(2)"
- " added to it, but it is %u", available));
+ " added to it, but it is %u", size));
gst_buffer_unref (buf);
return GST_FLOW_ERROR;
}
static gboolean gst_rtp_gsm_depay_setcaps (GstBaseRTPDepayload * _depayload,
GstCaps * caps);
-GST_BOILERPLATE (GstRTPGSMDepay, gst_rtp_gsm_depay, GstBaseRTPDepayload,
- GST_TYPE_BASE_RTP_DEPAYLOAD);
+#define gst_rtp_gsm_depay_parent_class parent_class
+G_DEFINE_TYPE (GstRTPGSMDepay, gst_rtp_gsm_depay, GST_TYPE_BASE_RTP_DEPAYLOAD);
static void
-gst_rtp_gsm_depay_base_init (gpointer klass)
+gst_rtp_gsm_depay_class_init (GstRTPGSMDepayClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstElementClass *gstelement_class;
+ GstBaseRTPDepayloadClass *gstbasertp_depayload_class;
+
+ gstelement_class = (GstElementClass *) klass;
+ gstbasertp_depayload_class = (GstBaseRTPDepayloadClass *) klass;
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_gsm_depay_src_template));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_gsm_depay_sink_template));
- gst_element_class_set_details_simple (element_class, "RTP GSM depayloader",
+
+ gst_element_class_set_details_simple (gstelement_class, "RTP GSM depayloader",
"Codec/Depayloader/Network/RTP",
"Extracts GSM audio from RTP packets", "Zeeshan Ali <zeenix@gmail.com>");
-}
-
-static void
-gst_rtp_gsm_depay_class_init (GstRTPGSMDepayClass * klass)
-{
- GstBaseRTPDepayloadClass *gstbasertp_depayload_class;
-
- gstbasertp_depayload_class = (GstBaseRTPDepayloadClass *) klass;
gstbasertp_depayload_class->process = gst_rtp_gsm_depay_process;
gstbasertp_depayload_class->set_caps = gst_rtp_gsm_depay_setcaps;
}
static void
-gst_rtp_gsm_depay_init (GstRTPGSMDepay * rtpgsmdepay,
- GstRTPGSMDepayClass * klass)
+gst_rtp_gsm_depay_init (GstRTPGSMDepay * rtpgsmdepay)
{
- /* needed because of GST_BOILERPLATE */
}
static gboolean
{
GstBuffer *outbuf = NULL;
gboolean marker;
+ GstRTPBuffer rtp = { NULL };
+
+ gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
- marker = gst_rtp_buffer_get_marker (buf);
+ marker = gst_rtp_buffer_get_marker (&rtp);
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
- GST_BUFFER_SIZE (buf), marker,
- gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
+ gst_buffer_get_size (buf), marker,
+ gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp));
+
+ outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
- outbuf = gst_rtp_buffer_get_payload_buffer (buf);
+ gst_rtp_buffer_unmap (&rtp);
if (marker) {
/* mark start of talkspurt with DISCONT */
static GstFlowReturn gst_rtp_gsm_pay_handle_buffer (GstBaseRTPPayload * payload,
GstBuffer * buffer);
-GST_BOILERPLATE (GstRTPGSMPay, gst_rtp_gsm_pay, GstBaseRTPPayload,
- GST_TYPE_BASE_RTP_PAYLOAD);
+#define gst_rtp_gsm_pay_parent_class parent_class
+G_DEFINE_TYPE (GstRTPGSMPay, gst_rtp_gsm_pay, GST_TYPE_BASE_RTP_PAYLOAD);
static void
-gst_rtp_gsm_pay_base_init (gpointer klass)
+gst_rtp_gsm_pay_class_init (GstRTPGSMPayClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstElementClass *gstelement_class;
+ GstBaseRTPPayloadClass *gstbasertppayload_class;
+
+ GST_DEBUG_CATEGORY_INIT (rtpgsmpay_debug, "rtpgsmpay", 0,
+ "GSM Audio RTP Payloader");
- gst_element_class_add_pad_template (element_class,
+ gstelement_class = (GstElementClass *) klass;
+ gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
+
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_gsm_pay_sink_template));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_gsm_pay_src_template));
- gst_element_class_set_details_simple (element_class, "RTP GSM payloader",
+
+ gst_element_class_set_details_simple (gstelement_class, "RTP GSM payloader",
"Codec/Payloader/Network/RTP",
"Payload-encodes GSM audio into a RTP packet",
"Zeeshan Ali <zeenix@gmail.com>");
-}
-
-static void
-gst_rtp_gsm_pay_class_init (GstRTPGSMPayClass * klass)
-{
- GstBaseRTPPayloadClass *gstbasertppayload_class;
-
- gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
gstbasertppayload_class->set_caps = gst_rtp_gsm_pay_setcaps;
gstbasertppayload_class->handle_buffer = gst_rtp_gsm_pay_handle_buffer;
-
- GST_DEBUG_CATEGORY_INIT (rtpgsmpay_debug, "rtpgsmpay", 0,
- "GSM Audio RTP Payloader");
}
static void
-gst_rtp_gsm_pay_init (GstRTPGSMPay * rtpgsmpay, GstRTPGSMPayClass * klass)
+gst_rtp_gsm_pay_init (GstRTPGSMPay * rtpgsmpay)
{
GST_BASE_RTP_PAYLOAD (rtpgsmpay)->clock_rate = 8000;
GST_BASE_RTP_PAYLOAD_PT (rtpgsmpay) = GST_RTP_PAYLOAD_GSM;
GstBuffer * buffer)
{
GstRTPGSMPay *rtpgsmpay;
- guint size, payload_len;
+ guint payload_len;
GstBuffer *outbuf;
guint8 *payload, *data;
GstClockTime timestamp, duration;
GstFlowReturn ret;
+ gsize size;
+ GstRTPBuffer rtp = { NULL };
rtpgsmpay = GST_RTP_GSM_PAY (basepayload);
- size = GST_BUFFER_SIZE (buffer);
+ data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+
timestamp = GST_BUFFER_TIMESTAMP (buffer);
duration = GST_BUFFER_DURATION (buffer);
payload_len = size;
/* FIXME, just error out for now */
- if (payload_len > GST_BASE_RTP_PAYLOAD_MTU (rtpgsmpay)) {
- GST_ELEMENT_ERROR (rtpgsmpay, STREAM, ENCODE, (NULL),
- ("payload_len %u > mtu %u", payload_len,
- GST_BASE_RTP_PAYLOAD_MTU (rtpgsmpay)));
- return GST_FLOW_ERROR;
- }
+ if (payload_len > GST_BASE_RTP_PAYLOAD_MTU (rtpgsmpay))
+ goto too_big;
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
GST_BUFFER_DURATION (outbuf) = duration;
/* get payload */
- payload = gst_rtp_buffer_get_payload (outbuf);
-
- data = GST_BUFFER_DATA (buffer);
+ gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
/* copy data in payload */
- memcpy (&payload[0], data, size);
+ payload = gst_rtp_buffer_get_payload (&rtp);
+ memcpy (payload, data, size);
+
+ gst_rtp_buffer_unmap (&rtp);
+ gst_buffer_unmap (buffer, data, size);
gst_buffer_unref (buffer);
GST_DEBUG ("gst_rtp_gsm_pay_chain: pushing buffer of size %d",
- GST_BUFFER_SIZE (outbuf));
+ gst_buffer_get_size (outbuf));
ret = gst_basertppayload_push (basepayload, outbuf);
return ret;
+
+ /* ERRORS */
+too_big:
+ {
+ GST_ELEMENT_ERROR (rtpgsmpay, STREAM, ENCODE, (NULL),
+ ("payload_len %u > mtu %u", payload_len,
+ GST_BASE_RTP_PAYLOAD_MTU (rtpgsmpay)));
+ gst_buffer_unmap (buffer, data, size);
+ return GST_FLOW_ERROR;
+ }
}
gboolean
} else {
if (n > rest_bits) {
context->window =
- (context->
- window << rest_bits) | (*context->win_end & (((guint) pow (2.0,
- (double) rest_bits)) - 1));
+ (context->window << rest_bits) | (*context->
+ win_end & (((guint) pow (2.0, (double) rest_bits)) - 1));
n -= rest_bits;
rest_bits = 0;
} else {
gst_rtp_h263_pay_boundry_init (&bound, NULL, rtph263pay->data - 1, 0, 0);
context->gobs =
- (GstRtpH263PayGob **) g_malloc0 (format_props[context->
- piclayer->ptype_srcformat][0] * sizeof (GstRtpH263PayGob *));
+ (GstRtpH263PayGob **) g_malloc0 (format_props[context->piclayer->
+ ptype_srcformat][0] * sizeof (GstRtpH263PayGob *));
for (i = 0; i < format_props[context->piclayer->ptype_srcformat][0]; i++) {
/* GStreamer
- * Copyright (C) <2005> Wim Taymans <wim@fluendo.com>
+ * Copyright (C) <2005> Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
GstBuffer *buffer;
} GstADUFrame;
-GST_BOILERPLATE (GstRtpMPARobustDepay, gst_rtp_mpa_robust_depay,
- GstBaseRTPDepayload, GST_TYPE_BASE_RTP_DEPAYLOAD);
+#define gst_rtp_mpa_robust_depay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpMPARobustDepay, gst_rtp_mpa_robust_depay,
+ GST_TYPE_BASE_RTP_DEPAYLOAD);
static GstStateChangeReturn gst_rtp_mpa_robust_change_state (GstElement *
element, GstStateChange transition);
depayload, GstBuffer * buf);
static void
-gst_rtp_mpa_robust_depay_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_mpa_robust_depay_src_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_mpa_robust_depay_sink_template));
-
- gst_element_class_set_details_simple (element_class,
- "RTP MPEG audio depayloader", "Codec/Depayloader/Network/RTP",
- "Extracts MPEG audio from RTP packets (RFC 5219)",
- "Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>");
-}
-
-static void
gst_rtp_mpa_robust_depay_finalize (GObject * object)
{
GstRtpMPARobustDepay *rtpmpadepay;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-
static void
gst_rtp_mpa_robust_depay_class_init (GstRtpMPARobustDepayClass * klass)
{
GstElementClass *gstelement_class;
GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
+ GST_DEBUG_CATEGORY_INIT (rtpmparobustdepay_debug, "rtpmparobustdepay", 0,
+ "Robust MPEG Audio RTP Depayloader");
+
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_rtp_mpa_robust_change_state);
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_rtp_mpa_robust_depay_src_template));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_rtp_mpa_robust_depay_sink_template));
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "RTP MPEG audio depayloader", "Codec/Depayloader/Network/RTP",
+ "Extracts MPEG audio from RTP packets (RFC 5219)",
+ "Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>");
+
gstbasertpdepayload_class->set_caps = gst_rtp_mpa_robust_depay_setcaps;
gstbasertpdepayload_class->process = gst_rtp_mpa_robust_depay_process;
-
- GST_DEBUG_CATEGORY_INIT (rtpmparobustdepay_debug, "rtpmparobustdepay", 0,
- "Robust MPEG Audio RTP Depayloader");
}
static void
-gst_rtp_mpa_robust_depay_init (GstRtpMPARobustDepay * rtpmpadepay,
- GstRtpMPARobustDepayClass * klass)
+gst_rtp_mpa_robust_depay_init (GstRtpMPARobustDepay * rtpmpadepay)
{
rtpmpadepay->adapter = gst_adapter_new ();
rtpmpadepay->adu_frames = g_queue_new ();
rtpmpadepay, GstADUFrame * frame)
{
GstADUFrame *dummy;
+ guint8 *data;
+ gsize size;
dummy = g_slice_dup (GstADUFrame, frame);
dummy->backpointer = 0;
dummy->buffer = gst_buffer_new_and_alloc (dummy->side_info + 4);
- memset (GST_BUFFER_DATA (dummy->buffer), 0, dummy->side_info + 4);
- GST_WRITE_UINT32_BE (GST_BUFFER_DATA (dummy->buffer), dummy->header);
+
+ data = gst_buffer_map (dummy->buffer, &size, NULL, GST_MAP_WRITE);
+ memset (data, 0, size);
+ GST_WRITE_UINT32_BE (data, dummy->header);
+ gst_buffer_unmap (dummy->buffer, data, size);
+
GST_BUFFER_TIMESTAMP (dummy->buffer) = GST_BUFFER_TIMESTAMP (frame->buffer);
return dummy;
GstADUFrame *frame = NULL;
guint version, layer, channels, size;
guint crc;
+ guint8 *bdata;
+ gsize bsize;
g_return_val_if_fail (buf != NULL, FALSE);
- if (GST_BUFFER_SIZE (buf) < 6) {
+ bdata = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
+
+ if (bsize < 6)
goto corrupt_frame;
- }
frame = g_slice_new0 (GstADUFrame);
- frame->header = GST_READ_UINT32_BE (GST_BUFFER_DATA (buf));
+ frame->header = GST_READ_UINT32_BE (bdata);
size = mp3_type_frame_length_from_header (GST_ELEMENT_CAST (rtpmpadepay),
frame->header, &version, &layer, &channels, NULL, NULL, NULL, &crc);
/* backpointer */
if (layer == 3) {
- frame->backpointer = GST_READ_UINT16_BE (GST_BUFFER_DATA (buf) + 4);
+ frame->backpointer = GST_READ_UINT16_BE (bdata + 4);
frame->backpointer >>= 7;
GST_LOG_OBJECT (rtpmpadepay, "backpointer: %d", frame->backpointer);
}
frame->data_size = frame->size - 4 - frame->side_info;
/* some size validation checks */
- if (4 + frame->side_info > GST_BUFFER_SIZE (buf))
+ if (4 + frame->side_info > bsize)
goto corrupt_frame;
/* ADU data would then extend past MP3 frame,
* even using past byte reservoir */
- if (-frame->backpointer + (gint) (GST_BUFFER_SIZE (buf)) > frame->size)
+ if (-frame->backpointer + (gint) (bsize) > frame->size)
goto corrupt_frame;
+ gst_buffer_unmap (buf, bdata, bsize);
+
/* ok, take buffer and queue */
frame->buffer = buf;
g_queue_push_tail (rtpmpadepay->adu_frames, frame);
corrupt_frame:
{
GST_DEBUG_OBJECT (rtpmpadepay, "frame is corrupt");
+ gst_buffer_unmap (buf, bdata, bsize);
gst_buffer_unref (buf);
if (frame)
g_slice_free (GstADUFrame, frame);
{
gboolean ret = FALSE;
guint8 *data;
+ gsize size;
guint val, iindex, icc;
- data = GST_BUFFER_DATA (buf);
+ data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
val = GST_READ_UINT16_BE (data) >> 5;
+ gst_buffer_unmap (buf, data, size);
+
iindex = val >> 3;
icc = val & 0x7;
GstFlowReturn ret = GST_FLOW_OK;
while (1) {
+ guint8 *data;
+ gsize size;
if (G_UNLIKELY (!rtpmpadepay->cur_adu_frame)) {
rtpmpadepay->cur_adu_frame = rtpmpadepay->adu_frames->head;
continue;
}
- if (rtpmpadepay->offset == GST_BUFFER_SIZE (frame->buffer)) {
+ if (rtpmpadepay->offset == gst_buffer_get_size (frame->buffer)) {
if (g_list_next (rtpmpadepay->cur_adu_frame)) {
GST_LOG_OBJECT (rtpmpadepay,
"moving to next ADU frame, size %d, side_info %d",
gst_byte_writer_set_pos (rtpmpadepay->mp3_frame, 0);
/* bytewriter corresponds to head frame,
* i.e. the header and the side info must match */
+ data = gst_buffer_map (head->buffer, &size, NULL, GST_MAP_READ);
gst_byte_writer_put_data (rtpmpadepay->mp3_frame,
- GST_BUFFER_DATA (head->buffer), 4 + head->side_info);
+ data, 4 + head->side_info);
+ gst_buffer_unmap (head->buffer, data, size);
}
buf = frame->buffer;
rtpmpadepay->size);
if (rtpmpadepay->offset) {
+ data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
/* no need to position, simply append */
- g_assert (GST_BUFFER_SIZE (buf) > rtpmpadepay->offset);
- av = MIN (av, GST_BUFFER_SIZE (buf) - rtpmpadepay->offset);
+ g_assert (size > rtpmpadepay->offset);
+ av = MIN (av, size - rtpmpadepay->offset);
GST_LOG_OBJECT (rtpmpadepay,
"appending %d bytes from ADU frame at offset %d", av,
rtpmpadepay->offset);
gst_byte_writer_put_data (rtpmpadepay->mp3_frame,
- GST_BUFFER_DATA (buf) + rtpmpadepay->offset, av);
+ data + rtpmpadepay->offset, av);
rtpmpadepay->offset += av;
+ gst_buffer_unmap (buf, data, size);
} else {
gint pos, tpos;
gst_byte_writer_set_pos (rtpmpadepay->mp3_frame, pos + av);
} else {
/* position and append */
+ data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
GST_LOG_OBJECT (rtpmpadepay, "adding to current MP3 frame");
gst_byte_writer_set_pos (rtpmpadepay->mp3_frame, tpos);
- av = MIN (av, GST_BUFFER_SIZE (buf) - 4 - frame->side_info);
+ av = MIN (av, size - 4 - frame->side_info);
gst_byte_writer_put_data (rtpmpadepay->mp3_frame,
- GST_BUFFER_DATA (buf) + 4 + frame->side_info, av);
+ data + 4 + frame->side_info, av);
rtpmpadepay->offset += av + 4 + frame->side_info;
+ gst_buffer_unmap (buf, data, size);
}
}
gboolean cont, dtype;
guint av, size;
GstClockTime timestamp;
+ GstRTPBuffer rtp = { NULL };
rtpmpadepay = GST_RTP_MPA_ROBUST_DEPAY (depayload);
- payload_len = gst_rtp_buffer_get_payload_len (buf);
timestamp = GST_BUFFER_TIMESTAMP (buf);
+ gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
+
+ payload_len = gst_rtp_buffer_get_payload_len (&rtp);
if (payload_len <= 1)
goto short_read;
- payload = gst_rtp_buffer_get_payload (buf);
+ payload = gst_rtp_buffer_get_payload (&rtp);
offset = 0;
GST_LOG_OBJECT (rtpmpadepay, "payload_len: %d", payload_len);
GST_LOG_OBJECT (rtpmpadepay, "offset %d has cont: %d, dtype: %d, size: %d",
offset, cont, dtype, size);
- buf = gst_rtp_buffer_get_payload_subbuffer (buf, offset,
+ buf = gst_rtp_buffer_get_payload_subbuffer (&rtp, offset,
MIN (size, payload_len));
if (cont) {
"discarding continuation fragment without prior fragment");
gst_buffer_unref (buf);
} else {
- av += GST_BUFFER_SIZE (buf);
+ av += gst_buffer_get_size (buf);
gst_adapter_push (rtpmpadepay->adapter, buf);
if (av == size) {
timestamp = gst_adapter_prev_timestamp (rtpmpadepay->adapter, NULL);
/* timestamp applies to first payload, no idea for subsequent ones */
timestamp = GST_CLOCK_TIME_NONE;
}
+ gst_rtp_buffer_unmap (&rtp);
return NULL;
{
GST_ELEMENT_WARNING (rtpmpadepay, STREAM, DECODE,
(NULL), ("Packet contains invalid data"));
+ gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}
"clock-rate = (int) 90000")
);
-GST_BOILERPLATE (GstRtpMPVDepay, gst_rtp_mpv_depay, GstBaseRTPDepayload,
- GST_TYPE_BASE_RTP_DEPAYLOAD);
+G_DEFINE_TYPE (GstRtpMPVDepay, gst_rtp_mpv_depay, GST_TYPE_BASE_RTP_DEPAYLOAD);
static gboolean gst_rtp_mpv_depay_setcaps (GstBaseRTPDepayload * depayload,
GstCaps * caps);
GstBuffer * buf);
static void
-gst_rtp_mpv_depay_base_init (gpointer klass)
+gst_rtp_mpv_depay_class_init (GstRtpMPVDepayClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstElementClass *gstelement_class;
+ GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
+
+ gstelement_class = (GstElementClass *) klass;
+ gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_mpv_depay_src_template));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_mpv_depay_sink_template));
- gst_element_class_set_details_simple (element_class,
+ gst_element_class_set_details_simple (gstelement_class,
"RTP MPEG video depayloader", "Codec/Depayloader/Network/RTP",
"Extracts MPEG video from RTP packets (RFC 2250)",
"Wim Taymans <wim.taymans@gmail.com>");
-}
-
-static void
-gst_rtp_mpv_depay_class_init (GstRtpMPVDepayClass * klass)
-{
- GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
-
- gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
gstbasertpdepayload_class->set_caps = gst_rtp_mpv_depay_setcaps;
gstbasertpdepayload_class->process = gst_rtp_mpv_depay_process;
}
static void
-gst_rtp_mpv_depay_init (GstRtpMPVDepay * rtpmpvdepay,
- GstRtpMPVDepayClass * klass)
+gst_rtp_mpv_depay_init (GstRtpMPVDepay * rtpmpvdepay)
{
- /* needed because of GST_BOILERPLATE */
}
static gboolean
{
GstRtpMPVDepay *rtpmpvdepay;
GstBuffer *outbuf;
+ GstRTPBuffer rtp = { NULL };
rtpmpvdepay = GST_RTP_MPV_DEPAY (depayload);
+ gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
+
{
gint payload_len, payload_header;
guint8 *payload;
guint8 T;
- payload_len = gst_rtp_buffer_get_payload_len (buf);
- payload = gst_rtp_buffer_get_payload (buf);
+ payload_len = gst_rtp_buffer_get_payload_len (&rtp);
+ payload = gst_rtp_buffer_get_payload (&rtp);
payload_header = 0;
if (payload_len <= 4)
payload += 4;
}
- outbuf = gst_rtp_buffer_get_payload_subbuffer (buf, payload_header, -1);
+ outbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, payload_header, -1);
GST_DEBUG_OBJECT (rtpmpvdepay,
"gst_rtp_mpv_depay_chain: pushing buffer of size %d",
- GST_BUFFER_SIZE (outbuf));
+ gst_buffer_get_size (outbuf));
return outbuf;
}
payload, GstBuffer * buffer);
static gboolean gst_rtp_mpv_pay_handle_event (GstPad * pad, GstEvent * event);
-GST_BOILERPLATE (GstRTPMPVPay, gst_rtp_mpv_pay, GstBaseRTPPayload,
- GST_TYPE_BASE_RTP_PAYLOAD);
-
-static void
-gst_rtp_mpv_pay_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_mpv_pay_sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_rtp_mpv_pay_src_template));
- gst_element_class_set_details_simple (element_class,
- "RTP MPEG2 ES video payloader", "Codec/Payloader/Network/RTP",
- "Payload-encodes MPEG2 ES into RTP packets (RFC 2250)",
- "Thijs Vermeir <thijsvermeir@gmail.com>");
-}
+#define gst_rtp_mpv_pay_parent_class parent_class
+G_DEFINE_TYPE (GstRTPMPVPay, gst_rtp_mpv_pay, GST_TYPE_BASE_RTP_PAYLOAD);
static void
gst_rtp_mpv_pay_class_init (GstRTPMPVPayClass * klass)
gstelement_class->change_state = gst_rtp_mpv_pay_change_state;
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_rtp_mpv_pay_sink_template));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_rtp_mpv_pay_src_template));
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "RTP MPEG2 ES video payloader", "Codec/Payloader/Network/RTP",
+ "Payload-encodes MPEG2 ES into RTP packets (RFC 2250)",
+ "Thijs Vermeir <thijsvermeir@gmail.com>");
+
gstbasertppayload_class->set_caps = gst_rtp_mpv_pay_setcaps;
gstbasertppayload_class->handle_buffer = gst_rtp_mpv_pay_handle_buffer;
gstbasertppayload_class->handle_event = gst_rtp_mpv_pay_handle_event;
}
static void
-gst_rtp_mpv_pay_init (GstRTPMPVPay * rtpmpvpay, GstRTPMPVPayClass * klass)
+gst_rtp_mpv_pay_init (GstRTPMPVPay * rtpmpvpay)
{
GST_BASE_RTP_PAYLOAD (rtpmpvpay)->clock_rate = 90000;
GST_BASE_RTP_PAYLOAD_PT (rtpmpvpay) = GST_RTP_PAYLOAD_MPV;
guint towrite;
guint packet_len;
guint payload_len;
+ GstRTPBuffer rtp = { NULL };
packet_len = gst_rtp_buffer_calc_packet_len (avail, 4, 0);
outbuf = gst_rtp_buffer_new_allocate (payload_len, 4, 0);
- payload = gst_rtp_buffer_get_payload (outbuf);
+ gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
+
+ payload = gst_rtp_buffer_get_payload (&rtp);
/* enable MPEG Video-specific header
*
* 0 1 2 3
avail -= payload_len;
- gst_rtp_buffer_set_marker (outbuf, avail == 0);
+ gst_rtp_buffer_set_marker (&rtp, avail == 0);
+ gst_rtp_buffer_unmap (&rtp);
GST_BUFFER_TIMESTAMP (outbuf) = rtpmpvpay->first_ts;
static gboolean gst_rtp_pcma_depay_setcaps (GstBaseRTPDepayload * depayload,
GstCaps * caps);
-GST_BOILERPLATE (GstRtpPcmaDepay, gst_rtp_pcma_depay, GstBaseRTPDepayload,
+#define gst_rtp_pcma_depay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpPcmaDepay, gst_rtp_pcma_depay,
GST_TYPE_BASE_RTP_DEPAYLOAD);
static void
-gst_rtp_pcma_depay_base_init (gpointer klass)
+gst_rtp_pcma_depay_class_init (GstRtpPcmaDepayClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstElementClass *gstelement_class;
+ GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
+
+ gstelement_class = (GstElementClass *) klass;
+ gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_pcma_depay_src_template));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_pcma_depay_sink_template));
- gst_element_class_set_details_simple (element_class, "RTP PCMA depayloader",
- "Codec/Depayloader/Network/RTP",
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "RTP PCMA depayloader", "Codec/Depayloader/Network/RTP",
"Extracts PCMA audio from RTP packets",
"Edgard Lima <edgard.lima@indt.org.br>, Zeeshan Ali <zeenix@gmail.com>");
-}
-
-static void
-gst_rtp_pcma_depay_class_init (GstRtpPcmaDepayClass * klass)
-{
- GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
-
- gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
gstbasertpdepayload_class->process = gst_rtp_pcma_depay_process;
gstbasertpdepayload_class->set_caps = gst_rtp_pcma_depay_setcaps;
}
static void
-gst_rtp_pcma_depay_init (GstRtpPcmaDepay * rtppcmadepay,
- GstRtpPcmaDepayClass * klass)
+gst_rtp_pcma_depay_init (GstRtpPcmaDepay * rtppcmadepay)
{
GstBaseRTPDepayload *depayload;
GstBuffer *outbuf = NULL;
gboolean marker;
guint len;
+ GstRTPBuffer rtp = { NULL };
+
+ gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
- marker = gst_rtp_buffer_get_marker (buf);
+ marker = gst_rtp_buffer_get_marker (&rtp);
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
- GST_BUFFER_SIZE (buf), marker,
- gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
+ gst_buffer_get_size (buf), marker,
+ gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp));
- len = gst_rtp_buffer_get_payload_len (buf);
- outbuf = gst_rtp_buffer_get_payload_buffer (buf);
+ len = gst_rtp_buffer_get_payload_len (&rtp);
+ outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
+ gst_rtp_buffer_unmap (&rtp);
GST_BUFFER_DURATION (outbuf) =
gst_util_uint64_scale_int (len, GST_SECOND, depayload->clock_rate);
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
}
+
return outbuf;
}
static gboolean gst_rtp_pcma_pay_setcaps (GstBaseRTPPayload * payload,
GstCaps * caps);
-GST_BOILERPLATE (GstRtpPcmaPay, gst_rtp_pcma_pay, GstBaseRTPAudioPayload,
+#define gst_rtp_pcma_pay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpPcmaPay, gst_rtp_pcma_pay,
GST_TYPE_BASE_RTP_AUDIO_PAYLOAD);
static void
-gst_rtp_pcma_pay_base_init (gpointer klass)
+gst_rtp_pcma_pay_class_init (GstRtpPcmaPayClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstElementClass *gstelement_class;
+ GstBaseRTPPayloadClass *gstbasertppayload_class;
+
+ gstelement_class = (GstElementClass *) klass;
+ gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_pcma_pay_sink_template));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_pcma_pay_src_template));
- gst_element_class_set_details_simple (element_class, "RTP PCMA payloader",
+
+ gst_element_class_set_details_simple (gstelement_class, "RTP PCMA payloader",
"Codec/Payloader/Network/RTP",
"Payload-encodes PCMA audio into a RTP packet",
"Edgard Lima <edgard.lima@indt.org.br>");
-}
-
-static void
-gst_rtp_pcma_pay_class_init (GstRtpPcmaPayClass * klass)
-{
- GstBaseRTPPayloadClass *gstbasertppayload_class;
-
- gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
gstbasertppayload_class->set_caps = gst_rtp_pcma_pay_setcaps;
}
static void
-gst_rtp_pcma_pay_init (GstRtpPcmaPay * rtppcmapay, GstRtpPcmaPayClass * klass)
+gst_rtp_pcma_pay_init (GstRtpPcmaPay * rtppcmapay)
{
GstBaseRTPAudioPayload *basertpaudiopayload;
static gboolean gst_rtp_pcmu_depay_setcaps (GstBaseRTPDepayload * depayload,
GstCaps * caps);
-GST_BOILERPLATE (GstRtpPcmuDepay, gst_rtp_pcmu_depay, GstBaseRTPDepayload,
+#define gst_rtp_pcmu_depay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpPcmuDepay, gst_rtp_pcmu_depay,
GST_TYPE_BASE_RTP_DEPAYLOAD);
static void
-gst_rtp_pcmu_depay_base_init (gpointer klass)
+gst_rtp_pcmu_depay_class_init (GstRtpPcmuDepayClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstElementClass *gstelement_class;
+ GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
+
+ gstelement_class = (GstElementClass *) klass;
+ gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_pcmu_depay_src_template));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_pcmu_depay_sink_template));
- gst_element_class_set_details_simple (element_class, "RTP PCMU depayloader",
- "Codec/Depayloader/Network/RTP",
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "RTP PCMU depayloader", "Codec/Depayloader/Network/RTP",
"Extracts PCMU audio from RTP packets",
"Edgard Lima <edgard.lima@indt.org.br>, Zeeshan Ali <zeenix@gmail.com>");
-}
-
-static void
-gst_rtp_pcmu_depay_class_init (GstRtpPcmuDepayClass * klass)
-{
- GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
-
- gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
gstbasertpdepayload_class->process = gst_rtp_pcmu_depay_process;
gstbasertpdepayload_class->set_caps = gst_rtp_pcmu_depay_setcaps;
}
static void
-gst_rtp_pcmu_depay_init (GstRtpPcmuDepay * rtppcmudepay,
- GstRtpPcmuDepayClass * klass)
+gst_rtp_pcmu_depay_init (GstRtpPcmuDepay * rtppcmudepay)
{
GstBaseRTPDepayload *depayload;
GstBuffer *outbuf = NULL;
guint len;
gboolean marker;
+ GstRTPBuffer rtp = { NULL };
+
+ gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
- marker = gst_rtp_buffer_get_marker (buf);
+ marker = gst_rtp_buffer_get_marker (&rtp);
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
- GST_BUFFER_SIZE (buf), marker,
- gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
+ gst_buffer_get_size (buf), marker,
+ gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp));
- len = gst_rtp_buffer_get_payload_len (buf);
- outbuf = gst_rtp_buffer_get_payload_buffer (buf);
+ len = gst_rtp_buffer_get_payload_len (&rtp);
+ outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
+ gst_rtp_buffer_unmap (&rtp);
GST_BUFFER_DURATION (outbuf) =
gst_util_uint64_scale_int (len, GST_SECOND, depayload->clock_rate);
static gboolean gst_rtp_pcmu_pay_setcaps (GstBaseRTPPayload * payload,
GstCaps * caps);
-GST_BOILERPLATE (GstRtpPcmuPay, gst_rtp_pcmu_pay, GstBaseRTPAudioPayload,
+#define gst_rtp_pcmu_pay_parent_class parent_class
+G_DEFINE_TYPE (GstRtpPcmuPay, gst_rtp_pcmu_pay,
GST_TYPE_BASE_RTP_AUDIO_PAYLOAD);
static void
-gst_rtp_pcmu_pay_base_init (gpointer klass)
+gst_rtp_pcmu_pay_class_init (GstRtpPcmuPayClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstElementClass *gstelement_class;
+ GstBaseRTPPayloadClass *gstbasertppayload_class;
+
+ gstelement_class = (GstElementClass *) klass;
+ gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_pcmu_pay_sink_template));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_pcmu_pay_src_template));
- gst_element_class_set_details_simple (element_class, "RTP PCMU payloader",
+
+ gst_element_class_set_details_simple (gstelement_class, "RTP PCMU payloader",
"Codec/Payloader/Network/RTP",
"Payload-encodes PCMU audio into a RTP packet",
"Edgard Lima <edgard.lima@indt.org.br>");
-}
-
-static void
-gst_rtp_pcmu_pay_class_init (GstRtpPcmuPayClass * klass)
-{
- GstBaseRTPPayloadClass *gstbasertppayload_class;
-
- gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
gstbasertppayload_class->set_caps = gst_rtp_pcmu_pay_setcaps;
}
static void
-gst_rtp_pcmu_pay_init (GstRtpPcmuPay * rtppcmupay, GstRtpPcmuPayClass * klass)
+gst_rtp_pcmu_pay_init (GstRtpPcmuPay * rtppcmupay)
{
GstBaseRTPAudioPayload *basertpaudiopayload;