2 * Gstreamer Editing Services
4 * Copyright (C) <2012> Thibault Saunier <thibault.saunier@collabora.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #ifndef _GES_TEST_UTILS
23 #define _GES_TEST_UTILS
26 #include <gst/check/gstcheck.h>
28 GESTimelinePipeline * ges_test_create_pipeline (GESTimeline *timeline);
29 /* The first 2 GNL priorities are used for:
30 * 0- The Mixing element
33 #define MIN_GNL_PRIO 2
35 gchar * ges_test_get_audio_only_uri (void);
36 gchar * ges_test_get_audio_video_uri (void);
37 gchar * ges_test_get_image_uri (void);
38 gchar * ges_test_file_uri (const gchar *filename);
40 void check_destroyed (GObject *object_to_unref, GObject *first_object, ...) G_GNUC_NULL_TERMINATED;
41 gchar * ges_test_file_name (const gchar *filename);
43 ges_generate_test_file_audio_video (const gchar * filedest,
44 const gchar * audio_enc,
45 const gchar * video_enc,
46 const gchar * mux, const gchar * video_pattern, const gchar * audio_wave);
48 #define gnl_object_check(gnlobj, start, duration, mstart, mduration, priority, active) { \
49 guint64 pstart, pdur, inpoint, pprio, pact; \
50 g_object_get (gnlobj, "start", &pstart, "duration", &pdur, \
51 "inpoint", &inpoint, "priority", &pprio, "active", &pact, \
53 assert_equals_uint64 (pstart, start); \
54 assert_equals_uint64 (pdur, duration); \
55 assert_equals_uint64 (inpoint, mstart); \
56 assert_equals_int (pprio, priority); \
57 assert_equals_int (pact, active); \
61 #define fail_error_message(msg) \
64 gst_message_parse_error(msg, &error, NULL); \
65 fail_unless(FALSE, "Error Message from %s : %s", \
66 GST_OBJECT_NAME (GST_MESSAGE_SRC(msg)), error->message); \
67 g_error_free (error); \
70 #define assert_is_type(object, type) \
72 fail_unless (g_type_is_a(G_OBJECT_TYPE(object), type), \
73 "%s is not a %s", G_OBJECT_TYPE_NAME(object), \
74 g_type_name (type)); \
77 #define _START(obj) GES_TIMELINE_ELEMENT_START (obj)
78 #define _DURATION(obj) GES_TIMELINE_ELEMENT_DURATION (obj)
79 #define _INPOINT(obj) GES_TIMELINE_ELEMENT_INPOINT (obj)
80 #define _PRIORITY(obj) GES_TIMELINE_ELEMENT_PRIORITY (obj)
82 #define CHECK_OBJECT_PROPS(obj, start, inpoint, duration) {\
83 assert_equals_uint64 (_START (obj), start);\
84 assert_equals_uint64 (_INPOINT (obj), inpoint);\
85 assert_equals_uint64 (_DURATION (obj), duration);\
88 #define check_layer(clip, layer_prio) { \
89 GESLayer *tmplayer = ges_clip_get_layer ((clip)); \
90 assert_equals_int (ges_layer_get_priority (tmplayer), (layer_prio)); \
91 gst_object_unref (tmplayer); \
94 #endif /* _GES_TEST_UTILS */