Debian Codegraph @

tests/check/nle/common.h

raw
1
2 #include <gst/check/gstcheck.h>
3 #include <ges/ges.h>
4
5 #define fail_error_message(msg) \
6 G_STMT_START { \
7 GError *error; \
8 gst_message_parse_error(msg, &error, NULL); \
9 fail_unless(FALSE, "Error Message from %s : %s", \
10 GST_OBJECT_NAME (GST_MESSAGE_SRC(msg)), error->message); \
11 g_error_free (error); \
12 } G_STMT_END;
13
14 #define check_start_stop_duration(object, startval, stopval, durval) \
15 G_STMT_START { guint64 start, stop; \
16 gint64 duration; \
17 GST_DEBUG_OBJECT (object, "Checking for valid start/stop/duration values"); \
18 g_object_get (object, "start", &start, "stop", &stop, \
19 "duration", &duration, NULL); \
20 fail_unless_equals_uint64(start, startval); \
21 fail_unless_equals_uint64(stop, stopval); \
22 fail_unless_equals_int64(duration, durval); \
23 GST_DEBUG_OBJECT (object, "start/stop/duration values valid"); \
24 } G_STMT_END;
25
26 #define check_state_simple(object, expected_state) \
27 G_STMT_START { \
28 GstStateChangeReturn ret; \
29 GstState state, pending; \
30 ret = gst_element_get_state(GST_ELEMENT_CAST(object), &state, &pending, 5 * GST_SECOND); \
31 fail_if (ret == GST_STATE_CHANGE_FAILURE); \
32 fail_unless (state == expected_state, "Element state (%s) is not the expected one (%s)", \
33 gst_state_get_name(state), gst_state_get_name(expected_state)); \
34 } G_STMT_END;
35
36 typedef struct _Segment {
37 gdouble rate;
38 GstFormat format;
39 guint64 start, stop, position;
40 } Segment;
41
42 typedef struct _CollectStructure {
43 GstElement *comp;
44 GstElement *sink;
45 guint64 last_time;
46 gboolean gotsegment;
47 GList *seen_segments;
48 GList *expected_segments;
49 guint64 expected_base;
50
51 gboolean keep_expected_segments;
52 } CollectStructure;
53
54 void poll_the_bus(GstBus *bus);
55 void composition_pad_added_cb (GstElement *composition, GstPad *pad, CollectStructure * collect);
56 GstPadProbeReturn sinkpad_probe (GstPad *sinkpad, GstPadProbeInfo * info, CollectStructure * collect);
57 GstElement *videotest_nle_src (const gchar * name, guint64 start, gint64 duration,
58 gint pattern, guint priority);
59 GstElement * videotest_nle_src_full (const gchar * name, guint64 start, gint64 duration,
60 guint64 inpoint,
61 gint pattern, guint priority);
62 GstElement *
63 videotest_in_bin_nle_src (const gchar * name, guint64 start, gint64 duration, gint pattern, guint priority);
64 GstElement *
65 audiotest_bin_src (const gchar * name, guint64 start,
66 gint64 duration, guint priority, gboolean intaudio);
67 GstElement *
68 new_operation (const gchar * name, const gchar * factory, guint64 start, gint64 duration, guint priority);
69 GList *
70 copy_segment_list (GList *list);
71 GstElement *
72 gst_element_factory_make_or_warn (const gchar * factoryname, const gchar * name);
73 Segment *
74 segment_new (gdouble rate, GstFormat format, gint64 start, gint64 stop, gint64 position);
75
76 void commit_and_wait (GstElement *comp, gboolean *ret);
77 gboolean nle_composition_remove (GstBin * comp, GstElement * object);
78 gboolean nle_composition_add (GstBin * comp, GstElement * object);
79
80 void collect_free (CollectStructure *collect);