gdp: port code to new buffer data API

This commit is contained in:
Wim Taymans 2011-03-21 18:13:55 +01:00 committed by Tim-Philipp Müller
parent c25051cb01
commit 7ec4633cef

View file

@ -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);