Commit graph

1048 commits

Author SHA1 Message Date
Sebastian Dröge ae0b12b109 pad: gst_pad_iterate_internal_links() can return NULL if there are none 2015-02-12 14:03:15 +02:00
Sebastian Dröge 5141641dc8 pad: Return NULL instead of FALSE for pointers 2015-02-12 14:03:03 +02:00
Sebastian Dröge 1937d09a95 pad: Implement more useful default handling for the LATENCY query
Before we just took the values from the first pad that succeded the query,
now we accumulate the results of every sinkpad properly and return that
result.
2015-02-12 13:55:36 +02:00
Tim-Philipp Müller 08167e3234 pad: add "offset" property to go with gst_pad_set_offset()
So we can set the offset via gst-launch.
2015-02-05 13:49:47 +00:00
Jan Schmidt ae2b0bacb6 gstpad: Fix a typo in a docstring. 2015-02-02 17:38:00 +11:00
Edward Hervey a6373625f3 gstpad: Inline apply_pad_offset()
Avoid doing a function call for something which will mostly be unused
2015-01-21 14:13:15 +01:00
Edward Hervey 64b451c170 gstpad: Fix debug message 2015-01-21 14:13:15 +01:00
Edward Hervey 93f540bb62 gstpad: Fix PROBE_NO_DATA macro
The problem was that the macro was always used with 'ret' as the defaultval
argument.

This would result in the macro eventually expanding to
    if (G_UNLIKELY (ret != ret && ret != GST_FLOW_OK))

... ret != ret will always fail, and therefore we'd never call the
following line.

Instead of that, store the previous value locally for comparision
2015-01-21 14:11:41 +01:00
Vincent Penquerc'h d4c551a292 pad: fail dropped queries
Previously, dropping a query from a pad probe would deem the
query succeeded, and the caller might then assume the query's
results are valid, and thus dereference an invalid object
such as a GstCaps.

We now assume dropped queries did not succeed. Dropped events
and buffers are still deemed a success.

Added back after previous revert, as it's been double checked.

https://bugzilla.gnome.org/show_bug.cgi?id=740003
2014-11-12 14:05:19 +00:00
Vincent Penquerc'h 1b06822ce3 Revert "pad: fail dropped queries"
This was pushed by mistake along with an unrelated patch.

This reverts commit c7103ce4b8.
2014-11-12 13:55:23 +00:00
Vincent Penquerc'h c7103ce4b8 pad: fail dropped queries
Previously, dropping a query from a pad probe would deem the
query succeeded, and the caller might then assume the query's
results are valid, and thus dereference an invalid object
such as a GstCaps.

We now assume dropped queries did not succeed. Dropped events
and buffers are still deemed a success.
2014-11-12 11:04:21 +00:00
Sebastian Dröge 126c511e62 pad: Make sure the buffer to get/pull_range() has at least the requested size
https://bugzilla.gnome.org/show_bug.cgi?id=735861
2014-09-12 15:22:19 +03:00
Wim Taymans 060b16ac75 pad: don't accept flush-stop on inactive pads
Inactive pads should at all times have the flushing flag set. This means
that when we get a flush-stop on an inactive pad we must ignore it.

On sinkpads, make this more explicit. We used to not clear the flush
flag but remove the events and then return an error because the flushing
flag was set. Now just simply refuse the event without doing anything.

On srcpads, check that we are trying to push a flush-stop event and
refuse it. We would allow this and mark the srcpad as non-flushing
anymore.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=735357
2014-09-02 12:04:15 +02:00
Arun Raghavan d3e411bda4 docs: Trivial pad documentation fix
Presumably a copy-pasto.
2014-08-12 20:04:11 +05:30
Göran Jönsson d0a808cdc8 pad: Don't unlock while iterating over all sticky events for removal
Otherwise we might end up getting the event removed from elsewhere
at the same time while we're unlocked for g_object_notify().

https://bugzilla.gnome.org/show_bug.cgi?id=732556
2014-07-01 19:26:18 +02:00
Evan Nemerson 4088363aea introspection: add some missing allow-none annotations to in params
https://bugzilla.gnome.org/show_bug.cgi?id=730957
2014-06-26 19:00:58 +02:00
Evan Nemerson 2759882379 introspection: add missing (nullable) annotations to return values
Support for (nullable) was added to G-I at the same time as nullable
return values.  Previous versions of G-I will not mark return values as
nullable, even when an (allow-none) annotation is present, so it is
not necessary to add (allow-none) annotations for compatibility with
older versions of G-I.

https://bugzilla.gnome.org/show_bug.cgi?id=730957
2014-06-26 18:56:38 +02: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 ba3073ffce pad: two minor docs fixes 2014-05-27 13:37:05 +01:00
Thiago Santos c6f92562b6 pad: store last flow return and provide acessor function
Stores the last result of a gst_pad_push or a pull on the GstPad and provides
a getter and a macro to access this field.

Whenever the pad is inactive it is set to FLUSHING

API: gst_pad_get_last_flow_return

https://bugzilla.gnome.org/show_bug.cgi?id=709224
2014-05-26 15:29:53 -03: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 dabb959747 pad: Add missing space in debug output 2014-04-15 21:16:06 +02:00
Linus Svensson cb554772e5 pad: don't access unowned and possibly already freed event
Don't print the name of the event when ownership is given away.

https://bugzilla.gnome.org/show_bug.cgi?id=727484
2014-04-12 11:44:36 +01:00
Sebastian Dröge 42cbb7c7c7 pad: Apply pad offsets on all events, not just segment events 2014-04-10 08:25:50 +02:00
Sebastian Dröge 04a204cd4c pad: Include event type in debug output when delaying a sticky event because of not-linked 2014-03-29 10:32:25 +01:00
Tim-Philipp Müller 075cc42f88 pad: simplify gst_pad_link_get_name() and fix Since marker
Has added benefit that compiler might warn if more values
are added to the enum.
2014-03-11 21:46:30 +00:00
Stefan Sauer 4a38acaa10 pad: add debug helper for GstPadLinkReturn names
Add a helper like gst_flow_get_name() for GstPadLinkReturn. Use this in core.
API: gst_pad_link_get_name()
2014-03-11 21:50:36 +01:00
Stefan Sauer 7077d347a3 pad: fix gst_pad_add_probe() return value docs
Also fix comment typos and add more detail in the logs.
2014-03-06 22:54:17 +01:00
Brendan Long f605472230 docs: gst_pad_new_from_*_template and gst_buffer_pool_new constructors return floating references
https://bugzilla.gnome.org/show_bug.cgi?id=710342
2014-02-06 22:50:53 +01:00
Sebastian Dröge ba7089cf04 pad: Minor code cleanup
!check_sticky()==GST_FLOW_OK is a bit confusing, compared to
check_sticky()!=GST_FLOW_OK.
2014-01-22 11:10:01 +01:00
Thiago Santos 75fe1004a5 pad: fix sticky event leak after sticky_events_foreach
events_foreach adds an extra ref when giving the event to the
user function. In case it was unrefed by the user, this extra ref
disappeared, but events_foreach still should unref again to
lose its own ref before removing the event from the array.

https://bugzilla.gnome.org/show_bug.cgi?id=722467
2014-01-17 23:11:49 -03:00
Wim Taymans 6d3fc584d5 pad: use new segment offset method to apply the offset
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=721422
2014-01-08 15:04:00 +01:00
Sebastian Dröge 93ce90f833 pad: Check if new probes need to be called when adding/removing some
This allows blocking a pad, add a new blocking probe, removing
the first probe and then having the second probe called. Which
could then decide that data-flow should actually continue
instead of blocking now.

https://bugzilla.gnome.org/show_bug.cgi?id=721289
2014-01-02 13:33:20 +01:00
Sebastian Dröge d04c8b6d2e pad: Keep an extra ref of the pad when calling an IDLE probe immediately
The callback might destroy the pad.
2013-12-30 19:03:22 +01:00
Sebastian Dröge 0324358ebc pad: Only call IDLE probes if we are actually idle
Also only check the data types for non-IDLE probes. When we
are idle, we have no data type obviously.

Previously we were calling IDLE probes during data flow whenever
a non-blocking probe would be called. The pad was usually not idle
at that time.
2013-12-30 18:53:36 +01:00
Sebastian Dröge 901cd5560c pad: Don't ignore probe callback return value when immediately calling IDLE probe
https://bugzilla.gnome.org/show_bug.cgi?id=721096
2013-12-30 10:53:09 +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
Sebastian Rasmussen e8ecf3c407 Fix some typos in code comments and debug messages
https://bugzilla.gnome.org/show_bug.cgi?id=720029
2013-12-07 17:09:39 +00:00
Wim Taymans 34db352879 pad: add ACCEPT_INTERCEPT flag
Make a new flag on the pad that tweaks the default behaviour of the
accept-caps function. By default it will check for a subset of the
query-caps result but this is not always desirable. The query-caps
result contains all the constraints to make a good caps decision
upstream but sometimes, like for parsers, not all the constrained caps
fields are known upstream and then a subset check would fail. Switching
to an intersection makes this work again.

See https://bugzilla.gnome.org/show_bug.cgi?id=705024
    https://bugzilla.gnome.org/show_bug.cgi?id=677401
2013-12-03 22:28:09 +01:00
Sebastian Rasmussen b40fa2b8c3 docs: cosmetic changes in references/decriptions
* fix typo GstBufferFlag -> GstBufferFlags
 * fix typo GstFeatures -> GstCapsFeatures
 * fix typo GstAllocatorParams -> GstAllocationParams
 * fix typo GstContrlSources -> GstControlSource
 * do not refer to gstcheck as an object
 * make references gtk_init() and tcase_set_timeout() not be references
 * gst_element_get_pad() renamed gst_element_get_static_pad()
 * gst_clock_id_wait_async_full() renamed gst_clock_id_wait_async()
 * _drop_element() is really gst_queue_array_drop_element()
 * gst_pad_accept_caps() was removed, do not refer to it
 * separate GST_META_TAG_MEMORY_STR declaration from description
 * do not describe removed gst_collect_pads_collect()
 * correctly link to GstElementClass' virtual set_context()

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=719614
2013-12-02 21:01:08 +00:00
Wim Taymans 62b7d17c2e pad: only check event order when something changed
Check the event order in dataflow only when something changed instead
of for each buffer.
2013-09-26 11:32:50 +02:00
Sebastian Dröge c279bdb663 pad: A newly activated pad should be marked as needing reconfiguration 2013-07-15 11:36:44 +02:00
Sebastian Dröge 942d905e19 Revert "pad: Don't consider flushing pads as needing reconfiguration"
This reverts commit 948a9d2f2b.

This is racy and trying to reconfigure and fail is still better
than not trying to reconfigure at all.

https://bugzilla.gnome.org/show_bug.cgi?id=704100
2013-07-15 11:32:54 +02:00
Nicolas Dufresne 4656d18fd5 Add few missing allow-none annotation 2013-07-03 14:25:07 -04:00
Sebastian Dröge 948a9d2f2b pad: Don't consider flushing pads as needing reconfiguration
Renegotiation and reconfiguration will fail because all queries
and events won't be accepted by the pad if it's flushing. In the
best case this just causes unneeded work and spurious warnings in
the debug logs, in the worst case it causes elements to fail completely.
2013-06-30 18:40:47 +02:00
Sjoerd Simons 1815e6067a pad: Add a filter to the caps_query done by acceptcaps
Use the caps that the pad is asked to accept as filter for the query

https://bugzilla.gnome.org/show_bug.cgi?id=702632
2013-06-19 15:12:18 +02:00
Sebastian Dröge 73895c05b1 pad: Store sticky events even if the pad is flushing
But do this only for events that are not dropped by flushing,
i.e. do it only for everything except SEGMENT and EOS.

Without this we might drop a CAPS event if flushing happens
at an unfortunate time and nobody is resending the CAPS event.

https://bugzilla.gnome.org/show_bug.cgi?id=700806
2013-05-27 12:40:50 +02:00
Sebastian Dröge 3d44f542ed pad: Only check if we get buffers before stream-start/segment if compiling without G_DISABLE_ASSERT
In releases this is set usually.
2013-05-10 16:03:34 +02:00
Sebastian Dröge d500ffc300 pad: Fix uninitialized variable compiler warning 2013-05-09 17:55:21 +02:00
Sebastian Dröge 1b87f0c36a pad: Make sure pending, older sticky events are sent downstream in dynamic linking scenarios
If a pad block was triggered from sending a sticky event downstream, it
could happen that the pad block is relinking pads, which then requires
to resend previous sticky events.
2013-05-09 17:55:21 +02:00
Sebastian Dröge 8bedcf450f pad: Warn if data flow happens before stream-start or segment event 2013-05-09 11:05:50 +02:00
Sebastian Dröge 430285b5c8 pad: Only let gst_pad_sticky_events_foreach() iterate over existing events 2013-05-09 10:59:41 +02:00
Sebastian Dröge e0f59d22eb pad: If we push sticky events because of another sticky event, only push those that come before the new event
https://bugzilla.gnome.org/show_bug.cgi?id=699937
2013-05-09 10:29:11 +02:00
Sebastian Dröge ae47133360 pad: No sticky events must arrive after EOS 2013-05-09 09:51:13 +02:00
Nicolas Dufresne e8a9ffa092 pad: Improve warning message naming events type name
With this patch, message should look like ¨Sticky event misordering, got
'caps' before 'stream-start'¨ making it faster to debug.

https://bugzilla.gnome.org/show_bug.cgi?id=688188
2013-05-09 09:35:30 +02:00
Nicolas Dufresne f6aa4d85c1 pad: Only inforce STREAM_START, CAPS and SEGMENT ordering
Previous patch was inforcing a complete ordering of the sticky events, while
in fact, only STREAM_START, CAPS and SEGMENT events need proper ordering.

See: https://bugzilla.gnome.org/show_bug.cgi?id=688188
2013-05-09 09:35:19 +02:00
Nicolas Dufresne a68e33712e pad: Detect, fix and warn when sticky events are in wrong order
We can prevent buggy element from causing other elements to fail or crash
by sorting sticky event at insertion. In this case, we also warn as this
is not supposed to happen.

See: https://bugzilla.gnome.org/show_bug.cgi?id=688188
2013-05-08 13:48:59 +02:00
Alessandro Decina 543b92a856 gstpad: run probes for FLUSH events sent with gst_pad_send_event
Move probe handling in gst_pad_send_event_unchecked so that probes are run for
FLUSH events too.
2013-04-25 06:43:29 +02:00
Wim Taymans 43620e1642 pad: notify caps property on NULL as well
Also notify the caps property when it changes to NULL
2013-04-23 11:17:05 +02:00
Wim Taymans 49c9d2f229 pad: clarify locking 2013-04-23 11:16:16 +02:00
Wim Taymans 3e1a430c22 pad: add gst_pad_store_sticky_event()
Rewire some internal functions and expose a new
gst_pad_store_sticky_event() function.

API: gst_pad_store_sticky_event()
2013-04-04 16:36:26 +02:00
Wim Taymans e857030232 pad: improve debug 2013-04-04 15:45:15 +02:00
Sebastian Dröge f23db94fef pad: Let gst_pad_get_allowed_caps() pass the caps own caps as filter
This will reduce the number of caps created downstream and we don't
need to intersect in the very end with the pad's own caps.
2013-03-30 11:48:27 +01:00
Edward Hervey 418dcd7277 pad: Remove SEGMENT sticky events when flushing
When flushing, it is expected that upstream will send a SEGMENT
event afterwards.
This also avoids stray SEGMENT events from coming through after a
flush.
2013-03-29 18:43:21 +01:00
Niv Sardi 4b3aee5698 gst_pad_check_reconfigure: only remove flag if set.
the code ifed a debug statement, that can't be right. anyway, the way it is,
we don't really need that branch, as we set the flag to unset only if set
(and that can't fail) hence the end result is always to unset the flag.

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=691985
2013-01-24 15:41:35 +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
Sebastian Dröge 3f9516cef8 pad: Downgrade GST_WARNING to GST_INFO
It's usually not a problem if a query fails if there's no peer,
especially as it will happen during pad linking (caps query)
quite often and spams the logs.
2012-10-10 11:34:27 +02:00
Wim Taymans d630a115f9 pad: resend dropped events
If we try to push sticky events but a probe dropped them, we don't mark
the event as received and mark the pad as PENDING_EVENTS. This ensures
that we resend the event the next time. For this we need to let the
custom flow return from the probe trickle up to
gst_pad_push_event_unchecked() so that we can differentiate between
OK and DROPPED probe returns.
2012-10-05 09:51:58 +02:00
Wim Taymans 0ae3492f6b pad: don't store sticky events on flushing/EOS pads
Don't store sticky events on flushing or EOS pads. This was done
correctly for source pads but not for sink pads.
2012-10-05 09:51:29 +02:00
Wim Taymans ef012f8e58 pad: fix activate docs 2012-09-28 10:41:54 +02:00
Olivier Crête 945e0d2be9 pad: Remove pad probes only once
Also add test to make sure that if a pad probe is removed while it's
callback is running, the cleanup_hook isn't called again if it
returns GST_PAD_PROBE_REMOVE
2012-09-20 15:24:33 -04:00
Olivier Crête 25b3e02b94 pad: Add functions to safely access GstProbeInfo data pointer
This is so that introspection based bindings can access it.

https://bugzilla.gnome.org/show_bug.cgi?id=684402
2012-09-20 15:24:33 -04:00
Sebastian Dröge 8f51345296 pad: Fix refcount bug by unreffing the correct variable 2012-09-18 12:46:37 +02:00
Sebastian Dröge de635d089f pad: Add parent parameter to the link and unlink functions
Fixes part of bug #683995.
2012-09-17 13:24:36 +02:00
Olivier Crête bc5cc2eb07 pad: don't try to pretty-print event after we've given away ownership
Might cause crashes with debug logging enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=683996
2012-09-14 01:28:46 +01:00
Tim-Philipp Müller 221d46f438 pad: expose gst_pad_mode_get_name() and use it in baseparse 2012-09-11 19:51:02 +01:00
Wim Taymans 8f282de37d pad: check sticky events also after pad block
Recheck for sticky events after doing a pad block because the pad block could
have caused a relink and then we need to resend the events to the newly linked
pad.

Fixes things like switching of visualisations.
2012-09-03 11:07:10 +02:00
Jan Schmidt 5aefdbaf10 gstpad: make some debug statements more verbose 2012-08-31 06:25:38 -07:00
Thiago Santos 9285ee9184 pad: add gst_pad_needs_reconfigure
Add an alternative version of gst_pad_check_reconfigure that doesn't
clear the reconfigure flag.

Useful for increasing error resilience without duplicating the
reconfigure code in pad task functions.

API: gst_pad_needs_reconfigure

https://bugzilla.gnome.org/show_bug.cgi?id=681198
2012-08-10 13:58:02 -03:00
Wim Taymans 3b6e5acbce pad: fix debug line
Use QUERY_TYPE on query types.
2012-07-18 17:49:33 +02:00
Wim Taymans 06addca012 pad: add PROXY_SCHEDULING flag
Add a flag that makes the default query handler forward the scheduling query.
2012-07-18 17:49:32 +02:00
Wim Taymans 107007f053 pad: improve query caps function
In the proxy_query_caps function, also filter against the filter in the query.
We don't need to filter against the filter in the query anymore in the default
caps query function because we already did this in the proxy_query_caps.
2012-07-18 17:49:32 +02:00
Jan Schmidt 524b56cb07 gstpad: Move sticky flag clearing code to gst_pad_activate_mode
The ghostpad code directly activates/deactivates the child code by
calling gst_pad_activate_mode, rather than gst_pad_set_active, so
make sure to clear the flags in gst_pad_activate_mode(), which should
catch all cases.
2012-07-12 00:41:23 +10:00
Edward Hervey d3ffa82639 Remove 0.10-related documentation and "Since" markers 2012-07-10 12:03:27 +02:00
Tim-Philipp Müller 95f2cab053 pads: no need to deactivate pads that are already in PAD_MODE_NONE 2012-07-03 22:24:22 +01:00
Tim-Philipp Müller 0841ac48f1 pads: make pad activation debug logs a bit more readable 2012-07-03 22:20:40 +01:00
Tim-Philipp Müller 4f7aa97b21 pad: clear EOS flag when deactivating pads fixing element re-use 2012-07-03 19:04:54 +01:00
Wim Taymans d2c632fcda pad: improve introspection annotation 2012-06-20 13:27:33 +02:00
Wim Taymans b2aa56f4e3 task: add separate methods to add enter/leave callback
Remove the structure of callbacks and replace with separate methods to register
each callback. This is much more binding friendly.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=677898
2012-06-20 11:59:09 +02:00
Wim Taymans 76e8b2ecda task: add GDestroyNotify to _new
Add a GDestroyNotify to the user_data we pass to gst_task_new()
Change gst_pad_start_task() to also take the notify
2012-06-20 10:31:49 +02:00
Wim Taymans 61fefbb542 pad: move gst_pad_set_caps() to compat
We want code to explicitly send a caps event instead.
2012-06-18 16:14:19 +02:00
Wim Taymans 2cab15c9f6 docs: improve API docs 2012-06-15 12:57:24 +02:00
Havard Graff 75853fa79b Make sure that unlinked pads do not cause a return false on latency events.
Context: Latency configuration should not be
messed up because of not-linked pads. In general,
one return FALSE on latency distribution causes
the "overall" pipeline latency configuration to
fail. This shows up as noise in logs (warning).

Conflicts:

	gst/gstpad.c
2012-06-06 13:42:32 +02:00
Wim Taymans d907544ab1 pad: only serialized events can't pass after EOS
Only serialized events can't be sent on pads that are EOS. Otherwise a seek
event would be refused as well.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=677520
2012-06-06 09:14:58 +02:00
Wim Taymans b0756827f6 pad: don't pause task on EOS
Elements should not rely on core to pause tasks on EOS.
2012-06-05 09:10:05 +02:00
Wim Taymans bae0c4b0c6 pad: fix event type check 2012-06-05 09:00:01 +02:00
Wim Taymans 66c88c1bb1 pad: fix 'res' may be used uninitialized in this function 2012-06-04 16:19:26 +02:00
Sebastian Dröge 8cc12b05fc pad: Don't accept any buffers or events after EOS 2012-06-04 13:01:40 +02:00
Sebastian Dröge 5a8c901507 pad: Always return errors for EOS events immediately
For non-EOS events things will error out later during data
flow but after EOS events no data flow is happening.

See bug #677340.
2012-06-04 11:25:47 +02:00
Sebastian Dröge 991ac561e1 pad: Only forward caps events to a pad if it accepts the caps
Fixes bug #677335.
2012-06-04 09:27:35 +02:00