guint8 *data;
from_buffer = gst_buffer_new_and_alloc (640 * 480 * 4);
- data = GST_BUFFER_DATA (from_buffer);
+ data = gst_buffer_map (from_buffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 640 * 480; i++) {
data[4 * i + 0] = 0; /* x */
data[4 * i + 1] = 255; /* R */
data[4 * i + 2] = 0; /* G */
data[4 * i + 3] = 0; /* B */
}
+ gst_buffer_unmap (from_buffer, data, 640 * 480 * 4);
+
from_caps = gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB,
640, 480, 25, 1, 1, 1);
gst_buffer_set_caps (from_buffer, from_caps);
ConvertFrameContext cf_data = { NULL, NULL, NULL };
from_buffer = gst_buffer_new_and_alloc (640 * 480 * 4);
- data = GST_BUFFER_DATA (from_buffer);
+ data = gst_buffer_map (from_buffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 640 * 480; i++) {
data[4 * i + 0] = 0; /* x */
data[4 * i + 1] = 255; /* R */
data[4 * i + 2] = 0; /* G */
data[4 * i + 3] = 0; /* B */
}
+ gst_buffer_unmap (from_buffer, data, 640 * 480 * 4);
+
from_caps = gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB,
640, 480, 25, 1, 1, 1);
gst_buffer_set_caps (from_buffer, from_caps);
static gboolean
buffer_probe_cb (GstPad * pad, GstBuffer * buffer)
{
+ guint8 *data;
+ gsize size;
+
+ data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_IN_CAPS)) {
GstCaps *caps;
GstStructure *s;
for (i = 0; i < 3; ++i) {
GValue *val;
+ guint8 *data2;
+ gsize size2;
val = &g_array_index (buffers, GValue, i);
buf = g_value_peek_pointer (val);
fail_unless (GST_IS_BUFFER (buf));
- if (GST_BUFFER_SIZE (buf) == GST_BUFFER_SIZE (buffer)) {
- if (memcmp (GST_BUFFER_DATA (buf), GST_BUFFER_DATA (buffer),
- GST_BUFFER_SIZE (buffer)) == 0) {
+
+ data2 = gst_buffer_map (buf, &size2, NULL, GST_MAP_READ);
+ if (size2 == size) {
+ if (memcmp (data2, data, size) == 0) {
found = TRUE;
}
}
+ gst_buffer_unmap (buf, data2, size2);
}
fail_unless (found, "Did not find incoming IN_CAPS buffer %p on caps",
buffer);
gst_caps_unref (caps);
}
+ gst_buffer_unmap (buffer, data, size);
return TRUE;
}