Commit graph

362 commits

Author SHA1 Message Date
Wim Taymans f4aa1b1011 caps: small cleanup, remove const 2012-03-12 18:22:05 +01:00
Wim Taymans 4bbc3b6f04 caps: small cleanups 2012-03-12 18:02:27 +01:00
Wim Taymans 1bc93bbf8f caps: small doc improvement 2012-03-12 16:40:38 +01:00
Wim Taymans 4feb6c3989 caps: fix some 0.11 FIXMEs 2012-03-12 12:35:07 +01:00
Wim Taymans 67931bfded caps: make _normalize take ownership of input
Make gst_caps_normalize() take ownership of the input so that it can more
intelligently decide when to copy or not.
2012-03-12 12:21:34 +01:00
Wim Taymans 8a76c3269a caps: _do_simplify() -> _simplify()
Rename _do_simplify() to _simplify(). The name was introduced as a replacement
method for a deprecated method but we can now rename it again.
Fix some docs.
2012-03-12 11:38:37 +01:00
Wim Taymans 9cdbffea94 caps: improve _do_simplify
Make gst_caps_do_simplify() take ownership of the input caps and produce a
simplified output caps. This removes the requirement of having writable input
caps and the method can make the caps writable only when needed.
2012-03-12 10:42:23 +01:00
Wim Taymans 43abf99a8a caps: avoid using in-place oprations
Rework some caps operations so they don't rely on writable caps but instead take
ownership of the input caps and do _make_writable() only when needed.
Remove some const from caps functions, it does not make much sense for
refcounted objects and does not allow us to return a refcount to the const input
caps.
Rework the base classes fixate vmethods to not operate on the caps in-place.
All this saves us around 30% of caps and structure copy and new operations.
2012-03-11 18:57:44 +01:00
Wim Taymans 34f770a900 gst: add some performance logging
Add some performance logging for caps copy and the slow default acceptcaps
implementation
2012-02-10 11:09:01 +01:00
Olivier Crête e234a10c63 Use macros to register boxed types thread safely 2012-01-28 16:42:38 +00:00
Andoni Morales Alastruey ded0ea049e caps: fix documenation typo 2012-01-27 18:14:50 +01:00
Wim Taymans 321ee10bd6 trace: rework alloc tracing
Remove trace, we use debug log for that
Make alloc trace simpler, removing some methods.
Activate alloc trace with a GST_TRACE=3 environment variable.
Dump leaked objects atexit.
Provide an offset in the object where the GType can be found so that more
verbose info can be given for objects.
Remove -T option from gst-launch because tracing is now triggered with the
environment variable.
2012-01-27 17:54:43 +01:00
Sebastian Dröge a7b96d0503 caps: Fix compiler warning 2012-01-26 14:57:14 +01:00
Sebastian Dröge 28f5b86637 caps: Use correct size for caps allocation 2012-01-26 14:55:30 +01:00
Sebastian Dröge b4066a6c95 caps: Make GstCaps public struct more opaque by moving the private pointer into the implementation 2012-01-26 14:45:30 +01:00
Sebastian Dröge 5d1d7d95b2 caps: Store a pointer to GstCaps in GstStaticCaps
...instead of using hackish subclass of GstCaps, which also
had some thread-safety problems.
2012-01-26 14:37:02 +01:00
Tim-Philipp Müller c721d53773 Remove GST_TYPE_DATE, our own GDate type
Which we had to add because GLib didn't have it
back in the day. Port everything to plain old
G_TYPE_DATE, which is also a boxed type. Ideally
we'd just use GDateTime for everything, but it
doesn't support not setting some of the fields
unfortuntely (which would be very useful for
tag handling in general, if we could express
2012-01 for example).

https://bugzilla.gnome.org/show_bug.cgi?id=666351
2012-01-12 20:50:53 +00:00
Wim Taymans 0a8dd0a4e7 caps: rename variable for consistency
Rename the variable for GST_CAPS_NONE to _gst_caps_none for consistency and to
hie the fact that NONE caps are also accidentally empty caps.
2011-12-21 11:10:04 +01:00
Wim Taymans 8ff059ba59 caps: add ANY and EMPTY singletons
Add a singleton for ANY and EMPTY caps and make the GST_CAPS_ANY and
GST_CAPS_NONE point to them. This makes the API more consistent now
that the macro does not magically create a ref. It also solves some leaks in
places where the macro was used to register a padtemplate.
2011-12-20 13:24:06 +01:00
Wim Taymans 5a4957eef6 caps: _CAPS_FLAGS_ -> CAPS_FLAG_ 2011-11-28 14:24:16 +01:00
Wim Taymans 9c0d8ca718 Merge branch 'master' into 0.11
Conflicts:
	gst/gstelement.h
	gst/gstghostpad.c
	gst/gstminiobject.c
2011-11-08 12:54:15 +01:00
Tim-Philipp Müller 16dcd5e958 docs: fix Since: markers for API added after 0.10.35 2011-11-08 00:32:36 +00:00
Wim Taymans c9a4037805 Merge branch 'master' into 0.11
Conflicts:
	gst/gstvalue.c
2011-11-07 17:17:39 +01:00
Vincent Penquerc'h 9121a30f9a gstcaps: remove unneeded use of gint64
https://bugzilla.gnome.org/show_bug.cgi?id=662777
2011-11-07 15:17:35 +00:00
Wim Taymans 4fa22944e9 caps: fix compilation 2011-11-07 10:40:23 +01:00
Wim Taymans b7fac4d093 Merge branch 'master' into 0.11
Conflicts:
	libs/gst/base/gstbasetransform.c
2011-11-07 10:01:27 +01:00
Sjoerd Simons 57074fc025 caps: Add gst_caps_is_strictly_equal 2011-11-04 17:49:55 +00:00
Wim Taymans e4725d9df2 structure: cleanup API
gst_structure_empty_new() -> gst_structure_new_empty()
  gst_structure_id_empty_new() -> gst_structure_new_id_empty()
  gst_structure_id_new() -> gst_structure_new_id()
2011-11-02 08:59:44 +01:00
Wim Taymans d9c8ab67a0 caps: add empty_simple variants 2011-10-27 17:09:04 +02:00
Wim Taymans 852851edab Merge branch 'master' into 0.11
Conflicts:
	libs/gst/base/gstbasetransform.c
2011-10-27 15:27:19 +02:00
Thiago Santos 27ce89812a caps: No need to require writable caps for _append/_merge second caps
The second caps ownership is transfered, no need to require it to
be writable from the caller function. Instead, _append and _merge
make it writable on their own.

Discovered because of an assertion on encoding-profile.c in
_get_input_caps using _merge but not passing writable caps.
2011-10-21 10:23:04 -03:00
René Stadler 221836f452 caps: fix race condition and memory leak in gst_static_caps_get
This was leaking the PtrArray from caps->priv, as set up by the other call to
gst_caps_init. Also, the thread safety issue presented in the comment above was
not taken care of anymore. We now zero the refcount again when publishing the
structure.

Fixes #661629.
2011-10-17 13:59:49 +02:00
Edward Hervey 10e7159cf8 Merge branch 'master' into 0.11
Conflicts:
	gst/gstcaps.c
	gst/gstpad.c
	libs/gst/base/gstbasesink.c
	libs/gst/base/gstbasesink.h
	libs/gst/base/gstbasetransform.c
2011-09-23 13:09:25 +02:00
Fabrizio (Misto) Milo 7be3899653 caps: use g_value_take_string() and gst_value_get_caps() instead of accessing internal fields 2011-09-19 09:50:11 +02:00
Tim-Philipp Müller 98ee2979d1 caps: move log messages for caps creation/freeing into TRACE category
Reduce SPAM for GST_CAPS:5.
2011-09-10 18:24:49 +01:00
Sebastian Dröge 43538e2e75 Merge branch 'master' into 0.11
Conflicts:
	docs/design/draft-buffer2.txt
	docs/design/part-TODO.txt
	docs/design/part-block.txt
	docs/design/part-bufferlist.txt
	docs/design/part-caps.txt
	docs/design/part-element-transform.txt
	docs/design/part-events.txt
	docs/design/part-negotiation.txt
	gst/gstcaps.c
	gst/gstevent.h
	gst/gstghostpad.c
	gst/gstinterface.c
	gst/gstpad.c
	gst/gstpad.h
	gst/gstutils.c
	libs/gst/base/gstbasesink.c
	libs/gst/base/gstbasesrc.c
	libs/gst/base/gstbasetransform.c
	libs/gst/base/gsttypefindhelper.c
	plugins/elements/gstcapsfilter.c
	plugins/elements/gsttee.c
	tests/check/generic/sinks.c
	tools/gst-launch.1.in
2011-09-08 14:28:23 +02:00
Piotr Fusik 14f5518f3d docs, gst: typo fixes
https://bugzilla.gnome.org/show_bug.cgi?id=658449
2011-09-07 18:03:17 +01:00
Wim Taymans a952de69dd miniobject: change to GST_DEFINE_MINI_OBJECT_TYPE
Append _TYPE to the macro for consistency with other similar macros.
2011-08-29 17:06:18 +02:00
Wim Taymans f3b0d3cdbe init: add _get_type() functions
Remove gst_mini_object_register() and add a GST_DEFINE_MINI_OBJECT macro to
define a _get_type() function for the boxed miniobject.
Remove a bunch of custom _get_type() functions and replace them with the
miniobject macro.
Rename some _init method to _priv_*_initialize() like the rest of them.

Inspired by patch from Johan Dahlin and see bug #657603
2011-08-29 15:34:30 +02:00
Wim Taymans 4145598972 gst: add some _priv prefixes to private methods 2011-08-29 13:27:26 +02:00
Wim Taymans 8170c34c94 Merge branch 'master' into 0.11
Conflicts:
	gst/gstbuffer.h
	gst/gstcaps.c
	gst/gstcaps.h
	gst/gstevent.c
2011-08-22 12:33:35 +02:00
Wim Taymans 405a5d2a92 value: remove our FOURCC GType
Remove our custom fourcc GValue.
2011-08-22 12:19:19 +02:00
Tim-Philipp Müller 4985d2a954 caps: fix compiler warning reported by ICC
The MAX macro expands to code that checks if an unsigned integer is < 0.

Fixes warning #186: pointless comparison of unsigned integer reported by ICC.

https://bugzilla.gnome.org/show_bug.cgi?id=656265
2011-08-15 21:15:29 +01:00
Josep Torra d99d270a69 caps: define GST_CAPS_FLAGS_NONE for consistency with other enumerations
Use them to fix warnings when building with ICC.

API: GST_CAPS_FLAGS_NONE

https://bugzilla.gnome.org/show_bug.cgi?id=656265
2011-08-15 21:13:29 +01:00
Wim Taymans 49fc4249e5 caps: add fixate function
Add a fixate function and use it in gstpad.c
2011-08-15 14:40:38 +02:00
Wim Taymans 314a2b961a caps: Hide implementation details
Make the Array of structures private. This should allow us to implement
the array more efficiently or with some preallocated structures when
we want to later.
Add a new method to clean up a static structure so that we can remove some code
that pokes into the private bits of the caps.
2011-06-22 12:28:14 +02:00
Wim Taymans 9553ea1c07 caps: remove some custom refcounting methods
Remove some custom made refcounting methods and use the miniobject ones instead.
2011-06-02 13:18:39 +02:00
Sebastian Dröge 30a7fd7b4d Merge branch 'master' into 0.11 2011-05-27 13:58:26 +02:00
Sebastian Dröge 57df188757 caps: Add gst_caps_is_subset_structure()
API: gst_caps_is_subset_structure()

This allows to check if a structure is a subset of given
caps without allocating a new caps instance for it.
2011-05-27 13:55:31 +02:00
Sebastian Dröge da58834884 structure: Add gst_structure_is_subset()
API: gst_structure_is_subset()
2011-05-27 13:47:11 +02:00
Sebastian Dröge d98e9acb0f caps: Optimize gst_caps_is_subset()
..and as a result gst_caps_is_equal() and others.

This now only checks if for every subset structure there is
a superset structure in the superset caps. Previously we were
subtracting one from another, creating completely new caps
and then even simplified them.

The new implemention now is about 1.27 times faster and doesn't
break the -base unit tests are anything anymore.
2011-05-27 13:38:51 +02:00
Sebastian Dröge 0cf2dfd0ba caps: Fix subset check in gst_caps_merge()
Caps A are a subset of caps B even if caps B doesn't
have all fields of caps A.

Also add a unit test for this.
2011-05-27 13:37:06 +02:00
Sebastian Dröge d706ca0859 Revert "caps: Optimize gst_caps_is_subset()"
This reverts commit 32248a9b85.

This breaks some tests in -base and the failures should
be fixed first.
2011-05-27 12:56:43 +02:00
Sebastian Dröge 32248a9b85 caps: Optimize gst_caps_is_subset()
..and as a result gst_caps_is_equal() and others.

This now only checks if for every subset structure there is
a superset structure in the superset caps. Previously we were
subtracting one from another, creating completely new caps
and then even simplified them.

The new implemention now is about 1.27 times faster.
2011-05-27 12:45:59 +02:00
Sebastian Dröge 007b16b024 Merge branch 'master' into 0.11 2011-05-26 13:36:48 +02:00
Tim-Philipp Müller 8a3721a1ca gst: we can now use GLib 2.24 API unconditionally 2011-05-25 16:02:10 +01:00
Sebastian Dröge e34c26b509 Merge branch 'master' into 0.11
Conflicts:
	win32/common/libgstreamer.def
2011-05-17 09:43:21 +02:00
Sebastian Dröge a08a17dfbd structure: Add gst_structure_intersect()
API: gst_structure_intersect()
2011-05-17 09:33:04 +02:00
Edward Hervey 64725facb5 gststructure: Add gst_structure_can_intersect API
Allows checking if two structures can intersect without having to
go through GstCaps

API: gst_structure_can_intersect

https://bugzilla.gnome.org/show_bug.cgi?id=629300
2011-05-17 09:28:06 +02:00
Edward Hervey ae46eb3a38 gstructure: New API: gst_structure_is_equal
Allows checking equality of GstStructure without having to create
intermediary GstCaps.

API: gst_structure_is_equal

https://bugzilla.gnome.org/show_bug.cgi?id=629300
2011-05-17 09:28:00 +02:00
Wim Taymans 32f1899354 caps: only add the structure when we could set the parent 2011-05-16 18:12:33 +02:00
Sebastian Dröge 6e57ce32e5 caps: Merge structures when intersecting instead of appending them
This prevents adding duplicates over and over again to the resulting
caps if they already describe the new intersection result.

While this changes intersection from O(n*m) to O(n^2*m), it results in
smaller caps, which in the end will decrease further processing times.

For example in an audioconvert ! audioconvert ! audioconvert pipeline,
when forwarding the downstream caps preference in basetransform
(see e26da72de25a91c3eaad9f7c8b2f53ba888a0394) this results in
16 instead of 191 caps structures.
2011-05-14 11:39:34 +02:00
Wim Taymans 9597545d23 structure: more cleanups
gst_structure_get_type() -> _gst_structure_type to avoid method calls for
getting the GType that initialized at the start.
Hide some structure fields in private data so that we can change the
implementation.
Move structure equality check from caps.c to structure.c where it belongs.
2011-05-11 18:17:45 +02:00
Wim Taymans e2452c8c78 caps: cleanups
We don't need to check if the type is 0, the init function is only called once
in the beginning.
2011-05-11 16:06:50 +02:00
Sebastian Dröge dc63e38219 caps: Merge structures when intersecting instead of appending them
This prevents adding duplicates over and over again to the resulting
caps if they already describe the new intersection result.

While this changes intersection from O(n*m) to O(n^2*m), it results in
smaller caps, which in the end will decrease further processing times.

For example in an audioconvert ! audioconvert ! audioconvert pipeline,
when forwarding the downstream caps preference in basetransform
(see e26da72de25a91c3eaad9f7c8b2f53ba888a0394) this results in
16 instead of 191 caps structures.
2011-05-05 15:22:14 +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
Edward Hervey 09d83e589a gstcaps: new API : gst_caps_intersect_full
Just like gst_caps_intersect, but adds a new parameter 'mode'
that allows selecting the intersection algorithm to use.

Currently we have GST_CAPS_INTERSECT_MODE_ZIG_ZAG (default) and
GST_CAPS_INTERSECT_MODE_FIRST.

API: gst_caps_intersect_full
API: GstCapsIntersectMode
API: GST_CAPS_INTERSECT_MODE_ZIG_ZAG
API: GST_CAPS_INTERSECT_MODE_FIRST

https://bugzilla.gnome.org/show_bug.cgi?id=617045
2011-03-24 11:14:18 -03:00
Wim Taymans fd0fd97200 Merge branch 'master' into 0.11 2011-03-08 17:06:30 +00:00
Stefan Kost 4d9e645551 caps,structure: trim trailing whitespace 2011-03-08 10:07:03 +02:00
Jonathan Matthew 2bbfa3304c caps: don't create broken caps for invalid media types
Check if structure has been created before appending it to the caps. Free the
caps in the case of an error to not conceal it be returning empty caps.

Fixes #642271
2011-03-08 10:06:12 +02:00
Wim Taymans 7e769a32b8 caps: remove poisoning 2011-02-24 10:28:20 +01:00
Wim Taymans b108e3b999 miniobject: cleanups
Use the stored size in the miniobject to free the miniobject.
Refactor some init methods.
2011-02-23 16:48:00 +01:00
Wim Taymans 70be8d8d95 improve type registration 2011-02-23 10:35:36 +01:00
Wim Taymans cdde34f0ee fix compilation 2011-02-23 10:35:36 +01:00
Wim Taymans b82a0f5050 fix macros 2011-02-23 10:35:36 +01:00
Wim Taymans d62ca7c063 miniobject: small fixes
Make dataflow happen.
2011-02-23 10:35:22 +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 56a3364183 messages: make message a simple boxed type 2011-02-23 10:34:27 +01:00
Wim Taymans fda9686b35 miniobject: work on making caps a boxed type
More work on making miniobject a simple allocated struct.
2011-02-23 10:34:08 +01:00
Wim Taymans 238b9a57cc Merge branch 'master' into 0.11
Conflicts:
	configure.ac
	gst/gstelement.c
	gst/gstelement.h
	gst/gstpad.c
	gst/gstutils.c
	libs/gst/base/Makefile.am
	libs/gst/check/Makefile.am
	libs/gst/controller/Makefile.am
	libs/gst/dataprotocol/Makefile.am
	libs/gst/net/Makefile.am
	win32/common/libgstreamer.def
2011-02-22 14:11:59 +01:00
Tim-Philipp Müller 8a7fc1d8c9 Revert "micro-optim: if (x) is cheaper than if (x > 0) for unsigned integers"
This reverts commit 6aa8ca37ee.

See http://article.gmane.org/gmane.comp.video.gstreamer.devel/32282
2010-12-26 21:21:43 +00: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 993eda5004 remove deprecated symbols and methods 2010-12-06 19:18:31 +01:00
Mark Nauwelaerts efe3c70450 caps: fix doc typo 2010-12-03 13:35:38 +01:00
Edward Hervey 6aa8ca37ee micro-optim: if (x) is cheaper than if (x > 0) for unsigned integers 2010-12-03 12:03:42 +01:00
Wim Taymans d36903c1c2 caps: improve some comments about the zigzag intersection 2010-12-02 19:10:44 +01:00
Stefan Kost 8ef7e46d24 docs: fix warnings pointed out by gtk-doc 2010-09-13 11:18:25 +03:00
Tim-Philipp Müller bf2bdba6b3 caps: simplify code a bit
No need to call g_slist_length() here.
2010-09-08 18:51:09 +01:00
Edward Hervey 70d1f1f177 gstcaps: Make sure _normalize() is applied on all structures.
We need to use gst_caps_get_size() in the loop counter since some
structures could be added while iterating.

Fixes #623301
2010-07-01 18:17:40 +02:00
Tim-Philipp Müller 71f3a6f0f7 Don't include <libxml/parser.h> from public headers if GST_DISABLE_DEPRECATED is defined
Since everything GstXML related has been deprecated, we can now skip the
libxml includes from the public headers when GST_DISABLE_DEPRECATED is
defined.

See #463435.
2010-06-26 10:35:38 +01:00
Sebastian Dröge 5f4a965f67 gstxml: Deprecate GstXml and related functions
Pipeline serialisation to and from XML is horribly broken for all
but the most simple use cases, and will likely never be fixed.
Make sure everyone playing around with these tools is aware of
this, to avoid frustration. See countless bug reports in bugzilla.

Fixes bug #622685.
2010-06-25 18:25:40 +02:00
Tim-Philipp Müller 6edfcc3705 docs: add Since: tag for new gst_caps_steal_structure 2010-06-14 12:28:57 +01:00
Edward Hervey 32adac81ee gstcaps: New gst_caps_steal_structure() method
This allows removing structures from caps without them being freed. Helpful when
plugins need to move around structures without having to do an expensive structure
copy.

API:gst_caps_steal_structure

https://bugzilla.gnome.org/show_bug.cgi?id=621527
2010-06-14 13:16:18 +02:00
Stefan Kost 2d2ec4e3d5 caps: use gst_caps_append_structure_unchecked() macro once more 2010-06-08 12:19:49 +03:00
Stefan Kost c5f85a1cda caps: use a safer name for temporary var. to not shadow one from outer scope 2010-06-08 12:19:22 +03:00
Tim-Philipp Müller 66fc4c8ba2 info: add new TRACE log level and move refcounting there from LOG level
This makes it possible to easily get a *:5 debug log without all
the refcounting noise, and drastically reduces the number of lines
output for a normal log (46m to 28m for a 20min video). The full log
including refcounting information can still be gotten using *:7.

Fixes #620460.
2010-06-05 12:53:15 +01:00
Stefan Kost ccaadae492 caps: use our macros more often in the code 2010-05-22 23:26:16 +03:00
Stefan Kost bd7a34bfa1 caps: add append_structure_unchecked
This is useful when we know that caps is !NULL, writable and structure is
!NULL too.
2010-05-22 23:14:48 +03:00
Stefan Kost 999a6235c0 caps: use our macos more 2010-05-22 22:44:02 +03:00
Stefan Kost e8c2c40b21 caps: comment and whitespace cleanup
Make comment more specific, reposition it and add more of the kind.
Move one ifdef'ed function around.
2010-05-14 11:54:56 +03:00