Commit graph

409 commits

Author SHA1 Message Date
Thibault Saunier
1f3ef7aa01 basetransform: Do not check if NULL is an emtpy caps
gst_base_transform_transform_caps can return NULL in various conditions
thus we should not treat its result as valid caps.

In all other places NULL is properly handled.
2018-07-18 21:18:56 -04:00
Tim-Philipp Müller
2db8e3705f Update for g_type_class_add_private() deprecation in recent GLib
https://gitlab.gnome.org/GNOME/glib/merge_requests/7
2018-06-24 12:49:14 +02:00
luz.paz
4a402c1c7d Fix typos in comments and docs
Found via `codespell`

https://bugzilla.gnome.org/show_bug.cgi?id=795610
2018-05-01 11:18:03 +01:00
Nicolas Dufresne
443221c661 basetransform: Allow going passthrough inside decide_allocation
Sub-class may want to decide to go passthrough/in-place by inspecting
the support meta APIs. This patch duplicates the check for this mode,
so we still don't do uneeded allocation query while we allow sub-classes
to switch the behaviour during it's own decide_allocation call.

Notice that such sub-class need to reset the class to non-passthrough in
set_caps() in order for decide_allocation to be called again. This is
needed otherwise we'd be doing an allocation query in element in which
it make no sense (notably capsfilter).

https://bugzilla.gnome.org/show_bug.cgi?id=791453
2017-12-17 15:39:51 -05:00
Tim-Philipp Müller
db3ea93439 libs: fix indentation 2017-11-24 13:40:33 +01:00
Havard Graff
df27ec3e67 gstbasetranform: replace GST_BASE_TRANSFORM with GST_BASE_TRANSFORM_CAST
To avoid a global type-lock on chain etc.
2017-11-24 13:39:39 +01:00
Frédéric Dalleau
ca7fa6a661 basetransform: Check if meta transform_func is NULL before using it
An untested pointer segfaulted in webkit while playing video
on imx6 sabrelite. It turned out that the imx plugin didn't
implement the meta transform function.

The following GST_DEBUG trace was visible:
gstbasetransform.c:1779:foreach_metadata:<conv2> copy metadata
                                                GstImxVpuBufferMetaAPI

Thread 26 vqueue:src received signal SIGSEGV, Segmentation fault.

(gdb) bt
 0x00000000 in ?? ()
 0x73f8d7d8 in foreach_metadata (inbuf=0xc9b020, meta=0x474b2490,
                  user_data=<optimized out>) at gstbasetransform.c:1781
 0x73eb3ea8 in gst_buffer_foreach_meta (buffer=buffer@entry=0xc9b020,
                  func=0x73f8d705 <foreach_metadata>,
                  user_data=user_data@entry=0x474b24d4)
                  at gstbuffer.c:2234

https://bugzilla.gnome.org/show_bug.cgi?id=782050
2017-05-02 14:26:21 +03:00
Yasushi SHOJI
c423df49af basetransform: fix typo in debug log output
This unbalanced closing parenthesis is leftover from the commit
8b739d91e7. It used to wrap the caps but we don't seem to do that in
the current code.

So, just remove it. No functionality has been changed.

https://bugzilla.gnome.org/show_bug.cgi?id=781484
2017-04-19 09:21:32 +01:00
Thibault Saunier
a87b4551a6 Port gtk-doc comments to their equivalent markdown syntax
Modernizing our documentation and preparing a possible move to hotdoc.
This commits also adds missing @title metadatas to all SECTIONs
2017-01-27 16:36:38 -03:00
Sebastian Dröge
f08c8d2da3 basetransform: Ensure to set the RECONFIGURE flag again if reconfiguration failed
It might've failed just because of flushing or other things, and we
should retry again on the next possibility if something ever calls in
here again.

https://bugzilla.gnome.org/show_bug.cgi?id=774623
2016-11-18 12:04:18 +02:00
Guillaume Desmottes
fcb938caae basetransform: fix pool leak when early returning in decide_allocation
https://bugzilla.gnome.org/show_bug.cgi?id=769023
2016-11-11 13:29:35 +00:00
Sebastian Dröge
1efb451154 Use new GST_ENABLE_EXTRA_CHECKS #define
https://bugzilla.gnome.org/show_bug.cgi?id=756870
2015-10-21 14:31:56 +03:00
Sebastian Dröge
73263271bb basetransform: Print buffer PTS when submitting an input buffer 2015-09-23 20:31:48 +02:00
Nicolas Dufresne
2534e39e55 basetransform: Reconfigure before propose_allocation
There exist cases where a reconfigure event was propagated from
downstream, but caps didn't change. In this case, we would
reconfigure only when the next buffer arrives. The problem is that
due to the allocation query being cached, the return query parameters
endup outdated.

In this patch we refactor the reconfigurating code into a function, and
along with reconfiguring when a new buffer comes in, we also reconfigure
when a query allocation arrives.

https://bugzilla.gnome.org/show_bug.cgi?id=753850
2015-08-21 15:14:34 -07:00
Thiago Santos
e0cc0e0888 basetransform: rework accept-caps
According to the design docs:
The ACCEPT_CAPS query is not required to work recursively, it can simply
return TRUE if a subsequent CAPS event with those caps would return
success.

So make it a shallow check instead of recursivelly check downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=748635
2015-08-13 14:07:35 -03:00
Thiago Santos
42acf05b22 basetransform: remove some dead code
Doesn't seem like it is going to get back to life anytime soon

Also removes a {} block that was likely used to keep the dead
code around.
2015-08-13 12:45:35 -03:00
Thiago Santos
7ec54c2217 basetransform: respect accept-caps intersect flag
GstPad has a flag for suggesting if the accept-caps
query should use intersect instead of the default
subset caps operation to verify if the caps would be
acceptable.

basetransform currently always uses the subset check and
this patch makes it honor the flag for using intersect
if it is set.

https://bugzilla.gnome.org/show_bug.cgi?id=748635
2015-08-13 06:01:36 -03:00
Vineeth TM
039ac81ee3 basetransform: remove unreachable return statement
https://bugzilla.gnome.org/show_bug.cgi?id=753538
2015-08-12 10:34:59 +01:00
Olivier Crête
5e5a14028a basetransform: Return FLOW_FLUSHING if negotiation fails during shutdown
https://bugzilla.gnome.org/show_bug.cgi?id=752800
2015-07-27 13:53:26 -04:00
Nicolas Dufresne
f9aa306747 basetransform: Avoid increasing query reference
gst_query_find_allocation_meta() requires the query to be
writable to work. This patch ensure avoids taking a reference
on the query, so we can now check if a certain allocation meta
is present.

https://bugzilla.gnome.org/show_bug.cgi?id=752661
2015-07-22 13:29:35 -04:00
Sebastian Dröge
231e77338c transform: Also copy POOL metas and make sure to copy over metas when creating subbuffers
POOL meta just means that this specific instance of the meta is related to a
pool, a copy should be made when reasonable and the flag should just not be
set in the copy.
2015-07-01 10:50:19 +02:00
Jan Schmidt
a198803bd6 basetransform: Split input buffer processing from output generation
Allow for sub-classes which want to collate incoming buffers or
split them into multiple output buffers by separating the input
buffer submission from output buffer generation and allowing
for looping of one of the phases depending on pull or push mode
operation.

https://bugzilla.gnome.org/show_bug.cgi?id=750033
2015-06-08 19:17:57 +10:00
Nicolas Dufresne
43f2f925a9 basetransform: Add Since mark for new method
https://bugzilla.gnome.org/show_bug.cgi?id=734424
2015-04-02 17:32:42 -04:00
Thibault Saunier
506afa54df basetransform: Add a method to let subclasses cleanly update srcpad caps
API:
    gst_base_transform_update_src

https://bugzilla.gnome.org/show_bug.cgi?id=734424
2015-04-02 17:16:23 -04:00
Sebastian Dröge
f4bd5f119a basetransform: Short-circuit CAPS query handling if transform_caps returns EMPTY caps
Both for the peer filter caps and the converted caps based on the peer caps.

If the peer filter caps are EMPTY, the peer caps query will also return
EMPTY. There's no ned to both downstream/upstream with this query.
2014-12-22 13:08:37 +01:00
Sebastian Dröge
154eefecc9 Don't compare booleans for equality to TRUE and FALSE
TRUE is 1, but every other non-zero value is also considered true. Comparing
for equality with TRUE would only consider 1 but not the others.

Also normalize booleans in a few places.
2014-12-01 09:51:37 +01:00
Sebastian Dröge
21321ce674 basetransform: Compare correct caps variable against NULL before comparing caps 2014-11-27 18:00:57 +01:00
Sebastian Dröge
a7f3571d02 basetransform: Fix caps equality check
Instead of checking if our outcaps are equivalent to the previous incaps, and
if that is the case not setting any caps on the pad... compare against our
previous outcaps because that's what we care about.

Fixes some cases where the outcaps became equivalent to the previous incaps,
but the previous outcaps were different and we were then sending buffers
downstream that were corresponding to the caps we forgot to set on the pad.
Resulting in crashes or image corruption.
2014-11-20 21:37:24 +01:00
Sebastian Dröge
a52184ed55 basetransform: Don't bother the subclass with setting the same caps multiple times 2014-11-09 10:42:55 +01:00
Evan Nemerson
25af4ad652 base: use correct syntax in documentation more consistently
Previously, many constants were prefixed with # or unprefixed,
some functions and macros were prefixed with # instead of suffixed
with (), etc.

https://bugzilla.gnome.org/show_bug.cgi?id=731293
2014-06-06 15:09:21 -04:00
Sebastian Dröge
70b38dd937 basetransform: Passthrough ALLOCATION queries in passthrough mode even if we had no caps yet
Or if the element does not care about caps at all.

Also remove an assigned but unused local variable.

https://bugzilla.gnome.org/show_bug.cgi?id=710268
2014-05-26 14:24:15 +02:00
Nicolas Dufresne
e73907200c basetransform: Correctly reset configuration
When pool can't we use, and we fall back to default pool, we need to
correctly reset that pool configuration.
2014-05-09 14:30:03 -04:00
Nicolas Dufresne
23e69d98d8 pool-nego: Retry setting configuration with modified config
Buffer pool set_config() may return FALSE if requested configuration needed
small changes. Reget the config and try setting it again (validating the
changes first). This ensure we have a configured pool if possible.

https://bugzilla.gnome.org/show_bug.cgi?id=727916
2014-05-08 13:11:14 -04:00
Stefan Sauer
f6d638153c docs: fix more gtk-doc warnings 2014-02-01 16:18:13 +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
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
Mathieu Duponchelle
8d24c4e451 basetransform: implement a default transform_meta.
If a metadata has no dependency as shown by the tags, copy it.
2013-09-09 15:32:18 +02:00
Edward Hervey
307d67f8c0 basetransform: Don't push out identical caps
This avoids triggering plenty of extra code/methods/overhead downstream when
we can just quickly check whenever we want to set caps whether they are
identical or not

https://bugzilla.gnome.org/show_bug.cgi?id=706600
2013-08-22 19:06:47 +02:00
Sjoerd Simons
12a72d2b08 basetransform: optimize default acceptcaps implementation
Pass the fixed caps we're asked to accept as a filter for the caps
query, so we don't get a fully-expanded set of caps back (which we don't
need and can take a lot of time for intersection).

This reduces the time for camerabin to produce a second frame on a
logitech C910 camera from around 52 seconds to a bit less then 16
seconds on my system.

https://bugzilla.gnome.org/show_bug.cgi?id=702632
2013-06-19 15:11:57 +02:00
Tim-Philipp Müller
4d1cb14c68 basetransform: remove 0.10-ism from docs
gst_buffer_pad_alloc() never existed, and gst_pad_alloc_buffer()
doesn't exist any more either, so don't mention it in the docs.

https://bugzilla.gnome.org/show_bug.cgi?id=694714
2013-05-24 23:01:09 +01:00
Sebastian Dröge
3e515099ec basetransform: Return GST_FLOW_ERROR if the allocator did not allow to allocate a buffer 2013-05-24 14:37:37 +02:00
Tim-Philipp Müller
5a73d15c80 basetransform: don't pass NULL outcaps to transform_size on shutdown
gst_pad_get_current_caps() on the source pad might yield NULL caps
if we're being shut down and the source pad has already been
deactivated by the other thread that's changing state. Just bail
out in that case, instead of passing NULL caps to the transform_size
function, which it might not expect.

Fixes spurious warnings in audioresample shutdown unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=693996
2013-02-21 11:28:12 +00: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
Tim-Philipp Müller
4e373aa952 docs: add Since markers for new API and add it to docs and .def file 2012-10-04 11:24:09 +01:00
Wim Taymans
d5b81aba6a basetrans: add an option to prefer passthrough
Basetransform attempts to do passthrough mode regardless of the order of
the transform_caps method. Add a method to disable this.
This is needed for elements like capsfilter that want to transform caps
based on the order of the caps property.
2012-10-04 11:15:36 +02:00
Wim Taymans
664f7141be basetrans: improve some comments 2012-10-04 10:01:19 +02:00
Wim Taymans
0ea3675cf4 basetransform: check acquire result value
Check the result value from _buffer_pool_acquire() and return the
value when allocation failed.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=684285
2012-09-18 21:49:41 +02:00
Wim Taymans
9828f72cda basetrans: whitespace fix 2012-09-14 16:58:10 +02:00
Wim Taymans
3abc720345 docs: fix some docs
from git grep for ffmpegcolorspace and x-raw-
2012-09-13 11:35:41 +02:00