2 * Copyright (C) 2005 Jan Schmidt <thaytan@mad.scientist.com>
4 * gstsegment.c: Unit test for segments
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., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #include <gst/check/gstcheck.h>
24 /* mess with the segment structure in the bytes format */
25 GST_START_TEST (segment_seek_nosize)
32 gst_segment_init (&segment, GST_FORMAT_BYTES);
34 /* configure segment to start 100 */
35 gst_segment_set_seek (&segment, 1.0,
38 GST_SEEK_TYPE_SET, 100, GST_SEEK_TYPE_NONE, -1, &update);
39 fail_unless (segment.start == 100);
40 fail_unless (segment.stop == -1);
42 /* configure segment to stop relative, should not do anything since
44 gst_segment_set_seek (&segment, 1.0,
47 GST_SEEK_TYPE_NONE, 200, GST_SEEK_TYPE_CUR, -100, &update);
48 fail_unless (segment.start == 100);
49 fail_unless (segment.stop == -1);
51 /* do some clipping on the open range */
52 /* completely outside */
53 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 0, 50, &cstart, &cstop);
54 fail_unless (res == FALSE);
56 /* touching lower bound, still outside of the segment */
57 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 100, &cstart, &cstop);
58 fail_unless (res == FALSE);
60 /* partially inside */
61 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 150, &cstart, &cstop);
62 fail_unless (res == TRUE);
63 fail_unless (cstart == 100);
64 fail_unless (cstop == 150);
66 /* inside, touching lower bound */
67 res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
68 100, 150, &cstart, &cstop);
69 fail_unless (res == TRUE);
70 fail_unless (cstart == 100);
71 fail_unless (cstop == 150);
73 /* completely inside */
74 res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
75 150, 200, &cstart, &cstop);
76 fail_unless (res == TRUE);
77 fail_unless (cstart == 150);
78 fail_unless (cstop == 200);
81 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -1, 100, &cstart, &cstop);
82 fail_unless (res == FALSE);
84 /* start outside, we don't know the stop */
85 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, -1, &cstart, &cstop);
86 fail_unless (res == TRUE);
87 fail_unless (cstart == 100);
88 fail_unless (cstop == -1);
90 /* start on lower bound */
91 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 100, -1, &cstart, &cstop);
92 fail_unless (res == TRUE);
93 fail_unless (cstart == 100);
94 fail_unless (cstop == -1);
97 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 150, -1, &cstart, &cstop);
98 fail_unless (res == TRUE);
99 fail_unless (cstart == 150);
100 fail_unless (cstop == -1);
102 /* add 100 to start, set stop to 300 */
103 gst_segment_set_seek (&segment, 1.0,
106 GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 300, &update);
107 fail_unless (segment.start == 200);
108 fail_unless (segment.stop == 300);
110 /* add 100 to start (to 300), set stop to 200, this is not allowed.
111 * nothing should be updated in the segment. A g_warning is
113 ASSERT_CRITICAL (gst_segment_set_seek (&segment, 1.0,
116 GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 200, &update));
117 fail_unless (segment.start == 200);
118 fail_unless (segment.stop == 300);
120 /* seek relative to end, should not do anything since size is
122 gst_segment_set_seek (&segment, 1.0,
125 GST_SEEK_TYPE_END, -300, GST_SEEK_TYPE_END, -100, &update);
126 fail_unless (segment.start == 200);
127 fail_unless (segment.stop == 300);
129 /* completely outside */
130 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 0, 50, &cstart, &cstop);
131 fail_unless (res == FALSE);
133 /* touching lower bound */
134 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 200, &cstart, &cstop);
135 fail_unless (res == FALSE);
137 /* partially inside */
138 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 250, &cstart, &cstop);
139 fail_unless (res == TRUE);
140 fail_unless (cstart == 200);
141 fail_unless (cstop == 250);
143 /* inside, touching lower bound */
144 res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
145 200, 250, &cstart, &cstop);
146 fail_unless (res == TRUE);
147 fail_unless (cstart == 200);
148 fail_unless (cstop == 250);
150 /* completely inside */
151 res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
152 250, 290, &cstart, &cstop);
153 fail_unless (res == TRUE);
154 fail_unless (cstart == 250);
155 fail_unless (cstop == 290);
157 /* partially inside */
158 res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
159 250, 350, &cstart, &cstop);
160 fail_unless (res == TRUE);
161 fail_unless (cstart == 250);
162 fail_unless (cstop == 300);
165 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -1, 100, &cstart, &cstop);
166 fail_unless (res == FALSE);
169 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, -1, &cstart, &cstop);
170 fail_unless (res == TRUE);
171 fail_unless (cstart == 200);
172 fail_unless (cstop == 300);
174 /* start on lower bound */
175 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 200, -1, &cstart, &cstop);
176 fail_unless (res == TRUE);
177 fail_unless (cstart == 200);
178 fail_unless (cstop == 300);
181 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 250, -1, &cstart, &cstop);
182 fail_unless (res == TRUE);
183 fail_unless (cstart == 250);
184 fail_unless (cstop == 300);
186 /* start outside on boundary */
187 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 300, -1, &cstart, &cstop);
188 fail_unless (res == FALSE);
190 /* start completely outside */
191 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 350, -1, &cstart, &cstop);
192 fail_unless (res == FALSE);
197 /* mess with the segment structure in the bytes format */
198 GST_START_TEST (segment_seek_size)
202 gint64 cstart, cstop;
205 gst_segment_init (&segment, GST_FORMAT_BYTES);
206 gst_segment_set_duration (&segment, GST_FORMAT_BYTES, 200);
208 /* configure segment to start 100 */
209 gst_segment_set_seek (&segment, 1.0,
212 GST_SEEK_TYPE_SET, 100, GST_SEEK_TYPE_NONE, -1, &update);
213 fail_unless (segment.start == 100);
214 fail_unless (segment.stop == -1);
216 /* configure segment to stop relative, does not update stop
217 * since we did not set it before. */
218 gst_segment_set_seek (&segment, 1.0,
221 GST_SEEK_TYPE_NONE, 200, GST_SEEK_TYPE_CUR, -100, &update);
222 fail_unless (segment.start == 100);
223 fail_unless (segment.stop == -1);
225 /* do some clipping on the open range */
226 /* completely outside */
227 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 0, 50, &cstart, &cstop);
228 fail_unless (res == FALSE);
230 /* touching lower bound */
231 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 100, &cstart, &cstop);
232 fail_unless (res == FALSE);
234 /* partially inside */
235 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 150, &cstart, &cstop);
236 fail_unless (res == TRUE);
237 fail_unless (cstart == 100);
238 fail_unless (cstop == 150);
240 /* inside, touching lower bound */
241 res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
242 100, 150, &cstart, &cstop);
243 fail_unless (res == TRUE);
244 fail_unless (cstart == 100);
245 fail_unless (cstop == 150);
247 /* completely inside */
248 res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
249 150, 200, &cstart, &cstop);
250 fail_unless (res == TRUE);
251 fail_unless (cstart == 150);
252 fail_unless (cstop == 200);
254 /* partially inside, clip to size */
255 res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
256 150, 300, &cstart, &cstop);
257 fail_unless (res == TRUE);
258 fail_unless (cstart == 150);
259 fail_unless (cstop == 200);
262 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -1, 100, &cstart, &cstop);
263 fail_unless (res == FALSE);
266 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, -1, &cstart, &cstop);
267 fail_unless (res == TRUE);
268 fail_unless (cstart == 100);
269 fail_unless (cstop == -1);
271 /* start on lower bound */
272 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 100, -1, &cstart, &cstop);
273 fail_unless (res == TRUE);
274 fail_unless (cstart == 100);
275 fail_unless (cstop == -1);
278 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 150, -1, &cstart, &cstop);
279 fail_unless (res == TRUE);
280 fail_unless (cstart == 150);
281 fail_unless (cstop == -1);
283 /* add 100 to start, set stop to 300, stop clips to 200 */
284 gst_segment_set_seek (&segment, 1.0,
287 GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 300, &update);
288 fail_unless (segment.start == 200);
289 fail_unless (segment.stop == 200);
291 /* add 100 to start (to 300), set stop to 200, this clips start
293 gst_segment_set_seek (&segment, 1.0,
296 GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 200, &update);
297 fail_unless (segment.start == 200);
298 fail_unless (segment.stop == 200);
300 /* seek relative to end */
301 gst_segment_set_seek (&segment, 1.0,
304 GST_SEEK_TYPE_END, -100, GST_SEEK_TYPE_END, -20, &update);
305 fail_unless (segment.start == 100);
306 fail_unless (segment.stop == 180);
308 /* completely outside */
309 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 0, 50, &cstart, &cstop);
310 fail_unless (res == FALSE);
312 /* touching lower bound */
313 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 100, &cstart, &cstop);
314 fail_unless (res == FALSE);
316 /* partially inside */
317 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, 150, &cstart, &cstop);
318 fail_unless (res == TRUE);
319 fail_unless (cstart == 100);
320 fail_unless (cstop == 150);
322 /* inside, touching lower bound */
323 res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
324 100, 150, &cstart, &cstop);
325 fail_unless (res == TRUE);
326 fail_unless (cstart == 100);
327 fail_unless (cstop == 150);
329 /* completely inside */
330 res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
331 150, 170, &cstart, &cstop);
332 fail_unless (res == TRUE);
333 fail_unless (cstart == 150);
334 fail_unless (cstop == 170);
336 /* partially inside */
337 res = gst_segment_clip (&segment, GST_FORMAT_BYTES,
338 150, 250, &cstart, &cstop);
339 fail_unless (res == TRUE);
340 fail_unless (cstart == 150);
341 fail_unless (cstop == 180);
344 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, -1, 100, &cstart, &cstop);
345 fail_unless (res == FALSE);
348 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 50, -1, &cstart, &cstop);
349 fail_unless (res == TRUE);
350 fail_unless (cstart == 100);
351 fail_unless (cstop == 180);
353 /* start on lower bound */
354 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 100, -1, &cstart, &cstop);
355 fail_unless (res == TRUE);
356 fail_unless (cstart == 100);
357 fail_unless (cstop == 180);
360 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 150, -1, &cstart, &cstop);
361 fail_unless (res == TRUE);
362 fail_unless (cstart == 150);
363 fail_unless (cstop == 180);
365 /* start outside on boundary */
366 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 180, -1, &cstart, &cstop);
367 fail_unless (res == FALSE);
369 /* start completely outside */
370 res = gst_segment_clip (&segment, GST_FORMAT_BYTES, 250, -1, &cstart, &cstop);
371 fail_unless (res == FALSE);
376 /* mess with the segment structure in the bytes format */
377 GST_START_TEST (segment_newsegment_open)
381 gst_segment_init (&segment, GST_FORMAT_BYTES);
383 /* time should also work for starting from 0 */
384 gst_segment_set_newsegment (&segment, FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0);
386 fail_unless (segment.rate == 1.0);
387 fail_unless (segment.format == GST_FORMAT_BYTES);
388 fail_unless (segment.flags == 0);
389 fail_unless (segment.start == 0);
390 fail_unless (segment.stop == -1);
391 fail_unless (segment.time == 0);
392 fail_unless (segment.accum == 0);
393 fail_unless (segment.last_stop == 0);
394 fail_unless (segment.duration == -1);
396 /* we set stop but in the wrong format, stop stays open. */
397 gst_segment_set_newsegment (&segment, FALSE, 1.0, GST_FORMAT_TIME, 0, 200, 0);
399 fail_unless (segment.start == 0);
400 fail_unless (segment.stop == -1);
401 fail_unless (segment.time == 0);
402 fail_unless (segment.accum == 0);
404 /* update, nothing changes */
405 gst_segment_set_newsegment (&segment, TRUE, 1.0, GST_FORMAT_BYTES, 0, -1, 0);
407 fail_unless (segment.start == 0);
408 fail_unless (segment.stop == -1);
409 fail_unless (segment.time == 0);
410 fail_unless (segment.accum == 0);
413 gst_segment_set_newsegment (&segment, TRUE, 1.0,
414 GST_FORMAT_BYTES, 100, -1, 100);
416 fail_unless (segment.start == 100);
417 fail_unless (segment.stop == -1);
418 fail_unless (segment.time == 100);
419 fail_unless (segment.accum == 100);
421 /* last_stop 0, accum does not change */
422 gst_segment_set_newsegment (&segment, FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0);
424 fail_unless (segment.start == 0);
425 fail_unless (segment.stop == -1);
426 fail_unless (segment.time == 0);
427 fail_unless (segment.accum == 100);
429 gst_segment_set_last_stop (&segment, GST_FORMAT_BYTES, 200);
431 /* last_stop 200, accum changes */
432 gst_segment_set_newsegment (&segment, FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0);
434 fail_unless (segment.start == 0);
435 fail_unless (segment.stop == -1);
436 fail_unless (segment.time == 0);
437 fail_unless (segment.accum == 300);
444 /* mess with the segment structure in the bytes format */
445 GST_START_TEST (segment_newsegment_closed)
449 gst_segment_init (&segment, GST_FORMAT_BYTES);
451 gst_segment_set_newsegment (&segment, FALSE, 1.0,
452 GST_FORMAT_BYTES, 0, 200, 0);
454 fail_unless (segment.rate == 1.0);
455 fail_unless (segment.format == GST_FORMAT_BYTES);
456 fail_unless (segment.flags == 0);
457 fail_unless (segment.start == 0);
458 fail_unless (segment.stop == 200);
459 fail_unless (segment.time == 0);
460 fail_unless (segment.accum == 0);
461 fail_unless (segment.last_stop == 0);
462 fail_unless (segment.duration == -1);
465 gst_segment_set_newsegment (&segment, TRUE, 1.0, GST_FORMAT_BYTES, 0, 300, 0);
467 fail_unless (segment.start == 0);
468 fail_unless (segment.stop == 300);
469 fail_unless (segment.time == 0);
470 fail_unless (segment.accum == 0);
472 /* and a new accumulated one */
473 gst_segment_set_newsegment (&segment, FALSE, 1.0,
474 GST_FORMAT_BYTES, 100, 400, 300);
476 fail_unless (segment.start == 100);
477 fail_unless (segment.stop == 400);
478 fail_unless (segment.time == 300);
479 fail_unless (segment.accum == 300);
481 /* and a new updated one */
482 gst_segment_set_newsegment (&segment, TRUE, 1.0,
483 GST_FORMAT_BYTES, 100, 500, 300);
485 fail_unless (segment.start == 100);
486 fail_unless (segment.stop == 500);
487 fail_unless (segment.time == 300);
488 fail_unless (segment.accum == 300);
490 /* and a new partially updated one */
491 gst_segment_set_newsegment (&segment, TRUE, 1.0,
492 GST_FORMAT_BYTES, 200, 500, 400);
494 fail_unless (segment.start == 200);
495 fail_unless (segment.stop == 500);
496 fail_unless (segment.time == 400);
497 fail_unless (segment.accum == 400);
502 /* mess with the segment structure in the time format */
503 GST_START_TEST (segment_newsegment_streamtime)
508 gst_segment_init (&segment, GST_FORMAT_TIME);
510 /***************************
512 ***************************/
513 gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 1.0,
514 GST_FORMAT_TIME, 0, 200, 0);
516 fail_unless (segment.rate == 1.0);
517 fail_unless (segment.applied_rate == 1.0);
518 fail_unless (segment.format == GST_FORMAT_TIME);
519 fail_unless (segment.flags == 0);
520 fail_unless (segment.start == 0);
521 fail_unless (segment.stop == 200);
522 fail_unless (segment.time == 0);
523 fail_unless (segment.accum == 0);
524 fail_unless (segment.last_stop == 0);
525 fail_unless (segment.duration == -1);
527 /* invalid time gives invalid result */
528 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
529 fail_unless (result == -1);
531 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0);
532 fail_unless (result == 0);
534 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
535 fail_unless (result == 100);
537 /* outside of the segment */
538 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
539 fail_unless (result == -1);
541 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
542 fail_unless (result == -1);
544 /*********************
545 * time shifted by 500
546 *********************/
547 gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 1.0,
548 GST_FORMAT_TIME, 0, 200, 500);
550 fail_unless (segment.accum == 200);
552 /* invalid time gives invalid result */
553 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
554 fail_unless (result == -1);
556 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0);
557 fail_unless (result == 500);
559 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
560 fail_unless (result == 600);
562 /* outside of the segment */
563 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 500);
564 fail_unless (result == -1);
566 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
567 fail_unless (result == -1);
569 /*********************
571 *********************/
572 gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 1.0,
573 GST_FORMAT_TIME, 500, 700, 0);
575 fail_unless (segment.accum == 400);
577 /* invalid time gives invalid result */
578 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
579 fail_unless (result == -1);
581 /* before segment is invalid */
582 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 400);
583 fail_unless (result == -1);
585 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 500);
586 fail_unless (result == 0);
588 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 600);
589 fail_unless (result == 100);
591 /* outside of the segment */
592 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 700);
593 fail_unless (result == -1);
595 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 800);
596 fail_unless (result == -1);
598 /*************************************
599 * time offset by 500, shifted by 200
600 *************************************/
601 gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 1.0,
602 GST_FORMAT_TIME, 500, 700, 200);
604 fail_unless (segment.accum == 600);
606 /* invalid time gives invalid result */
607 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
608 fail_unless (result == -1);
610 /* before segment is invalid */
611 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 400);
612 fail_unless (result == -1);
614 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 500);
615 fail_unless (result == 200);
617 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 600);
618 fail_unless (result == 300);
620 /* outside of the segment */
621 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 700);
622 fail_unless (result == -1);
624 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 800);
625 fail_unless (result == -1);
630 /* mess with the segment structure in the time format */
631 GST_START_TEST (segment_newsegment_streamtime_rate)
636 gst_segment_init (&segment, GST_FORMAT_TIME);
638 /***************************
639 * Normal segment rate 2.0
640 ***************************/
641 gst_segment_set_newsegment_full (&segment, FALSE, 2.0, 1.0,
642 GST_FORMAT_TIME, 0, 200, 0);
644 fail_unless (segment.rate == 2.0);
645 fail_unless (segment.applied_rate == 1.0);
646 fail_unless (segment.format == GST_FORMAT_TIME);
647 fail_unless (segment.flags == 0);
648 fail_unless (segment.start == 0);
649 fail_unless (segment.stop == 200);
650 fail_unless (segment.time == 0);
651 fail_unless (segment.accum == 0);
652 fail_unless (segment.last_stop == 0);
653 fail_unless (segment.duration == -1);
655 /* invalid time gives invalid result */
656 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
657 fail_unless (result == -1);
659 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0);
660 fail_unless (result == 0);
662 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
663 fail_unless (result == 100);
665 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150);
666 fail_unless (result == 150);
668 /* outside of the segment */
669 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
670 fail_unless (result == -1);
672 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
673 fail_unless (result == -1);
675 /***************************************
676 * Normal segment rate 2.0, offset
677 ***************************************/
678 gst_segment_set_newsegment_full (&segment, FALSE, 2.0, 1.0,
679 GST_FORMAT_TIME, 100, 300, 0);
681 fail_unless (segment.accum == 100);
683 /* invalid time gives invalid result */
684 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
685 fail_unless (result == -1);
687 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
688 fail_unless (result == 0);
690 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
691 fail_unless (result == 100);
693 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 250);
694 fail_unless (result == 150);
696 /* outside of the segment */
697 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
698 fail_unless (result == -1);
700 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 400);
701 fail_unless (result == -1);
703 /***************************************
704 * Normal segment rate -1.0, offset
705 ***************************************/
707 /* buffers will arrive from 300 to 100 in a sink, stream time
708 * calculation is unaffected by the rate */
709 gst_segment_set_newsegment_full (&segment, FALSE, -1.0, 1.0,
710 GST_FORMAT_TIME, 100, 300, 0);
712 fail_unless (segment.accum == 200);
714 /* invalid time gives invalid result */
715 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
716 fail_unless (result == -1);
718 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
719 fail_unless (result == 0);
721 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
722 fail_unless (result == 100);
724 /***********************************************
725 * Normal segment rate -1.0, offset, time = 200
726 ***********************************************/
727 gst_segment_set_newsegment_full (&segment, FALSE, -1.0, 1.0,
728 GST_FORMAT_TIME, 100, 300, 200);
730 /* invalid time gives invalid result */
731 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
732 fail_unless (result == -1);
734 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
735 fail_unless (result == 200);
737 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
738 fail_unless (result == 300);
740 /* outside of the segment */
741 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
742 fail_unless (result == -1);
744 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 400);
745 fail_unless (result == -1);
750 /* mess with the segment structure in the time format */
751 GST_START_TEST (segment_newsegment_streamtime_applied_rate)
756 gst_segment_init (&segment, GST_FORMAT_TIME);
758 /***********************************************************
759 * Normal segment rate 1.0, applied rate -1.0
760 * This means the timestamps represents a stream going backwards
761 * starting from @time to 0.
762 ************************************************************/
763 gst_segment_set_newsegment_full (&segment, FALSE, 1.0, -1.0,
764 GST_FORMAT_TIME, 0, 200, 200);
766 fail_unless (segment.rate == 1.0);
767 fail_unless (segment.applied_rate == -1.0);
768 fail_unless (segment.format == GST_FORMAT_TIME);
769 fail_unless (segment.flags == 0);
770 fail_unless (segment.start == 0);
771 fail_unless (segment.stop == 200);
772 fail_unless (segment.time == 200);
773 fail_unless (segment.accum == 0);
774 fail_unless (segment.last_stop == 0);
775 fail_unless (segment.duration == -1);
777 /* invalid time gives invalid result */
778 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
779 fail_unless (result == -1);
781 /* we count backwards from 200 */
782 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0);
783 fail_unless (result == 200);
785 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
786 fail_unless (result == 100);
788 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150);
789 fail_unless (result == 50);
791 /* outside of the segment */
792 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
793 fail_unless (result == -1);
795 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
796 fail_unless (result == -1);
798 /***********************************************************
799 * Normal segment rate 1.0, applied rate 2.0
800 * This means the timestamps represents a stream at twice the
802 ************************************************************/
803 gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 2.0,
804 GST_FORMAT_TIME, 0, 200, 0);
806 fail_unless (segment.rate == 1.0);
807 fail_unless (segment.applied_rate == 2.0);
808 fail_unless (segment.format == GST_FORMAT_TIME);
809 fail_unless (segment.flags == 0);
810 fail_unless (segment.start == 0);
811 fail_unless (segment.stop == 200);
812 fail_unless (segment.time == 0);
813 fail_unless (segment.accum == 200);
814 fail_unless (segment.last_stop == 0);
815 fail_unless (segment.duration == -1);
817 /* invalid time gives invalid result */
818 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
819 fail_unless (result == -1);
821 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0);
822 fail_unless (result == 0);
824 /* the stream prepresents a stream going twice as fast, the position
825 * in the segment is therefore scaled by the applied rate */
826 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
827 fail_unless (result == 200);
829 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150);
830 fail_unless (result == 300);
832 /* outside of the segment */
833 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
834 fail_unless (result == -1);
836 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
837 fail_unless (result == -1);
839 /***********************************************************
840 * Normal segment rate 1.0, applied rate -2.0
841 * This means the timestamps represents a stream at twice the
843 ************************************************************/
844 gst_segment_set_newsegment_full (&segment, FALSE, 1.0, -2.0,
845 GST_FORMAT_TIME, 0, 200, 400);
847 fail_unless (segment.rate == 1.0);
848 fail_unless (segment.applied_rate == -2.0);
849 fail_unless (segment.format == GST_FORMAT_TIME);
850 fail_unless (segment.flags == 0);
851 fail_unless (segment.start == 0);
852 fail_unless (segment.stop == 200);
853 fail_unless (segment.time == 400);
854 /* previous segment lasted 200, rate of 2.0 was already applied */
855 fail_unless (segment.accum == 400);
856 fail_unless (segment.last_stop == 0);
857 fail_unless (segment.duration == -1);
859 /* invalid time gives invalid result */
860 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
861 fail_unless (result == -1);
863 /* we count backwards from 400 */
864 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0);
865 fail_unless (result == 400);
867 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
868 fail_unless (result == 200);
870 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150);
871 fail_unless (result == 100);
873 /* outside of the segment */
874 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
875 fail_unless (result == -1);
877 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
878 fail_unless (result == -1);
880 /***********************************************************
881 * Normal segment rate 1.0, applied rate -2.0
882 * This means the timestamps represents a stream at twice the
883 * reverse rate, start time cannot compensate the complete
884 * duration of the segment so we stop at 0
885 ************************************************************/
886 gst_segment_set_newsegment_full (&segment, FALSE, 1.0, -2.0,
887 GST_FORMAT_TIME, 0, 200, 200);
889 fail_unless (segment.rate == 1.0);
890 fail_unless (segment.applied_rate == -2.0);
891 fail_unless (segment.format == GST_FORMAT_TIME);
892 fail_unless (segment.flags == 0);
893 fail_unless (segment.start == 0);
894 fail_unless (segment.stop == 200);
895 fail_unless (segment.time == 200);
896 fail_unless (segment.accum == 600);
897 fail_unless (segment.last_stop == 0);
898 fail_unless (segment.duration == -1);
900 /* invalid time gives invalid result */
901 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
902 fail_unless (result == -1);
904 /* we count backwards from 200 */
905 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0);
906 fail_unless (result == 200);
908 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
909 fail_unless (result == 0);
912 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150);
913 fail_unless (result == 0);
915 /* outside of the segment */
916 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
917 fail_unless (result == -1);
919 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
920 fail_unless (result == -1);
925 /* mess with the segment structure in the time format */
926 GST_START_TEST (segment_newsegment_streamtime_applied_rate_rate)
931 gst_segment_init (&segment, GST_FORMAT_TIME);
933 /***********************************************************
934 * Segment rate 2.0, applied rate 2.0
935 * this means we have a double speed stream that we should
936 * speed up by a factor of 2.0 some more. the resulting
937 * stream will be played at four times the speed.
938 ************************************************************/
939 gst_segment_set_newsegment_full (&segment, FALSE, 2.0, 2.0,
940 GST_FORMAT_TIME, 0, 200, 0);
942 fail_unless (segment.rate == 2.0);
943 fail_unless (segment.applied_rate == 2.0);
944 fail_unless (segment.format == GST_FORMAT_TIME);
945 fail_unless (segment.flags == 0);
946 fail_unless (segment.start == 0);
947 fail_unless (segment.stop == 200);
948 fail_unless (segment.time == 0);
949 fail_unless (segment.accum == 0);
950 fail_unless (segment.last_stop == 0);
951 fail_unless (segment.duration == -1);
953 /* invalid time gives invalid result */
954 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
955 fail_unless (result == -1);
957 /* only applied rate affects our calculation of the stream time */
958 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0);
959 fail_unless (result == 0);
961 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
962 fail_unless (result == 200);
964 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150);
965 fail_unless (result == 300);
967 /* outside of the segment */
968 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
969 fail_unless (result == -1);
971 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
972 fail_unless (result == -1);
974 /***********************************************************
975 * Segment rate 2.0, applied rate -1.0
976 * this means we have a reverse stream that we should
977 * speed up by a factor of 2.0
978 ************************************************************/
979 gst_segment_set_newsegment_full (&segment, FALSE, 2.0, -1.0,
980 GST_FORMAT_TIME, 0, 200, 200);
982 fail_unless (segment.rate == 2.0);
983 fail_unless (segment.applied_rate == -1.0);
984 fail_unless (segment.format == GST_FORMAT_TIME);
985 fail_unless (segment.flags == 0);
986 fail_unless (segment.start == 0);
987 fail_unless (segment.stop == 200);
988 fail_unless (segment.time == 200);
989 /* previous segment lasted 100 */
990 fail_unless (segment.accum == 100);
991 fail_unless (segment.last_stop == 0);
992 fail_unless (segment.duration == -1);
994 /* invalid time gives invalid result */
995 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
996 fail_unless (result == -1);
998 /* only applied rate affects our calculation of the stream time */
999 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0);
1000 fail_unless (result == 200);
1002 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
1003 fail_unless (result == 100);
1005 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150);
1006 fail_unless (result == 50);
1008 /* outside of the segment */
1009 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
1010 fail_unless (result == -1);
1012 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
1013 fail_unless (result == -1);
1015 /***********************************************************
1016 * Segment rate -1.0, applied rate -1.0
1017 * this means we have a reverse stream that we should
1018 * reverse to get the normal stream again.
1019 ************************************************************/
1020 gst_segment_set_newsegment_full (&segment, FALSE, -1.0, -1.0,
1021 GST_FORMAT_TIME, 0, 200, 200);
1023 fail_unless (segment.rate == -1.0);
1024 fail_unless (segment.applied_rate == -1.0);
1025 fail_unless (segment.format == GST_FORMAT_TIME);
1026 fail_unless (segment.flags == 0);
1027 fail_unless (segment.start == 0);
1028 fail_unless (segment.stop == 200);
1029 fail_unless (segment.time == 200);
1030 /* accumulated 100 of previous segment to make 200 */
1031 fail_unless (segment.accum == 200);
1032 fail_unless (segment.last_stop == 0);
1033 fail_unless (segment.duration == -1);
1035 /* invalid time gives invalid result */
1036 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
1037 fail_unless (result == -1);
1039 /* only applied rate affects our calculation of the stream time */
1040 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0);
1041 fail_unless (result == 200);
1043 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
1044 fail_unless (result == 100);
1046 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150);
1047 fail_unless (result == 50);
1049 /* outside of the segment */
1050 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
1051 fail_unless (result == -1);
1053 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
1054 fail_unless (result == -1);
1056 /***********************************************************
1057 * Segment rate -1.0, applied rate -1.0
1058 * this means we have a reverse stream that we should
1059 * reverse to get the normal stream again.
1060 ************************************************************/
1061 gst_segment_set_newsegment_full (&segment, FALSE, -1.0, 2.0,
1062 GST_FORMAT_TIME, 0, 200, 0);
1064 fail_unless (segment.rate == -1.0);
1065 fail_unless (segment.applied_rate == 2.0);
1066 fail_unless (segment.format == GST_FORMAT_TIME);
1067 fail_unless (segment.flags == 0);
1068 fail_unless (segment.start == 0);
1069 fail_unless (segment.stop == 200);
1070 fail_unless (segment.time == 0);
1071 fail_unless (segment.accum == 400);
1072 fail_unless (segment.last_stop == 0);
1073 fail_unless (segment.duration == -1);
1075 /* invalid time gives invalid result */
1076 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1);
1077 fail_unless (result == -1);
1079 /* only applied rate affects our calculation of the stream time */
1080 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 0);
1081 fail_unless (result == 0);
1083 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 100);
1084 fail_unless (result == 200);
1086 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 150);
1087 fail_unless (result == 300);
1089 /* outside of the segment */
1090 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 200);
1091 fail_unless (result == -1);
1093 result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, 300);
1094 fail_unless (result == -1);
1099 /* mess with the segment structure in the time format */
1100 GST_START_TEST (segment_newsegment_runningtime)
1105 gst_segment_init (&segment, GST_FORMAT_TIME);
1107 /***************************
1109 ***************************/
1110 gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 1.0,
1111 GST_FORMAT_TIME, 0, 200, 0);
1113 fail_unless (segment.rate == 1.0);
1114 fail_unless (segment.applied_rate == 1.0);
1115 fail_unless (segment.format == GST_FORMAT_TIME);
1116 fail_unless (segment.flags == 0);
1117 fail_unless (segment.start == 0);
1118 fail_unless (segment.stop == 200);
1119 fail_unless (segment.time == 0);
1120 fail_unless (segment.accum == 0);
1121 fail_unless (segment.last_stop == 0);
1122 fail_unless (segment.duration == -1);
1124 /* invalid time gives invalid result */
1125 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1);
1126 fail_unless (result == -1);
1128 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 0);
1129 fail_unless (result == 0);
1131 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 100);
1132 fail_unless (result == 100);
1134 /* outside of the segment */
1135 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 200);
1136 fail_unless (result == -1);
1138 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 300);
1139 fail_unless (result == -1);
1141 /***********************************************************
1142 * time shifted by 500, check if accumulation worked.
1143 * Rate convert to twice the speed which means scaling down
1144 * all positions by 2.0 in this segment.
1145 * Then time argument is not used at all here.
1146 ***********************************************************/
1147 gst_segment_set_newsegment_full (&segment, FALSE, 2.0, 1.0,
1148 GST_FORMAT_TIME, 0, 200, 500);
1150 /* normal speed gives elapsed of 200 */
1151 fail_unless (segment.accum == 200);
1153 /* invalid time gives invalid result */
1154 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1);
1155 fail_unless (result == -1);
1157 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 0);
1158 fail_unless (result == 200);
1160 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 100);
1161 fail_unless (result == 250);
1163 /* outside of the segment */
1164 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 500);
1165 fail_unless (result == -1);
1167 /********************************************
1168 * time offset by 500
1169 * applied rate is not used for running time
1170 ********************************************/
1171 gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 2.0,
1172 GST_FORMAT_TIME, 500, 700, 0);
1174 /* previous segment played at double speed gives elapsed time of
1175 * 100 added to previous accum of 200 gives 300. */
1176 fail_unless (segment.accum == 300);
1178 /* invalid time gives invalid result */
1179 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1);
1180 fail_unless (result == -1);
1182 /* before segment is invalid */
1183 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 400);
1184 fail_unless (result == -1);
1186 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 500);
1187 fail_unless (result == 300);
1189 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 600);
1190 fail_unless (result == 400);
1192 /* outside of the segment */
1193 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 700);
1194 fail_unless (result == -1);
1196 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 800);
1197 fail_unless (result == -1);
1199 /**********************************************************
1200 * time offset by 500, shifted by 200
1201 * Negative rate makes the running time go backwards
1202 * relative to the segment stop position. again time
1204 **********************************************************/
1205 gst_segment_set_newsegment_full (&segment, FALSE, -1.0, 1.0,
1206 GST_FORMAT_TIME, 500, 700, 200);
1208 fail_unless (segment.accum == 500);
1210 /* invalid time gives invalid result */
1211 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1);
1212 fail_unless (result == -1);
1214 /* before segment is invalid */
1215 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 400);
1216 fail_unless (result == -1);
1218 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 500);
1219 fail_unless (result == 700);
1221 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 600);
1222 fail_unless (result == 600);
1224 /* outside of the segment */
1225 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 700);
1226 fail_unless (result == -1);
1228 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 800);
1229 fail_unless (result == -1);
1231 /**********************************************************
1232 * time offset by 500, shifted by 200
1233 * Negative rate makes the running time go backwards at
1234 * twice speed relative to the segment stop position. again
1236 **********************************************************/
1237 gst_segment_set_newsegment_full (&segment, FALSE, -2.0, -2.0,
1238 GST_FORMAT_TIME, 500, 700, 200);
1240 fail_unless (segment.accum == 700);
1242 /* invalid time gives invalid result */
1243 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1);
1244 fail_unless (result == -1);
1246 /* before segment is invalid */
1247 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 400);
1248 fail_unless (result == -1);
1250 /* total scaled segment time is 100, accum is 700, so we get 800 */
1251 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 500);
1252 fail_unless (result == 800);
1254 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 600);
1255 fail_unless (result == 750);
1257 /* outside of the segment */
1258 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 700);
1259 fail_unless (result == -1);
1261 result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 800);
1262 fail_unless (result == -1);
1264 /* see if negative rate closed segment correctly */
1265 gst_segment_set_newsegment_full (&segment, FALSE, -2.0, -1.0,
1266 GST_FORMAT_TIME, 500, 700, 200);
1268 /* previous segment lasted 100, and was at 700 so we should get 800 */
1269 fail_unless (segment.accum == 800);
1275 gst_segment_suite (void)
1277 Suite *s = suite_create ("GstSegment");
1278 TCase *tc_chain = tcase_create ("segments");
1280 tcase_set_timeout (tc_chain, 20);
1282 suite_add_tcase (s, tc_chain);
1283 tcase_add_test (tc_chain, segment_seek_nosize);
1284 tcase_add_test (tc_chain, segment_seek_size);
1285 tcase_add_test (tc_chain, segment_newsegment_open);
1286 tcase_add_test (tc_chain, segment_newsegment_closed);
1287 tcase_add_test (tc_chain, segment_newsegment_streamtime);
1288 tcase_add_test (tc_chain, segment_newsegment_streamtime_rate);
1289 tcase_add_test (tc_chain, segment_newsegment_streamtime_applied_rate);
1290 tcase_add_test (tc_chain, segment_newsegment_streamtime_applied_rate_rate);
1291 tcase_add_test (tc_chain, segment_newsegment_runningtime);
1296 GST_CHECK_MAIN (gst_segment);