diff options
Diffstat (limited to 'tests/check/gst/gstsegment.c')
-rw-r--r-- | tests/check/gst/gstsegment.c | 343 |
1 files changed, 179 insertions, 164 deletions
diff --git a/tests/check/gst/gstsegment.c b/tests/check/gst/gstsegment.c index 2c7b42bbcb..ca78aa09b0 100644 --- a/tests/check/gst/gstsegment.c +++ b/tests/check/gst/gstsegment.c @@ -27,13 +27,13 @@ GST_START_TEST (segment_seek_nosize) { GstSegment segment; gboolean res; - gint64 cstart, cstop; + guint64 cstart, cstop; gboolean update; gst_segment_init (&segment, GST_FORMAT_BYTES); /* configure segment to start 100 */ - gst_segment_set_seek (&segment, 1.0, + gst_segment_do_seek (&segment, 1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_SET, 100, GST_SEEK_TYPE_NONE, -1, &update); @@ -43,7 +43,7 @@ GST_START_TEST (segment_seek_nosize) /* configure segment to stop relative, should not do anything since * size is unknown. */ - gst_segment_set_seek (&segment, 1.0, + gst_segment_do_seek (&segment, 1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, 200, GST_SEEK_TYPE_CUR, -100, &update); @@ -121,7 +121,7 @@ GST_START_TEST (segment_seek_nosize) fail_unless (cstop == -1); /* add 100 to start, set stop to 300 */ - gst_segment_set_seek (&segment, 1.0, + gst_segment_do_seek (&segment, 1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 300, &update); @@ -130,10 +130,10 @@ GST_START_TEST (segment_seek_nosize) fail_unless (update == TRUE); update = FALSE; - /* add 100 to start (to 300), set stop to 200, this is not allowed. + /* add 100 to start (to 300), set stop to 200, this is not allowed. * nothing should be updated in the segment. A g_warning is * emited. */ - ASSERT_CRITICAL (gst_segment_set_seek (&segment, 1.0, + ASSERT_CRITICAL (gst_segment_do_seek (&segment, 1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 200, &update)); @@ -145,7 +145,7 @@ GST_START_TEST (segment_seek_nosize) update = TRUE; /* seek relative to end, should not do anything since size is * unknown. */ - gst_segment_set_seek (&segment, 1.0, + gst_segment_do_seek (&segment, 1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_END, -300, GST_SEEK_TYPE_END, -100, &update); @@ -226,14 +226,14 @@ GST_START_TEST (segment_seek_size) { GstSegment segment; gboolean res; - gint64 cstart, cstop; + guint64 cstart, cstop; gboolean update; gst_segment_init (&segment, GST_FORMAT_BYTES); - gst_segment_set_duration (&segment, GST_FORMAT_BYTES, 200); + segment.duration = 200; /* configure segment to start 100 */ - gst_segment_set_seek (&segment, 1.0, + gst_segment_do_seek (&segment, 1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_SET, 100, GST_SEEK_TYPE_NONE, -1, &update); @@ -243,7 +243,7 @@ GST_START_TEST (segment_seek_size) /* configure segment to stop relative, does not update stop * since we did not set it before. */ - gst_segment_set_seek (&segment, 1.0, + gst_segment_do_seek (&segment, 1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, 200, GST_SEEK_TYPE_CUR, -100, &update); @@ -310,7 +310,7 @@ GST_START_TEST (segment_seek_size) fail_unless (cstop == -1); /* add 100 to start, set stop to 300, stop clips to 200 */ - gst_segment_set_seek (&segment, 1.0, + gst_segment_do_seek (&segment, 1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 300, &update); @@ -319,7 +319,7 @@ GST_START_TEST (segment_seek_size) /* add 100 to start (to 300), set stop to 200, this clips start * to duration */ - gst_segment_set_seek (&segment, 1.0, + gst_segment_do_seek (&segment, 1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_CUR, 100, GST_SEEK_TYPE_SET, 200, &update); @@ -328,7 +328,7 @@ GST_START_TEST (segment_seek_size) fail_unless (update == FALSE); /* seek relative to end */ - gst_segment_set_seek (&segment, 1.0, + gst_segment_do_seek (&segment, 1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_END, -100, GST_SEEK_TYPE_END, -20, &update); @@ -410,38 +410,38 @@ GST_START_TEST (segment_seek_reverse) gboolean update; gst_segment_init (&segment, GST_FORMAT_BYTES); - gst_segment_set_duration (&segment, GST_FORMAT_BYTES, 200); + segment.duration = 200; /* configure segment to stop 100 */ - gst_segment_set_seek (&segment, -1.0, + gst_segment_do_seek (&segment, -1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_SET, 100, &update); fail_unless (segment.start == 0); fail_unless (segment.stop == 100); fail_unless (segment.time == 0); - fail_unless (segment.last_stop == 100); + fail_unless (segment.position == 100); fail_unless (update == TRUE); /* update */ - gst_segment_set_seek (&segment, -1.0, + gst_segment_do_seek (&segment, -1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_SET, 10, GST_SEEK_TYPE_CUR, -20, &update); fail_unless (segment.start == 10); fail_unless (segment.stop == 80); fail_unless (segment.time == 10); - fail_unless (segment.last_stop == 80); + fail_unless (segment.position == 80); fail_unless (update == TRUE); - gst_segment_set_seek (&segment, -1.0, + gst_segment_do_seek (&segment, -1.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_SET, 20, GST_SEEK_TYPE_NONE, 0, &update); fail_unless (segment.start == 20); fail_unless (segment.stop == 80); fail_unless (segment.time == 20); - fail_unless (segment.last_stop == 80); + fail_unless (segment.position == 80); fail_unless (update == FALSE); } @@ -455,10 +455,9 @@ GST_START_TEST (segment_seek_rate) gst_segment_init (&segment, GST_FORMAT_BYTES); - /* configure segment to rate 2.0, format does not matter when we don't specify - * a start or stop position. */ - gst_segment_set_seek (&segment, 2.0, - GST_FORMAT_UNDEFINED, + /* configure segment to rate 2.0 */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_NONE, -1, &update); fail_unless (segment.format == GST_FORMAT_BYTES); @@ -467,43 +466,45 @@ GST_START_TEST (segment_seek_rate) fail_unless (segment.rate == 2.0); fail_unless (update == FALSE); +#if 0 /* 0 is the same in all formats and should not fail */ - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, -1, &update); fail_unless (segment.format == GST_FORMAT_BYTES); /* set to -1 means start from 0 */ - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_SET, -1, GST_SEEK_TYPE_NONE, -1, &update); fail_unless (segment.format == GST_FORMAT_BYTES); fail_unless (segment.start == 0); - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_CUR, 0, GST_SEEK_TYPE_NONE, -1, &update); - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_END, 0, GST_SEEK_TYPE_NONE, -1, &update); /* -1 for end is fine too in all formats */ - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_SET, -1, &update); /* 0 as relative end is fine too */ - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_CUR, 0, &update); - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_END, 0, &update); +#endif /* set a real stop position, this must happen in bytes */ - gst_segment_set_seek (&segment, 3.0, + gst_segment_do_seek (&segment, 3.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_SET, 100, &update); @@ -515,52 +516,53 @@ GST_START_TEST (segment_seek_rate) * playback mode.*/ fail_unless (update == FALSE); +#if 0 /* 0 as relative end is fine too */ - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_CUR, 0, &update); fail_unless (segment.stop == 100); - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_END, 0, &update); fail_unless (segment.stop == 100); /* -1 for end is fine too in all formats */ - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_SET, -1, &update); fail_unless (segment.stop == -1); +#endif /* set some duration, stop -1 END seeks will now work with the * duration, if the formats match */ - gst_segment_set_duration (&segment, GST_FORMAT_BYTES, 200); + segment.duration = 200; fail_unless (segment.duration == 200); - /* seek to end in any format with 0 should set the stop to the - * duration */ - gst_segment_set_seek (&segment, 2.0, - GST_FORMAT_TIME, GST_SEEK_FLAG_NONE, + /* seek to end with 0 should set the stop to the duration */ + gst_segment_do_seek (&segment, 2.0, + GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_END, 0, &update); fail_unless (segment.stop == 200); fail_unless (segment.duration == 200); /* subtract 100 from the end */ - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_END, -100, &update); fail_unless (segment.stop == 100); fail_unless (segment.duration == 200); /* add 100 to the duration, this should be clamped to the duration */ - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_END, 100, &update); fail_unless (segment.stop == 200); fail_unless (segment.duration == 200); /* add 300 to the start, this should be clamped to the duration */ - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_CUR, 300, GST_SEEK_TYPE_END, 0, &update); fail_unless (segment.start == 200); @@ -568,9 +570,10 @@ GST_START_TEST (segment_seek_rate) fail_unless (segment.duration == 200); /* subtract 300 from the start, this should be clamped to 0 */ - gst_segment_set_seek (&segment, 2.0, + gst_segment_do_seek (&segment, 2.0, GST_FORMAT_BYTES, GST_SEEK_FLAG_NONE, GST_SEEK_TYPE_CUR, -300, GST_SEEK_TYPE_END, 0, &update); + GST_DEBUG ("%" G_GINT64_FORMAT, segment.start); fail_unless (segment.start == 0); fail_unless (segment.stop == 200); fail_unless (segment.duration == 200); @@ -578,6 +581,7 @@ GST_START_TEST (segment_seek_rate) GST_END_TEST; +#if 0 /* mess with the segment structure in the bytes format */ GST_START_TEST (segment_newsegment_open) { @@ -586,7 +590,8 @@ GST_START_TEST (segment_newsegment_open) gst_segment_init (&segment, GST_FORMAT_BYTES); /* time should also work for starting from 0 */ - gst_segment_set_newsegment (&segment, FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0); + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_TIME, 0, -1, + 0); fail_unless (segment.rate == 1.0); fail_unless (segment.format == GST_FORMAT_BYTES); @@ -594,58 +599,62 @@ GST_START_TEST (segment_newsegment_open) fail_unless (segment.start == 0); fail_unless (segment.stop == -1); fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); fail_unless (segment.duration == -1); /* we set stop but in the wrong format, stop stays open. */ - gst_segment_set_newsegment (&segment, FALSE, 1.0, GST_FORMAT_TIME, 0, 200, 0); + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_TIME, 0, + 200, 0); fail_unless (segment.start == 0); fail_unless (segment.stop == -1); fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); /* update, nothing changes */ - gst_segment_set_newsegment (&segment, TRUE, 1.0, GST_FORMAT_BYTES, 0, -1, 0); + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, GST_FORMAT_BYTES, 0, -1, + 0); fail_unless (segment.start == 0); fail_unless (segment.stop == -1); fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); /* update */ - gst_segment_set_newsegment (&segment, TRUE, 1.0, + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, GST_FORMAT_BYTES, 100, -1, 100); fail_unless (segment.start == 100); fail_unless (segment.stop == -1); fail_unless (segment.time == 100); - fail_unless (segment.accum == 100); - fail_unless (segment.last_stop == 100); + fail_unless (segment.base == 100); + fail_unless (segment.position == 100); - /* last_stop 0, accum does not change */ - gst_segment_set_newsegment (&segment, FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0); + /* last_stop 0, base does not change */ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_BYTES, 0, + -1, 0); fail_unless (segment.start == 0); fail_unless (segment.stop == -1); fail_unless (segment.time == 0); - fail_unless (segment.accum == 100); + fail_unless (segment.base == 100); gst_segment_set_last_stop (&segment, GST_FORMAT_BYTES, 200); - fail_unless (segment.last_stop == 200); + fail_unless (segment.position == 200); - /* last_stop 200, accum changes */ - gst_segment_set_newsegment (&segment, FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0); + /* last_stop 200, base changes */ + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_BYTES, 0, + -1, 0); fail_unless (segment.start == 0); fail_unless (segment.stop == -1); fail_unless (segment.time == 0); - fail_unless (segment.accum == 300); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 300); + fail_unless (segment.position == 0); } GST_END_TEST; @@ -658,7 +667,7 @@ GST_START_TEST (segment_newsegment_closed) gst_segment_init (&segment, GST_FORMAT_BYTES); - gst_segment_set_newsegment (&segment, FALSE, 1.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_BYTES, 0, 200, 0); fail_unless (segment.rate == 1.0); @@ -667,60 +676,60 @@ GST_START_TEST (segment_newsegment_closed) fail_unless (segment.start == 0); fail_unless (segment.stop == 200); fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); fail_unless (segment.duration == -1); /* assume we advanced to position 40 */ gst_segment_set_last_stop (&segment, GST_FORMAT_BYTES, 40); - fail_unless (segment.last_stop == 40); + fail_unless (segment.position == 40); /* do an update to the start, last_stop is unchanged because it's bigger */ - gst_segment_set_newsegment (&segment, TRUE, 1.0, GST_FORMAT_BYTES, 20, 200, - 20); + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, GST_FORMAT_BYTES, 20, + 200, 20); fail_unless (segment.start == 20); fail_unless (segment.stop == 200); fail_unless (segment.time == 20); - fail_unless (segment.accum == 20); - fail_unless (segment.last_stop == 40); + fail_unless (segment.base == 20); + fail_unless (segment.position == 40); /* do an update past our last_stop, it should be updated now */ - gst_segment_set_newsegment (&segment, TRUE, 1.0, GST_FORMAT_BYTES, 50, 300, - 50); + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, GST_FORMAT_BYTES, 50, + 300, 50); fail_unless (segment.start == 50); fail_unless (segment.stop == 300); fail_unless (segment.time == 50); - fail_unless (segment.accum == 50); - fail_unless (segment.last_stop == 50); + fail_unless (segment.base == 50); + fail_unless (segment.position == 50); /* and a new accumulated one */ - gst_segment_set_newsegment (&segment, FALSE, 1.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_BYTES, 100, 400, 300); fail_unless (segment.start == 100); fail_unless (segment.stop == 400); fail_unless (segment.time == 300); - fail_unless (segment.accum == 300); + fail_unless (segment.base == 300); /* and a new updated one */ - gst_segment_set_newsegment (&segment, TRUE, 1.0, + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, GST_FORMAT_BYTES, 100, 500, 300); fail_unless (segment.start == 100); fail_unless (segment.stop == 500); fail_unless (segment.time == 300); - fail_unless (segment.accum == 300); + fail_unless (segment.base == 300); /* and a new partially updated one */ - gst_segment_set_newsegment (&segment, TRUE, 1.0, + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, GST_FORMAT_BYTES, 200, 500, 400); fail_unless (segment.start == 200); fail_unless (segment.stop == 500); fail_unless (segment.time == 400); - fail_unless (segment.accum == 400); + fail_unless (segment.base == 400); } GST_END_TEST; @@ -729,14 +738,14 @@ GST_END_TEST; GST_START_TEST (segment_newsegment_streamtime) { GstSegment segment; - gint64 result; + guint64 result; gst_segment_init (&segment, GST_FORMAT_TIME); /*************************** * Normal segment ***************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_TIME, 0, 200, 0); fail_unless (segment.rate == 1.0); @@ -746,8 +755,8 @@ GST_START_TEST (segment_newsegment_streamtime) fail_unless (segment.start == 0); fail_unless (segment.stop == 200); fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -770,10 +779,10 @@ GST_START_TEST (segment_newsegment_streamtime) /********************* * time shifted by 500 *********************/ - gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_TIME, 0, 200, 500); - fail_unless (segment.accum == 200); + fail_unless (segment.base == 200); /* invalid time gives invalid result */ result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); @@ -795,10 +804,10 @@ GST_START_TEST (segment_newsegment_streamtime) /********************* * time offset by 500 *********************/ - gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_TIME, 500, 700, 0); - fail_unless (segment.accum == 400); + fail_unless (segment.base == 400); /* invalid time gives invalid result */ result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); @@ -824,10 +833,10 @@ GST_START_TEST (segment_newsegment_streamtime) /************************************* * time offset by 500, shifted by 200 *************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_TIME, 500, 700, 200); - fail_unless (segment.accum == 600); + fail_unless (segment.base == 600); /* invalid time gives invalid result */ result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); @@ -857,14 +866,14 @@ GST_END_TEST; GST_START_TEST (segment_newsegment_streamtime_rate) { GstSegment segment; - gint64 result; + guint64 result; gst_segment_init (&segment, GST_FORMAT_TIME); /*************************** * Normal segment rate 2.0 ***************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 2.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, 2.0, 1.0, GST_FORMAT_TIME, 0, 200, 0); fail_unless (segment.rate == 2.0); @@ -874,8 +883,8 @@ GST_START_TEST (segment_newsegment_streamtime_rate) fail_unless (segment.start == 0); fail_unless (segment.stop == 200); fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -901,10 +910,10 @@ GST_START_TEST (segment_newsegment_streamtime_rate) /*************************************** * Normal segment rate 2.0, offset ***************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 2.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, 2.0, 1.0, GST_FORMAT_TIME, 100, 300, 0); - fail_unless (segment.accum == 100); + fail_unless (segment.base == 100); /* invalid time gives invalid result */ result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); @@ -932,10 +941,10 @@ GST_START_TEST (segment_newsegment_streamtime_rate) /* buffers will arrive from 300 to 100 in a sink, stream time * calculation is unaffected by the rate */ - gst_segment_set_newsegment_full (&segment, FALSE, -1.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, -1.0, 1.0, GST_FORMAT_TIME, 100, 300, 0); - fail_unless (segment.accum == 200); + fail_unless (segment.base == 200); /* invalid time gives invalid result */ result = gst_segment_to_stream_time (&segment, GST_FORMAT_TIME, -1); @@ -950,7 +959,7 @@ GST_START_TEST (segment_newsegment_streamtime_rate) /*********************************************** * Normal segment rate -1.0, offset, time = 200 ***********************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, -1.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, -1.0, 1.0, GST_FORMAT_TIME, 100, 300, 200); /* invalid time gives invalid result */ @@ -977,7 +986,7 @@ GST_END_TEST; GST_START_TEST (segment_newsegment_streamtime_applied_rate) { GstSegment segment; - gint64 result; + guint64 result; gst_segment_init (&segment, GST_FORMAT_TIME); @@ -986,7 +995,7 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate) * This means the timestamps represents a stream going backwards * starting from @time to 0. ************************************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 1.0, -1.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, -1.0, GST_FORMAT_TIME, 0, 200, 200); fail_unless (segment.rate == 1.0); @@ -996,8 +1005,8 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate) fail_unless (segment.start == 0); fail_unless (segment.stop == 200); fail_unless (segment.time == 200); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -1026,7 +1035,7 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate) * This means the timestamps represents a stream at twice the * normal rate ************************************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 2.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, 2.0, GST_FORMAT_TIME, 0, 200, 0); fail_unless (segment.rate == 1.0); @@ -1036,8 +1045,8 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate) fail_unless (segment.start == 0); fail_unless (segment.stop == 200); fail_unless (segment.time == 0); - fail_unless (segment.accum == 200); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 200); + fail_unless (segment.position == 0); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -1067,7 +1076,7 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate) * This means the timestamps represents a stream at twice the * reverse rate ************************************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 1.0, -2.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, -2.0, GST_FORMAT_TIME, 0, 200, 400); fail_unless (segment.rate == 1.0); @@ -1078,8 +1087,8 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate) fail_unless (segment.stop == 200); fail_unless (segment.time == 400); /* previous segment lasted 200, rate of 2.0 was already applied */ - fail_unless (segment.accum == 400); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 400); + fail_unless (segment.position == 0); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -1109,7 +1118,7 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate) * reverse rate, start time cannot compensate the complete * duration of the segment so we stop at 0 ************************************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 1.0, -2.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, -2.0, GST_FORMAT_TIME, 0, 200, 200); fail_unless (segment.rate == 1.0); @@ -1119,8 +1128,8 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate) fail_unless (segment.start == 0); fail_unless (segment.stop == 200); fail_unless (segment.time == 200); - fail_unless (segment.accum == 600); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 600); + fail_unless (segment.position == 0); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -1152,7 +1161,7 @@ GST_END_TEST; GST_START_TEST (segment_newsegment_streamtime_applied_rate_rate) { GstSegment segment; - gint64 result; + guint64 result; gst_segment_init (&segment, GST_FORMAT_TIME); @@ -1162,7 +1171,7 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate_rate) * speed up by a factor of 2.0 some more. the resulting * stream will be played at four times the speed. ************************************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 2.0, 2.0, + gst_segment_set_newsegment (&segment, FALSE, 2.0, 2.0, GST_FORMAT_TIME, 0, 200, 0); fail_unless (segment.rate == 2.0); @@ -1172,8 +1181,8 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate_rate) fail_unless (segment.start == 0); fail_unless (segment.stop == 200); fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -1202,7 +1211,7 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate_rate) * this means we have a reverse stream that we should * speed up by a factor of 2.0 ************************************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 2.0, -1.0, + gst_segment_set_newsegment (&segment, FALSE, 2.0, -1.0, GST_FORMAT_TIME, 0, 200, 200); fail_unless (segment.rate == 2.0); @@ -1213,8 +1222,8 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate_rate) fail_unless (segment.stop == 200); fail_unless (segment.time == 200); /* previous segment lasted 100 */ - fail_unless (segment.accum == 100); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 100); + fail_unless (segment.position == 0); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -1243,7 +1252,7 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate_rate) * this means we have a reverse stream that we should * reverse to get the normal stream again. ************************************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, -1.0, -1.0, + gst_segment_set_newsegment (&segment, FALSE, -1.0, -1.0, GST_FORMAT_TIME, 0, 200, 200); fail_unless (segment.rate == -1.0); @@ -1254,8 +1263,8 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate_rate) fail_unless (segment.stop == 200); fail_unless (segment.time == 200); /* accumulated 100 of previous segment to make 200 */ - fail_unless (segment.accum == 200); - fail_unless (segment.last_stop == 200); + fail_unless (segment.base == 200); + fail_unless (segment.position == 200); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -1284,7 +1293,7 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate_rate) * this means we have a reverse stream that we should * reverse to get the normal stream again. ************************************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, -1.0, 2.0, + gst_segment_set_newsegment (&segment, FALSE, -1.0, 2.0, GST_FORMAT_TIME, 0, 200, 0); fail_unless (segment.rate == -1.0); @@ -1294,8 +1303,8 @@ GST_START_TEST (segment_newsegment_streamtime_applied_rate_rate) fail_unless (segment.start == 0); fail_unless (segment.stop == 200); fail_unless (segment.time == 0); - fail_unless (segment.accum == 400); - fail_unless (segment.last_stop == 200); + fail_unless (segment.base == 400); + fail_unless (segment.position == 200); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -1326,14 +1335,14 @@ GST_END_TEST; GST_START_TEST (segment_newsegment_runningtime) { GstSegment segment; - gint64 result; + guint64 result; gst_segment_init (&segment, GST_FORMAT_TIME); /*************************** * Normal segment ***************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_TIME, 0, 200, 0); fail_unless (segment.rate == 1.0); @@ -1343,8 +1352,8 @@ GST_START_TEST (segment_newsegment_runningtime) fail_unless (segment.start == 0); fail_unless (segment.stop == 200); fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == 0); + fail_unless (segment.base == 0); + fail_unless (segment.position == 0); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -1379,11 +1388,11 @@ GST_START_TEST (segment_newsegment_runningtime) * all positions by 2.0 in this segment. * Then time argument is not used at all here. ***********************************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 2.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, 2.0, 1.0, GST_FORMAT_TIME, 0, 200, 500); /* normal speed gives elapsed of 200 */ - fail_unless (segment.accum == 200); + fail_unless (segment.base == 200); /* invalid time gives invalid result */ result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1); @@ -1409,12 +1418,12 @@ GST_START_TEST (segment_newsegment_runningtime) * time offset by 500 * applied rate is not used for running time ********************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 2.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, 2.0, GST_FORMAT_TIME, 500, 700, 0); /* previous segment played at double speed gives elapsed time of * 100 added to previous accum of 200 gives 300. */ - fail_unless (segment.accum == 300); + fail_unless (segment.base == 300); /* invalid time gives invalid result */ result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1); @@ -1453,10 +1462,10 @@ GST_START_TEST (segment_newsegment_runningtime) * relative to the segment stop position. again time * is ignored. **********************************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, -1.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, -1.0, 1.0, GST_FORMAT_TIME, 500, 700, 200); - fail_unless (segment.accum == 500); + fail_unless (segment.base == 500); /* invalid time gives invalid result */ result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1); @@ -1495,10 +1504,10 @@ GST_START_TEST (segment_newsegment_runningtime) * twice speed relative to the segment stop position. again * time is ignored. **********************************************************/ - gst_segment_set_newsegment_full (&segment, FALSE, -2.0, -2.0, + gst_segment_set_newsegment (&segment, FALSE, -2.0, -2.0, GST_FORMAT_TIME, 500, 700, 200); - fail_unless (segment.accum == 700); + fail_unless (segment.base == 700); /* invalid time gives invalid result */ result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, -1); @@ -1533,11 +1542,11 @@ GST_START_TEST (segment_newsegment_runningtime) fail_unless (result == -1); /* see if negative rate closed segment correctly */ - gst_segment_set_newsegment_full (&segment, FALSE, -2.0, -1.0, + gst_segment_set_newsegment (&segment, FALSE, -2.0, -1.0, GST_FORMAT_TIME, 500, 700, 200); /* previous segment lasted 100, and was at 700 so we should get 800 */ - fail_unless (segment.accum == 800); + fail_unless (segment.base == 800); result = gst_segment_to_position (&segment, GST_FORMAT_TIME, 800); fail_unless (result == 700); } @@ -1548,14 +1557,14 @@ GST_END_TEST; GST_START_TEST (segment_newsegment_accum) { GstSegment segment; - gint64 result; + guint64 result; gst_segment_init (&segment, GST_FORMAT_TIME); /*************************** * Normal reverse segment ***************************/ - gst_segment_set_newsegment_full (&segment, FALSE, -1.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, -1.0, 1.0, GST_FORMAT_TIME, 0, 200, 0); fail_unless (segment.rate == -1.0); @@ -1565,8 +1574,8 @@ GST_START_TEST (segment_newsegment_accum) fail_unless (segment.start == 0); fail_unless (segment.stop == 200); fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == 200); + fail_unless (segment.base == 0); + fail_unless (segment.position == 200); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -1584,7 +1593,7 @@ GST_START_TEST (segment_newsegment_accum) fail_unless (result == 150); /* update segment, this accumulates 50 from the previous segment. */ - gst_segment_set_newsegment_full (&segment, TRUE, -2.0, 1.0, + gst_segment_set_newsegment (&segment, TRUE, -2.0, 1.0, GST_FORMAT_TIME, 0, 150, 0); fail_unless (segment.rate == -2.0); @@ -1594,8 +1603,8 @@ GST_START_TEST (segment_newsegment_accum) fail_unless (segment.start == 0); fail_unless (segment.stop == 150); fail_unless (segment.time == 0); - fail_unless (segment.accum == 50); - fail_unless (segment.last_stop == 150); + fail_unless (segment.base == 50); + fail_unless (segment.position == 150); fail_unless (segment.duration == -1); result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 150); @@ -1610,7 +1619,7 @@ GST_START_TEST (segment_newsegment_accum) fail_unless (result == 100); /* update segment, this does not accumulate anything. */ - gst_segment_set_newsegment_full (&segment, TRUE, 1.0, 1.0, + gst_segment_set_newsegment (&segment, TRUE, 1.0, 1.0, GST_FORMAT_TIME, 100, 200, 100); fail_unless (segment.rate == 1.0); @@ -1620,8 +1629,8 @@ GST_START_TEST (segment_newsegment_accum) fail_unless (segment.start == 100); fail_unless (segment.stop == 200); fail_unless (segment.time == 100); - fail_unless (segment.accum == 50); - fail_unless (segment.last_stop == 150); + fail_unless (segment.base == 50); + fail_unless (segment.position == 150); fail_unless (segment.duration == -1); result = gst_segment_to_running_time (&segment, GST_FORMAT_TIME, 100); @@ -1641,14 +1650,14 @@ GST_END_TEST; GST_START_TEST (segment_newsegment_accum2) { GstSegment segment; - gint64 result; + guint64 result; gst_segment_init (&segment, GST_FORMAT_TIME); /*************************** * Normal reverse segment ***************************/ - gst_segment_set_newsegment_full (&segment, FALSE, -1.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, -1.0, 1.0, GST_FORMAT_TIME, 0, 200, 0); fail_unless (segment.rate == -1.0); @@ -1658,8 +1667,8 @@ GST_START_TEST (segment_newsegment_accum2) fail_unless (segment.start == 0); fail_unless (segment.stop == 200); fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == 200); + fail_unless (segment.base == 0); + fail_unless (segment.position == 200); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -1679,7 +1688,7 @@ GST_START_TEST (segment_newsegment_accum2) fail_unless (result == 150); /* close segment, this accumulates nothing. */ - gst_segment_set_newsegment_full (&segment, TRUE, -1.0, 1.0, + gst_segment_set_newsegment (&segment, TRUE, -1.0, 1.0, GST_FORMAT_TIME, 150, 200, 0); fail_unless (segment.rate == -1.0); @@ -1689,12 +1698,12 @@ GST_START_TEST (segment_newsegment_accum2) fail_unless (segment.start == 150); fail_unless (segment.stop == 200); fail_unless (segment.time == 0); - fail_unless (segment.accum == 0); - fail_unless (segment.last_stop == 200); + fail_unless (segment.base == 0); + fail_unless (segment.position == 200); fail_unless (segment.duration == -1); /* new segment, this accumulates 50. */ - gst_segment_set_newsegment_full (&segment, FALSE, 1.0, 1.0, + gst_segment_set_newsegment (&segment, FALSE, 1.0, 1.0, GST_FORMAT_TIME, 150, 300, 150); fail_unless (segment.rate == 1.0); @@ -1704,8 +1713,8 @@ GST_START_TEST (segment_newsegment_accum2) fail_unless (segment.start == 150); fail_unless (segment.stop == 300); fail_unless (segment.time == 150); - fail_unless (segment.accum == 50); - fail_unless (segment.last_stop == 150); + fail_unless (segment.base == 50); + fail_unless (segment.position == 150); fail_unless (segment.duration == -1); /* invalid time gives invalid result */ @@ -1724,6 +1733,7 @@ GST_START_TEST (segment_newsegment_accum2) } GST_END_TEST; +#endif GST_START_TEST (segment_copy) { @@ -1735,8 +1745,11 @@ GST_START_TEST (segment_copy) gst_segment_init (&segment, GST_FORMAT_TIME); - gst_segment_set_newsegment_full (&segment, FALSE, -1.0, 1.0, - GST_FORMAT_TIME, 0, 200, 0); + segment.rate = -1.0; + segment.applied_rate = 1.0; + segment.start = 0; + segment.stop = 200; + segment.time = 0; copy = gst_segment_copy (&segment); fail_unless (copy != NULL); @@ -1761,6 +1774,7 @@ gst_segment_suite (void) tcase_add_test (tc_chain, segment_seek_size); tcase_add_test (tc_chain, segment_seek_reverse); tcase_add_test (tc_chain, segment_seek_rate); +#if 0 tcase_add_test (tc_chain, segment_newsegment_open); tcase_add_test (tc_chain, segment_newsegment_closed); tcase_add_test (tc_chain, segment_newsegment_streamtime); @@ -1770,6 +1784,7 @@ gst_segment_suite (void) tcase_add_test (tc_chain, segment_newsegment_runningtime); tcase_add_test (tc_chain, segment_newsegment_accum); tcase_add_test (tc_chain, segment_newsegment_accum2); +#endif tcase_add_test (tc_chain, segment_copy); return s; |