diff options
-rw-r--r-- | gst/gdp/dataprotocol.c | 10 |
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); |