bump GDP to 0.1, add buffer flags

Original commit message from CVS:
bump GDP to 0.1, add buffer flags
This commit is contained in:
Thomas Vander Stichele 2004-06-09 16:24:19 +00:00
parent aea04009d0
commit 452faea68a
6 changed files with 40 additions and 5 deletions

View file

@ -1,3 +1,14 @@
2004-06-09 Thomas Vander Stichele <thomas at apestaart dot org>
* docs/random/gdp:
* libs/gst/dataprotocol/dataprotocol-test.c: (buffer_test):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer), (gst_dp_packet_from_caps),
(gst_dp_buffer_from_header):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
rev version to 0.1, add buffer flags and copy them
2004-06-09 Johan Dahlin <johan@gnome.org>
* gst/gstbuffer.c (gst_buffer_default_copy): Don't forget to merge

View file

@ -15,8 +15,8 @@ IDEAS
PROTOCOL
--------
* 1 byte GDP major version
* 1 byte GDP minor version
* 1 byte GDP major version (0)
* 1 byte GDP minor version (1)
* 1 byte GDP flags
* 1 byte GDP data type
1 for buffer, 2 caps, 65+ for events
@ -25,11 +25,16 @@ PROTOCOL
* 8 byte duration of buffer
* 8 byte offset
* 8 byte offset_end
* 16 byte future extension (ABI padding)
* 2 byte buffer data flags
* 14 byte future extension (ABI padding)
* 2 byte optional header crc
* 2 byte optional payload crc
* (length) payload
header: 60 bytes
PROTOCOL CHANGELOG
------------------
0.1: added two bytes for buffer flags
all numbers use network byte ordering.

View file

@ -116,6 +116,8 @@ buffer_test ()
GST_BUFFER_DURATION (buffer) = (GstClockTime) GST_SECOND;
GST_BUFFER_OFFSET (buffer) = (guint64) 10;
GST_BUFFER_OFFSET_END (buffer) = (guint64) 19;
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_IN_CAPS);
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_SUBBUFFER);
memmove (GST_BUFFER_DATA (buffer), "a buffer", 8);
/* create a buffer with CRC checking */
@ -158,6 +160,12 @@ buffer_test ()
if (GST_BUFFER_OFFSET_END (newbuffer) != GST_BUFFER_OFFSET_END (buffer)) {
g_error ("Offset ends don't match !");
}
if (GST_BUFFER_FLAG_IS_SET (newbuffer, GST_BUFFER_SUBBUFFER)) {
g_error ("GST_BUFFER_SUBBUFFER flag should not have been copied !");
}
if (!GST_BUFFER_FLAG_IS_SET (newbuffer, GST_BUFFER_IN_CAPS)) {
g_error ("GST_BUFFER_IN_CAPS flag should have been copied !");
}
g_free (header);
return 0;

View file

@ -163,6 +163,7 @@ gst_dp_header_from_buffer (const GstBuffer * buffer, GstDPHeaderFlag flags,
{
guint8 *h;
guint16 crc;
guint16 flags_mask;
g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
g_return_val_if_fail (GST_BUFFER_REFCOUNT_VALUE (buffer) > 0, FALSE);
@ -184,8 +185,16 @@ gst_dp_header_from_buffer (const GstBuffer * buffer, GstDPHeaderFlag flags,
GST_WRITE_UINT64_BE (h + 24, GST_BUFFER_OFFSET (buffer));
GST_WRITE_UINT64_BE (h + 32, GST_BUFFER_OFFSET_END (buffer));
/* data flags */
/* we only copy KEY_UNIT and IN_CAPS flags */
flags_mask = GST_DATA_FLAG_SHIFT (GST_BUFFER_KEY_UNIT) |
GST_DATA_FLAG_SHIFT (GST_BUFFER_IN_CAPS);
GST_WRITE_UINT16_BE (h + 40, GST_BUFFER_FLAGS (buffer) & flags_mask);
/* ABI padding */
GST_WRITE_UINT64_BE (h + 40, (guint64) 0);
GST_WRITE_UINT16_BE (h + 42, (guint64) 0);
GST_WRITE_UINT32_BE (h + 44, (guint64) 0);
GST_WRITE_UINT64_BE (h + 48, (guint64) 0);
/* CRC */
@ -419,6 +428,7 @@ gst_dp_buffer_from_header (guint header_length, const guint8 * header)
GST_BUFFER_DURATION (buffer) = GST_DP_HEADER_DURATION (header);
GST_BUFFER_OFFSET (buffer) = GST_DP_HEADER_OFFSET (header);
GST_BUFFER_OFFSET_END (buffer) = GST_DP_HEADER_OFFSET_END (header);
GST_BUFFER_FLAGS (buffer) = GST_DP_HEADER_BUFFER_FLAGS (header);
return buffer;
}

View file

@ -33,7 +33,7 @@ G_BEGIN_DECLS
/* GStreamer Data Protocol Version */
#define GST_DP_VERSION_MAJOR 0
#define GST_DP_VERSION_MINOR 0
#define GST_DP_VERSION_MINOR 1
#define GST_DP_HEADER_LENGTH 60 /* header size in bytes */

View file

@ -40,6 +40,7 @@ G_BEGIN_DECLS
#define GST_DP_HEADER_DURATION(x) GST_READ_UINT64_BE (x + 16)
#define GST_DP_HEADER_OFFSET(x) GST_READ_UINT64_BE (x + 24)
#define GST_DP_HEADER_OFFSET_END(x) GST_READ_UINT64_BE (x + 32)
#define GST_DP_HEADER_BUFFER_FLAGS(x) GST_READ_UINT16_BE (x + 40)
#define GST_DP_HEADER_CRC_HEADER(x) GST_READ_UINT16_BE (x + 56)
#define GST_DP_HEADER_CRC_PAYLOAD(x) GST_READ_UINT16_BE (x + 58)