mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 06:01:04 +00:00
tests: fix remaining unit tests
This commit is contained in:
parent
40dc12da3a
commit
076f3f6fa3
3 changed files with 19 additions and 6 deletions
|
@ -24,7 +24,6 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
|
||||||
#include <gst/app/gstappbuffer.h>
|
|
||||||
#include <gst/app/gstapp-marshal.h>
|
#include <gst/app/gstapp-marshal.h>
|
||||||
#include <gst/app/gstappsink.h>
|
#include <gst/app/gstappsink.h>
|
||||||
#include <gst/app/gstappsrc.h>
|
#include <gst/app/gstappsrc.h>
|
||||||
|
|
|
@ -606,14 +606,16 @@ GST_START_TEST (test_convert_frame)
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
|
||||||
from_buffer = gst_buffer_new_and_alloc (640 * 480 * 4);
|
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++) {
|
for (i = 0; i < 640 * 480; i++) {
|
||||||
data[4 * i + 0] = 0; /* x */
|
data[4 * i + 0] = 0; /* x */
|
||||||
data[4 * i + 1] = 255; /* R */
|
data[4 * i + 1] = 255; /* R */
|
||||||
data[4 * i + 2] = 0; /* G */
|
data[4 * i + 2] = 0; /* G */
|
||||||
data[4 * i + 3] = 0; /* B */
|
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,
|
from_caps = gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB,
|
||||||
640, 480, 25, 1, 1, 1);
|
640, 480, 25, 1, 1, 1);
|
||||||
gst_buffer_set_caps (from_buffer, from_caps);
|
gst_buffer_set_caps (from_buffer, from_caps);
|
||||||
|
@ -675,14 +677,16 @@ GST_START_TEST (test_convert_frame_async)
|
||||||
ConvertFrameContext cf_data = { NULL, NULL, NULL };
|
ConvertFrameContext cf_data = { NULL, NULL, NULL };
|
||||||
|
|
||||||
from_buffer = gst_buffer_new_and_alloc (640 * 480 * 4);
|
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++) {
|
for (i = 0; i < 640 * 480; i++) {
|
||||||
data[4 * i + 0] = 0; /* x */
|
data[4 * i + 0] = 0; /* x */
|
||||||
data[4 * i + 1] = 255; /* R */
|
data[4 * i + 1] = 255; /* R */
|
||||||
data[4 * i + 2] = 0; /* G */
|
data[4 * i + 2] = 0; /* G */
|
||||||
data[4 * i + 3] = 0; /* B */
|
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,
|
from_caps = gst_video_format_new_caps (GST_VIDEO_FORMAT_xRGB,
|
||||||
640, 480, 25, 1, 1, 1);
|
640, 480, 25, 1, 1, 1);
|
||||||
gst_buffer_set_caps (from_buffer, from_caps);
|
gst_buffer_set_caps (from_buffer, from_caps);
|
||||||
|
|
|
@ -122,6 +122,11 @@ static int n_in_caps = 0;
|
||||||
static gboolean
|
static gboolean
|
||||||
buffer_probe_cb (GstPad * pad, GstBuffer * buffer)
|
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)) {
|
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_IN_CAPS)) {
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
|
@ -143,22 +148,27 @@ buffer_probe_cb (GstPad * pad, GstBuffer * buffer)
|
||||||
|
|
||||||
for (i = 0; i < 3; ++i) {
|
for (i = 0; i < 3; ++i) {
|
||||||
GValue *val;
|
GValue *val;
|
||||||
|
guint8 *data2;
|
||||||
|
gsize size2;
|
||||||
|
|
||||||
val = &g_array_index (buffers, GValue, i);
|
val = &g_array_index (buffers, GValue, i);
|
||||||
buf = g_value_peek_pointer (val);
|
buf = g_value_peek_pointer (val);
|
||||||
fail_unless (GST_IS_BUFFER (buf));
|
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),
|
data2 = gst_buffer_map (buf, &size2, NULL, GST_MAP_READ);
|
||||||
GST_BUFFER_SIZE (buffer)) == 0) {
|
if (size2 == size) {
|
||||||
|
if (memcmp (data2, data, size) == 0) {
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (buf, data2, size2);
|
||||||
}
|
}
|
||||||
fail_unless (found, "Did not find incoming IN_CAPS buffer %p on caps",
|
fail_unless (found, "Did not find incoming IN_CAPS buffer %p on caps",
|
||||||
buffer);
|
buffer);
|
||||||
|
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (buffer, data, size);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue