summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2011-03-21 18:13:55 +0100
committerTim-Philipp Müller <tim@centricular.net>2012-09-11 01:54:41 +0100
commit7ec4633cef8e5ae0b3fd73f40dc5c0939ca4eb91 (patch)
tree66eea66e05fe52b5594dbf8f7a319f47abeaf420
parentc25051cb0160645e2c2d2175459c874bfd3e7d8e (diff)
gdp: port code to new buffer data API
-rw-r--r--gst/gdp/dataprotocol.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gst/gdp/dataprotocol.c b/gst/gdp/dataprotocol.c
index 2cecd6bf3..728b3f548 100644
--- a/gst/gdp/dataprotocol.c
+++ b/gst/gdp/dataprotocol.c
@@ -131,6 +131,8 @@ gst_dp_header_from_buffer_any (const GstBuffer * buffer, GstDPHeaderFlag flags,
{
guint8 *h;
guint16 flags_mask;
+ guint8 *data;
+ gsize size;
g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
g_return_val_if_fail (length, FALSE);
@@ -142,8 +144,10 @@ gst_dp_header_from_buffer_any (const GstBuffer * buffer, GstDPHeaderFlag flags,
/* version, flags, type */
GST_DP_INIT_HEADER (h, version, flags, GST_DP_PAYLOAD_BUFFER);
+ data = gst_buffer_map ((GstBuffer *) buffer, &size, NULL, GST_MAP_READ);
+
/* buffer properties */
- GST_WRITE_UINT32_BE (h + 6, GST_BUFFER_SIZE (buffer));
+ GST_WRITE_UINT32_BE (h + 6, size);
GST_WRITE_UINT64_BE (h + 10, GST_BUFFER_TIMESTAMP (buffer));
GST_WRITE_UINT64_BE (h + 18, GST_BUFFER_DURATION (buffer));
GST_WRITE_UINT64_BE (h + 26, GST_BUFFER_OFFSET (buffer));
@@ -157,7 +161,9 @@ gst_dp_header_from_buffer_any (const GstBuffer * buffer, GstDPHeaderFlag flags,
GST_WRITE_UINT16_BE (h + 42, GST_BUFFER_FLAGS (buffer) & flags_mask);
- GST_DP_SET_CRC (h, flags, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer));
+ GST_DP_SET_CRC (h, flags, data, size);
+
+ gst_buffer_unmap ((GstBuffer *) buffer, data, size);
GST_LOG ("created header from buffer:");
gst_dp_dump_byte_array (h, GST_DP_HEADER_LENGTH);