static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("AYUV"))
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("AYUV"))
);
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBA ";" GST_VIDEO_CAPS_RGB)
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ RGBA, RGB }"))
);
static GstElement *
return caps;
}
+static void
+push_caps (GstCaps * caps)
+{
+ fail_unless (gst_pad_set_caps (mysrcpad, caps));
+ gst_caps_unref (caps);
+}
+
static GstBuffer *
create_buffer_rgb24_3x4 (void)
{
};
guint rowstride = GST_ROUND_UP_4 (WIDTH * 3);
GstBuffer *buf;
- GstCaps *caps;
+ gpointer buf_data;
+ gsize size;
buf = gst_buffer_new_and_alloc (HEIGHT * rowstride);
- fail_unless_equals_int (GST_BUFFER_SIZE (buf), sizeof (rgb24_3x4_img));
- memcpy (GST_BUFFER_DATA (buf), rgb24_3x4_img, sizeof (rgb24_3x4_img));
+ buf_data = gst_buffer_map (buf, &size, NULL, GST_MAP_READWRITE);
+ fail_unless_equals_int (size, sizeof (rgb24_3x4_img));
+ memcpy (buf_data, rgb24_3x4_img, sizeof (rgb24_3x4_img));
- caps = create_caps_rgb24 ();
- gst_buffer_set_caps (buf, caps);
- gst_caps_unref (caps);
+ gst_buffer_unmap (buf, buf_data, size);
return buf;
}
};
guint rowstride = WIDTH * 4;
GstBuffer *buf;
- GstCaps *caps;
+ gpointer buf_data;
+ gsize size;
buf = gst_buffer_new_and_alloc (HEIGHT * rowstride);
- fail_unless_equals_int (GST_BUFFER_SIZE (buf), sizeof (rgba32_3x4_img));
- memcpy (GST_BUFFER_DATA (buf), rgba32_3x4_img, sizeof (rgba32_3x4_img));
+ buf_data = gst_buffer_map (buf, &size, NULL, GST_MAP_READWRITE);
+ fail_unless_equals_int (size, sizeof (rgba32_3x4_img));
+ memcpy (buf_data, rgba32_3x4_img, sizeof (rgba32_3x4_img));
- caps = create_caps_rgba32 ();
- gst_buffer_set_caps (buf, caps);
- gst_caps_unref (caps);
+ gst_buffer_unmap (buf, buf_data, size);
return buf;
}
fail_unless_equals_int (gst_element_set_state (alphacolor, GST_STATE_PLAYING),
GST_STATE_CHANGE_SUCCESS);
+ push_caps (create_caps_rgb24 ());
+
inbuffer = create_buffer_rgb24_3x4 ();
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
GstCaps *incaps;
guint8 *ayuv;
guint outlength;
+ gpointer buf_data;
+ gsize size;
incaps = create_caps_rgba32 ();
alphacolor = setup_alphacolor ();
fail_unless_equals_int (gst_element_set_state (alphacolor, GST_STATE_PLAYING),
GST_STATE_CHANGE_SUCCESS);
+ push_caps (create_caps_rgba32 ());
+
inbuffer = create_buffer_rgba32_3x4 ();
- GST_DEBUG ("Created buffer of %d bytes", GST_BUFFER_SIZE (inbuffer));
+ GST_DEBUG ("Created buffer of %d bytes", gst_buffer_get_size (inbuffer));
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* pushing gives away reference */
ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
outlength = WIDTH * HEIGHT * 4; /* output is AYUV */
- fail_unless_equals_int (GST_BUFFER_SIZE (outbuffer), outlength);
+ buf_data = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
+ fail_unless_equals_int (size, outlength);
- ayuv = GST_BUFFER_DATA (outbuffer);
+ ayuv = buf_data;
/* check alpha values (0x00 = totally transparent, 0xff = totally opaque) */
fail_unless_ayuv_pixel_has_alpha (ayuv, 0, 0, 0xff);
/* we don't check the YUV data, because apparently results differ slightly
* depending on whether we run in valgrind or not */
+ gst_buffer_unmap (outbuffer, buf_data, size);
+
buffers = g_list_remove (buffers, outbuffer);
gst_buffer_unref (outbuffer);