Commit graph

452 commits

Author SHA1 Message Date
Sebastian Dröge 1d57e46dbd basesink: Only reinit the cached GstClockID if it is for the same clock
The clock might have changed since the clock ID was created and in
that case we have to request a new one.
2011-05-20 13:05:04 +02:00
Sebastian Dröge a46c9c2a62 event: Make SEGMENT event parsing API more consistent with the others 2011-05-18 16:56:43 +02:00
Sebastian Dröge 5f2cd2b0a3 base: Update for caps/pad template related API changes 2011-05-17 13:14:12 +02:00
Sebastian Dröge 3d2127f865 Revert "query: allow _make_writable on query handlers"
This reverts commit cf4fbc005c.

This change did not improve the situation for bindings because
queries are usually created, then directly passed to a function
and not stored elsewhere, and the writability problem with
miniobjects usually happens with buffers or caps instead.
2011-05-17 11:21:41 +02:00
Wim Taymans 115c34badd basesink: handle more formats
Don't hardcode GST_FORMAT_TIME in places, we can work with many formats.
2011-05-16 17:09:06 +02:00
Sebastian Dröge bdf9022861 base: Improve negotiation with new getcaps() filter 2011-05-16 15:33:10 +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 cf4fbc005c query: allow _make_writable on query handlers
Pass a GstQuery ** to the query handlers so that they can make the query
writable before using a setter on it.
Port code to new API.
2011-05-10 18:36:33 +02:00
Wim Taymans 7f24a48387 event: _qos_full -> _qos 2011-05-09 18:48:55 +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
Wim Taymans f127a416fa basesink: add some more debug 2011-05-09 15:08:51 +02:00
Wim Taymans d34ca6140b basesink: use CAPS event instead of setcaps function 2011-05-08 13:07:13 +02:00
Wim Taymans 02e5feb2bf pad: avoid using the old GST_PAD_CAPS
Don't use GST_PAD_CAPS but instead use the new gst_pad_get_current_caps()
method.
Avoid setting caps on buffers.
2011-05-06 19:04:54 +02:00
Wim Taymans fb3da828e5 element: rename gst_element_lost_state_full()
Rename gst_element_lost_state_full() to gst_element_lost_state() and
remove the old method name.
2011-05-06 12:19:16 +02:00
Wim Taymans 6ab7e6c15d Remove pad_alloc, this can now be done better
Remove pad_alloc and all references. This can now be done more efficiently and
more flexible with the ALLOCATION query and the bufferpool objects. There is no
reverse negotiation yet but that will be done with an event later.
2011-04-29 13:26:19 +02:00
Sebastian Dröge 1cff66d587 base{sink,src}: Don't try to fixate ANY caps 2011-04-19 11:45:36 +02:00
Sebastian Dröge 9b90d3d9c0 base: Update docs to say class_init instead of base_init
And remove a useless base_init in basesrc
2011-04-16 15:59:40 +02:00
Sebastian Dröge f51a23a83c Merge branch 'master' into 0.11 2011-04-16 08:59:58 +02:00
Ole André Vadla Ravnås e7bf5484c7 base: Fix pad callbacks so they handle when parent goes away
1) We need to lock and get a strong ref to the parent, if still there.
2) If it has gone away, we need to handle that gracefully.

This is necessary in order to safely modify a running pipeline. Has been
observed when a streaming thread is doing a buffer_alloc() while an
application thread sends an event on a pad further downstream, and from
within a pad probe (holding STREAM_LOCK) carries out the pipeline plumbing
while the streaming thread has its buffer_alloc() in progress.
2011-04-13 17:39:05 +02:00
Wim Taymans 468ec5bc40 bufferlist: simplify bufferlists
We now have multiple memory blocks as part of the buffers and we can therefore
reduce the bufferlist to a simple array of buffers.
2011-03-31 17:51:02 +02:00
Wim Taymans a12ede3fb1 Merge branch 'master' into 0.11-fdo
Conflicts:
	gst/gst.c
	libs/gst/base/gstcollectpads.c
2011-03-28 20:11:20 +02:00
Wim Taymans d82c8bd2af memory: port code to new buffer data API 2011-03-28 20:08:45 +02:00
Stefan Kost 71dcd52cc0 basesink: print flow return as a name in debug log 2011-03-24 18:32:20 +02:00
Wim Taymans f505f778cc pad: more preroll lock to basesink
Move the preroll lock to basesink where it belongs.
2011-03-04 17:25:02 +01:00
Wim Taymans 6c18c9508d miniobject: more boxed type fixing
More miniobject fixing, leaks horribly somewhere..
2011-02-23 10:35:09 +01:00
Wim Taymans 1218511185 libs: cleanups for 0.11
Remove deprecated stuff, fix padding, rearrange methods.
2011-02-22 19:09:48 +01:00
Wim Taymans f8828eace6 basesink: improve duration calculation
Keep track of the average distance between incomming timestamps and
use that to estimate the frame duration when buffers have no duration set on
them.
2011-02-14 15:17:45 +01:00
Wim Taymans 79665e8247 basesink: improve rate calculation
When there is no duration on input buffers, assume the rate is 1.0
instead of (the undefined) 0.0.
2011-02-14 15:17:44 +01:00
Wim Taymans 9661a713ba basesink: improve average duration calculation
Improve the calculation of the duration. When we have no input duration set on
the input buffers stop is set to start and then we end up using a 0 duration in
the average calculation.
2011-02-14 15:17:44 +01:00
Wim Taymans dc0120fe28 basesink: rename variable
Rename an internal variable to better reflact what its value means.
2011-02-14 15:17:44 +01:00
Wim Taymans c8d1abdd00 basesink: fix some comments 2011-02-10 15:21:46 +01:00
Wim Taymans d19f40c716 basesink: keep track of earliest QoS timestamp
Keep track of the earliest allowed timestamp according to the latest
QoS report and drop buffers before that time. Activate this filter
when throttling is enabled. We could later also activate this in the
other QoS cases.

See #638891
2011-02-10 15:21:46 +01:00
Wim Taymans dad43fa004 basesink: use new QoS type
Use the new QoS type and send throttling QoS messages.
2011-02-10 15:21:46 +01:00
Wim Taymans 4ee5c61a2d basesink: add property to configure a throttle-time
Add a property to configure the throttle time on a sink. The
property is not yet used.

See #638891
2011-02-10 15:21:45 +01:00
Tim-Philipp Müller 655451db54 basesrc, basesink: add some FIXMEs for the type of the blocksize property 2011-01-02 16:59:18 +00:00
Wim Taymans ef44d4b539 basesink: also preroll async=false sinks
Also preroll async=false sinks after a flush.
2010-12-28 16:23:32 +01:00
Wim Taymans 041d33e5f5 basesink: fix typo 2010-12-21 10:35:40 +01:00
Wim Taymans 6da39bf508 basesink: improve last_stop calculation
Only update the last_stop value when we had a valid stop position for the
clipping or else the clipping code assumes the stop position extends to the end
of the segment, which makes the position reporting return weird values.
2010-12-14 19:00:14 +01:00
Wim Taymans 4fd63f0ce2 basesink: fix object type handling in queued preroll
Factor out the method to get the object type.
When preroll-queue-len > 0, use the right object type instead of ignoring
buffer-lists.
2010-12-14 15:54:41 +01:00
Stefan Kost 1de8b60034 docs: fix wrong use of Since: keyword 2010-12-08 12:17:35 +02:00
Tim-Philipp Müller 686b16756d docs: libgstbase: more gobject introspection annotations
Many of these are superfluous and were added for clarity.
2010-12-07 18:37:04 +00:00
Edward Hervey 27c0bc93b7 basesink: Don't forget to unref the cached ClockId 2010-12-05 15:58:48 +01:00
Wim Taymans a813aad0ac basesink: rework position reporting code
Unify the different position reporting code paths to make it more
understandable.
Use start_time to get more accurate position reporting in paused.
Fix unit tests for more accurate reporting.
2010-12-02 19:10:46 +01:00
Wim Taymans 79570f49dc basesink: perform wait_preroll in a while loop
We need to continue calling wait_preroll() as long as the need_preroll variable
is true.
2010-12-02 19:10:45 +01:00
Wim Taymans 9076d5688f basesink: also preroll after a flush with async=false
Make sure to preroll after a flush even when we are async=false.
Add unit test.

Fixes #634965
2010-12-02 19:10:45 +01:00
Edward Hervey ece40dacbc basesink: Re-using GstClockID instead of constantly recreating one
Makes _sink_wait_clock at least 2 times faster.

https://bugzilla.gnome.org/show_bug.cgi?id=632778
2010-12-02 19:04:56 +01:00
Edward Hervey 7115b77aab basesink: Pass along miniobject type through various functions
Avoids doing useless GST_IS_*

https://bugzilla.gnome.org/show_bug.cgi?id=632778
2010-12-02 19:04:56 +01:00
Edward Hervey 606e59468d basesink: Switch enable_last_buffer to an atomic int
Avoids having to take a lock to read/write it.

https://bugzilla.gnome.org/show_bug.cgi?id=632778
2010-12-02 19:04:56 +01:00
Mark Nauwelaerts 21c5064783 basesink: recompute correct running time for buffer ending flushing step
Prevents delaying/hanging when resuming PLAYING.

Fixes #632433.
2010-10-20 18:46:39 +02:00
Stefan Kost a11b047d00 basesink: don't take preroll-lock in get_property
Use atomic ops to read and write more properties. Taking the preroll lock in get_property
can lock up applications reading the property during preroll.
2010-10-05 12:30:34 +03:00
Wim Taymans c9c9894552 basesink: format negative values better
Format negative values properly in the debug log.
2010-10-04 15:56:59 +02:00
Wim Taymans 29e23e9142 basesink: improve adjust_time()
Add some more comments.
Make sure we don't end up with negative timestamps.
2010-09-24 12:22:33 +02:00
Havard Graff 54a5871434 basesink: renderdelay needs to be subtracted in adjust_time()
latency is already sink-latency + render-delay, and here we only
want to deal with the sink-latency.

Fixes #630436
2010-09-24 12:16:48 +02:00
Sebastian Dröge 2dfb0d2772 base: Stop using GST_FLOW_IS_FATAL()
And document the special handling of WRONG_STATE.
2010-08-27 16:59:09 +02:00
Stefan Kost 2237af4b6b debug: logging improvements
Use the event serialisation. Log formats name instead of number.
2010-08-05 10:31:50 +03:00
Sebastian Dröge 249c4c18d0 basesink: Implement GstElement::get_query_types() 2010-07-16 17:26:50 +02:00
Sebastian Dröge b2e7c4bd45 basesink: Only answer the SEGMENT query in pull mode
Otherwise the element handling the seeks should answer this query.

Fixes bug #623622.
2010-07-16 17:26:31 +02:00
Alessandro Decina 3a553f4eda basesink: add accessors for the enable-last-buffer property.
API: gst_base_sink_set_last_buffer_enabled
API: gst_base_sink_is_last_buffer_enabled
2010-07-06 16:39:18 +02:00
Alessandro Decina f079ff3f20 basesink: add new enable-last-buffer property.
Add a new enable-last-buffer property. When false, it disables storing the last
received buffer in basesink::last-buffer. This can be useful in cases where
buffers need to be released asap.

API: GstBaseSink::enable-last-buffer
2010-07-06 12:38:21 +02:00
Sebastian Dröge a15344515a basesink: Initialize jitter to prevent printing an uninitialized variable if waiting for the clock failed 2010-06-17 13:20:13 +02:00
Sebastian Dröge 83929a5849 basesink: Make sure we have a valid object to render in _render_object() 2010-06-13 18:05:41 +02:00
Philippe Normand 6b8baaed50 basesink: Make gst_base_sink_query return TRUE if the segment query succeeded.
Fixes bug #620490.
2010-06-03 17:40:45 +02:00
Wim Taymans 3d72274b19 basesink: add jitter to debug output 2010-05-18 18:38:14 +02:00
Stefan Kost c96dec2a06 basesink: implement percentage position and duration queries
If upstream does not handle them, then implement those ourself.
2010-04-30 10:03:38 +03:00
Stefan Kost c29e34113f basesink: use gst_pad_peer_query instead of reinventing. 2010-04-30 10:03:38 +03:00
Stefan Kost 2d49414eef queries: add more logging
Log human readable formats and log query result.
2010-04-30 10:03:38 +03:00
Robert Swain d576c1105e basesink: Implement QoS message posting in basesink
Post QoS messages when frames are dropped.
This goes a little further towards resolving bug #322947
2010-03-18 13:04:34 +01:00
Mark Nauwelaerts 8cdf5a586f basesink: fix emergency rendering timestamp tracking
Specifically, if all (including initial) buffers turn up late,
emergency rendering should also kick in appropriately.

Fixes #611087.
2010-02-26 15:48:41 +01:00
Tim-Philipp Müller 087aa6ced4 gst_private.h: make sure gst_private.h is included before glib.h
For the reason outlined at the beginning of gst_private.h (inline
functions in glib may need the g_log_domain variable). Also include
gst_private.h before using any G_OS_* defines, esp. in plugin loader.
2010-01-20 01:48:56 +00:00
Wim Taymans a3fdb45aa6 basesink: add some more debugging 2009-12-11 16:19:18 +01:00
Sebastian Dröge 25fc43487b basesink: Allow update NEWSEGMENT events after EOS
This allows demuxers to update the segment stop of an already
finished stream. This might be needed if some stream goes to
EOS before the duration of the longest stream is known to properly
set the segment stop of all streams to the same value in the end.
2009-12-08 15:24:43 +01:00
Edward Hervey efa5aee509 basesrc/basesink: Register debug funcptr only once.
Makes basesrc/basesink initialization 3-4 times faster and avoids
contention on the global funcptr lock
2009-12-01 19:27:47 +01:00
Wim Taymans 8d34217dcc basesink: clip stepping boundaries
Rounding errors with the floating point rate could make it so that we
don't end up exactly at the required stepping duration.
Use the segment clipping boundaries, which are not subject to rate
adjustements, instead to detect when we reached the stepping duration.

Add some debug info related to going to the PAUSED state.
2009-11-28 22:34:19 +01:00
Stefan Kost a9a6c0f0cd docs: fix broken xrefs 2009-11-27 18:31:39 +02:00
Stefan Kost 2ba8b37d15 docs: fix broken xrefs 2009-11-27 16:39:37 +02:00
Jan Schmidt 81d3fda6e8 basesink: Clamp the base time correctly in position reporting
When clamping the base time, correctly use 'now', instead of
'-now' - the intent is to prevent 'now-base' ever being
negative, which would cause a position report outside the segment.

Fixes: #602419
2009-11-19 19:02:22 +01:00
Sebastian Dröge cb28889b11 basesink: Handle the new sink-message event 2009-11-18 13:12:28 +01:00
Wim Taymans 9da89ef4e1 basesink: fix position reporting
Only update the current stream time after we checked if we got a new step
event. This improves the position reporting by the sink.

See #595958
2009-11-16 14:59:14 +01:00
Jan Schmidt f83ea8233b basesink: Fix treating base_time as unsigned in position calculation
Element base_time is a signed quantity, which leads to basesink returning
a position of 0 when dealing with a negative base time - which are quite
legal when clocks (such as the audio clock) are close to 0.

This doesn't manifest in normal pipelines, of course - but can happen
(at least) when manually setting the base time on a pipeline.
2009-11-11 17:12:19 +00:00
Tim-Philipp Müller daecaf0e8a Remove GST_DEBUG_FUNCPTR where they're pointless
There's not much point in using GST_DEBUG_FUNCPTR with GObject
virtual functions such as get_property, set_propery, finalize and
dispose, since they'll never be used by anyone anyway. Saves a
few bytes and possibly a tenth of a polar bear.
2009-10-28 00:44:24 +00:00
Stefan Kost 7fcd73875f basesink: lets keep -1 for segmenst as they are guint64 and not GstClockTime 2009-10-09 17:44:28 +03:00
Stefan Kost 4efc01a61d basesink: use GST_CLOCK_TIME_NONE and GST_CLOCK_TIME_IS_VALID more 2009-10-09 17:15:52 +03:00
Edward Hervey a8e03abd17 gst/base/basesink: Remove dead assignment.
The code was previously:
* checking if ret was != OK
* .. but if it was FLOW_STEP, swith it to OK
* .. and then not using ret

Instead we just make it more compact by checking if it's OK or STEP.
2009-10-08 08:53:54 +02:00
Wim Taymans 989d9861e3 basesink: whitespace fixes 2009-08-24 17:56:32 +02:00
Edward Hervey 8eb9d55627 basesink: Remove dead assignments 2009-08-08 14:47:57 +02:00
Wim Taymans 575e1de88b basesink: cleanups in position queries
Use existing boolean flag to pass position queries upstream. Also add upstream
queries for the last position queries.
2009-08-06 10:45:30 +02:00
Stian Selnes 6033efb920 basesink: Query upstream for the position if conversion in PAUSED failed
Fixes bug #590045.
2009-08-06 06:41:57 +02:00
Stefan Kost 4bfb312e13 logging: use perf category for dropped buffers 2009-07-06 19:52:44 +01:00
Wim Taymans 92b0f32d74 bufferlist: use faster gst_buffer_list_get()
Use the faster gst_buffer_list_get() to get the first buffer of a list.
2009-06-29 11:56:10 +02:00
Ognyan Tonchev 27fe127e76 basesink: take timestamp later
Make sure we don't accidentally cast a bufferlist of a buffer and try to take
the timestamp of it.

Refixes #585960
2009-06-29 11:46:00 +02:00
Tim-Philipp Müller 31ff42de21 basesink: don't do things with side effects within a g_assert()
Make the bufferlist stuff work properly when things are compiled
with -DG_DISABLE_ASSERT.
2009-06-25 11:25:46 +01:00
Branko Subasic de5bcfc4cd basesink: add support for buffer list
Fixes #585960
2009-06-16 13:32:37 +02:00
Wim Taymans 25067558dc stepping: more stepping improvements
Update design doc with step-start docs.
Add eos field to step done message
when stepping in reverse, update the segment time field.
Flush out the current step when we are flushing.
2009-06-12 13:20:36 +02:00
Wim Taymans 23b772664b basesink: post step-start
when we clip, also stop the stepping.
Don't do QoS when stepping
Post step-start when queueing and activating the step.
2009-06-12 13:16:29 +02:00
Wim Taymans 6e633cbe33 basesink: update segment start/stop for clipping
When we start stepping, store the start/stop values of the segment before we
install new start/stop values for clipping in non-flushing steps.

for non-flushing steps, update the element start time. For flushing steps, it
does not change because running_time does not advance

Make sure we always perform the stop_stepping operations even when we drop
frames.
2009-06-09 12:06:35 +02:00
Wim Taymans 72e8d9909c basesink: do proper clipping in stepping
Update the stop position of the segment so that we clip correctly.
After clipping in non-flushing mode, rerender the remainder of the buffer.
2009-06-09 10:25:34 +02:00
Wim Taymans 89c42f8506 stepping: do flushing steps correctly
Note in the docs that a flushing step in PLAYING brings the pipeline to the lost
state and skips the data before prerolling again.

Implement the flushing step correctly by invalidating the current step
operation, which would activate the new step operation.
2009-06-08 17:41:56 +02:00
Jan Schmidt f0f9ed875f basesink: Change awkward wording in a translateable message. 2009-06-08 16:16:27 +01:00
Wim Taymans a4c6d04b4c basesink: add non-flushing steps
Add support for non-flushing steps and with different rates.
Clear step info when flushing
2009-06-08 16:27:36 +02:00
Wim Taymans fa7db7d247 basesink: fix clipped start/stop after step
Use the segment helpers to get a more accurate clipped start/stop position after
a stepping operation ended.
2009-06-04 17:27:03 +02:00
Wim Taymans 957e40343d basesink: use more correct segment methods
Use the more correct new segment methods for updating the segment before and
after a step.
2009-06-04 12:53:23 +02:00
Wim Taymans a907f8d145 basesink; handle EOS correctly.
Handle EOS and buffers without a timestamp gracefully.
Remove a warning that is not so much a warning now anymore.
2009-06-03 15:39:13 +02:00
Wim Taymans c811d51471 basesink: forget previous times when stepping
When we start a flushing step operation, forget about the previous stream time
so that the position reporting works correctly.
2009-06-03 10:39:53 +02:00
Wim Taymans 71a5ebe638 basesink: fix regression in unit tests
Store the timestamp of the buffer after prerolling. While we are prerolled we
want to report the position of the segment start value.
2009-06-02 15:37:22 +02:00
Wim Taymans 484d188440 basesink: post a warning on excessive framedrops
When we go into emergency rendering, post a warning informing the user about
this fact.
2009-06-01 19:37:14 +02:00
Wim Taymans 5479772bec basesink: more stepping in reverse
Fix stepping and position reporting in reverse playback.
2009-06-01 13:37:29 +02:00
Wim Taymans 8c54c70d9c basesink: use start_time as the step start
Use the start_time of the element as the point from where the step operation
starts. This fixes stepping in all paused states.
2009-06-01 13:37:29 +02:00
Wim Taymans 642bb32196 basesink: catch step cases in _wait_preroll()
When a subclass is blocking in _wait_preroll() in the _render method, make sure
we can unlock the subclass and detect this return value from the render method.
2009-06-01 13:37:29 +02:00
Wim Taymans 1caab05238 basesink: more stepping in reverse fixes 2009-06-01 13:37:28 +02:00
Wim Taymans 4be27fa555 basesink: small cleanups 2009-06-01 13:37:28 +02:00
Wim Taymans 0c205b96b4 framestep: implement backwards framestep
Update framestep document, we want to pass the flush flag in the step-done
message.

Add flush flag to the gstmessage.

Update examples to use the new step-done message api.

Implement framestep with playback rates < 0.0 too.
2009-06-01 13:37:28 +02:00
Wim Taymans 1839782379 basesink: add framestepping in time 2009-06-01 13:37:28 +02:00
Wim Taymans 7a7e9629ce basesink: keep track of stepped time
Pass running_time around so that the stepping code can calculate the elapsed
time correctly.
2009-06-01 13:37:27 +02:00
Wim Taymans f07b86f18b basesink: move stuff around, more stepping
Make start and stop_stepping methods and move their invocation in the right
places.

Perform the atual stepping operation where we have full context about the
timestamps.
2009-06-01 13:37:27 +02:00
Wim Taymans 546c959f26 basesink: first stab at frame stepping in PAUSED
Unlock the prerolled frame and recheck if we need to step.
Keep a simple counter for the frames we're about to skip while stepping and
preroll/post step_done when stepping finished.
2009-06-01 13:37:26 +02:00
Edward Hervey 9e4fa43657 basesink: Remove dead assignments.
sstart/sstop/rstart/rstop are all either:
* assigned values later on before being used in 'do_times:' (EOS and buffers)
* not used (non-EOS events)
2009-04-04 14:39:51 +02:00
Sebastian Dröge d12034ab4b gst: Use g_once_init* or G_DEFINE_TYPE 2009-04-04 10:59:39 +02:00
Edward Hervey 6577af3635 basesink : Remove unused variable.
sync is never used anywhere in that code.
2009-04-03 12:57:24 +02:00
Tim-Philipp Müller 13f8041238 basesink: fix once-per-second 'emergency rendering' for case where all buffers but the very first are late
Due to a typo basesink didn't do any emergency rendering of late buffers
if the only buffer ever rendered was the first one with timestamp 0. This
means that in cases where the decoder is very very slow, we'd never see
any buffers but the very first one rendered. Fixes #576381.
2009-03-23 12:34:34 +00:00
Andy Wingo e2ff005e63 basesink: propagate UPSTREAM events in pull mode too
* libs/gst/base/gstbasesink.c (gst_base_sink_send_event): Propagate
  upstream events in pull mode too.
2009-03-05 17:42:22 +01:00
Stefan Kost df620c9cb6 basesink: move left over handling of the error case to the activate_failed label.
If was left as dead code.
2009-02-26 15:42:06 +02:00
Wim Taymans 805569c873 Don't forward LATENCY event when not ready
When we are not ready to handle a latency query (we are not yet prerolled) we
also don't try to forward the latency event because that might cause unexpected
errors when upstream is not yet linked.
2009-02-23 10:53:17 +01:00
Wim Taymans d807bca61c GstBaseSink: use new variable to schedule preroll
Use a separate variable to keep track if we need to call the preroll method
instead of abusing the commited variable.
2009-02-03 15:27:34 +01:00
Wim Taymans fe4233120c GstBaseSink: avoid calling preroll multiple times
Fix a regression introduced by fix for #567725 in commit
1c7ab4ed4f. We should only call the preroll
function once namely when we did not yet commit the state change.

Add a unit test to check that we call the preroll function when interrupting the
clock_wait (see #567725).

Add a unit test to check that we only call the preroll function once.
2009-02-03 12:52:49 +01:00
Wim Taymans 1c7ab4ed4f Update the last_buffer exactly with the buffer that caused the
preroll and also call the preroll method with that preroll buffer.
Fixes #567725.
2009-01-21 12:43:55 +01:00
Wim Taymans 10f9331125 libs/gst/base/gstbasesink.*: Fix documentation for the wait_clock method, rename basesink -> sink for consistency.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_wait_clock):
* libs/gst/base/gstbasesink.h:
Fix documentation for the wait_clock method, rename basesink -> sink
for consistency.
2009-01-09 15:43:17 +00:00
Wim Taymans b2052bb385 libs/gst/base/gstbasesink.c: Release the object lock before calling the query convert pad functions to avoid deadlocks.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position):
Release the object lock before calling the query convert pad functions
to avoid deadlocks.
2009-01-05 15:42:53 +00:00
Wim Taymans 1ec9399318 libs/gst/base/gstbasesink.c: Expose the render-delay as a property so things like appsink can use it to tweak the syn...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_init), (gst_base_sink_set_property),
(gst_base_sink_get_property):
Expose the render-delay as a property so things like appsink can use it
to tweak the synchronisation.
2008-12-15 12:47:59 +00:00
Stefan Kost 95e825900f libs/gst/base/gstbasesink.c: Turn comment into gtk-doc comment.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c:
Turn comment into gtk-doc comment.
2008-11-24 20:02:55 +00:00
Wim Taymans 94752eaefd libs/gst/base/gstbasesink.c: Changing the render delay changes the latency and so we must post a latency message.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_set_render_delay):
Changing the render delay changes the latency and so we must post a
latency message.
2008-11-20 14:23:05 +00:00
Wim Taymans 0a71170006 Copy seqnums from events to messages so that they can all be related back to eachother.
Original commit message from CVS:
* gst/gstbin.c: (bin_handle_async_start),
(gst_bin_handle_message_func), (gst_bin_query):
* libs/gst/base/gstbasesink.c: (gst_base_sink_render_object),
(gst_base_sink_event), (gst_base_sink_change_state):
* libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek),
(gst_base_src_loop), (gst_base_src_change_state):
Copy seqnums from events to messages so that they can all be related
back to eachother.
2008-11-04 15:56:55 +00:00
Wim Taymans ca9ccf1d02 libs/gst/base/gstbasesink.c: Implement more seeking in pull mode.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_default_do_seek),
(gst_base_sink_default_prepare_seek_segment),
(gst_base_sink_perform_seek), (gst_base_sink_get_position_last),
(gst_base_sink_get_position_paused), (gst_base_sink_get_position),
(gst_base_sink_query):
Implement more seeking in pull mode.
Use pad convert functions to convert position to the requested format.
Fix position/duration reporting in pull mode.
Implement position and duration reporting in other formats than time.
* libs/gst/base/gstbasesink.h:
Add member to keep track of when the segment is playing.
2008-10-20 15:18:14 +00:00
Wim Taymans 4561f3bf47 libs/gst/base/gstbasesink.c: Query the total number of bytes when activating the pad in pull mode.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_pad_activate_pull),
(gst_base_sink_query):
Query the total number of bytes when activating the pad in pull mode.
Implement duration query in pull mode by using the installed pad convert
function to convert from bytes to the requested format.
2008-10-17 13:27:59 +00:00
Wim Taymans fe07568997 Add method to commit the state in subclasses.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_do_preroll),
(gst_base_sink_flush_start), (gst_base_sink_flush_stop),
(gst_base_sink_event), (gst_base_sink_perform_seek),
(gst_base_sink_loop), (gst_base_sink_pad_activate_pull),
(gst_base_sink_send_event), (gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add method to commit the state in subclasses.
Refactor the flush_start and flush_stop code because we need it for
flushing while seeking too.
Implement the beginnings of seeking in pull mode.
Use the segment last_stop field for the pulling offset.
Fix the pause method in pull mode.
Configure the segment to BYTES for pull mode.
API: GstBaseSink::gst_base_sink_do_preroll()
2008-10-16 14:09:18 +00:00
Wim Taymans bc8e367885 gst/gstbin.c: The message src can be NULL, don't try to print the object names in that case.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_remove_func), (update_degree),
(gst_bin_handle_message_func):
The message src can be NULL, don't try to print the object names in that
case.
* libs/gst/base/gstbasesink.c: (gst_base_sink_pad_activate):
Add some more debug info.
* tests/check/pipelines/simple-launch-lines.c: (run_pipeline),
(GST_START_TEST):
Add some debug.
Fix the test, pull based sinks go ASYNC to PAUSED, just like other
scheduling modes.
2008-10-10 10:38:12 +00:00
Wim Taymans b3403511ea docs/design/part-negotiation.txt: Small doc update.
Original commit message from CVS:
* docs/design/part-negotiation.txt:
Small doc update.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_pad_getcaps), (gst_base_sink_pad_setcaps),
(gst_base_sink_init), (gst_base_sink_set_blocksize),
(gst_base_sink_get_blocksize), (gst_base_sink_set_property),
(gst_base_sink_get_property), (gst_base_sink_needs_preroll),
(gst_base_sink_loop), (gst_base_sink_pad_activate),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_change_state):
* libs/gst/base/gstbasesink.h:
Add blocksize property and methods to control the amount of data
to pull.
Negotiate first before activating upstream in pull mode so that they can
negotiate themselves.
When we operate in pull mode, we only accept the caps that we
negotiated.
Make the sink go ASYNC to PAUSED, like all other sinks.
API: GstBaseSink::gst_base_sink_set_blocksize()
API: GstBaseSink::gst_base_sink_get_blocksize()
API: GstBaseSink::blocksize
* libs/gst/base/gstbasesrc.c: (gst_base_src_wait_playing),
(gst_base_src_set_live), (gst_base_src_is_live),
(gst_base_src_set_format), (gst_base_src_query_latency),
(gst_base_src_set_blocksize), (gst_base_src_get_blocksize),
(gst_base_src_set_do_timestamp), (gst_base_src_get_do_timestamp),
(gst_base_src_set_property), (gst_base_src_get_property):
* libs/gst/base/gstbasesrc.h:
Add typechecking in public API functions.
Add methods to control the blocksize in subclasses.
API: GstBaseSrc::gst_base_src_set_blocksize()
API: GstBaseSrc::gst_base_src_get_blocksize()
2008-10-10 10:01:36 +00:00
Wim Taymans 1fb53a23a1 libs/gst/base/gstbasesink.c: Forward LATENCY events upstreams so that elements know about the total pipeline latency....
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_send_event):
Forward LATENCY events upstreams so that elements know about the total
pipeline latency. Fixes #555307.
2008-10-08 14:21:13 +00:00
Wim Taymans a4b27adb00 libs/gst/base/gstbasesink.c: Improve position reporting while flushing and other intermediate state changes. Fixes #5...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Improve position reporting while flushing and other intermediate state
changes. Fixes #553874.
2008-10-06 08:58:25 +00:00
Wim Taymans e93b94afdf libs/gst/base/gstbasesink.c: Improve position reporting in the flushing state.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_render_object),
(gst_base_sink_event), (gst_base_sink_chain_unlocked),
(gst_base_sink_negotiate_pull), (gst_base_sink_pad_activate_pull),
(gst_base_sink_get_position), (gst_base_sink_change_state):
Improve position reporting in the flushing state.
Also report the position when we are not yet prerolled but we
have a newsegment event. Fixes #543444.
Improve the pull-based negotiation code.
* tests/check/elements/fakesink.c: (GST_START_TEST),
(fakesink_suite):
Add testcase for position reporting while flushing in PAUSED and
PLAYING.
* tests/check/generic/sinks.c: (GST_START_TEST):
Update unit-test, we can now query the position as soon as we receive a
NEWSEGMENT event.
2008-08-19 16:47:07 +00:00
Jason Zhao b981ec6e09 libs/gst/base/gstbasesink.c: When the subclass event handler releases the PREROLL_LOCK, we could be in the flushing s...
Original commit message from CVS:
Based on patch by: Jason Zhao <e3423c at motorola dot com>
* libs/gst/base/gstbasesink.c: (gst_base_sink_render_object):
When the subclass event handler releases the PREROLL_LOCK, we could be
in the flushing state and we have to ignore the event. Fixes #548394.
2008-08-19 08:52:05 +00:00
Wim Taymans 6624a8de12 Add method to allow sinks to specify additional delay between the sync times and the actual rendering of the data.
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_init),
(gst_base_sink_query_latency), (gst_base_sink_set_render_delay),
(gst_base_sink_get_render_delay), (gst_base_sink_wait_eos),
(gst_base_sink_do_sync):
* libs/gst/base/gstbasesink.h:
* win32/common/libgstbase.def:
Add method to allow sinks to specify additional delay between the sync
times and the actual rendering of the data.
API: gst_base_sink_set_render_delay()
API: gst_base_sink_get_render_delay()
2008-06-20 08:54:45 +00:00
Wim Taymans 8cd06f8770 libs/gst/base/gstbasesink.c: If we have not seen a buffer before EOS, use the segment values to report the current po...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_wait_eos), (gst_base_sink_event):
If we have not seen a buffer before EOS, use the segment values to
report the current position instead of invalid positions.
2008-06-20 08:28:46 +00:00
Wim Taymans f01c4d6201 libs/gst/base/gstbasesink.c: Add some debug.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_set_async_enabled),
(gst_base_sink_set_ts_offset), (gst_base_sink_perform_qos):
Add some debug.
Make sure we don't generate invalid QoS messages.
2008-06-04 11:47:16 +00:00
Wim Taymans a866e9d33b libs/gst/base/gstbasesink.c: The reported position must always be smaller than the last seen timestamps (or timestamp...
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_get_position):
The reported position must always be smaller than the last seen
timestamps (or timestamp + duration for reverse).
2008-05-30 15:48:52 +00:00
Wim Taymans 5cba5bdbf1 libs/gst/base/gstbasesink.c: Fix position query range checks in reverse playback.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times),
(gst_base_sink_get_position_last), (gst_base_sink_get_position):
Fix position query range checks in reverse playback.
2008-05-29 16:34:22 +00:00
Sjoerd Simons 98faaeb7f4 libs/gst/base/gstbasesink.c: If nothing else can be used, use the last buffer's start time as the segment's last stop...
Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times):
If nothing else can be used, use the last buffer's start time as
the segment's last stop. Fixes bug #534258.
2008-05-22 08:33:27 +00:00
Wim Taymans b6286c0edc Expose a method that was previously used internally to synchronize against the clock because it can be useful for sub...
Original commit message from CVS:
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/base/gstbasesink.c: (gst_base_sink_wait_clock):
* libs/gst/base/gstbasesink.h:
Expose a method that was previously used internally to synchronize
against the clock because it can be useful for subclasses too.
GstBaseSink::gst_base_sink_wait_clock()
2008-05-19 16:36:51 +00:00
Wim Taymans 092a80f2f0 libs/gst/base/gstbasesink.c: Refactor adjusting the running_time with latency and offset into a separate method.
Original commit message from CVS:
* libs/gst/base/gstbasesink.c: (gst_base_sink_adjust_time),
(gst_base_sink_wait_clock), (gst_base_sink_wait_eos),
(gst_base_sink_do_sync), (gst_base_sink_chain_unlocked):
Refactor adjusting the running_time with latency and offset into a
separate method.
When doing clipping, we still want to use the subclass get_times method,
just in case the DURATION or TIMESTAMP are not set.
2008-05-19 11:11:49 +00:00
Wim Taymans 640d16a2bc libs/gst/base/gstadapter.c: Small code cleanup.
Original commit message from CVS:
* libs/gst/base/gstadapter.c: (gst_adapter_available_fast):
Small code cleanup.
* libs/gst/base/gstbasesink.c: (gst_base_sink_query_latency),
(gst_base_sink_set_flushing):
* libs/gst/base/gstbasesrc.c: (gst_base_src_perform_seek):
Fix some comments.
2008-05-07 09:47:27 +00:00