summaryrefslogtreecommitdiff
path: root/tests/examples
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2011-10-04 14:27:08 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2011-10-04 14:27:08 +0200
commitbe20e84e39a19241e63e249bd21f1e7261450c05 (patch)
tree67f922ba12e19168996c726fc4af3a401b18754c /tests/examples
parentfae37396a4a1bbe22fb56a93fb2e2ff243a209bc (diff)
tests: fix some tests
Diffstat (limited to 'tests/examples')
-rw-r--r--tests/examples/camerabin/gst-camera-perf.c36
-rw-r--r--tests/examples/camerabin/gst-camera.c2
-rw-r--r--tests/examples/camerabin/gst-camerabin-test.c31
3 files changed, 30 insertions, 39 deletions
diff --git a/tests/examples/camerabin/gst-camera-perf.c b/tests/examples/camerabin/gst-camera-perf.c
index c5554a0e3..ec84d74c5 100644
--- a/tests/examples/camerabin/gst-camera-perf.c
+++ b/tests/examples/camerabin/gst-camera-perf.c
@@ -171,15 +171,16 @@ static const gchar *test_names[TEST_CASES] = {
static void print_result (void);
static gboolean run_test (gpointer user_data);
static gboolean setup_add_pad_probe (GstElement * elem, const gchar * pad_name,
- GCallback handler, gpointer data);
+ GstPadProbeCallback handler, gpointer data);
/*
* Callbacks
*/
-static gboolean
-pad_has_buffer (GstPad * pad, GstBuffer * buf, gpointer user_data)
+static GstProbeReturn
+pad_has_buffer (GstPad * pad, GstProbeType type, gpointer type_data,
+ gpointer user_data)
{
gboolean *signal_sink = (gboolean *) user_data;
gboolean print_and_restart = FALSE;
@@ -209,7 +210,7 @@ pad_has_buffer (GstPad * pad, GstBuffer * buf, gpointer user_data)
print_result ();
g_idle_add ((GSourceFunc) run_test, NULL);
}
- return TRUE;
+ return GST_PROBE_OK;
}
static void
@@ -227,8 +228,7 @@ element_added (GstBin * bin, GstElement * element, gpointer user_data)
if (elem) {
need_vmux_pad_probe = FALSE;
GST_INFO_OBJECT (elem, "got default video muxer");
- if (setup_add_pad_probe (elem, "src", (GCallback) pad_has_buffer,
- &signal_vid_sink)) {
+ if (setup_add_pad_probe (elem, "src", pad_has_buffer, &signal_vid_sink)) {
/* enable test */
target[8] = test_09_taget;
}
@@ -239,8 +239,7 @@ element_added (GstBin * bin, GstElement * element, gpointer user_data)
if (elem) {
need_ienc_pad_probe = FALSE;
GST_INFO_OBJECT (elem, "got default image encoder");
- if (setup_add_pad_probe (elem, "src", (GCallback) pad_has_buffer,
- &signal_img_enc)) {
+ if (setup_add_pad_probe (elem, "src", pad_has_buffer, &signal_img_enc)) {
/* enable test */
target[5] = test_06_taget;
}
@@ -480,7 +479,7 @@ cleanup_pipeline (void)
static gboolean
setup_add_pad_probe (GstElement * elem, const gchar * pad_name,
- GCallback handler, gpointer data)
+ GstPadProbeCallback handler, gpointer data)
{
GstPad *pad = NULL;
@@ -489,7 +488,8 @@ setup_add_pad_probe (GstElement * elem, const gchar * pad_name,
return FALSE;
}
- gst_pad_add_buffer_probe (pad, (GCallback) handler, data);
+ gst_pad_add_probe (pad, GST_PROBE_TYPE_BLOCK | GST_PROBE_TYPE_BUFFER, handler,
+ data, NULL);
gst_object_unref (pad);
return TRUE;
@@ -567,13 +567,12 @@ setup_pipeline (void)
/* set properties */
g_object_set (camera_bin, "filename", filename->str, NULL);
- if (src_csp && strlen (src_csp) == 4) {
+ if (src_csp) {
GstCaps *filter_caps;
/* FIXME: why do we need to set this? */
- filter_caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC,
- GST_MAKE_FOURCC (src_csp[0], src_csp[1], src_csp[2], src_csp[3]), NULL);
+ filter_caps = gst_caps_new_simple ("video/x-raw",
+ "format", G_TYPE_STRING, src_csp, NULL);
if (filter_caps) {
g_object_set (camera_bin, "filter-caps", filter_caps, NULL);
gst_caps_unref (filter_caps);
@@ -589,8 +588,7 @@ setup_pipeline (void)
/* connect signal handlers */
g_assert (sink);
- if (!setup_add_pad_probe (sink, "sink", (GCallback) pad_has_buffer,
- &signal_vf_sink)) {
+ if (!setup_add_pad_probe (sink, "sink", pad_has_buffer, &signal_vf_sink)) {
goto error;
}
if (!vmux) {
@@ -603,8 +601,7 @@ setup_pipeline (void)
}
}
if (vmux) {
- if (!setup_add_pad_probe (vmux, "src", (GCallback) pad_has_buffer,
- &signal_vid_sink)) {
+ if (!setup_add_pad_probe (vmux, "src", pad_has_buffer, &signal_vid_sink)) {
goto error;
}
}
@@ -618,8 +615,7 @@ setup_pipeline (void)
}
}
if (ienc) {
- if (!setup_add_pad_probe (ienc, "src", (GCallback) pad_has_buffer,
- &signal_img_enc)) {
+ if (!setup_add_pad_probe (ienc, "src", pad_has_buffer, &signal_img_enc)) {
goto error;
}
}
diff --git a/tests/examples/camerabin/gst-camera.c b/tests/examples/camerabin/gst-camera.c
index 57ff706e1..d4ce6dd8a 100644
--- a/tests/examples/camerabin/gst-camera.c
+++ b/tests/examples/camerabin/gst-camera.c
@@ -32,7 +32,7 @@
#include "gst-camera.h"
#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
#include <gst/interfaces/colorbalance.h>
#include <gst/interfaces/photography.h>
#include <gtk/gtk.h>
diff --git a/tests/examples/camerabin/gst-camerabin-test.c b/tests/examples/camerabin/gst-camerabin-test.c
index 27037fad3..e4fb5bc14 100644
--- a/tests/examples/camerabin/gst-camerabin-test.c
+++ b/tests/examples/camerabin/gst-camerabin-test.c
@@ -89,7 +89,7 @@
#define GST_USE_UNSTABLE_API 1
#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/interfaces/videooverlay.h>
#include <gst/interfaces/photography.h>
#include <string.h>
#include <sys/time.h>
@@ -240,8 +240,7 @@ sync_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
const GValue *image;
GstBuffer *buf = NULL;
guint8 *data_buf = NULL;
- gchar *caps_string;
- guint size = 0;
+ gsize size = 0;
gchar *preview_filename = NULL;
FILE *f = NULL;
size_t written;
@@ -250,10 +249,10 @@ sync_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
case GST_MESSAGE_ELEMENT:{
st = gst_message_get_structure (message);
if (st) {
- if (gst_structure_has_name (message->structure, "prepare-xwindow-id")) {
+ if (gst_structure_has_name (st, "prepare-xwindow-id")) {
if (!no_xwindow && window) {
- gst_x_overlay_set_window_handle (GST_X_OVERLAY (GST_MESSAGE_SRC
- (message)), window);
+ gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY
+ (GST_MESSAGE_SRC (message)), window);
gst_message_unref (message);
message = NULL;
return GST_BUS_DROP;
@@ -266,13 +265,10 @@ sync_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
image = gst_structure_get_value (st, "buffer");
if (image) {
buf = gst_value_get_buffer (image);
- data_buf = GST_BUFFER_DATA (buf);
- size = GST_BUFFER_SIZE (buf);
+ data_buf = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
preview_filename = g_strdup_printf ("test_vga.rgb");
- caps_string = gst_caps_to_string (GST_BUFFER_CAPS (buf));
- g_print ("writing buffer to %s, elapsed: %.2fs, buffer caps: %s\n",
- preview_filename, g_timer_elapsed (timer, NULL), caps_string);
- g_free (caps_string);
+ g_print ("writing buffer to %s, elapsed: %.2fs\n",
+ preview_filename, g_timer_elapsed (timer, NULL));
f = g_fopen (preview_filename, "w");
if (f) {
written = fwrite (data_buf, size, 1, f);
@@ -284,6 +280,7 @@ sync_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
g_print ("error opening file for raw image writing\n");
}
g_free (preview_filename);
+ gst_buffer_unmap (buf, data_buf, size);
}
}
}
@@ -526,12 +523,11 @@ setup_pipeline (void)
/* set properties */
if (src_format) {
filter_caps = gst_caps_from_string (src_format);
- } else if (src_csp && strlen (src_csp) == 4) {
+ } else if (src_csp) {
/* Set requested colorspace format, this is needed if the default
colorspace negotiated for viewfinder doesn't match with e.g. encoders. */
- filter_caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC,
- GST_MAKE_FOURCC (src_csp[0], src_csp[1], src_csp[2], src_csp[3]), NULL);
+ filter_caps = gst_caps_new_simple ("video/x-raw",
+ "format", G_TYPE_STRING, src_csp, NULL);
}
if (filter_caps) {
@@ -646,8 +642,7 @@ run_pipeline (gpointer user_data)
g_object_get (camera_bin, "video-source", &video_source, NULL);
if (video_source) {
- if (GST_IS_ELEMENT (video_source) &&
- gst_element_implements_interface (video_source, GST_TYPE_PHOTOGRAPHY)) {
+ if (GST_IS_ELEMENT (video_source) && GST_IS_PHOTOGRAPHY (video_source)) {
/* Set GstPhotography interface options. If option not given as
command-line parameter use default of the source element. */
if (scene_mode != SCENE_MODE_NONE)