Commit graph

622 commits

Author SHA1 Message Date
Wim Taymans fc7dd46b20 avoid some more type checks 2009-12-24 14:40:54 +01:00
Wim Taymans 381d35fd1e pad: Fix problem with destroy callback not being called
When we unblock a pad with the same user_data, the destroy callback is not
called. This leads to refcounting leaks that cannot be avoided. Instead always
call the destroy notify whenever we install a new pad block.
In particular, this fixes a nasty pad leak in decodebin2.

Also update the unit test to have more accurate comments and test the required
behaviour.
2009-12-23 21:20:14 +01:00
Edward Hervey 4da0da822a gstpad: Only register debug funcptr once.
This makes pad initialization 2 times faster and without any contention
over the debug funcptr global lock.
2009-12-01 17:56:19 +01:00
Stefan Kost 23da3639f0 docs: fix xrefs in docs
Fix typos in xrefs, links to non existing functions and rework plural forms.
2009-11-25 16:59:50 +02:00
Stefan Kost f63ecd04a8 pad: rename new api from _refed to _reffed.
Due to popular demand rename the new api as we still can.
API: gst_pad_get_caps_reffed(), gst_pad_peer_get_caps_reffed()
2009-11-05 12:54:32 +02:00
Rob Clark 746284f807 pad: make _fixate_caps() also truncate when needed
The default gst_pad_fixate_caps() previously would only fixate each individual
struct. In case there are multiple structs, the resulting caps would still not
be fixed. In the spirit of how individual structs are fixated, this patch
changes gst_pad_fixate_caps() to remove all but the first struct.

Fixes #595886
2009-10-28 16:36:13 +01: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
Tim-Philipp Müller 07d953b791 docs: fix Since: tags in docs for newly-added API 2009-10-07 23:34:44 +01:00
Stefan Kost fcc5d783df pad: add variants of gst_pad_get_caps() that don't copy caps. Fixes #590941
In most places in core and baseclasses we just need the caps to do caps-
intersections. In that case ref'ed caps are enough (no need to copy).
This patch also switches the code to use the new functions.
API: gst_pad_get_caps_refed(), gst_pad_peer_get_caps_refed()
2009-10-07 22:41:30 +03:00
Tim-Philipp Müller 3c6db4ed95 gst: remove more unnecessary cast when using g_signal_*() 2009-10-06 20:04:10 +01:00
Wim Taymans f64243e037 states: post structure change on sinkpads
Post the structure change messages on the sinkpads of the elements. This allows
us to catch unlinked pads earlier without ending up with inconsistent element
degrees.
2009-09-02 18:54:06 +02:00
Sebastian Dröge 884467d493 gstpad: Add some DISABLE_DEPRECATED markers in the header too
The internal links function is deprecated since some time and
there already were GST_REMOVE_DEPRECATED markers in the source file,
now add them to the header too.

Fixes bug #592209.
2009-08-18 14:57:08 +02:00
Edward Hervey 51bc185f7f gst: Remove dead assignments 2009-08-08 14:47:40 +02:00
Stefan Kost aee208ff30 pad: use new _caps_can_intersect() 2009-08-06 15:30:33 +03:00
Stefan Kost 12f9b39fac pad: use correct variable in test 2009-08-06 15:30:32 +03:00
Wim Taymans 4146fa2eed pad: Add some more debugging 2009-08-06 10:52:05 +02:00
Edward Hervey 3c21f2d86c Spread branch prediction macros.
These are based on profiling several playback scenarios using playbin2.
2009-06-30 16:29:58 +02:00
Edward Hervey 923913984e Use local variables in for/while loops.
This makes the generated code faster since:
* It won't have to read an undirect value (which will most likely be
 outside of the L1/L2 cache)
* We know that value never changes (the compiler has no clue that it doesn't).
2009-06-30 16:29:50 +02: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
Wim Taymans 309d78770c debug: add some more debug to element and pads 2009-06-15 18:42:59 +02:00
Wim Taymans 8f7c59936e pad: add pad private structure
Add pad private structure and move the new chainlistfunc into the private
struct. This avoids ABI breakage and allows us to expand in the future.
2009-05-28 16:36:32 +02:00
Wim Taymans fd8559e4fb pad: keep task ref before releasing the lock
Keep a ref to the task on the pad so that a concurrent stop can stop and join
the task.
2009-05-25 13:03:42 +02:00
Stefan Kost c2da78a953 docs: fix gtk-doc warnings
Move MT safety to main description (it does not belong to Return: or Since:
statement). Add a few missing return docs. Downgrade a normal comment froma doc
comment. Fix a doc header to only contain symbol name.
2009-05-22 12:53:11 +03:00
Jan Schmidt c05e2382cb docs: Fix up some documentation warnings.
Since: tags should always be the last thing in a doc block, apparently.
Add some Returns: descriptions to some recent functions.
2009-05-22 09:33:02 +01:00
Hannes Bistry b47f425069 loadsave: fix requestpad handling and serialisation order.
Support request pads when loading. Reverse pad serialisation order to
preserve it when recreating the pipeline.
2009-05-20 10:58:59 +03:00
Jonas Holmberg 22a48fb08c bufferlist: hook up the pad functions
Reuse buffer code for bufferlists. Not sure if this measurably impacts performance
for the simple buffer case, if it does after doing some benchmarks, we can
decouple it later.

Fixes #572285
2009-05-12 15:18:53 +02:00
Wim Taymans 4b604f7da6 Pad: post STREAM_STATUS_TYPE_CREATE
Post a stream-status message indicating that a new task was created so that the
application has a chance to change the properties of the task.

Fix unit test to take into account the new ref of the message.
2009-05-12 00:27:10 +02:00
Wim Taymans b59045aab9 GstTask: improve documentation
Improve the documentation for the callbacks.
2009-05-12 00:05:12 +02:00
Wim Taymans 540560a758 GstPad: install thread callbacks of the task
Install thread status callbacks on the task object of a pad and post
STREAM_STATUS messages.
2009-05-12 00:00:44 +02:00
Wim Taymans 10f5429887 GstPad: use new task function
Use the new task_set_state function and actually return its result to
the caller.
2009-05-11 23:00:45 +02:00
Sebastian Dröge e7ccf786c3 gst: Use G_DEFINE_TYPE and friends or at least g_once_init_* in the _get_type() functions 2009-04-04 10:20:36 +02:00
Wim Taymans b4b386a1fd gstpad: fix gst_pad_can_link
We were converting the GstPadLinkReturn to a gboolean, which is not what we want
to do.
2009-03-19 17:20:50 +01:00
Zeeshan Ali (Khattak) 8af9d58ea7 gstpad: fix gst_pad_can_link()
Move the gst_pad_can_link() implementation from gstutils to gstpad and use
gst_pad_link_prepare() to make it work correctly and also check the caps.

Make the broken implementation in gstutils static.

Small cleanups in the _get_fixed_caps() function.

Fixes #575682.
2009-03-18 17:01:16 +01:00
Wim Taymans da0060d3aa pad: call new callbacks set in the block callback
Keep track of when a new callback is installed in the callback and call the new
callback in that case.
Add unit test for checking pad blocking.
Fixes #573823.
2009-03-09 11:48:36 +01:00
Antoine Tremblay fe2f12b162 GstPad: relax failure to deactivate unlinked pads
When de/activating a pad in pull mode the pad needs to de/activate the
peer pad it is connected to, failure to be able to do this in activation mode
is an error.

However if there is no peerpad, we can still deactivate the pad correctly and
assume the application will deactivate the unlinked peer pad eventually.

Fixes #574163.
2009-03-05 11:29:48 +01:00
Alessandro Decina d3940f520b GstPad: Add gst_pad_set_blocked_async_full
This allows connecting a GDestroyNotify for when the callback is removed/replaced.
Partially fixes #514717
2009-02-22 20:01:05 +01:00
Wim Taymans ede1e01d13 gst/gstpad.c: Avoid getting the acceptcaps function too early.
Original commit message from CVS:
* gst/gstpad.c: (gst_pad_accept_caps):
Avoid getting the acceptcaps function too early.
2008-11-21 16:48:48 +00:00
Wim Taymans b340b510ce gst/gstpad.c: When we use gst_pad_alloc_buffer() without wanting to set the caps we also don't need to check if the c...
Original commit message from CVS:
* gst/gstpad.c: (gst_pad_configure_src):
When we use gst_pad_alloc_buffer() without wanting to set the caps we
also don't need to check if the caps are compatible because the caller
presumably is going to perform its own custom checks. Fixes some cases
where basetransform elements would error out when it was not needed.
2008-10-20 13:32:07 +00:00
Wim Taymans 401cc7fe6a gst/gstpad.c: Revert a patch from 21 months ago that broke caps negotiation in pull mode. Basically, having a buffer ...
Original commit message from CVS:
* gst/gstpad.c: (gst_pad_get_range), (gst_pad_pull_range):
Revert a patch from 21 months ago that broke caps negotiation in pull
mode. Basically, having a buffer pass over a pad will trigger the
setcaps function when caps change, just like in push mode.
2008-10-10 15:27:37 +00:00
Olivier Crete ee0eaf824b gst/gstbin.c: Keep track of pads that are being linked/unlinked and resync the state changes.
Original commit message from CVS:
Base on Patch by: Olivier Crete <tester at tester dot ca>
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (update_degree),
(gst_bin_sort_iterator_new), (gst_bin_handle_message_func):
Keep track of pads that are being linked/unlinked and resync the state
changes.
* gst/gstpad.c: (gst_pad_get_direction),
(gst_pad_set_chain_function), (gst_pad_set_getrange_function),
(gst_pad_set_checkgetrange_function), (gst_pad_unlink),
(gst_pad_link_prepare), (gst_pad_link),
(gst_pad_event_default_dispatch), (gst_pad_chain), (gst_pad_push),
(gst_pad_check_pull_range), (gst_pad_get_range),
(gst_pad_pull_range):
Some code cleanups, use macros to check pad direction.
Don't need to take the lock on the pad direction.
Post structure change when pads are linked/unlinked.
Change some checks into _return_if_fail().
* tests/check/gst/gstbin.c:
(test_link_structure_change_state_changed_sync_cb),
(GST_START_TEST), (gst_bin_suite):
Add testcase for pad link/unlinke resync during a state change.
Fixes #510354.
2008-10-06 16:15:02 +00:00
Antoine Tremblay db71547857 gst/gstpad.c: Fix small refount leak in caps compatibility check.
Original commit message from CVS:
Patch by: Antoine Tremblay <hexa00 at gmail dot com>
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked):
Original patch by : Simon Descaries
Fix small refount leak in caps compatibility check.
Fixes #551676.
2008-10-06 08:45:42 +00:00
Wim Taymans 7cf8be7fd8 gst/gstpad.c: Add fallback when calling the deprecated function on an element that implements the new internal_link h...
Original commit message from CVS:
* gst/gstpad.c: (add_unref_pad_to_list),
(gst_pad_get_internal_links_default):
Add fallback when calling the deprecated function on an element that
implements the new internal_link handler.
2008-09-01 14:05:45 +00:00
Olivier Crete 390369246e gst/gstpad.c: Use thread-safe internal links iterator. Fixes #549504.
Original commit message from CVS:
Patch by: Olivier Crete <tester at tester dot ca>
* gst/gstpad.c: (gst_pad_iterate_internal_links_default),
(gst_pad_event_default_dispatch), (gst_pad_dispatcher):
Use thread-safe internal links iterator. Fixes #549504.
2008-09-01 11:27:45 +00:00
Olivier Crete 68037404b8 Add threadsafe replacement functions for getting internal links of an element. Deprecate the old internal links funct...
Original commit message from CVS:
Based on patch by: Olivier Crete <tester at tester dot ca>
* docs/gst/gstreamer-sections.txt:
* win32/common/libgstreamer.def:
* gst/gstpad.c: (gst_pad_init),
(gst_pad_set_iterate_internal_links_function),
(int_link_iter_data_free), (iterate_pad),
(gst_pad_iterate_internal_links_default),
(gst_pad_iterate_internal_links), (gst_pad_get_internal_links):
* gst/gstpad.h:
Add threadsafe replacement functions for getting internal links of an
element. Deprecate the old internal links functions.
API:GstPad::gst_pad_set_iterate_internal_links_function()
API:GstPad::GstPadIterIntLinkFunction
API:GstPad::gst_pad_iterate_internal_links()
API:GstPad::gst_pad_iterate_internal_links_default()
* gst/gstghostpad.c: (gst_proxy_pad_do_iterate_internal_links),
(gst_proxy_pad_init):
Implement threadsafe internal links.
* tests/check/elements/tee.c: (GST_START_TEST), (tee_suite):
Unit test for internal links on tee. See #549504.
2008-09-01 10:42:04 +00:00
Edward Hervey 98354dc527 gst/gstpad.c: Die evil deadlock, die !
Original commit message from CVS:
* gst/gstpad.c: (gst_pad_get_internal_links_default):
Die evil deadlock, die !
2008-08-30 12:07:41 +00:00
Wim Taymans 31aded4133 gst/gstpad.c: Make the internal links function less thread-unsafe and add some comments, dunno why.
Original commit message from CVS:
* gst/gstpad.c: (gst_pad_get_internal_links_default):
Make the internal links function less thread-unsafe and add some
comments, dunno why.
2008-08-29 16:10:56 +00:00
Wim Taymans 48336614c0 gst/gstpad.c: Remove silly redundant debug.
Original commit message from CVS:
* gst/gstpad.c: (gst_pad_acceptcaps_default),
(gst_pad_configure_src), (gst_pad_alloc_buffer_full):
Remove silly redundant debug.
Add some more debug info.
Clarify the docs regarding new caps received from pad_alloc.
2008-07-31 12:50:52 +00:00
Tim-Philipp Müller 20d11b6fe0 gst/gstpad.c: Only sanity-check the buffer size if requested_caps == buffer_caps (ie. don't take pad caps into accoun...
Original commit message from CVS:
* gst/gstpad.c: (gst_pad_alloc_buffer_full):
Only sanity-check the buffer size if requested_caps == buffer_caps
(ie. don't take pad caps into account, they're not relevant here)
2008-07-29 15:32:11 +00:00
Wim Taymans e84afb820d gst/gstpad.c: The default event function on a sinkpad should return TRUE when there are no internal links but should ...
Original commit message from CVS:
* gst/gstpad.c: (gst_pad_event_default_dispatch):
The default event function on a sinkpad should return TRUE when
there are no internal links but should collect the return values from
the internal links otherwise.
2008-05-27 10:59:38 +00:00
Tim-Philipp Müller 1d5691d033 gst/gstpad.c: Move size sanity check to the right place: downstream may return a buffer with a smaller size if the bu...
Original commit message from CVS:
* gst/gstpad.c: (gst_pad_alloc_buffer_full):
Move size sanity check to the right place: downstream may return
a buffer with a smaller size if the buffer caps are different than
the requested ones, as may happen when doing reverse negotiation.
2008-05-21 18:33:08 +00:00