port more plugins to 0.11

This commit is contained in:
Wim Taymans 2011-04-18 10:54:43 +02:00
parent 7555d0949f
commit 4aa6ca5578
6 changed files with 101 additions and 63 deletions

View File

@ -129,7 +129,7 @@ static void gst_audio_panorama_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static gboolean gst_audio_panorama_get_unit_size (GstBaseTransform * base, static gboolean gst_audio_panorama_get_unit_size (GstBaseTransform * base,
GstCaps * caps, guint * size); GstCaps * caps, gsize * size);
static GstCaps *gst_audio_panorama_transform_caps (GstBaseTransform * base, static GstCaps *gst_audio_panorama_transform_caps (GstBaseTransform * base,
GstPadDirection direction, GstCaps * caps); GstPadDirection direction, GstCaps * caps);
static gboolean gst_audio_panorama_set_caps (GstBaseTransform * base, static gboolean gst_audio_panorama_set_caps (GstBaseTransform * base,
@ -315,7 +315,7 @@ gst_audio_panorama_get_property (GObject * object, guint prop_id,
static gboolean static gboolean
gst_audio_panorama_get_unit_size (GstBaseTransform * base, GstCaps * caps, gst_audio_panorama_get_unit_size (GstBaseTransform * base, GstCaps * caps,
guint * size) gsize * size)
{ {
gint width, channels; gint width, channels;
GstStructure *structure; GstStructure *structure;

View File

@ -184,10 +184,13 @@ gst_rtp_gst_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
gint payload_len; gint payload_len;
guint8 *payload; guint8 *payload;
guint CV; guint CV;
GstRTPBuffer rtp = { NULL };
rtpgstdepay = GST_RTP_GST_DEPAY (depayload); rtpgstdepay = GST_RTP_GST_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 <= 8) if (payload_len <= 8)
goto empty_packet; goto empty_packet;
@ -197,7 +200,7 @@ gst_rtp_gst_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
gst_adapter_clear (rtpgstdepay->adapter); gst_adapter_clear (rtpgstdepay->adapter);
} }
payload = gst_rtp_buffer_get_payload (buf); payload = gst_rtp_buffer_get_payload (&rtp);
/* strip off header /* strip off header
* *
@ -214,10 +217,10 @@ gst_rtp_gst_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
*/ */
/* subbuffer skipping the 8 header bytes */ /* subbuffer skipping the 8 header bytes */
subbuf = gst_rtp_buffer_get_payload_subbuffer (buf, 8, -1); subbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, 8, -1);
gst_adapter_push (rtpgstdepay->adapter, subbuf); gst_adapter_push (rtpgstdepay->adapter, subbuf);
if (gst_rtp_buffer_get_marker (buf)) { if (gst_rtp_buffer_get_marker (&rtp)) {
guint avail; guint avail;
GstCaps *outcaps; GstCaps *outcaps;
@ -228,25 +231,30 @@ gst_rtp_gst_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
CV = (payload[0] >> 4) & 0x7; CV = (payload[0] >> 4) & 0x7;
if (payload[0] & 0x80) { if (payload[0] & 0x80) {
guint b, csize, size, offset; guint b, csize, left, offset;
gsize size;
guint8 *data; guint8 *data;
GstBuffer *subbuf; GstBuffer *subbuf;
/* C bit, we have inline caps */ /* C bit, we have inline caps */
data = GST_BUFFER_DATA (outbuf); data = gst_buffer_map (outbuf, &size, NULL, GST_MAP_READ);
size = GST_BUFFER_SIZE (outbuf);
/* start reading the length, we need this to skip to the data later */ /* start reading the length, we need this to skip to the data later */
csize = offset = 0; csize = offset = 0;
left = size;
do { do {
if (offset >= size) if (offset >= left) {
gst_buffer_unmap (outbuf, data, size);
goto too_small; goto too_small;
}
b = data[offset++]; b = data[offset++];
csize = (csize << 7) | (b & 0x7f); csize = (csize << 7) | (b & 0x7f);
} while (b & 0x80); } while (b & 0x80);
if (size < csize) if (left < csize) {
gst_buffer_unmap (outbuf, data, size);
goto too_small; goto too_small;
}
/* parse and store in cache */ /* parse and store in cache */
outcaps = gst_caps_from_string ((gchar *) & data[offset]); outcaps = gst_caps_from_string ((gchar *) & data[offset]);
@ -254,17 +262,19 @@ gst_rtp_gst_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
/* skip caps */ /* skip caps */
offset += csize; offset += csize;
size -= csize; left -= csize;
GST_DEBUG_OBJECT (rtpgstdepay, GST_DEBUG_OBJECT (rtpgstdepay,
"inline caps %u, length %u, %" GST_PTR_FORMAT, CV, csize, outcaps); "inline caps %u, length %u, %" GST_PTR_FORMAT, CV, csize, outcaps);
/* create real data buffer when needed */ /* create real data buffer when needed */
if (size) if (size)
subbuf = gst_buffer_create_sub (outbuf, offset, size); subbuf =
gst_buffer_copy_region (outbuf, GST_BUFFER_COPY_ALL, offset, left);
else else
subbuf = NULL; subbuf = NULL;
gst_buffer_unmap (outbuf, data, size);
gst_buffer_unref (outbuf); gst_buffer_unref (outbuf);
outbuf = subbuf; outbuf = subbuf;
} }
@ -302,6 +312,7 @@ empty_packet:
{ {
GST_ELEMENT_WARNING (rtpgstdepay, STREAM, DECODE, GST_ELEMENT_WARNING (rtpgstdepay, STREAM, DECODE,
("Empty Payload."), (NULL)); ("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL; return NULL;
} }
too_small: too_small:
@ -310,6 +321,7 @@ too_small:
("Buffer too small."), (NULL)); ("Buffer too small."), (NULL));
if (outbuf) if (outbuf)
gst_buffer_unref (outbuf); gst_buffer_unref (outbuf);
gst_rtp_buffer_unmap (&rtp);
return NULL; return NULL;
} }
missing_caps: missing_caps:
@ -318,6 +330,7 @@ missing_caps:
("Missing caps %u.", CV), (NULL)); ("Missing caps %u.", CV), (NULL));
if (outbuf) if (outbuf)
gst_buffer_unref (outbuf); gst_buffer_unref (outbuf);
gst_rtp_buffer_unmap (&rtp);
return NULL; return NULL;
} }
} }

View File

@ -131,8 +131,8 @@ gst_rtp_gst_pay_handle_buffer (GstBaseRTPPayload * basepayload,
GstBuffer * buffer) GstBuffer * buffer)
{ {
GstRtpGSTPay *rtpgstpay; GstRtpGSTPay *rtpgstpay;
guint8 *data; guint8 *data, *ptr;
guint size; gsize size, left;
GstBuffer *outbuf; GstBuffer *outbuf;
GstFlowReturn ret; GstFlowReturn ret;
GstClockTime timestamp; GstClockTime timestamp;
@ -141,8 +141,7 @@ gst_rtp_gst_pay_handle_buffer (GstBaseRTPPayload * basepayload,
rtpgstpay = GST_RTP_GST_PAY (basepayload); rtpgstpay = GST_RTP_GST_PAY (basepayload);
size = GST_BUFFER_SIZE (buffer); data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
data = GST_BUFFER_DATA (buffer);
timestamp = GST_BUFFER_TIMESTAMP (buffer); timestamp = GST_BUFFER_TIMESTAMP (buffer);
ret = GST_FLOW_OK; ret = GST_FLOW_OK;
@ -168,15 +167,18 @@ gst_rtp_gst_pay_handle_buffer (GstBaseRTPPayload * basepayload,
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/ */
frag_offset = 0; frag_offset = 0;
ptr = data;
left = size;
while (size > 0) { while (left > 0) {
guint towrite; guint towrite;
guint8 *payload; guint8 *payload;
guint payload_len; guint payload_len;
guint packet_len; guint packet_len;
GstRTPBuffer rtp = { NULL };
/* this will be the total lenght of the packet */ /* this will be the total lenght of the packet */
packet_len = gst_rtp_buffer_calc_packet_len (8 + size, 0, 0); packet_len = gst_rtp_buffer_calc_packet_len (8 + left, 0, 0);
/* fill one MTU or all available bytes */ /* fill one MTU or all available bytes */
towrite = MIN (packet_len, GST_BASE_RTP_PAYLOAD_MTU (rtpgstpay)); towrite = MIN (packet_len, GST_BASE_RTP_PAYLOAD_MTU (rtpgstpay));
@ -186,7 +188,9 @@ gst_rtp_gst_pay_handle_buffer (GstBaseRTPPayload * basepayload,
/* create buffer to hold the payload */ /* create buffer to hold the payload */
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0); outbuf = gst_rtp_buffer_new_allocate (payload_len, 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);
payload[0] = flags; payload[0] = flags;
payload[1] = payload[2] = payload[3] = 0; payload[1] = payload[2] = payload[3] = 0;
@ -198,19 +202,22 @@ gst_rtp_gst_pay_handle_buffer (GstBaseRTPPayload * basepayload,
payload += 8; payload += 8;
payload_len -= 8; payload_len -= 8;
memcpy (payload, data, payload_len); memcpy (payload, ptr, payload_len);
data += payload_len; ptr += payload_len;
size -= payload_len; left -= payload_len;
frag_offset += payload_len; frag_offset += payload_len;
if (size == 0) if (left == 0)
gst_rtp_buffer_set_marker (outbuf, TRUE); gst_rtp_buffer_set_marker (&rtp, TRUE);
gst_rtp_buffer_unmap (&rtp);
GST_BUFFER_TIMESTAMP (outbuf) = timestamp; GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
ret = gst_basertppayload_push (basepayload, outbuf); ret = gst_basertppayload_push (basepayload, outbuf);
} }
gst_buffer_unmap (buffer, data, size);
return ret; return ret;
} }

View File

@ -179,14 +179,19 @@ gst_rtp_ilbc_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{ {
GstBuffer *outbuf; GstBuffer *outbuf;
gboolean marker; gboolean marker;
GstRTPBuffer rtp = { NULL };
marker = gst_rtp_buffer_get_marker (buf); gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
marker = gst_rtp_buffer_get_marker (&rtp);
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d", GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
GST_BUFFER_SIZE (buf), marker, gst_buffer_get_size (buf), marker,
gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf)); gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp));
outbuf = gst_rtp_buffer_get_payload_buffer (buf); outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
gst_rtp_buffer_unmap (&rtp);
if (marker) { if (marker) {
/* mark start of talkspurt with DISCONT */ /* mark start of talkspurt with DISCONT */

View File

@ -122,18 +122,25 @@ gst_rtp_mpa_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{ {
GstRtpMPADepay *rtpmpadepay; GstRtpMPADepay *rtpmpadepay;
GstBuffer *outbuf; GstBuffer *outbuf;
GstRTPBuffer rtp = { NULL };
gint payload_len;
#if 0
guint8 *payload;
guint16 frag_offset;
#endif
gboolean marker;
rtpmpadepay = GST_RTP_MPA_DEPAY (depayload); rtpmpadepay = GST_RTP_MPA_DEPAY (depayload);
{ gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
gint payload_len;
gboolean marker;
payload_len = gst_rtp_buffer_get_payload_len (buf); payload_len = gst_rtp_buffer_get_payload_len (&rtp);
if (payload_len <= 4) if (payload_len <= 4)
goto empty_packet; goto empty_packet;
#if 0
payload = gst_rtp_buffer_get_payload (&rtp);
/* strip off header /* strip off header
* *
* 0 1 2 3 * 0 1 2 3
@ -142,11 +149,12 @@ gst_rtp_mpa_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
* | MBZ | Frag_offset | * | MBZ | Frag_offset |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/ */
/* frag_offset = (payload[2] << 8) | payload[3]; */ frag_offset = (payload[2] << 8) | payload[3];
#endif
/* subbuffer skipping the 4 header bytes */ /* subbuffer skipping the 4 header bytes */
outbuf = gst_rtp_buffer_get_payload_subbuffer (buf, 4, -1); outbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, 4, -1);
marker = gst_rtp_buffer_get_marker (buf); marker = gst_rtp_buffer_get_marker (&rtp);
if (marker) { if (marker) {
/* mark start of talkspurt with discont */ /* mark start of talkspurt with discont */
@ -154,20 +162,20 @@ gst_rtp_mpa_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
} }
GST_DEBUG_OBJECT (rtpmpadepay, GST_DEBUG_OBJECT (rtpmpadepay,
"gst_rtp_mpa_depay_chain: pushing buffer of size %d", "gst_rtp_mpa_depay_chain: pushing buffer of size %d",
GST_BUFFER_SIZE (outbuf)); gst_buffer_get_size (outbuf));
gst_rtp_buffer_unmap (&rtp);
/* FIXME, we can push half mpeg frames when they are split over multiple /* FIXME, we can push half mpeg frames when they are split over multiple
* RTP packets */ * RTP packets */
return outbuf; return outbuf;
}
return NULL;
/* ERRORS */ /* ERRORS */
empty_packet: empty_packet:
{ {
GST_ELEMENT_WARNING (rtpmpadepay, STREAM, DECODE, GST_ELEMENT_WARNING (rtpmpadepay, STREAM, DECODE,
("Empty Payload."), (NULL)); ("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL; return NULL;
} }
} }

View File

@ -192,6 +192,7 @@ gst_rtp_mpa_pay_flush (GstRtpMPAPay * rtpmpapay)
guint8 *payload; guint8 *payload;
guint payload_len; guint payload_len;
guint packet_len; guint packet_len;
GstRTPBuffer rtp = { NULL };
/* this will be the total length of the packet */ /* this will be the total length of the packet */
packet_len = gst_rtp_buffer_calc_packet_len (4 + avail, 0, 0); packet_len = gst_rtp_buffer_calc_packet_len (4 + avail, 0, 0);
@ -205,9 +206,11 @@ gst_rtp_mpa_pay_flush (GstRtpMPAPay * rtpmpapay)
/* create buffer to hold the payload */ /* create buffer to hold the payload */
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0); outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
payload_len -= 4; payload_len -= 4;
gst_rtp_buffer_set_payload_type (outbuf, GST_RTP_PAYLOAD_MPA); gst_rtp_buffer_set_payload_type (&rtp, GST_RTP_PAYLOAD_MPA);
/* /*
* 0 1 2 3 * 0 1 2 3
@ -216,7 +219,7 @@ gst_rtp_mpa_pay_flush (GstRtpMPAPay * rtpmpapay)
* | MBZ | Frag_offset | * | MBZ | Frag_offset |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/ */
payload = gst_rtp_buffer_get_payload (outbuf); payload = gst_rtp_buffer_get_payload (&rtp);
payload[0] = 0; payload[0] = 0;
payload[1] = 0; payload[1] = 0;
payload[2] = frag_offset >> 8; payload[2] = frag_offset >> 8;
@ -229,7 +232,9 @@ gst_rtp_mpa_pay_flush (GstRtpMPAPay * rtpmpapay)
frag_offset += payload_len; frag_offset += payload_len;
if (avail == 0) if (avail == 0)
gst_rtp_buffer_set_marker (outbuf, TRUE); gst_rtp_buffer_set_marker (&rtp, TRUE);
gst_rtp_buffer_unmap (&rtp);
GST_BUFFER_TIMESTAMP (outbuf) = rtpmpapay->first_ts; GST_BUFFER_TIMESTAMP (outbuf) = rtpmpapay->first_ts;
GST_BUFFER_DURATION (outbuf) = rtpmpapay->duration; GST_BUFFER_DURATION (outbuf) = rtpmpapay->duration;
@ -252,7 +257,7 @@ gst_rtp_mpa_pay_handle_buffer (GstBaseRTPPayload * basepayload,
rtpmpapay = GST_RTP_MPA_PAY (basepayload); rtpmpapay = GST_RTP_MPA_PAY (basepayload);
size = GST_BUFFER_SIZE (buffer); size = gst_buffer_get_size (buffer);
duration = GST_BUFFER_DURATION (buffer); duration = GST_BUFFER_DURATION (buffer);
timestamp = GST_BUFFER_TIMESTAMP (buffer); timestamp = GST_BUFFER_TIMESTAMP (buffer);