From 8c7da1d42684b434e7d504dfbbbd0de552d90b02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 7 Jun 2016 11:32:47 +0300 Subject: [PATCH] adapter: Rename functions and implement new functions, update test We don't do calculations with different units (buffer offsets and bytes) anymore but have functions for: 1) getting the number of bytes since the last discont 2) getting the offset (and pts/dts) at the last discont and the previously added function to get the last offset and its distance from the current adapter position. https://bugzilla.gnome.org/show_bug.cgi?id=766647 --- docs/libs/gstreamer-libs-sections.txt | 5 +- libs/gst/base/gstadapter.c | 125 +++++++++++++++----- libs/gst/base/gstadapter.h | 7 +- tests/check/libs/adapter.c | 159 ++++++++++++++++++++++---- win32/common/libgstbase.def | 5 +- 5 files changed, 245 insertions(+), 56 deletions(-) diff --git a/docs/libs/gstreamer-libs-sections.txt b/docs/libs/gstreamer-libs-sections.txt index a43624d287..a37b9187c0 100644 --- a/docs/libs/gstreamer-libs-sections.txt +++ b/docs/libs/gstreamer-libs-sections.txt @@ -179,7 +179,10 @@ gst_adapter_prev_dts gst_adapter_prev_pts_at_offset gst_adapter_prev_dts_at_offset gst_adapter_prev_offset -gst_adapter_get_offset_from_discont +gst_adapter_pts_at_discont +gst_adapter_dts_at_discont +gst_adapter_offset_at_discont +gst_adapter_distance_from_discont gst_adapter_masked_scan_uint32 gst_adapter_masked_scan_uint32_peek diff --git a/libs/gst/base/gstadapter.c b/libs/gst/base/gstadapter.c index c37d2de28d..079a2b511e 100644 --- a/libs/gst/base/gstadapter.c +++ b/libs/gst/base/gstadapter.c @@ -96,12 +96,13 @@ * (#GST_BUFFER_OFFSET) that were pushed. The last seen offset before the * current position can be queried with gst_adapter_prev_offset(). This function * can optionally return the number of bytes between the start of the buffer - * that carried the offset and the current adapter position. If the meaning of - * #GST_BUFFER_OFFSET for the stream being handled corresponds to bytes, then - * the accumulated offset since the last #GST_BUFFER_FLAG_DISCONT buffer can be - * queried with gst_adapter_get_offset_from_discont(). This is useful for - * elements that want to track the position of data in the stream based on the - * offset of the incoming buffers. + * that carried the offset and the current adapter position. + * + * Additionally the adapter also keeps track of the PTS, DTS and buffer offset + * at the last discontinuity, which can be retrieved with + * gst_adapter_pts_at_discont(), gst_adapter_dts_at_discont() and + * gst_adapter_offset_at_discont(). The number of bytes that were consumed + * since then can be queried with gst_adapter_distance_from_discont(). * * A last thing to note is that while #GstAdapter is pretty optimized, * merging buffers still might be an operation that requires a malloc() and @@ -129,8 +130,6 @@ /* default size for the assembled data buffer */ #define DEFAULT_SIZE 4096 -#define INCREASE_OFFSET(a, offs) if ((a)->offset_discont != GST_BUFFER_OFFSET_NONE) { (a)->offset_discont += (offs); } - static void gst_adapter_flush_unchecked (GstAdapter * adapter, gsize flush); GST_DEBUG_CATEGORY_STATIC (gst_adapter_debug); @@ -162,7 +161,11 @@ struct _GstAdapter gsize scan_offset; GSList *scan_entry; - guint64 offset_discont; + GstClockTime pts_at_discont; + GstClockTime dts_at_discont; + guint64 offset_at_discont; + + guint64 distance_from_discont; GstMapInfo info; }; @@ -200,7 +203,10 @@ gst_adapter_init (GstAdapter * adapter) adapter->dts_distance = 0; adapter->offset = GST_BUFFER_OFFSET_NONE; adapter->offset_distance = 0; - adapter->offset_discont = GST_BUFFER_OFFSET_NONE; + adapter->pts_at_discont = GST_CLOCK_TIME_NONE; + adapter->dts_at_discont = GST_CLOCK_TIME_NONE; + adapter->offset_at_discont = GST_BUFFER_OFFSET_NONE; + adapter->distance_from_discont = 0; } static void @@ -264,9 +270,12 @@ gst_adapter_clear (GstAdapter * adapter) adapter->dts_distance = 0; adapter->offset = GST_BUFFER_OFFSET_NONE; adapter->offset_distance = 0; + adapter->pts_at_discont = GST_CLOCK_TIME_NONE; + adapter->dts_at_discont = GST_CLOCK_TIME_NONE; + adapter->offset_at_discont = GST_BUFFER_OFFSET_NONE; + adapter->distance_from_discont = 0; adapter->scan_offset = 0; adapter->scan_entry = NULL; - adapter->offset_discont = GST_BUFFER_OFFSET_NONE; } static inline void @@ -288,17 +297,19 @@ update_timestamps_and_offset (GstAdapter * adapter, GstBuffer * buf) adapter->dts_distance = 0; } offset = GST_BUFFER_OFFSET (buf); - if (GST_BUFFER_IS_DISCONT (buf)) { - /* Take offset as-is (might be NONE) */ - adapter->offset_discont = offset; - GST_LOG_OBJECT (adapter, "offset discont now %" G_GUINT64_FORMAT, - adapter->offset_discont); - } if (offset != GST_BUFFER_OFFSET_NONE) { GST_LOG_OBJECT (adapter, "new offset %" G_GUINT64_FORMAT, offset); adapter->offset = offset; adapter->offset_distance = 0; } + + if (GST_BUFFER_IS_DISCONT (buf)) { + /* Take values as-is (might be NONE) */ + adapter->pts_at_discont = pts; + adapter->dts_at_discont = dts; + adapter->offset_at_discont = offset; + adapter->distance_from_discont = 0; + } } /* copy data into @dest, skipping @skip bytes from the head buffers */ @@ -634,7 +645,7 @@ gst_adapter_flush_unchecked (GstAdapter * adapter, gsize flush) adapter->pts_distance -= adapter->skip; adapter->dts_distance -= adapter->skip; adapter->offset_distance -= adapter->skip; - INCREASE_OFFSET (adapter, -adapter->skip); + adapter->distance_from_discont -= adapter->skip; g = adapter->buflist; cur = g->data; @@ -645,8 +656,8 @@ gst_adapter_flush_unchecked (GstAdapter * adapter, gsize flush) adapter->pts_distance += size; adapter->dts_distance += size; adapter->offset_distance += size; + adapter->distance_from_discont += size; flush -= size; - INCREASE_OFFSET (adapter, size); gst_buffer_unref (cur); g = g_slist_delete_link (g, g); @@ -668,7 +679,7 @@ gst_adapter_flush_unchecked (GstAdapter * adapter, gsize flush) adapter->pts_distance += flush; adapter->dts_distance += flush; adapter->offset_distance += flush; - INCREASE_OFFSET (adapter, flush); + adapter->distance_from_discont += flush; /* invalidate scan position */ adapter->scan_offset = 0; adapter->scan_entry = NULL; @@ -1354,24 +1365,81 @@ gst_adapter_available_fast (GstAdapter * adapter) } /** - * gst_adapter_get_offset_from_discont: + * gst_adapter_get_distance_from_discont: * @adapter: a #GstAdapter * - * Get the offset of the adapter based on the incoming buffer offset. Will only - * return valid values if the incoming buffers have valid offsets set on them. + * Get the distance in bytes since the last buffer with the + * %GST_BUFFER_FLAG_DISCONT flag. * - * The offset will be initially recorded for all buffers with - * %GST_BUFFER_FLAG_DISCONT on them, and then calculated for all other following - * buffers based on their size. + * The distance will be reset to 0 for all buffers with + * %GST_BUFFER_FLAG_DISCONT on them, and then calculated for all other + * following buffers based on their size. * * Since: 1.10 * * Returns: The offset. Can be %GST_BUFFER_OFFSET_NONE. */ guint64 -gst_adapter_get_offset_from_discont (GstAdapter * adapter) +gst_adapter_distance_from_discont (GstAdapter * adapter) { - return adapter->offset_discont; + return adapter->distance_from_discont; +} + +/** + * gst_adapter_offset_at_discont: + * @adapter: a #GstAdapter + * + * Get the offset that was on the last buffer with the GST_BUFFER_FLAG_DISCONT + * flag, or GST_BUFFER_OFFSET_NONE. + * + * Since: 1.10 + * + * Returns: The offset at the last discont or GST_BUFFER_OFFSET_NONE. + */ +guint64 +gst_adapter_offset_at_discont (GstAdapter * adapter) +{ + g_return_val_if_fail (GST_IS_ADAPTER (adapter), GST_BUFFER_OFFSET_NONE); + + return adapter->offset_at_discont; +} + +/** + * gst_adapter_pts_at_discont: + * @adapter: a #GstAdapter + * + * Get the PTS that was on the last buffer with the GST_BUFFER_FLAG_DISCONT + * flag, or GST_CLOCK_TIME_NONE. + * + * Since: 1.10 + * + * Returns: The PTS at the last discont or GST_CLOCK_TIME_NONE. + */ +GstClockTime +gst_adapter_pts_at_discont (GstAdapter * adapter) +{ + g_return_val_if_fail (GST_IS_ADAPTER (adapter), GST_CLOCK_TIME_NONE); + + return adapter->pts_at_discont; +} + +/** + * gst_adapter_dts_at_discont: + * @adapter: a #GstAdapter + * + * Get the DTS that was on the last buffer with the GST_BUFFER_FLAG_DISCONT + * flag, or GST_CLOCK_TIME_NONE. + * + * Since: 1.10 + * + * Returns: The DTS at the last discont or GST_CLOCK_TIME_NONE. + */ +GstClockTime +gst_adapter_dts_at_discont (GstAdapter * adapter) +{ + g_return_val_if_fail (GST_IS_ADAPTER (adapter), GST_CLOCK_TIME_NONE); + + return adapter->dts_at_discont; } /** @@ -1401,7 +1469,6 @@ gst_adapter_prev_offset (GstAdapter * adapter, guint64 * distance) *distance = adapter->offset_distance; return adapter->offset; - } /** diff --git a/libs/gst/base/gstadapter.h b/libs/gst/base/gstadapter.h index 92d9ba35fa..23cc2504b2 100644 --- a/libs/gst/base/gstadapter.h +++ b/libs/gst/base/gstadapter.h @@ -76,7 +76,12 @@ GstClockTime gst_adapter_prev_dts (GstAdapter *adapter, gu GstClockTime gst_adapter_prev_pts_at_offset (GstAdapter * adapter, gsize offset, guint64 * distance); GstClockTime gst_adapter_prev_dts_at_offset (GstAdapter * adapter, gsize offset, guint64 * distance); guint64 gst_adapter_prev_offset (GstAdapter *adapter, guint64 *distance); -guint64 gst_adapter_get_offset_from_discont (GstAdapter *adapter); + +GstClockTime gst_adapter_pts_at_discont (GstAdapter *adapter); +GstClockTime gst_adapter_dts_at_discont (GstAdapter *adapter); +guint64 gst_adapter_offset_at_discont (GstAdapter *adapter); + +guint64 gst_adapter_distance_from_discont (GstAdapter *adapter); gssize gst_adapter_masked_scan_uint32 (GstAdapter * adapter, guint32 mask, guint32 pattern, gsize offset, gsize size); diff --git a/tests/check/libs/adapter.c b/tests/check/libs/adapter.c index a0b7070667..f503245def 100644 --- a/tests/check/libs/adapter.c +++ b/tests/check/libs/adapter.c @@ -381,9 +381,20 @@ GST_START_TEST (test_timestamp) fail_unless (timestamp == GST_CLOCK_TIME_NONE); fail_unless (dist == 0); + timestamp = gst_adapter_pts_at_discont (adapter); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + /* Offset should be undefined */ - offset = gst_adapter_get_offset_from_discont (adapter); + offset = gst_adapter_prev_offset (adapter, &dist); fail_unless (offset == GST_BUFFER_OFFSET_NONE); + fail_unless (dist == 0); + + offset = gst_adapter_offset_at_discont (adapter); + fail_unless (offset == GST_CLOCK_TIME_NONE); + + /* 0 bytes since discont */ + dist = gst_adapter_distance_from_discont (adapter); + fail_unless (dist == 0); gst_adapter_flush (adapter, 50); avail = gst_adapter_available (adapter); @@ -394,9 +405,20 @@ GST_START_TEST (test_timestamp) fail_unless (timestamp == GST_CLOCK_TIME_NONE); fail_unless (dist == 50); + timestamp = gst_adapter_pts_at_discont (adapter); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + /* Offset still undefined */ - offset = gst_adapter_get_offset_from_discont (adapter); + offset = gst_adapter_prev_offset (adapter, &dist); fail_unless (offset == GST_BUFFER_OFFSET_NONE); + fail_unless (dist == 50); + + offset = gst_adapter_offset_at_discont (adapter); + fail_unless (offset == GST_CLOCK_TIME_NONE); + + /* 50 bytes since discont */ + dist = gst_adapter_distance_from_discont (adapter); + fail_unless (dist == 50); buffer = gst_buffer_new_and_alloc (100); GST_BUFFER_TIMESTAMP (buffer) = 1 * GST_SECOND; @@ -411,6 +433,21 @@ GST_START_TEST (test_timestamp) fail_unless (timestamp == GST_CLOCK_TIME_NONE); fail_unless (dist == 50); + timestamp = gst_adapter_pts_at_discont (adapter); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + + /* Offset still undefined */ + offset = gst_adapter_prev_offset (adapter, &dist); + fail_unless (offset == GST_BUFFER_OFFSET_NONE); + fail_unless (dist == 50); + + offset = gst_adapter_offset_at_discont (adapter); + fail_unless (offset == GST_CLOCK_TIME_NONE); + + /* 50 bytes since discont */ + dist = gst_adapter_distance_from_discont (adapter); + fail_unless (dist == 50); + /* flush out first buffer we are now at the second buffer timestamp */ gst_adapter_flush (adapter, 50); avail = gst_adapter_available (adapter); @@ -420,6 +457,14 @@ GST_START_TEST (test_timestamp) fail_unless (timestamp == 1 * GST_SECOND); fail_unless (dist == 0); + /* timestamp was undefined at discont */ + timestamp = gst_adapter_pts_at_discont (adapter); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + + /* 100 bytes since discont */ + dist = gst_adapter_distance_from_discont (adapter); + fail_unless (dist == 100); + /* move some more, still the same timestamp but further away */ gst_adapter_flush (adapter, 50); avail = gst_adapter_available (adapter); @@ -429,6 +474,10 @@ GST_START_TEST (test_timestamp) fail_unless (timestamp == 1 * GST_SECOND); fail_unless (dist == 50); + /* timestamp was undefined at discont */ + timestamp = gst_adapter_pts_at_discont (adapter); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + /* push a buffer without timestamp in the adapter */ buffer = gst_buffer_new_and_alloc (100); gst_adapter_push (adapter, buffer); @@ -446,6 +495,10 @@ GST_START_TEST (test_timestamp) fail_unless (timestamp == 1 * GST_SECOND); fail_unless (dist == 50); + /* timestamp was undefined at discont */ + timestamp = gst_adapter_pts_at_discont (adapter); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + /* flush away buffer with the timestamp */ gst_adapter_flush (adapter, 50); avail = gst_adapter_available (adapter); @@ -454,6 +507,10 @@ GST_START_TEST (test_timestamp) fail_unless (timestamp == 1 * GST_SECOND); fail_unless (dist == 100); + /* timestamp was undefined at discont */ + timestamp = gst_adapter_pts_at_discont (adapter); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + /* move into the second buffer */ gst_adapter_flush (adapter, 50); avail = gst_adapter_available (adapter); @@ -462,6 +519,10 @@ GST_START_TEST (test_timestamp) fail_unless (timestamp == 1 * GST_SECOND); fail_unless (dist == 150); + /* timestamp was undefined at discont */ + timestamp = gst_adapter_pts_at_discont (adapter); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + /* move to third buffer we move to the new timestamp */ gst_adapter_flush (adapter, 50); avail = gst_adapter_available (adapter); @@ -470,6 +531,10 @@ GST_START_TEST (test_timestamp) fail_unless (timestamp == 2 * GST_SECOND); fail_unless (dist == 0); + /* timestamp was undefined at discont */ + timestamp = gst_adapter_pts_at_discont (adapter); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + /* move everything out */ gst_adapter_flush (adapter, 100); avail = gst_adapter_available (adapter); @@ -486,6 +551,10 @@ GST_START_TEST (test_timestamp) fail_unless (timestamp == GST_CLOCK_TIME_NONE); fail_unless (dist == 0); + /* timestamp was undefined at discont */ + timestamp = gst_adapter_pts_at_discont (adapter); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + /* push an empty buffer with timestamp in the adapter */ buffer = gst_buffer_new (); GST_BUFFER_TIMESTAMP (buffer) = 2 * GST_SECOND; @@ -496,6 +565,11 @@ GST_START_TEST (test_timestamp) fail_unless (timestamp == 2 * GST_SECOND); fail_unless (dist == 0); + /* timestamp was undefined at discont (clearing the adapter is not + * necessarily a discont) */ + timestamp = gst_adapter_pts_at_discont (adapter); + fail_unless (timestamp == GST_CLOCK_TIME_NONE); + /* push another empty buffer */ buffer = gst_buffer_new (); GST_BUFFER_TIMESTAMP (buffer) = 3 * GST_SECOND; @@ -591,23 +665,31 @@ GST_START_TEST (test_offset) fail_unless (avail == 100); /* Offset should be undefined */ - offset = gst_adapter_get_offset_from_discont (adapter); - fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET_NONE); + offset = gst_adapter_distance_from_discont (adapter); + fail_unless_equals_uint64 (offset, 0); offset = gst_adapter_prev_offset (adapter, &dist); fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET_NONE); fail_unless_equals_int (dist, 0); + /* Offset is undefined */ + offset = gst_adapter_offset_at_discont (adapter); + fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET_NONE); + gst_adapter_flush (adapter, 50); avail = gst_adapter_available (adapter); fail_unless (avail == 50); /* Offset still undefined, dist changed though */ - offset = gst_adapter_get_offset_from_discont (adapter); - fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET_NONE); + offset = gst_adapter_distance_from_discont (adapter); + fail_unless_equals_uint64 (offset, 50); offset = gst_adapter_prev_offset (adapter, &dist); fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET_NONE); fail_unless_equals_int (dist, 50); + /* Offset is undefined */ + offset = gst_adapter_offset_at_discont (adapter); + fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET_NONE); + /* Let's push in a discont buffer with a valid offset */ buffer = gst_buffer_new_and_alloc (100); GST_BUFFER_OFFSET (buffer) = 10000; @@ -619,34 +701,45 @@ GST_START_TEST (test_offset) fail_unless (avail == 150); /* offset is still undefined */ - offset = gst_adapter_get_offset_from_discont (adapter); - fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET_NONE); + offset = gst_adapter_distance_from_discont (adapter); + fail_unless_equals_uint64 (offset, 50); offset = gst_adapter_prev_offset (adapter, &dist); fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET_NONE); fail_unless_equals_int (dist, 50); + /* Offset is undefined */ + offset = gst_adapter_offset_at_discont (adapter); + fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET_NONE); + /* flush out first buffer we are now at the second buffer offset */ gst_adapter_flush (adapter, 50); avail = gst_adapter_available (adapter); fail_unless (avail == 100); - offset = gst_adapter_get_offset_from_discont (adapter); - fail_unless_equals_uint64 (offset, 10000); + offset = gst_adapter_distance_from_discont (adapter); + fail_unless_equals_uint64 (offset, 0); offset = gst_adapter_prev_offset (adapter, &dist); fail_unless_equals_uint64 (offset, 10000); fail_unless_equals_int (dist, 0); + /* Offset should be defined now */ + offset = gst_adapter_offset_at_discont (adapter); + fail_unless_equals_uint64 (offset, 10000); + /* move some more, we should have an updated offset */ gst_adapter_flush (adapter, 50); avail = gst_adapter_available (adapter); fail_unless (avail == 50); - offset = gst_adapter_get_offset_from_discont (adapter); - fail_unless_equals_uint64 (offset, 10050); + offset = gst_adapter_distance_from_discont (adapter); + fail_unless_equals_uint64 (offset, 50); offset = gst_adapter_prev_offset (adapter, &dist); fail_unless_equals_uint64 (offset, 10000); fail_unless_equals_int (dist, 50); + offset = gst_adapter_offset_at_discont (adapter); + fail_unless_equals_uint64 (offset, 10000); + /* push a buffer without offset in the adapter (contiguous with the other) */ buffer = gst_buffer_new_and_alloc (100); @@ -663,65 +756,83 @@ GST_START_TEST (test_offset) fail_unless (avail == 250); /* offset still as it was before the push */ - offset = gst_adapter_get_offset_from_discont (adapter); - fail_unless_equals_uint64 (offset, 10050); + offset = gst_adapter_distance_from_discont (adapter); + fail_unless_equals_uint64 (offset, 50); offset = gst_adapter_prev_offset (adapter, &dist); fail_unless_equals_uint64 (offset, 10000); fail_unless_equals_int (dist, 50); + offset = gst_adapter_offset_at_discont (adapter); + fail_unless_equals_uint64 (offset, 10000); + /* flush away buffer with the offset */ gst_adapter_flush (adapter, 50); avail = gst_adapter_available (adapter); fail_unless (avail == 200); - offset = gst_adapter_get_offset_from_discont (adapter); - fail_unless_equals_uint64 (offset, 10100); + offset = gst_adapter_distance_from_discont (adapter); + fail_unless_equals_uint64 (offset, 100); /* The previous valid offset seen is now 100 bytes away */ offset = gst_adapter_prev_offset (adapter, &dist); fail_unless_equals_uint64 (offset, 10000); fail_unless_equals_int (dist, 100); + offset = gst_adapter_offset_at_discont (adapter); + fail_unless_equals_uint64 (offset, 10000); + /* move into the second buffer */ gst_adapter_flush (adapter, 50); avail = gst_adapter_available (adapter); fail_unless (avail == 150); - offset = gst_adapter_get_offset_from_discont (adapter); - fail_unless_equals_uint64 (offset, 10150); + offset = gst_adapter_distance_from_discont (adapter); + fail_unless_equals_uint64 (offset, 150); offset = gst_adapter_prev_offset (adapter, &dist); fail_unless_equals_uint64 (offset, 10000); fail_unless_equals_int (dist, 150); + offset = gst_adapter_offset_at_discont (adapter); + fail_unless_equals_uint64 (offset, 10000); + /* move to third buffer, we should still see a continuously increasing * offset and ignore the non-discont offset */ gst_adapter_flush (adapter, 50); avail = gst_adapter_available (adapter); fail_unless (avail == 100); - offset = gst_adapter_get_offset_from_discont (adapter); - fail_unless_equals_uint64 (offset, 10200); + offset = gst_adapter_distance_from_discont (adapter); + fail_unless_equals_uint64 (offset, 200); /* But the prev_offset *does* give us the actual buffer offset value */ offset = gst_adapter_prev_offset (adapter, &dist); fail_unless_equals_uint64 (offset, 50000); fail_unless_equals_int (dist, 0); + offset = gst_adapter_offset_at_discont (adapter); + fail_unless_equals_uint64 (offset, 10000); + /* move everything out, we end up at the last offset */ gst_adapter_flush (adapter, 100); avail = gst_adapter_available (adapter); fail_unless (avail == 0); - offset = gst_adapter_get_offset_from_discont (adapter); - fail_unless_equals_uint64 (offset, 10300); + offset = gst_adapter_distance_from_discont (adapter); + fail_unless_equals_uint64 (offset, 300); offset = gst_adapter_prev_offset (adapter, &dist); fail_unless_equals_uint64 (offset, 50000); fail_unless_equals_int (dist, 100); + offset = gst_adapter_offset_at_discont (adapter); + fail_unless_equals_uint64 (offset, 10000); + /* clear everything */ gst_adapter_clear (adapter); avail = gst_adapter_available (adapter); fail_unless (avail == 0); - offset = gst_adapter_get_offset_from_discont (adapter); - fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET_NONE); + offset = gst_adapter_distance_from_discont (adapter); + fail_unless_equals_uint64 (offset, 0); offset = gst_adapter_prev_offset (adapter, &dist); fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET_NONE); fail_unless_equals_int (dist, 0); + offset = gst_adapter_offset_at_discont (adapter); + fail_unless_equals_uint64 (offset, GST_BUFFER_OFFSET_NONE); + g_object_unref (adapter); } diff --git a/win32/common/libgstbase.def b/win32/common/libgstbase.def index 18dd221e7c..783f1af410 100644 --- a/win32/common/libgstbase.def +++ b/win32/common/libgstbase.def @@ -4,22 +4,25 @@ EXPORTS gst_adapter_clear gst_adapter_copy gst_adapter_copy_bytes + gst_adapter_distance_from_discont + gst_adapter_dts_at_discont gst_adapter_flush gst_adapter_get_buffer gst_adapter_get_buffer_fast gst_adapter_get_buffer_list gst_adapter_get_list - gst_adapter_get_offset_from_discont gst_adapter_get_type gst_adapter_map gst_adapter_masked_scan_uint32 gst_adapter_masked_scan_uint32_peek gst_adapter_new + gst_adapter_offset_at_discont gst_adapter_prev_dts gst_adapter_prev_dts_at_offset gst_adapter_prev_offset gst_adapter_prev_pts gst_adapter_prev_pts_at_offset + gst_adapter_pts_at_discont gst_adapter_push gst_adapter_take gst_adapter_take_buffer