summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/check/gnl/gnloperation.c926
1 files changed, 131 insertions, 795 deletions
diff --git a/tests/check/gnl/gnloperation.c b/tests/check/gnl/gnloperation.c
index 25d25cd..74a2dd7 100644
--- a/tests/check/gnl/gnloperation.c
+++ b/tests/check/gnl/gnloperation.c
@@ -1,86 +1,20 @@
1#include "common.h" 1#include "common.h"
2 2
3GST_START_TEST (test_simple_operation) 3static void
4fill_pipeline_and_check (GstElement * comp, GList * segments)
4{ 5{
5 GstElement *pipeline; 6 GstElement *pipeline, *sink;
6 guint64 start, stop;
7 gint64 duration;
8 GstElement *comp, *oper, *source, *sink;
9 CollectStructure *collect; 7 CollectStructure *collect;
10 GstBus *bus; 8 GstBus *bus;
11 GstMessage *message; 9 GstMessage *message;
12 gboolean carry_on = TRUE; 10 gboolean carry_on = TRUE;
13 GstPad *sinkpad; 11 GstPad *sinkpad;
12 GList *listcopy = copy_segment_list (segments);
14 13
15 pipeline = gst_pipeline_new ("test_pipeline"); 14 pipeline = gst_pipeline_new ("test_pipeline");
16 comp =
17 gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
18
19 /* TOPOLOGY
20 *
21 * 0 1 2 3 4 5 | Priority
22 * ----------------------------------------------------------------------------
23 * [-- oper --] | 0
24 * [------------- source -------------] | 1
25 * */
26
27 /*
28 source
29 Start : 0s
30 Duration : 3s
31 Priority : 1
32 */
33
34 source = videotest_gnl_src ("source", 0, 3 * GST_SECOND, 2, 1);
35 fail_if (source == NULL);
36 check_start_stop_duration (source, 0, 3 * GST_SECOND, 3 * GST_SECOND);
37
38 /*
39 operation
40 Start : 1s
41 Duration : 1s
42 Priority : 0
43 */
44
45 oper = new_operation ("oper", "identity", 1 * GST_SECOND, 1 * GST_SECOND, 0);
46 fail_if (oper == NULL);
47 check_start_stop_duration (oper, 1 * GST_SECOND, 2 * GST_SECOND,
48 1 * GST_SECOND);
49
50 /* Add source */
51 ASSERT_OBJECT_REFCOUNT (source, "source", 1);
52 ASSERT_OBJECT_REFCOUNT (oper, "oper", 1);
53
54 gst_bin_add (GST_BIN (comp), source);
55 check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND);
56
57 ASSERT_OBJECT_REFCOUNT (source, "source", 1);
58
59 /* Add operaton */
60
61 gst_bin_add (GST_BIN (comp), oper);
62 check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND);
63
64 ASSERT_OBJECT_REFCOUNT (oper, "oper", 1);
65
66 /* remove source */
67
68 gst_object_ref (source);
69 gst_bin_remove (GST_BIN (comp), source);
70 check_start_stop_duration (comp, 1 * GST_SECOND, 2 * GST_SECOND,
71 1 * GST_SECOND);
72
73 ASSERT_OBJECT_REFCOUNT (source, "source", 1);
74
75 /* re-add source */
76 gst_bin_add (GST_BIN (comp), source);
77 check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND);
78 gst_object_unref (source);
79
80 ASSERT_OBJECT_REFCOUNT (source, "source", 1);
81
82
83 sink = gst_element_factory_make_or_warn ("fakesink", "sink"); 15 sink = gst_element_factory_make_or_warn ("fakesink", "sink");
16 fail_if (sink == NULL);
17
84 gst_bin_add_many (GST_BIN (pipeline), comp, sink, NULL); 18 gst_bin_add_many (GST_BIN (pipeline), comp, sink, NULL);
85 19
86 /* Shared data */ 20 /* Shared data */
@@ -89,14 +23,7 @@ GST_START_TEST (test_simple_operation)
89 collect->sink = sink; 23 collect->sink = sink;
90 24
91 /* Expected segments */ 25 /* Expected segments */
92 collect->expected_segments = g_list_append (collect->expected_segments, 26 collect->expected_segments = segments;
93 segment_new (1.0, GST_FORMAT_TIME, 0, 1 * GST_SECOND, 0));
94 collect->expected_segments = g_list_append (collect->expected_segments,
95 segment_new (1.0, GST_FORMAT_TIME,
96 1 * GST_SECOND, 2 * GST_SECOND, 1 * GST_SECOND));
97 collect->expected_segments = g_list_append (collect->expected_segments,
98 segment_new (1.0, GST_FORMAT_TIME,
99 2 * GST_SECOND, 3 * GST_SECOND, 2 * GST_SECOND));
100 27
101 g_signal_connect (G_OBJECT (comp), "pad-added", 28 g_signal_connect (G_OBJECT (comp), "pad-added",
102 G_CALLBACK (composition_pad_added_cb), collect); 29 G_CALLBACK (composition_pad_added_cb), collect);
@@ -109,13 +36,11 @@ GST_START_TEST (test_simple_operation)
109 bus = gst_element_get_bus (GST_ELEMENT (pipeline)); 36 bus = gst_element_get_bus (GST_ELEMENT (pipeline));
110 37
111 GST_DEBUG ("Setting pipeline to PLAYING"); 38 GST_DEBUG ("Setting pipeline to PLAYING");
112 ASSERT_OBJECT_REFCOUNT (source, "source", 1);
113 39
114 fail_if (gst_element_set_state (GST_ELEMENT (pipeline), 40 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
115 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE); 41 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
116 42
117 GST_DEBUG ("Let's poll the bus"); 43 GST_DEBUG ("Let's poll the bus");
118
119 while (carry_on) { 44 while (carry_on) {
120 message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 10); 45 message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 10);
121 if (message) { 46 if (message) {
@@ -141,7 +66,7 @@ GST_START_TEST (test_simple_operation)
141 } 66 }
142 } 67 }
143 68
144 GST_DEBUG ("Setting pipeline to NULL"); 69 GST_DEBUG ("Setting pipeline to READY");
145 70
146 fail_if (gst_element_set_state (GST_ELEMENT (pipeline), 71 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
147 GST_STATE_READY) == GST_STATE_CHANGE_FAILURE); 72 GST_STATE_READY) == GST_STATE_CHANGE_FAILURE);
@@ -150,18 +75,9 @@ GST_START_TEST (test_simple_operation)
150 75
151 GST_DEBUG ("Resetted pipeline to READY"); 76 GST_DEBUG ("Resetted pipeline to READY");
152 77
153 /* Expected segments */ 78 collect->expected_segments = listcopy;
154 collect->expected_segments = g_list_append (collect->expected_segments,
155 segment_new (1.0, GST_FORMAT_TIME, 0, 1 * GST_SECOND, 0));
156 collect->expected_segments = g_list_append (collect->expected_segments,
157 segment_new (1.0, GST_FORMAT_TIME,
158 1 * GST_SECOND, 2 * GST_SECOND, 1 * GST_SECOND));
159 collect->expected_segments = g_list_append (collect->expected_segments,
160 segment_new (1.0, GST_FORMAT_TIME,
161 2 * GST_SECOND, 3 * GST_SECOND, 2 * GST_SECOND));
162 collect->gotsegment = FALSE; 79 collect->gotsegment = FALSE;
163 80
164
165 GST_DEBUG ("Setting pipeline to PLAYING again"); 81 GST_DEBUG ("Setting pipeline to PLAYING again");
166 82
167 fail_if (gst_element_set_state (GST_ELEMENT (pipeline), 83 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
@@ -211,21 +127,101 @@ GST_START_TEST (test_simple_operation)
211 g_free (collect); 127 g_free (collect);
212} 128}
213 129
130GST_START_TEST (test_simple_operation)
131{
132 guint64 start, stop;
133 gint64 duration;
134 GstElement *comp, *oper, *source;
135 GList *segments = NULL;
136
137 comp =
138 gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
139
140 /* TOPOLOGY
141 *
142 * 0 1 2 3 4 5 | Priority
143 * ----------------------------------------------------------------------------
144 * [-- oper --] | 0
145 * [------------- source -------------] | 1
146 * */
147
148 /*
149 source
150 Start : 0s
151 Duration : 3s
152 Priority : 1
153 */
154
155 source = videotest_gnl_src ("source", 0, 3 * GST_SECOND, 2, 1);
156 fail_if (source == NULL);
157 check_start_stop_duration (source, 0, 3 * GST_SECOND, 3 * GST_SECOND);
158
159 /*
160 operation
161 Start : 1s
162 Duration : 1s
163 Priority : 0
164 */
165
166 oper = new_operation ("oper", "identity", 1 * GST_SECOND, 1 * GST_SECOND, 0);
167 fail_if (oper == NULL);
168 check_start_stop_duration (oper, 1 * GST_SECOND, 2 * GST_SECOND,
169 1 * GST_SECOND);
170
171 /* Add source */
172 ASSERT_OBJECT_REFCOUNT (source, "source", 1);
173 ASSERT_OBJECT_REFCOUNT (oper, "oper", 1);
174
175 gst_bin_add (GST_BIN (comp), source);
176 check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND);
177
178 ASSERT_OBJECT_REFCOUNT (source, "source", 1);
179
180 /* Add operaton */
181
182 gst_bin_add (GST_BIN (comp), oper);
183 check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND);
184
185 ASSERT_OBJECT_REFCOUNT (oper, "oper", 1);
186
187 /* remove source */
188
189 gst_object_ref (source);
190 gst_bin_remove (GST_BIN (comp), source);
191 check_start_stop_duration (comp, 1 * GST_SECOND, 2 * GST_SECOND,
192 1 * GST_SECOND);
193
194 ASSERT_OBJECT_REFCOUNT (source, "source", 1);
195
196 /* re-add source */
197 gst_bin_add (GST_BIN (comp), source);
198 check_start_stop_duration (comp, 0, 3 * GST_SECOND, 3 * GST_SECOND);
199 gst_object_unref (source);
200
201 ASSERT_OBJECT_REFCOUNT (source, "source", 1);
202
203 /* Expected segments */
204 segments = g_list_append (segments,
205 segment_new (1.0, GST_FORMAT_TIME, 0, 1 * GST_SECOND, 0));
206 segments = g_list_append (segments,
207 segment_new (1.0, GST_FORMAT_TIME,
208 1 * GST_SECOND, 2 * GST_SECOND, 1 * GST_SECOND));
209 segments = g_list_append (segments,
210 segment_new (1.0, GST_FORMAT_TIME,
211 2 * GST_SECOND, 3 * GST_SECOND, 2 * GST_SECOND));
212
213 fill_pipeline_and_check (comp, segments);
214}
215
214GST_END_TEST; 216GST_END_TEST;
215 217
216GST_START_TEST (test_pyramid_operations) 218GST_START_TEST (test_pyramid_operations)
217{ 219{
218 GstElement *pipeline;
219 guint64 start, stop; 220 guint64 start, stop;
220 gint64 duration; 221 gint64 duration;
221 GstElement *comp, *oper1, *oper2, *source, *sink; 222 GstElement *comp, *oper1, *oper2, *source;
222 CollectStructure *collect; 223 GList *segments = NULL;
223 GstBus *bus;
224 GstMessage *message;
225 gboolean carry_on = TRUE;
226 GstPad *sinkpad;
227 224
228 pipeline = gst_pipeline_new ("test_pipeline");
229 comp = 225 comp =
230 gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); 226 gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
231 227
@@ -287,166 +283,34 @@ GST_START_TEST (test_pyramid_operations)
287 283
288 ASSERT_OBJECT_REFCOUNT (oper1, "oper2", 1); 284 ASSERT_OBJECT_REFCOUNT (oper1, "oper2", 1);
289 285
290
291
292 sink = gst_element_factory_make_or_warn ("fakesink", "sink");
293 gst_bin_add_many (GST_BIN (pipeline), comp, sink, NULL);
294
295 /* Shared data */
296 collect = g_new0 (CollectStructure, 1);
297 collect->comp = comp;
298 collect->sink = sink;
299
300 /* Expected segments */
301 collect->expected_segments = g_list_append (collect->expected_segments,
302 segment_new (1.0, GST_FORMAT_TIME, 0, 2 * GST_SECOND, 0));
303 collect->expected_segments = g_list_append (collect->expected_segments,
304 segment_new (1.0, GST_FORMAT_TIME,
305 2 * GST_SECOND, 4 * GST_SECOND, 2 * GST_SECOND));
306 collect->expected_segments = g_list_append (collect->expected_segments,
307 segment_new (1.0, GST_FORMAT_TIME,
308 4 * GST_SECOND, 6 * GST_SECOND, 4 * GST_SECOND));
309 collect->expected_segments = g_list_append (collect->expected_segments,
310 segment_new (1.0, GST_FORMAT_TIME,
311 6 * GST_SECOND, 8 * GST_SECOND, 6 * GST_SECOND));
312 collect->expected_segments = g_list_append (collect->expected_segments,
313 segment_new (1.0, GST_FORMAT_TIME,
314 8 * GST_SECOND, 10 * GST_SECOND, 8 * GST_SECOND));
315
316 g_signal_connect (G_OBJECT (comp), "pad-added",
317 G_CALLBACK (composition_pad_added_cb), collect);
318
319 sinkpad = gst_element_get_pad (sink, "sink");
320 gst_pad_add_event_probe (sinkpad, G_CALLBACK (sinkpad_event_probe), collect);
321 gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (sinkpad_buffer_probe),
322 collect);
323
324 bus = gst_element_get_bus (GST_ELEMENT (pipeline));
325
326 GST_DEBUG ("Setting pipeline to PLAYING");
327 ASSERT_OBJECT_REFCOUNT (source, "source", 1);
328
329 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
330 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
331
332 GST_DEBUG ("Let's poll the bus");
333
334 while (carry_on) {
335 message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 10);
336 if (message) {
337 switch (GST_MESSAGE_TYPE (message)) {
338 case GST_MESSAGE_EOS:
339 /* we should check if we really finished here */
340 GST_WARNING ("Got an EOS");
341 carry_on = FALSE;
342 break;
343 case GST_MESSAGE_SEGMENT_START:
344 case GST_MESSAGE_SEGMENT_DONE:
345 /* We shouldn't see any segement messages, since we didn't do a segment seek */
346 GST_WARNING ("Saw a Segment start/stop");
347 fail_if (TRUE);
348 break;
349 case GST_MESSAGE_ERROR:
350 GST_WARNING ("Saw an ERROR");
351 fail_if (TRUE);
352 default:
353 break;
354 }
355 gst_mini_object_unref (GST_MINI_OBJECT (message));
356 }
357 }
358
359 GST_DEBUG ("Setting pipeline to NULL");
360
361 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
362 GST_STATE_READY) == GST_STATE_CHANGE_FAILURE);
363
364 fail_if (collect->expected_segments != NULL);
365
366 GST_DEBUG ("Resetted pipeline to READY");
367
368 /* Expected segments */ 286 /* Expected segments */
369 collect->expected_segments = g_list_append (collect->expected_segments, 287 segments = g_list_append (segments,
370 segment_new (1.0, GST_FORMAT_TIME, 0, 2 * GST_SECOND, 0)); 288 segment_new (1.0, GST_FORMAT_TIME, 0, 2 * GST_SECOND, 0));
371 collect->expected_segments = g_list_append (collect->expected_segments, 289 segments = g_list_append (segments,
372 segment_new (1.0, GST_FORMAT_TIME, 290 segment_new (1.0, GST_FORMAT_TIME,
373 2 * GST_SECOND, 4 * GST_SECOND, 2 * GST_SECOND)); 291 2 * GST_SECOND, 4 * GST_SECOND, 2 * GST_SECOND));
374 collect->expected_segments = g_list_append (collect->expected_segments, 292 segments = g_list_append (segments,
375 segment_new (1.0, GST_FORMAT_TIME, 293 segment_new (1.0, GST_FORMAT_TIME,
376 4 * GST_SECOND, 6 * GST_SECOND, 4 * GST_SECOND)); 294 4 * GST_SECOND, 6 * GST_SECOND, 4 * GST_SECOND));
377 collect->expected_segments = g_list_append (collect->expected_segments, 295 segments = g_list_append (segments,
378 segment_new (1.0, GST_FORMAT_TIME, 296 segment_new (1.0, GST_FORMAT_TIME,
379 6 * GST_SECOND, 8 * GST_SECOND, 6 * GST_SECOND)); 297 6 * GST_SECOND, 8 * GST_SECOND, 6 * GST_SECOND));
380 collect->expected_segments = g_list_append (collect->expected_segments, 298 segments = g_list_append (segments,
381 segment_new (1.0, GST_FORMAT_TIME, 299 segment_new (1.0, GST_FORMAT_TIME,
382 8 * GST_SECOND, 10 * GST_SECOND, 8 * GST_SECOND)); 300 8 * GST_SECOND, 10 * GST_SECOND, 8 * GST_SECOND));
383 collect->gotsegment = FALSE;
384
385
386 GST_DEBUG ("Setting pipeline to PLAYING again");
387
388 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
389 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
390
391 carry_on = TRUE;
392
393 GST_DEBUG ("Let's poll the bus");
394
395 while (carry_on) {
396 message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 10);
397 if (message) {
398 switch (GST_MESSAGE_TYPE (message)) {
399 case GST_MESSAGE_EOS:
400 /* we should check if we really finished here */
401 carry_on = FALSE;
402 break;
403 case GST_MESSAGE_SEGMENT_START:
404 case GST_MESSAGE_SEGMENT_DONE:
405 /* We shouldn't see any segement messages, since we didn't do a segment seek */
406 GST_WARNING ("Saw a Segment start/stop");
407 fail_if (TRUE);
408 break;
409 case GST_MESSAGE_ERROR:
410 GST_ERROR ("Saw an ERROR");
411 fail_if (TRUE);
412 default:
413 break;
414 }
415 gst_mini_object_unref (GST_MINI_OBJECT (message));
416 } else {
417 GST_DEBUG ("bus_poll responded, but there wasn't any message...");
418 }
419 }
420 301
421 fail_if (collect->expected_segments != NULL); 302 fill_pipeline_and_check (comp, segments);
422
423 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
424 GST_STATE_NULL) == GST_STATE_CHANGE_FAILURE);
425
426 gst_object_unref (GST_OBJECT (sinkpad));
427 ASSERT_OBJECT_REFCOUNT_BETWEEN (pipeline, "main pipeline", 1, 2);
428 gst_object_unref (pipeline);
429 ASSERT_OBJECT_REFCOUNT_BETWEEN (bus, "main bus", 1, 2);
430 gst_object_unref (bus);
431
432 g_free (collect);
433} 303}
434 304
435GST_END_TEST; 305GST_END_TEST;
436 306
437GST_START_TEST (test_pyramid_operations2) 307GST_START_TEST (test_pyramid_operations2)
438{ 308{
439 GstElement *pipeline;
440 guint64 start, stop; 309 guint64 start, stop;
441 gint64 duration; 310 gint64 duration;
442 GstElement *comp, *oper, *source1, *source2, *def, *sink; 311 GstElement *comp, *oper, *source1, *source2, *def;
443 CollectStructure *collect; 312 GList *segments = NULL;
444 GstBus *bus;
445 GstMessage *message;
446 gboolean carry_on = TRUE;
447 GstPad *sinkpad;
448 313
449 pipeline = gst_pipeline_new ("test_pipeline");
450 comp = 314 comp =
451 gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); 315 gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
452 316
@@ -516,166 +380,34 @@ GST_START_TEST (test_pyramid_operations2)
516 check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND); 380 check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND);
517 381
518 382
519
520 sink = gst_element_factory_make_or_warn ("fakesink", "sink");
521 gst_bin_add_many (GST_BIN (pipeline), comp, sink, NULL);
522
523 /* Shared data */
524 collect = g_new0 (CollectStructure, 1);
525 collect->comp = comp;
526 collect->sink = sink;
527
528 /* Expected segments */
529 collect->expected_segments = g_list_append (collect->expected_segments,
530 segment_new (1.0, GST_FORMAT_TIME, 0, 1 * GST_SECOND, 0));
531 collect->expected_segments = g_list_append (collect->expected_segments,
532 segment_new (1.0, GST_FORMAT_TIME,
533 1 * GST_SECOND, 2 * GST_SECOND, 1 * GST_SECOND));
534 collect->expected_segments = g_list_append (collect->expected_segments,
535 segment_new (1.0, GST_FORMAT_TIME,
536 2 * GST_SECOND, 4 * GST_SECOND, 2 * GST_SECOND));
537 collect->expected_segments = g_list_append (collect->expected_segments,
538 segment_new (1.0, GST_FORMAT_TIME,
539 4 * GST_SECOND, 5 * GST_SECOND, 4 * GST_SECOND));
540 collect->expected_segments = g_list_append (collect->expected_segments,
541 segment_new (1.0, GST_FORMAT_TIME,
542 5 * GST_SECOND, 6 * GST_SECOND, 5 * GST_SECOND));
543
544 g_signal_connect (G_OBJECT (comp), "pad-added",
545 G_CALLBACK (composition_pad_added_cb), collect);
546
547 sinkpad = gst_element_get_pad (sink, "sink");
548 gst_pad_add_event_probe (sinkpad, G_CALLBACK (sinkpad_event_probe), collect);
549 gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (sinkpad_buffer_probe),
550 collect);
551
552 bus = gst_element_get_bus (GST_ELEMENT (pipeline));
553
554 GST_DEBUG ("Setting pipeline to PLAYING");
555 ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
556
557 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
558 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
559
560 GST_DEBUG ("Let's poll the bus");
561
562 while (carry_on) {
563 message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 10);
564 if (message) {
565 switch (GST_MESSAGE_TYPE (message)) {
566 case GST_MESSAGE_EOS:
567 /* we should check if we really finished here */
568 GST_WARNING ("Got an EOS");
569 carry_on = FALSE;
570 break;
571 case GST_MESSAGE_SEGMENT_START:
572 case GST_MESSAGE_SEGMENT_DONE:
573 /* We shouldn't see any segement messages, since we didn't do a segment seek */
574 GST_WARNING ("Saw a Segment start/stop");
575 fail_if (TRUE);
576 break;
577 case GST_MESSAGE_ERROR:
578 GST_WARNING ("Saw an ERROR");
579 fail_if (TRUE);
580 default:
581 break;
582 }
583 gst_mini_object_unref (GST_MINI_OBJECT (message));
584 }
585 }
586
587 GST_DEBUG ("Setting pipeline to NULL");
588
589 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
590 GST_STATE_READY) == GST_STATE_CHANGE_FAILURE);
591
592 fail_if (collect->expected_segments != NULL);
593
594 GST_DEBUG ("Resetted pipeline to READY");
595
596 /* Expected segments */ 383 /* Expected segments */
597 collect->expected_segments = g_list_append (collect->expected_segments, 384 segments = g_list_append (segments,
598 segment_new (1.0, GST_FORMAT_TIME, 0, 1 * GST_SECOND, 0)); 385 segment_new (1.0, GST_FORMAT_TIME, 0, 1 * GST_SECOND, 0));
599 collect->expected_segments = g_list_append (collect->expected_segments, 386 segments = g_list_append (segments,
600 segment_new (1.0, GST_FORMAT_TIME, 387 segment_new (1.0, GST_FORMAT_TIME,
601 1 * GST_SECOND, 2 * GST_SECOND, 1 * GST_SECOND)); 388 1 * GST_SECOND, 2 * GST_SECOND, 1 * GST_SECOND));
602 collect->expected_segments = g_list_append (collect->expected_segments, 389 segments = g_list_append (segments,
603 segment_new (1.0, GST_FORMAT_TIME, 390 segment_new (1.0, GST_FORMAT_TIME,
604 2 * GST_SECOND, 4 * GST_SECOND, 2 * GST_SECOND)); 391 2 * GST_SECOND, 4 * GST_SECOND, 2 * GST_SECOND));
605 collect->expected_segments = g_list_append (collect->expected_segments, 392 segments = g_list_append (segments,
606 segment_new (1.0, GST_FORMAT_TIME, 393 segment_new (1.0, GST_FORMAT_TIME,
607 4 * GST_SECOND, 5 * GST_SECOND, 4 * GST_SECOND)); 394 4 * GST_SECOND, 5 * GST_SECOND, 4 * GST_SECOND));
608 collect->expected_segments = g_list_append (collect->expected_segments, 395 segments = g_list_append (segments,
609 segment_new (1.0, GST_FORMAT_TIME, 396 segment_new (1.0, GST_FORMAT_TIME,
610 5 * GST_SECOND, 6 * GST_SECOND, 5 * GST_SECOND)); 397 5 * GST_SECOND, 6 * GST_SECOND, 5 * GST_SECOND));
611 398
612 collect->gotsegment = FALSE; 399 fill_pipeline_and_check (comp, segments);
613
614
615 GST_DEBUG ("Setting pipeline to PLAYING again");
616
617 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
618 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
619
620 carry_on = TRUE;
621
622 GST_DEBUG ("Let's poll the bus");
623
624 while (carry_on) {
625 message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 10);
626 if (message) {
627 switch (GST_MESSAGE_TYPE (message)) {
628 case GST_MESSAGE_EOS:
629 /* we should check if we really finished here */
630 carry_on = FALSE;
631 break;
632 case GST_MESSAGE_SEGMENT_START:
633 case GST_MESSAGE_SEGMENT_DONE:
634 /* We shouldn't see any segement messages, since we didn't do a segment seek */
635 GST_WARNING ("Saw a Segment start/stop");
636 fail_if (TRUE);
637 break;
638 case GST_MESSAGE_ERROR:
639 GST_ERROR ("Saw an ERROR");
640 fail_if (TRUE);
641 default:
642 break;
643 }
644 gst_mini_object_unref (GST_MINI_OBJECT (message));
645 } else {
646 GST_DEBUG ("bus_poll responded, but there wasn't any message...");
647 }
648 }
649
650 fail_if (collect->expected_segments != NULL);
651
652 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
653 GST_STATE_NULL) == GST_STATE_CHANGE_FAILURE);
654
655 gst_object_unref (GST_OBJECT (sinkpad));
656 ASSERT_OBJECT_REFCOUNT_BETWEEN (pipeline, "main pipeline", 1, 2);
657 gst_object_unref (pipeline);
658 ASSERT_OBJECT_REFCOUNT_BETWEEN (bus, "main bus", 1, 2);
659 gst_object_unref (bus);
660
661 g_free (collect);
662} 400}
663 401
664GST_END_TEST; 402GST_END_TEST;
665 403
666GST_START_TEST (test_pyramid_operations_expandable) 404GST_START_TEST (test_pyramid_operations_expandable)
667{ 405{
668 GstElement *pipeline;
669 guint64 start, stop; 406 guint64 start, stop;
670 gint64 duration; 407 gint64 duration;
671 GstElement *comp, *oper, *source1, *source2, *def, *sink; 408 GstElement *comp, *oper, *source1, *source2, *def;
672 CollectStructure *collect; 409 GList *segments = NULL;
673 GstBus *bus;
674 GstMessage *message;
675 gboolean carry_on = TRUE;
676 GstPad *sinkpad;
677 410
678 pipeline = gst_pipeline_new ("test_pipeline");
679 comp = 411 comp =
680 gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); 412 gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
681 413
@@ -745,159 +477,29 @@ GST_START_TEST (test_pyramid_operations_expandable)
745 gst_bin_add (GST_BIN (comp), def); 477 gst_bin_add (GST_BIN (comp), def);
746 check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND); 478 check_start_stop_duration (comp, 0, 6 * GST_SECOND, 6 * GST_SECOND);
747 479
748
749
750 sink = gst_element_factory_make_or_warn ("fakesink", "sink");
751 gst_bin_add_many (GST_BIN (pipeline), comp, sink, NULL);
752
753 /* Shared data */
754 collect = g_new0 (CollectStructure, 1);
755 collect->comp = comp;
756 collect->sink = sink;
757
758 /* Expected segments */
759 collect->expected_segments = g_list_append (collect->expected_segments,
760 segment_new (1.0, GST_FORMAT_TIME, 0, 2 * GST_SECOND, 0));
761 collect->expected_segments = g_list_append (collect->expected_segments,
762 segment_new (1.0, GST_FORMAT_TIME,
763 2 * GST_SECOND, 4 * GST_SECOND, 2 * GST_SECOND));
764 collect->expected_segments = g_list_append (collect->expected_segments,
765 segment_new (1.0, GST_FORMAT_TIME,
766 4 * GST_SECOND, 6 * GST_SECOND, 4 * GST_SECOND));
767
768 g_signal_connect (G_OBJECT (comp), "pad-added",
769 G_CALLBACK (composition_pad_added_cb), collect);
770
771 sinkpad = gst_element_get_pad (sink, "sink");
772 gst_pad_add_event_probe (sinkpad, G_CALLBACK (sinkpad_event_probe), collect);
773 gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (sinkpad_buffer_probe),
774 collect);
775
776 bus = gst_element_get_bus (GST_ELEMENT (pipeline));
777
778 GST_DEBUG ("Setting pipeline to PLAYING");
779 ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
780
781 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
782 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
783
784 GST_DEBUG ("Let's poll the bus");
785
786 while (carry_on) {
787 message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 10);
788 if (message) {
789 switch (GST_MESSAGE_TYPE (message)) {
790 case GST_MESSAGE_EOS:
791 /* we should check if we really finished here */
792 GST_WARNING ("Got an EOS");
793 carry_on = FALSE;
794 break;
795 case GST_MESSAGE_SEGMENT_START:
796 case GST_MESSAGE_SEGMENT_DONE:
797 /* We shouldn't see any segement messages, since we didn't do a segment seek */
798 GST_WARNING ("Saw a Segment start/stop");
799 fail_if (TRUE);
800 break;
801 case GST_MESSAGE_ERROR:
802 GST_WARNING ("Saw an ERROR");
803 fail_if (TRUE);
804 default:
805 break;
806 }
807 gst_mini_object_unref (GST_MINI_OBJECT (message));
808 }
809 }
810
811 GST_DEBUG ("Setting pipeline to NULL");
812
813 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
814 GST_STATE_READY) == GST_STATE_CHANGE_FAILURE);
815
816 fail_if (collect->expected_segments != NULL);
817
818 GST_DEBUG ("Resetted pipeline to READY");
819
820 /* Expected segments */ 480 /* Expected segments */
821 collect->expected_segments = g_list_append (collect->expected_segments, 481 segments = g_list_append (segments,
822 segment_new (1.0, GST_FORMAT_TIME, 0, 2 * GST_SECOND, 0)); 482 segment_new (1.0, GST_FORMAT_TIME, 0, 2 * GST_SECOND, 0));
823 collect->expected_segments = g_list_append (collect->expected_segments, 483 segments = g_list_append (segments,
824 segment_new (1.0, GST_FORMAT_TIME, 484 segment_new (1.0, GST_FORMAT_TIME,
825 2 * GST_SECOND, 4 * GST_SECOND, 2 * GST_SECOND)); 485 2 * GST_SECOND, 4 * GST_SECOND, 2 * GST_SECOND));
826 collect->expected_segments = g_list_append (collect->expected_segments, 486 segments = g_list_append (segments,
827 segment_new (1.0, GST_FORMAT_TIME, 487 segment_new (1.0, GST_FORMAT_TIME,
828 4 * GST_SECOND, 6 * GST_SECOND, 4 * GST_SECOND)); 488 4 * GST_SECOND, 6 * GST_SECOND, 4 * GST_SECOND));
829 489
830 collect->gotsegment = FALSE; 490 fill_pipeline_and_check (comp, segments);
831
832
833 GST_DEBUG ("Setting pipeline to PLAYING again");
834
835 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
836 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
837
838 carry_on = TRUE;
839
840 GST_DEBUG ("Let's poll the bus");
841
842 while (carry_on) {
843 message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 10);
844 if (message) {
845 switch (GST_MESSAGE_TYPE (message)) {
846 case GST_MESSAGE_EOS:
847 /* we should check if we really finished here */
848 carry_on = FALSE;
849 break;
850 case GST_MESSAGE_SEGMENT_START:
851 case GST_MESSAGE_SEGMENT_DONE:
852 /* We shouldn't see any segement messages, since we didn't do a segment seek */
853 GST_WARNING ("Saw a Segment start/stop");
854 fail_if (TRUE);
855 break;
856 case GST_MESSAGE_ERROR:
857 GST_ERROR ("Saw an ERROR");
858 fail_if (TRUE);
859 default:
860 break;
861 }
862 gst_mini_object_unref (GST_MINI_OBJECT (message));
863 } else {
864 GST_DEBUG ("bus_poll responded, but there wasn't any message...");
865 }
866 }
867
868 fail_if (collect->expected_segments != NULL);
869
870 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
871 GST_STATE_NULL) == GST_STATE_CHANGE_FAILURE);
872
873 gst_object_unref (GST_OBJECT (sinkpad));
874 ASSERT_OBJECT_REFCOUNT_BETWEEN (pipeline, "main pipeline", 1, 2);
875 gst_object_unref (pipeline);
876 ASSERT_OBJECT_REFCOUNT_BETWEEN (bus, "main bus", 1, 2);
877 gst_object_unref (bus);
878
879 g_free (collect);
880} 491}
881 492
882GST_END_TEST; 493GST_END_TEST;
883 494
884 495
885
886
887
888GST_START_TEST (test_complex_operations) 496GST_START_TEST (test_complex_operations)
889{ 497{
890 GstElement *pipeline;
891 guint64 start, stop; 498 guint64 start, stop;
892 gint64 duration; 499 gint64 duration;
893 GstElement *comp, *oper, *source1, *source2, *sink; 500 GstElement *comp, *oper, *source1, *source2;
894 CollectStructure *collect; 501 GList *segments = NULL;
895 GstBus *bus;
896 GstMessage *message;
897 gboolean carry_on = TRUE;
898 GstPad *sinkpad;
899 502
900 pipeline = gst_pipeline_new ("test_pipeline");
901 comp = 503 comp =
902 gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); 504 gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
903 505
@@ -909,11 +511,7 @@ GST_START_TEST (test_complex_operations)
909 */ 511 */
910 512
911 source1 = videotest_in_bin_gnl_src ("source1", 0, 4 * GST_SECOND, 2, 3); 513 source1 = videotest_in_bin_gnl_src ("source1", 0, 4 * GST_SECOND, 2, 3);
912 if (source1 == NULL) { 514 fail_if (source1 == NULL);
913 gst_object_unref (pipeline);
914 gst_object_unref (comp);
915 return;
916 }
917 check_start_stop_duration (source1, 0, 4 * GST_SECOND, 4 * GST_SECOND); 515 check_start_stop_duration (source1, 0, 4 * GST_SECOND, 4 * GST_SECOND);
918 516
919 /* 517 /*
@@ -966,143 +564,17 @@ GST_START_TEST (test_complex_operations)
966 564
967 ASSERT_OBJECT_REFCOUNT (oper, "oper", 1); 565 ASSERT_OBJECT_REFCOUNT (oper, "oper", 1);
968 566
969
970 sink = gst_element_factory_make_or_warn ("fakesink", "sink");
971 gst_bin_add_many (GST_BIN (pipeline), comp, sink, NULL);
972
973 /* Shared data */
974 collect = g_new0 (CollectStructure, 1);
975 collect->comp = comp;
976 collect->sink = sink;
977
978 /* Expected segments */
979 collect->expected_segments = g_list_append (collect->expected_segments,
980 segment_new (1.0, GST_FORMAT_TIME, 0, 2 * GST_SECOND, 0));
981 collect->expected_segments = g_list_append (collect->expected_segments,
982 segment_new (1.0, GST_FORMAT_TIME,
983 0 * GST_SECOND, 2 * GST_SECOND, 2 * GST_SECOND));
984 collect->expected_segments = g_list_append (collect->expected_segments,
985 segment_new (1.0, GST_FORMAT_TIME,
986 4 * GST_SECOND, 6 * GST_SECOND, 4 * GST_SECOND));
987
988 g_signal_connect (G_OBJECT (comp), "pad-added",
989 G_CALLBACK (composition_pad_added_cb), collect);
990
991 sinkpad = gst_element_get_pad (sink, "sink");
992 gst_pad_add_event_probe (sinkpad, G_CALLBACK (sinkpad_event_probe), collect);
993 gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (sinkpad_buffer_probe),
994 collect);
995
996 bus = gst_element_get_bus (GST_ELEMENT (pipeline));
997
998 GST_DEBUG ("Setting pipeline to PLAYING");
999 ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
1000 ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
1001 ASSERT_OBJECT_REFCOUNT (oper, "oper", 1);
1002
1003 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
1004 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
1005
1006 GST_DEBUG ("Let's poll the bus");
1007
1008 while (carry_on) {
1009 message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 10);
1010 if (message) {
1011 switch (GST_MESSAGE_TYPE (message)) {
1012 case GST_MESSAGE_EOS:
1013 /* we should check if we really finished here */
1014 GST_WARNING ("Got an EOS");
1015 carry_on = FALSE;
1016 break;
1017 case GST_MESSAGE_SEGMENT_START:
1018 case GST_MESSAGE_SEGMENT_DONE:
1019 /* We shouldn't see any segement messages, since we didn't do a segment seek */
1020 GST_WARNING ("Saw a Segment start/stop");
1021 fail_if (TRUE);
1022 break;
1023 case GST_MESSAGE_ERROR:
1024 GST_WARNING ("Saw an ERROR");
1025 fail_if (TRUE);
1026 default:
1027 break;
1028 }
1029 gst_mini_object_unref (GST_MINI_OBJECT (message));
1030 }
1031 }
1032
1033 GST_DEBUG ("Setting pipeline to READY");
1034
1035 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
1036 GST_STATE_READY) == GST_STATE_CHANGE_FAILURE);
1037
1038 fail_if (collect->expected_segments != NULL);
1039
1040 GST_DEBUG ("Resetted pipeline to READY");
1041
1042 /* Elements should all be in the READY state */
1043 check_state_simple (source1, GST_STATE_READY);
1044 check_state_simple (source2, GST_STATE_READY);
1045 check_state_simple (oper, GST_STATE_READY);
1046
1047 /* Expected segments */ 567 /* Expected segments */
1048 collect->expected_segments = g_list_append (collect->expected_segments, 568 segments = g_list_append (segments,
1049 segment_new (1.0, GST_FORMAT_TIME, 0, 2 * GST_SECOND, 0)); 569 segment_new (1.0, GST_FORMAT_TIME, 0, 2 * GST_SECOND, 0));
1050 collect->expected_segments = g_list_append (collect->expected_segments, 570 segments = g_list_append (segments,
1051 segment_new (1.0, GST_FORMAT_TIME, 571 segment_new (1.0, GST_FORMAT_TIME,
1052 0 * GST_SECOND, 2 * GST_SECOND, 2 * GST_SECOND)); 572 0 * GST_SECOND, 2 * GST_SECOND, 2 * GST_SECOND));
1053 collect->expected_segments = g_list_append (collect->expected_segments, 573 segments = g_list_append (segments,
1054 segment_new (1.0, GST_FORMAT_TIME, 574 segment_new (1.0, GST_FORMAT_TIME,
1055 4 * GST_SECOND, 6 * GST_SECOND, 4 * GST_SECOND)); 575 4 * GST_SECOND, 6 * GST_SECOND, 4 * GST_SECOND));
1056 collect->gotsegment = FALSE;
1057
1058
1059 GST_DEBUG ("Setting pipeline to PLAYING again");
1060
1061 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
1062 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
1063
1064 carry_on = TRUE;
1065
1066 GST_DEBUG ("Let's poll the bus");
1067
1068 while (carry_on) {
1069 message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 10);
1070 if (message) {
1071 switch (GST_MESSAGE_TYPE (message)) {
1072 case GST_MESSAGE_EOS:
1073 /* we should check if we really finished here */
1074 carry_on = FALSE;
1075 break;
1076 case GST_MESSAGE_SEGMENT_START:
1077 case GST_MESSAGE_SEGMENT_DONE:
1078 /* We shouldn't see any segement messages, since we didn't do a segment seek */
1079 GST_WARNING ("Saw a Segment start/stop");
1080 fail_if (TRUE);
1081 break;
1082 case GST_MESSAGE_ERROR:
1083 GST_ERROR ("Saw an ERROR");
1084 fail_if (TRUE);
1085 default:
1086 break;
1087 }
1088 gst_mini_object_unref (GST_MINI_OBJECT (message));
1089 } else {
1090 GST_DEBUG ("bus_poll responded, but there wasn't any message...");
1091 }
1092 }
1093 576
1094 fail_if (collect->expected_segments != NULL); 577 fill_pipeline_and_check (comp, segments);
1095
1096 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
1097 GST_STATE_NULL) == GST_STATE_CHANGE_FAILURE);
1098
1099 gst_object_unref (GST_OBJECT (sinkpad));
1100 ASSERT_OBJECT_REFCOUNT_BETWEEN (pipeline, "main pipeline", 1, 2);
1101 gst_object_unref (pipeline);
1102 ASSERT_OBJECT_REFCOUNT_BETWEEN (bus, "main bus", 1, 2);
1103 gst_object_unref (bus);
1104
1105 g_free (collect);
1106} 578}
1107 579
1108GST_END_TEST; 580GST_END_TEST;
@@ -1110,17 +582,11 @@ GST_END_TEST;
1110 582
1111GST_START_TEST (test_complex_operations_bis) 583GST_START_TEST (test_complex_operations_bis)
1112{ 584{
1113 GstElement *pipeline;
1114 guint64 start, stop; 585 guint64 start, stop;
1115 gint64 duration; 586 gint64 duration;
1116 GstElement *comp, *oper, *source1, *source2, *sink; 587 GstElement *comp, *oper, *source1, *source2;
1117 CollectStructure *collect; 588 GList *segments = NULL;
1118 GstBus *bus;
1119 GstMessage *message;
1120 gboolean carry_on = TRUE;
1121 GstPad *sinkpad;
1122 589
1123 pipeline = gst_pipeline_new ("test_pipeline");
1124 comp = 590 comp =
1125 gst_element_factory_make_or_warn ("gnlcomposition", "test_composition"); 591 gst_element_factory_make_or_warn ("gnlcomposition", "test_composition");
1126 592
@@ -1142,11 +608,7 @@ GST_START_TEST (test_complex_operations_bis)
1142 */ 608 */
1143 609
1144 source1 = videotest_in_bin_gnl_src ("source1", 0, 4 * GST_SECOND, 3, 2); 610 source1 = videotest_in_bin_gnl_src ("source1", 0, 4 * GST_SECOND, 3, 2);
1145 if (source1 == NULL) { 611 fail_if (source1 == NULL);
1146 gst_object_unref (pipeline);
1147 gst_object_unref (comp);
1148 return;
1149 }
1150 check_start_stop_duration (source1, 0, 4 * GST_SECOND, 4 * GST_SECOND); 612 check_start_stop_duration (source1, 0, 4 * GST_SECOND, 4 * GST_SECOND);
1151 613
1152 /* 614 /*
@@ -1204,143 +666,17 @@ GST_START_TEST (test_complex_operations_bis)
1204 666
1205 ASSERT_OBJECT_REFCOUNT (oper, "oper", 1); 667 ASSERT_OBJECT_REFCOUNT (oper, "oper", 1);
1206 668
1207
1208 sink = gst_element_factory_make_or_warn ("fakesink", "sink");
1209 gst_bin_add_many (GST_BIN (pipeline), comp, sink, NULL);
1210
1211 /* Shared data */
1212 collect = g_new0 (CollectStructure, 1);
1213 collect->comp = comp;
1214 collect->sink = sink;
1215
1216 /* Expected segments */
1217 collect->expected_segments = g_list_append (collect->expected_segments,
1218 segment_new (1.0, GST_FORMAT_TIME, 0, 2 * GST_SECOND, 0));
1219 collect->expected_segments = g_list_append (collect->expected_segments,
1220 segment_new (1.0, GST_FORMAT_TIME,
1221 0 * GST_SECOND, 2 * GST_SECOND, 2 * GST_SECOND));
1222 collect->expected_segments = g_list_append (collect->expected_segments,
1223 segment_new (1.0, GST_FORMAT_TIME,
1224 0 * GST_SECOND, 2 * GST_SECOND, 4 * GST_SECOND));
1225
1226 g_signal_connect (G_OBJECT (comp), "pad-added",
1227 G_CALLBACK (composition_pad_added_cb), collect);
1228
1229 sinkpad = gst_element_get_pad (sink, "sink");
1230 gst_pad_add_event_probe (sinkpad, G_CALLBACK (sinkpad_event_probe), collect);
1231 gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (sinkpad_buffer_probe),
1232 collect);
1233
1234 bus = gst_element_get_bus (GST_ELEMENT (pipeline));
1235
1236 GST_DEBUG ("Setting pipeline to PLAYING");
1237 ASSERT_OBJECT_REFCOUNT (source1, "source1", 1);
1238 ASSERT_OBJECT_REFCOUNT (source2, "source2", 1);
1239 ASSERT_OBJECT_REFCOUNT (oper, "oper", 1);
1240
1241 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
1242 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
1243
1244 GST_DEBUG ("Let's poll the bus");
1245
1246 while (carry_on) {
1247 message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 10);
1248 if (message) {
1249 switch (GST_MESSAGE_TYPE (message)) {
1250 case GST_MESSAGE_EOS:
1251 /* we should check if we really finished here */
1252 GST_WARNING ("Got an EOS");
1253 carry_on = FALSE;
1254 break;
1255 case GST_MESSAGE_SEGMENT_START:
1256 case GST_MESSAGE_SEGMENT_DONE:
1257 /* We shouldn't see any segement messages, since we didn't do a segment seek */
1258 GST_WARNING ("Saw a Segment start/stop");
1259 fail_if (TRUE);
1260 break;
1261 case GST_MESSAGE_ERROR:
1262 GST_WARNING ("Saw an ERROR");
1263 fail_if (TRUE);
1264 default:
1265 break;
1266 }
1267 gst_mini_object_unref (GST_MINI_OBJECT (message));
1268 }
1269 }
1270
1271 GST_DEBUG ("Setting pipeline to READY");
1272
1273 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
1274 GST_STATE_READY) == GST_STATE_CHANGE_FAILURE);
1275
1276 fail_if (collect->expected_segments != NULL);
1277
1278 GST_DEBUG ("Resetted pipeline to READY, checking state of elements");
1279
1280 /* Elements should all be in the READY state */
1281 check_state_simple (source1, GST_STATE_READY);
1282 check_state_simple (source2, GST_STATE_READY);
1283 check_state_simple (oper, GST_STATE_READY);
1284
1285 /* Expected segments */ 669 /* Expected segments */
1286 collect->expected_segments = g_list_append (collect->expected_segments, 670 segments = g_list_append (segments,
1287 segment_new (1.0, GST_FORMAT_TIME, 0, 2 * GST_SECOND, 0)); 671 segment_new (1.0, GST_FORMAT_TIME, 0, 2 * GST_SECOND, 0));
1288 collect->expected_segments = g_list_append (collect->expected_segments, 672 segments = g_list_append (segments,
1289 segment_new (1.0, GST_FORMAT_TIME, 673 segment_new (1.0, GST_FORMAT_TIME,
1290 0 * GST_SECOND, 2 * GST_SECOND, 2 * GST_SECOND)); 674 0 * GST_SECOND, 2 * GST_SECOND, 2 * GST_SECOND));
1291 collect->expected_segments = g_list_append (collect->expected_segments, 675 segments = g_list_append (segments,
1292 segment_new (1.0, GST_FORMAT_TIME, 676 segment_new (1.0, GST_FORMAT_TIME,
1293 0 * GST_SECOND, 2 * GST_SECOND, 4 * GST_SECOND)); 677 0 * GST_SECOND, 2 * GST_SECOND, 4 * GST_SECOND));
1294 collect->gotsegment = FALSE;
1295
1296
1297 GST_DEBUG ("Setting pipeline to PLAYING again");
1298
1299 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
1300 GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE);
1301
1302 carry_on = TRUE;
1303
1304 GST_DEBUG ("Let's poll the bus");
1305
1306 while (carry_on) {
1307 message = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 10);
1308 if (message) {
1309 switch (GST_MESSAGE_TYPE (message)) {
1310 case GST_MESSAGE_EOS:
1311 /* we should check if we really finished here */
1312 carry_on = FALSE;
1313 break;
1314 case GST_MESSAGE_SEGMENT_START:
1315 case GST_MESSAGE_SEGMENT_DONE:
1316 /* We shouldn't see any segement messages, since we didn't do a segment seek */
1317 GST_WARNING ("Saw a Segment start/stop");
1318 fail_if (TRUE);
1319 break;
1320 case GST_MESSAGE_ERROR:
1321 GST_ERROR ("Saw an ERROR");
1322 fail_if (TRUE);
1323 default:
1324 break;
1325 }
1326 gst_mini_object_unref (GST_MINI_OBJECT (message));
1327 } else {
1328 GST_DEBUG ("bus_poll responded, but there wasn't any message...");
1329 }
1330 }
1331 678
1332 fail_if (collect->expected_segments != NULL); 679 fill_pipeline_and_check (comp, segments);
1333
1334 fail_if (gst_element_set_state (GST_ELEMENT (pipeline),
1335 GST_STATE_NULL) == GST_STATE_CHANGE_FAILURE);
1336
1337 gst_object_unref (GST_OBJECT (sinkpad));
1338 ASSERT_OBJECT_REFCOUNT_BETWEEN (pipeline, "main pipeline", 1, 2);
1339 gst_object_unref (pipeline);
1340 ASSERT_OBJECT_REFCOUNT_BETWEEN (bus, "main bus", 1, 2);
1341 gst_object_unref (bus);
1342
1343 g_free (collect);
1344} 680}
1345 681
1346GST_END_TEST; 682GST_END_TEST;