Commit graph

90 commits

Author SHA1 Message Date
Vivia Nikolaidou
44ba1565d9 segment: Replaced gst_segment_to_position with gst_segment_position_from_running_time
gst_segment_to_position might cause confusion, especially with the addition of
gst_segment_position_from_stream_time . Deprecated gst_segment_to_position
now, and replaced it with gst_segment_position_from_running_time.

Also added unit tests.
2015-09-26 00:00:08 +02:00
Vivia Nikolaidou
26ef44f17c segment: gst_segment_to_stream_time: Renamed 'result' to 'stream_time'
Renamed the "result" variable to "stream_time" for better readability.
2015-09-25 23:59:59 +02:00
Vivia Nikolaidou
c0d4b1b646 segment: Added gst_segment_position_from_stream_time()
gst_segment_position_from_stream_time() will convert stream time into a
position in the segment so that gst_segment_to_stream_time() with that
position returns the same stream time. It will return -1 if the stream time
given is not inside the segment.
2015-09-25 23:59:53 +02:00
Vincent Penquerc'h
d6ae9c0feb segment: add gst_segment_is_equal
It beats memcmp due to the 'reserved' fields.

API: gst_segment_is_equal()

Found via, but probably not directly linked to,
https://bugzilla.gnome.org/show_bug.cgi?id=738216
2015-04-03 12:10:33 +01:00
Wim Taymans
bc282da83c segment: remove the bounds check from _to_running_time_full()
Do not do any checks for the start/stop in the new
gst_segment_to_running_time_full() method, we can let this be done by
the more capable gst_segment_clip() method. This allows us to remove the
enum of results and only return the sign of the calculated running-time.
We need to put the old clipping checks in the old
gst_segment_to_running_time() still because they work slightly
differently than the _clip methods.

See https://bugzilla.gnome.org/show_bug.cgi?id=740575
2015-03-20 09:00:47 +01:00
Wim Taymans
edf484ab6b segment: add option to disable clipping
Add a clip argument to gst_segment_to_running_time_full() to disable
the checks against the segment boundaries. This makes it possible to
generate an extrapolated running-time for timestamps outside of the
segment.

See https://bugzilla.gnome.org/show_bug.cgi?id=740575
2015-03-19 17:36:36 +01:00
Wim Taymans
8c8b3818e4 segment: add helper to get negative running-time
Add a helper method to get a running-time with a little more features
such as detecting if the value was before or after the segment and
negative running-time.

API: gst_segment_to_running_time_full()

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=740575
2015-03-18 11:35:42 +01:00
Wim Taymans
6e67ad7675 segment: fix offset handling with non 0 start
The position in the segment is relative to the start but the offset
isn't, so subtract the start from the position when setting the offset.
Add unit test for this as well.
2015-03-18 11:35:42 +01:00
Jan Schmidt
f3756af07b segment: Add new skip flags for clarifying trick mode playback.
Add GST_SEEK_FLAG_TRICKMODE_KEY_UNITS and
GST_SEEK_FLAG_TRICKMODE_NO_AUDIO, and rename GST_SEEK_FLAG_SKIP
to GST_SEEK_FLAG_TRICKMODE (with backwards compat define).

Do the same for the corresponding SEGMENT flags.

https://bugzilla.gnome.org/show_bug.cgi?id=735666
2015-01-27 01:51:58 +11:00
Evan Nemerson
e10266e3f3 docs: convert NULL, TRUE, and FALSE to %NULL, %TRUE, and %FALSE
This should help improve documentation generated for
languages other than C.

https://bugzilla.gnome.org/show_bug.cgi?id=730961
2014-05-30 00:20:27 +01:00
Tim-Philipp Müller
6eb6d9ec38 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 21:21:51 +01:00
Sebastian Dröge
1d6136b930 segment: gst_segment_offset_running_time() will be available in 1.2.3 2014-01-15 11:13:00 +01:00
Wim Taymans
f664fbd198 segment: take offset into account in _to_position()
Take the offset into account when converting between running-time and
segment positions.
2014-01-08 15:23:00 +01:00
Wim Taymans
dc0176e4a0 segment: add method to offset the segment running-time
Add a method that can apply an offset to the calculated running-time of
a segment.
2014-01-08 15:04:00 +01:00
Sebastian Rasmussen
53ae1b2c9c docs: Fix typos in function/object descriptions
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720029
2013-12-07 17:11:12 +00:00
Mark Nauwelaerts
ebca6aa84f segment: resurrect sanitizing start and stop for seeking 2013-11-02 16:13:27 +01:00
Wim Taymans
95c6cd37a8 segment: don't WARN, just DEBUG
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=696911
2013-04-04 10:17:30 +02:00
Nicolas Dufresne
ab44e14c52 segment: Fix seeking when position is slightly outside the segment
Very often, when the end of a segment is detected by demuxer, the position
is slightly outside the segment boundaries. Currently, if that is the case
the base will be set to NONE instead of normal accumulation. This would
break non-flushing seeks in oggdemux and most likely other demuxers.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=696899
2013-04-04 10:10:24 +02:00
Stefan Sauer
82f7bdd7bb seeking: add more logging for seeking
Especially add logging to error code paths.
2013-02-27 22:17:17 +01:00
Tim-Philipp Müller
666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Jan Schmidt
1f1e4fc30c GstSegment: Fix doc description string last_stop->position 2012-08-31 06:25:37 -07:00
Wim Taymans
c8840b8270 segment: add offset field
Add an offset field that is used to track at what position the segment was
updated. This is used to set the running time to 0 when we do a flushing
seek that doesn't update the position.

See https://bugzilla.gnome.org/show_bug.cgi?id=680306
2012-07-27 17:09:45 +02:00
Wim Taymans
f05b0e222f Update for new seeking variable name
When seeking, the start value and type are now called start and start_type.
2012-07-27 15:24:52 +02:00
Wim Taymans
104ef4e7e0 segment: small cleanup
Move the code to update the segment at the end of the function.
2012-07-27 15:24:51 +02:00
Wim Taymans
90e32338c8 segment: remove redundant checks
We don't need to check the segment format anymore because we asserted on them
being equal before.
2012-07-27 13:02:52 +02:00
Wim Taymans
5360ba56f7 basesink: handle -1 step amounts
Define a 0 and -1 step amount. They used to almost do the same thing but now, 0
cancels/stops the current step and -1 keeps on stepping until the end of the
segment.

See https://bugzilla.gnome.org/show_bug.cgi?id=679378
2012-07-18 17:49:32 +02:00
Stefan Sauer
30c30ed171 segment: remove removed api from the docs. 2012-07-11 12:51:30 +02:00
Edward Hervey
d3ffa82639 Remove 0.10-related documentation and "Since" markers 2012-07-10 12:03:27 +02:00
Stefan Sauer
f165a77fdc segment: also copy the segment flag
Fixes segmented seeks (as tested e.g. in the adder tests in base).
2012-07-09 22:16:46 +02:00
Tim-Philipp Müller
49ea16e041 segment: make sure we don't have unmapped seek flags littering out segment flags
Make GstSeekFlag to GstSegmentFlag conversion explicit, and
set only those seek flags in the segment flags which are
mapped. This makes sure we don't have extraneous flags
littering our segment flag field, which also fixes the
debug printing/serialisation of segment events in the
debug log.
2012-07-04 16:16:04 +01:00
Wim Taymans
ce67b0e539 docs: update more documentation 2012-03-29 13:34:50 +02:00
Wim Taymans
afba547722 segment: don't use duration in clipping
Don't use the duration in the segment for calculating clipping values.
The duration is expressed in stream time and clipping is done on unrelated
timestamp values.
This used to be interesting for elements that used the segment structure to
implement seeking because then they would use stream-time for the segment
start/stop values and the duration could be used as a fallback when the stop
position was not set. Now that the complete segment event is passed between
elements we cannot do this anymore because some elements might store the
duration and start/stop values with different time bases in the segment.
2012-02-20 14:39:26 +01:00
Olivier Crête
e234a10c63 Use macros to register boxed types thread safely 2012-01-28 16:42:38 +00:00
Edward Hervey
bf19148acb gstsegment: Initialize with proper type 2011-12-04 11:32:57 +01:00
Wim Taymans
a70934e4ef segment: remove GST_SEEK_TYPE_CUR 2011-10-28 16:23:49 +02:00
Wim Taymans
5cf8e68944 Merge branch 'master' into 0.11
Conflicts:
	gst/gstmessage.c
	gst/gstquery.c
	gst/gstregistrychunks.c
	gst/gstsegment.c
	libs/gst/base/gstbasetransform.c
	libs/gst/base/gstbasetransform.h
	libs/gst/base/gsttypefindhelper.c
	plugins/elements/gsttypefindelement.c
2011-08-26 14:37:54 +02:00
Josep Torra
c0b0b977d7 segment: use GST_SEEK_FLAG_NONE instead of 0
Fixes warning #188: enumerated type mixed with another type reported by ICC.
2011-08-26 14:11:14 +02:00
Koop Mast
4fe5dd2b9d segment: cast to right type
See #653137
2011-06-22 16:58:53 +02:00
Edward Hervey
c72321b260 gstsegment: Remove dead assignment
base is unconditionally written a couple of lines below
2011-05-31 18:30:50 +02:00
Wim Taymans
82cc487776 segment: handle wraparound better
Now that we use unsigned values for the segment, handle wraparound when seeking
better.
2011-05-17 17:51:58 +02:00
Wim Taymans
bdbc069348 Rework GstSegment handling
Improve GstSegment, rename some fields. The idea is to have the GstSegment
structure represent the timing structure of the buffers as they are generated by
the source or demuxer element.
gst_segment_set_seek() -> gst_segment_do_seek()
Rename the NEWSEGMENT event to SEGMENT.
Make parsing of the SEGMENT event into a GstSegment structure.
Pass a GstSegment structure when making a new SEGMENT event. This allows us to
pass the timing info directly to the next element. No accumulation is needed in
the receiving element, all the info is inside the element.
Remove gst_segment_set_newsegment(): This function as used to accumulate
segments received from upstream, which is now not needed anymore because the
segment event contains the complete timing information.
2011-05-16 11:37:52 +02:00
Wim Taymans
c07b57fc05 segment: remove _full version
Rename the _full versions of the functions to the normal function names.
2011-05-09 17:51:07 +02:00
Wim Taymans
d63829fc9a segment: remove abs_rate from segment structure
Remove the abs_rate field from the segment structure, we can trivially compute
it when needed.
2011-05-09 16:39:13 +02:00
Tim-Philipp Müller
3256c708be docs: gst: more gobject introspection annotations
Many of these are superfluous, added for clarity.
2010-12-07 18:37:04 +00:00
Wim Taymans
8412c2a656 segment: move g_return_if_fail to where it is needed 2010-12-02 19:03:35 +01:00
Sebastian Dröge
276a55fd24 gstsegment: Actually start==stop==segment_start is inside the segment
Still the old code was wrong as it claimed that start==stop<segment_start
would be inside the segment and returned insane clipping differences.
2009-08-11 13:21:35 +02:00
Sebastian Dröge
ca8a0376c5 gstsegment: Clipping should detect start=stop<segment_start as outside the segment
Before it returned that [start,stop] is inside the segment and that the
difference between segment_start and start needs to be clipped. If the
clipping is done on a buffer (like in baseaudiosink) this will result
in the data pointer being at a invalid memory position.

Fixes bug #589849.
2009-08-11 12:59:13 +02:00
Руслан Ижбулатов
18a34288cf segment: fix include order to get config.h before _mingw.h
config.h must always be included before any other includes, either
directly or indirectly via gst_private.h. Fixes #585733.
2009-06-14 20:00:49 +01:00
Wim Taymans
afeec70eff segment: make conversion more precise
Make sure the conversion from and the conversion to give the same results.
2009-06-09 10:23:23 +02:00
Wim Taymans
0e74bfe248 segment: add gst_segment_set_running_time
Added new method for closing the segment to a specific running time.

API: GstSegment::gst_segment_set_running_time()
2009-06-04 12:53:20 +02:00