GST_BUFFER_OFFSET_END (dest) = GST_BUFFER_OFFSET_NONE;
}
}
-#if 0
- if (flags & GST_BUFFER_COPY_CAPS) {
- gst_caps_replace (&GST_BUFFER_CAPS (dest), GST_BUFFER_CAPS (src));
- }
-#endif
if (flags & GST_BUFFER_COPY_MEMORY) {
GstMemory *mem;
GST_CAT_LOG (GST_CAT_BUFFER, "finalize %p", buffer);
-#if 0
- gst_caps_replace (&GST_BUFFER_CAPS (buffer), NULL);
-#endif
-
/* free metadata */
for (walk = GST_BUFFER_META (buffer); walk; walk = next) {
GstMeta *meta = &walk->meta;
(GstMiniObjectFreeFunction) _gst_buffer_free;
GST_BUFFER (buffer)->pool = NULL;
-#if 0
- GST_BUFFER_CAPS (buffer) = NULL;
-#endif
GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE;
GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
}
/**
- * gst_buffer_get_caps:
- * @buffer: a #GstBuffer.
- *
- * Gets the media type of the buffer. This can be NULL if there
- * is no media type attached to this buffer.
- *
- * Returns: (transfer full): a reference to the #GstCaps. unref after usage.
- * Returns NULL if there were no caps on this buffer.
- */
-/* this is not made atomic because if the buffer were reffed from multiple
- * threads, it would have a refcount > 2 and thus be immutable.
- */
-GstCaps *
-gst_buffer_get_caps (GstBuffer * buffer)
-{
- GstCaps *ret;
-
- g_return_val_if_fail (buffer != NULL, NULL);
-
- ret = GST_BUFFER_CAPS (buffer);
-
- if (ret)
- gst_caps_ref (ret);
-
- return ret;
-}
-
-/**
- * gst_buffer_set_caps:
- * @buffer: a #GstBuffer.
- * @caps: (transfer none): a #GstCaps.
- *
- * Sets the media type on the buffer. The refcount of the caps will
- * be increased and any previous caps on the buffer will be
- * unreffed.
- */
-/* this is not made atomic because if the buffer were reffed from multiple
- * threads, it would have a refcount > 2 and thus be immutable.
- */
-void
-gst_buffer_set_caps (GstBuffer * buffer, GstCaps * caps)
-{
- g_return_if_fail (buffer != NULL);
- g_return_if_fail (caps == NULL || GST_CAPS_IS_SIMPLE (caps));
-
-#if GST_VERSION_NANO == 1
- /* we enable this extra debugging in git versions only for now */
- g_warn_if_fail (gst_buffer_is_writable (buffer));
- /* FIXME: would be nice to also check if caps are fixed here, but expensive */
-#endif
-
- gst_caps_replace (&GST_BUFFER_CAPS (buffer), caps);
-}
-
-/**
* gst_buffer_copy_region:
* @parent: a #GstBuffer.
* @offset: the offset into parent #GstBuffer at which the new sub-buffer
*/
#define GST_BUFFER_DURATION(buf) (GST_BUFFER_CAST(buf)->duration)
/**
- * GST_BUFFER_CAPS:
- * @buf: a #GstBuffer.
- *
- * The caps for this buffer.
- */
-#define GST_BUFFER_CAPS(buf) (GST_BUFFER_CAST(buf)->caps)
-/**
* GST_BUFFER_OFFSET:
* @buf: a #GstBuffer.
*
/*< public >*/ /* with COW */
GstBufferPool *pool;
- /* the media type of this buffer */
- GstCaps *caps;
/* timestamp */
GstClockTime timestamp;
* @GST_BUFFER_COPY_FLAGS: flag indicating that buffer flags should be copied
* @GST_BUFFER_COPY_TIMESTAMPS: flag indicating that buffer timestamp, duration,
* offset and offset_end should be copied
- * @GST_BUFFER_COPY_CAPS: flag indicating that buffer caps should be copied
* @GST_BUFFER_COPY_MEMORY: flag indicating that buffer memory should be copied
* and appended to already existing memory
* @GST_BUFFER_COPY_MERGE: flag indicating that buffer memory should be
GST_BUFFER_COPY_NONE = 0,
GST_BUFFER_COPY_FLAGS = (1 << 0),
GST_BUFFER_COPY_TIMESTAMPS = (1 << 1),
- GST_BUFFER_COPY_CAPS = (1 << 2),
- GST_BUFFER_COPY_MEMORY = (1 << 3),
- GST_BUFFER_COPY_MERGE = (1 << 4)
+ GST_BUFFER_COPY_MEMORY = (1 << 2),
+ GST_BUFFER_COPY_MERGE = (1 << 3)
} GstBufferCopyFlags;
/**
* Combination of all possible metadata fields that can be copied with
* gst_buffer_copy_into().
*/
-#define GST_BUFFER_COPY_METADATA (GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_CAPS)
+#define GST_BUFFER_COPY_METADATA (GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS)
/**
* GST_BUFFER_COPY_ALL:
GST_MINI_OBJECT_CAST (nbuf)); \
} G_STMT_END
-GstCaps* gst_buffer_get_caps (GstBuffer *buffer);
-void gst_buffer_set_caps (GstBuffer *buffer, GstCaps *caps);
-
/* creating a region */
GstBuffer* gst_buffer_copy_region (GstBuffer *parent, GstBufferCopyFlags flags,
gsize offset, gsize size);
*
* Gets the capabilities this pad can produce or consume.
* Note that this method doesn't necessarily return the caps set by
- * gst_pad_set_caps() - use GST_PAD_CAPS() for that instead.
+ * gst_pad_set_caps() - use gst_pad_get_current_caps() for that instead.
* gst_pad_get_caps returns all possible caps a pad can operate with, using
* the pad's get_caps function;
* this returns the pad template caps if not explicitly set.
gboolean block_callback_called;
/* the pad capabilities */
- GstCaps *caps;
GstPadGetCapsFunction getcapsfunc;
GstPadSetCapsFunction setcapsfunc;
GstPadAcceptCapsFunction acceptcapsfunc;
#define GST_PAD_LINKFUNC(pad) (GST_PAD_CAST(pad)->linkfunc)
#define GST_PAD_UNLINKFUNC(pad) (GST_PAD_CAST(pad)->unlinkfunc)
-/**
- * GST_PAD_CAPS:
- * @pad: a #GstPad.
- *
- * The caps for this pad.
- */
-#define GST_PAD_CAPS(pad) (GST_PAD_CAST(pad)->caps)
#define GST_PAD_GETCAPSFUNC(pad) (GST_PAD_CAST(pad)->getcapsfunc)
#define GST_PAD_SETCAPSFUNC(pad) (GST_PAD_CAST(pad)->setcapsfunc)
#define GST_PAD_ACCEPTCAPSFUNC(pad) (GST_PAD_CAST(pad)->acceptcapsfunc)
/* setup dummy buffer */
caps = gst_caps_from_string ("application/x-unknown");
buf = gst_buffer_new_and_alloc (1);
- gst_buffer_set_caps (buf, caps);
- gst_caps_unref (caps);
while (l != NULL) {
/* set selector pad */
/* cleanup buffer */
gst_buffer_unref (buf);
+ gst_caps_unref (caps);
}
/* Create output-selector with given number of src pads and switch
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS);
buffer = gst_buffer_new ();
+#if 0
gst_buffer_set_caps (buffer, caps);
+#endif
/* First check if everything works in normal state */
fail_unless (gst_pad_push (mysrc, gst_buffer_ref (buffer)) == GST_FLOW_OK);
GST_END_TEST;
-GST_START_TEST (test_buffer)
-{
- GstCaps *c1;
- GstBuffer *buffer;
-
- buffer = gst_buffer_new_and_alloc (1000);
- c1 = gst_caps_new_simple ("audio/x-raw-int",
- "buffer", GST_TYPE_BUFFER, buffer, NULL);
-
- GST_DEBUG ("caps: %" GST_PTR_FORMAT, c1);
- gst_buffer_unref (buffer);
-
- buffer = gst_buffer_new_and_alloc (1000);
- gst_buffer_set_caps (buffer, c1); /* doesn't give away our c1 ref */
-
- gst_caps_unref (c1);
- gst_buffer_unref (buffer); /* Should now drop both references */
-}
-
-GST_END_TEST;
-
GST_START_TEST (test_double_append)
{
GstStructure *s1;
tcase_add_test (tc_chain, test_from_string);
tcase_add_test (tc_chain, test_double_append);
tcase_add_test (tc_chain, test_mutability);
- tcase_add_test (tc_chain, test_buffer);
tcase_add_test (tc_chain, test_static_caps);
tcase_add_test (tc_chain, test_simplify);
tcase_add_test (tc_chain, test_truncate);
caps1 = gst_caps_from_string ("meh");
fail_unless (gst_pad_set_caps (src, caps1));
- caps2 = GST_PAD_CAPS (ghost);
+ caps2 = gst_pad_get_current_caps (ghost);
fail_unless (gst_caps_is_equal (caps1, caps2));
fail_unless_equals_int (notify_counter, 1);
caps1 = gst_caps_from_string ("meh");
fail_unless (gst_pad_set_caps (ghost, caps1));
- caps2 = GST_PAD_CAPS (src);
+ caps2 = gst_pad_get_current_caps (src);
fail_unless (caps2 == NULL);
fail_unless_equals_int (notify_counter, 1);
caps1 = gst_caps_from_string ("muh");
fail_unless (gst_pad_set_caps (ghost, caps1));
- caps2 = GST_PAD_CAPS (sink);
+ caps2 = gst_pad_get_current_caps (sink);
fail_unless (gst_caps_is_equal (caps1, caps2));
fail_unless_equals_int (notify_counter, 1);
caps1 = gst_caps_from_string ("muh");
fail_unless (gst_pad_set_caps (sink, caps1));
- caps2 = GST_PAD_CAPS (ghost);
+ caps2 = gst_pad_get_current_caps (ghost);
fail_unless (caps2 == NULL);
fail_unless_equals_int (notify_counter, 0);
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
fail_unless (gst_buffer_get_size (buffer) == 20);
+#if 0
/* caps should not have been set */
fail_unless (GST_BUFFER_CAPS (buffer) == NULL);
+#endif
gst_buffer_unref (buffer);
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
fail_unless (gst_buffer_get_size (buffer) == 10);
+#if 0
/* caps should not have been set */
fail_unless (GST_BUFFER_CAPS (buffer) == NULL);
+#endif
gst_buffer_unref (buffer);
GST_DEBUG_OBJECT (trans, "buffer with caps, size 20");
buffer = gst_buffer_new_and_alloc (20);
+#if 0
gst_buffer_set_caps (buffer, caps);
+#endif
buffer_alloc_pt1_called = FALSE;
set_caps_pt2_called = FALSE;
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
fail_unless (gst_buffer_get_size (buffer) == 20);
+#if 0
fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), caps));
+#endif
gst_buffer_unref (buffer);
GST_DEBUG_OBJECT (trans, "buffer with caps, size 10");
buffer = gst_buffer_new_and_alloc (10);
+#if 0
gst_buffer_set_caps (buffer, caps);
+#endif
buffer_alloc_pt1_called = FALSE;
set_caps_pt2_called = FALSE;
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
fail_unless (gst_buffer_get_size (buffer) == 10);
+#if 0
fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), caps));
+#endif
gst_buffer_unref (buffer);
GST_DEBUG_OBJECT (trans, "buffer with caps, size 20");
buffer = gst_buffer_new_and_alloc (20);
+#if 0
gst_buffer_set_caps (buffer, caps);
+#endif
transform_ip_1_called = FALSE;
transform_ip_1_writable = FALSE;
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
fail_unless (gst_buffer_get_size (buffer) == 20);
+#if 0
fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), caps));
+#endif
gst_buffer_unref (buffer);
#if 0
GST_DEBUG_OBJECT (trans, "buffer with caps extra ref, size 20");
buffer = gst_buffer_new_and_alloc (20);
+#if 0
gst_buffer_set_caps (buffer, caps);
+#endif
/* take additional ref to make it non-writable */
gst_buffer_ref (buffer);
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
fail_unless (gst_buffer_get_size (buffer) == 20);
+#if 0
fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), caps));
+#endif
/* output buffer has refcount 1 */
//fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1);
/* try to push a buffer with caps */
buffer = gst_buffer_new_and_alloc (20);
+#if 0
gst_buffer_set_caps (buffer, incaps);
+#endif
GST_DEBUG_OBJECT (trans, "buffer with caps %" GST_PTR_FORMAT, incaps);
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
fail_unless (gst_buffer_get_size (buffer) == 40);
+#if 0
fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), outcaps));
+#endif
gst_buffer_unref (buffer);
buffer = gst_buffer_new_and_alloc (20);
+#if 0
gst_buffer_set_caps (buffer, incaps);
+#endif
/* take additional ref to make it non-writable */
gst_buffer_ref (buffer);
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
fail_unless (gst_buffer_get_size (buffer) == 40);
+#if 0
fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), outcaps));
+#endif
/* output buffer has refcount 1 */
fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1);
/* try to push a buffer with caps */
buffer = gst_buffer_new_and_alloc (20);
+#if 0
gst_buffer_set_caps (buffer, incaps);
+#endif
GST_DEBUG_OBJECT (trans, "buffer with caps %" GST_PTR_FORMAT, incaps);
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
fail_unless (gst_buffer_get_size (buffer) == 20);
+#if 0
fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps));
+#endif
gst_buffer_unref (buffer);
buffer = gst_buffer_new_and_alloc (20);
+#if 0
gst_buffer_set_caps (buffer, incaps);
+#endif
/* take additional ref to make it non-writable */
gst_buffer_ref (buffer);
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
fail_unless (gst_buffer_get_size (buffer) == 20);
+#if 0
fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps));
+#endif
/* output buffer has refcount 1 */
//fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1);
/* try to push a buffer with caps */
buffer = gst_buffer_new_and_alloc (20);
+#if 0
gst_buffer_set_caps (buffer, incaps);
+#endif
GST_DEBUG_OBJECT (trans, "buffer with caps %" GST_PTR_FORMAT, incaps);
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
fail_unless (gst_buffer_get_size (buffer) == 20);
+#if 0
fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps));
+#endif
gst_buffer_unref (buffer);
buffer = gst_buffer_new_and_alloc (20);
+#if 0
gst_buffer_set_caps (buffer, incaps);
+#endif
/* take additional ref to make it non-writable */
gst_buffer_ref (buffer);
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
fail_unless (gst_buffer_get_size (buffer) == 20);
+#if 0
fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), incaps));
+#endif
/* output buffer has refcount 1 */
fail_unless (GST_MINI_OBJECT_REFCOUNT_VALUE (buffer) == 1);
GST_DEBUG_OBJECT (trans,
"buffer with in passthrough with caps %" GST_PTR_FORMAT, incaps);
buffer = gst_buffer_new_and_alloc (10);
+#if 0
gst_buffer_set_caps (buffer, incaps);
+#endif
/* don't suggest anything else */
buffer_alloc_ct2_case = 1;
buffer = gst_test_trans_pop (trans);
fail_unless (buffer != NULL);
/* FIXME changing src caps should produce converted buffer */
+#if 0
GST_DEBUG_OBJECT (trans, "received caps %" GST_PTR_FORMAT,
GST_BUFFER_CAPS (buffer));
+#endif
//fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), outcaps));
//fail_unless (gst_buffer_get_size (buffer) == 20);
GST_DEBUG_OBJECT (trans, "buffer with caps %" GST_PTR_FORMAT, incaps);
buffer = gst_buffer_new_and_alloc (10);
+#if 0
gst_buffer_set_caps (buffer, incaps);
+#endif
/* don't suggest anything else */
buffer_alloc_ct2_suggest = FALSE;