Commit graph

309 commits

Author SHA1 Message Date
Tim-Philipp Müller 7ea4152323 gstvalue: allocate slightly larger than needed tables at startup
If we pre-allocate only *exactly* as many nodes as we need for the
core types, we are practically guaranteed a re-alloc when external
code like GstVideoTimeCode or GstEncodingProfile register their
own GstValue things. So allocate a bit more than strictly needed.
2017-11-23 13:56:51 +01:00
Thibault Saunier 996bedb81d value: Handle serializing NULL GValueArray
Concider them as an empty array and do not segfault...

https://bugzilla.gnome.org/show_bug.cgi?id=786670
2017-08-26 13:46:58 -03:00
Olivier Crête dd1f0f49ab value: Accept NULL as a structure
Some GstStructure properties default to NULL, so it should
be a supported value.

With unit test.
2017-04-10 12:37:12 -04:00
Vincent Penquerc'h c361365890 gstvalue: fix GstValue leak in structure_field_union_into
https://bugzilla.gnome.org/show_bug.cgi?id=780751
2017-03-31 11:57:36 +01:00
Nicolas Dufresne 84f826a937 gstvalue: Add transformation to/from GValueArray
This allow transforming a GValue of type G_TYPE_VALUE_ARRAY to
and from GST_TYPE_ARRAY/LIST.

https://bugzilla.gnome.org/show_bug.cgi?id=753754
2017-03-24 13:30:45 -04:00
Vincent Penquerc'h 371fe0be65 value: fix union of int range and int when extending on a side
The internal representation uses bounds scaled by the step

Add tests to catch those cases
2017-03-20 14:09:55 +00:00
Jan Schmidt d781d09d99 gstvalue: Do more checks when guessing at flagset strings
If guessing that a string matches a flagset, be more thorough
at checking that the string following a string of hex:hex:
actually looks like a flag set string. Add some unit tests
to catch more cases.

https://bugzilla.gnome.org/show_bug.cgi?id=779755
2017-03-09 12:09:57 +11:00
Vivia Nikolaidou 63775ac6e3 value: Add deserialization for arrays/lists outside GstStructures
This is mostly useful for properties of those types when used in
gst-launch or similar.

https://bugzilla.gnome.org/show_bug.cgi?id=777375
2017-02-23 21:00:16 +02:00
Sebastian Dröge ba49927aaf value: Add a type abbreviation for GstFlagSet in serialization 2017-02-23 20:50:38 +02:00
Vivia Nikolaidou a3cfcbfede value: Always add the type name to elements when serializing arrays/lists
But only when serializing outside of GstStructures, because in case of
GstStructure the type is already preprended to the array/list and the
GstStructure API makes sure that they have the same "generic" type so
deserialization works properly.

This keeps serialization of GstStructures the same as before, and the
GstCaps unit tests already test for that. However when serializing
standalone arrays/lists get the types added now.
2017-02-23 20:48:40 +02:00
Vivia Nikolaidou 33118f6118 value: Move list/array serialization/deserialization functions from GstStructure to GstValue
https://bugzilla.gnome.org/show_bug.cgi?id=777375
2017-02-23 20:22:03 +02: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
Matthew Waters ad40c5cd36 value: add structure intersect/union/is_subset/fixate implementations
Allows proper usage of structures in structures in caps.  Subtraction
is not implemented due to complications with empty fields representing
all possible values.

The only implementation that doesn't delegate to the already existing
GstStructure functions is the union function.

https://bugzilla.gnome.org/show_bug.cgi?id=775796
2016-12-15 13:39:57 +11:00
Stefan Sauer 96304d613f gstvalue: add serialisation for GTypes
We need this in the GstTracerRecord. This will serialize GTypes to the typename
and vice versa.
2016-12-13 13:24:18 +01:00
Jan Schmidt e1dc60524e dynamic types: Implement dynamic types in the registry
Implement GstDynamicTypeFactory as a new registry feature.

GstDynamicTypeFactory provides a way of registering a GType
into the registry, such that it will be registered as a dynamic
type when the registry is loaded, and then automatically loaded
if the type is needed during caps parsing.

This allows using non-core types in pad templates, by loading a
registry feature to create the GType on the fly.

https://bugzilla.gnome.org/show_bug.cgi?id=750079
2016-11-02 11:21:37 +11:00
Sebastian Dröge 1a1152fa03 value: Update GstValue table size for GValueArray 2016-11-01 23:54:05 +02:00
Stian Selnes c85a30f80b gstvalue: Make GValueArray serializable
For instance very useful for logging GValueArray with GST_PTR_FORMAT

https://bugzilla.gnome.org/show_bug.cgi?id=761918
2016-11-01 20:30:43 +02:00
Jan Schmidt a95645eaba value: Implement can_intersect for GstFlagSet types
Make sure that gst_value_can_intersect returns TRUE
for GstFlagSet combinations that can successfully
intersect
2016-08-26 03:23:40 +10:00
Stefan Sauer eaa992825d gstvalue: remove a half finishesh sentence in the docs
No idea what was the idea here. SO lets just drop it.
2016-01-20 10:02:37 +01:00
Stefan Sauer 4859494945 tracer: add an internal ptr format for tracer serialisation
We need to apply the string wrapping that value serialisation does also in the
tracer logging, otherwise we can't parse nested structures.
2016-01-20 09:14:12 +01:00
Tim-Philipp Müller eb4c5498b5 value: fail flag deserialization on invalid flag names 2016-01-18 19:39:11 +00:00
Sebastian Dröge 3e8ef4cf5a Update GLib dependency to 2.40.0 2015-10-02 22:18:24 +03:00
Vineeth TM 0eb9dde1e8 value: free caps during failure
While calling gst_value_deserialize_sample, if there is a failure
after caps is ref'ed, then caps is getting leaked. Hence checking for
caps in fail: goto condition and unref'ing it

https://bugzilla.gnome.org/show_bug.cgi?id=753338
2015-08-07 10:17:02 +02:00
Nicolas Dufresne 48700c7791 doc: More doc warning fixes
So from this point, the remaining warning for libgstreamer are about
protected member not showing in the doc. This may need some discussion
with upstream gtk-doc people.

* Remove % in from of none macro
* Fixed GST_TYPE_FAGS -> GST_TYPE_FAG_SET
* Minor wording fix
* Can't link to GstUri.port, so split the .port part
2015-06-14 10:29:04 -04:00
Jan Schmidt 58e5cd2695 gstvalue: Implement gst_value_is_subset() for flagsets 2015-06-03 00:48:17 +10:00
Jan Schmidt f9e5178dd1 gstvalue: Add GstFlagSet type
GstFlagSet is a new type designed for negotiating sets
of boolean capabilities flags, consisting of a 32-bit
flags bitfield and 32-bit mask field. The mask field
indicates which of the flags bits an element needs to have
as specific values, and which it doesn't care about.

This allows efficient negotiation of arrays of boolean
capabilities.

The standard serialisation format is FLAGS:MASK, with
flags and mask fields expressed in hexadecimal, however
GstFlagSet has a gst_register_flagset() function, which
associates a new GstFlagSet derived type with an existing
GFlags gtype. When serializing a GstFlagSet with an
associated set of GFlags, it also serializes a human-readable
form of the flags for easier debugging.

It is possible to parse a GFlags style serialisation of a
flagset, without the hex portion on the front. ie,
+flag1/flag2/flag3+flag4, to indicate that
flag1 & flag4 must be set, and flag2/flag3 must be unset,
and any other flags are don't-care.

https://bugzilla.gnome.org/show_bug.cgi?id=746373
2015-05-25 16:23:33 +10:00
Thibault Saunier 99d3179634 gstvalue: Add a comparision function for GstStructures 2015-05-20 20:21:24 +02:00
Hyunjun Ko e08c03ed07 gstvalue: reset errno before g_ascii_strtoull call
"errno" already has meaningless value before g_ascii_strtoull call.
This causes invalid error check without reset.

https://bugzilla.gnome.org/show_bug.cgi?id=747690
2015-04-13 11:39:59 +01:00
Luis de Bethencourt 555e0211c8 gstvalue: only unwrap string delimited with "
Don't unwrap strings that start but don't finish with a double quote. If a
string is delimited by two quotes we unescape them and any special characters
in the middle (like \" or \\). If the first character or the last character
aren't a quote we assume it's part of an unescaped string.

Moved some deserialize_string unit tests because we don't try to unwrap strings
missing that second quote anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=688625
2015-03-27 17:18:23 +00:00
Jan Schmidt d33440b51e gstvalue: Tidy initialisation
Use some macros to make our value functions setup a bit
tidier, and micro-optimise a few reallocs by setting an
initial size for the global type arrays.
2014-10-20 23:55:47 +11:00
Stefan Sauer d5518edf12 fixme: bump leftover 0.11 fixme comments 2014-09-25 21:27:03 +02:00
Thiago Santos 4ca6694e09 gstvalue: add GstTagList compare function
When serializing GstStructures from events in GDP it will add a taglist
as a GstStructure field, having the compare function allows comparison of
GstStructures to check if the serialized/deserialized version matches the
original one, among other cases.

https://bugzilla.gnome.org/show_bug.cgi?id=733131
2014-07-21 11:42:05 -03:00
Sebastian Rasmussen 863ba1a598 docs: Fix documentation typos and inconsistencies
* GstGlobalDeviceMonitor was renamed to GstDeviceMonitor
 * Expand GST_MESSAGE_DEVICE to the full enum value names
 * Correct the incorrect references to the GstDeviceProvider interfaces
 * Describe caps arguments for gstcheck interface
 * Add missing docs for GstNetAddressMeta and its add function
 * Add docs for toc helper macros
 * Avoid refering to GstValueList type as done elsewhere

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=732786
2014-07-09 09:22:11 +02:00
Evan Nemerson 5d80cf12ba introspection: add nullability annotations to out and inout params
https://bugzilla.gnome.org/show_bug.cgi?id=730957
2014-06-26 18:59:15 +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
Tim-Philipp Müller bc75a166f0 gstvalue: optimise checks for lists
Our fundamental types are non-derivable, so we can
just check for equality. Also avoid doing the same
check multiple times in a couple of places.
2014-06-19 08:40:16 +01:00
Tim-Philipp Müller d74708a820 gstvalue: use g_assert() in internal function for already-checked things
So these get compiled out for releases.
2014-06-19 08:40:15 +01:00
Tim-Philipp Müller bbefd6082f gstvalue: add internal _can_compare_unchecked() 2014-06-19 08:40:15 +01:00
Tim-Philipp Müller adcbe94aff gstvalue: add internal _list_concat() that takes ownership of input values
Avoids unnecessary copies.
2014-06-19 08:40:15 +01:00
Sebastian Dröge 8f4b479c98 value: Add a FIXME 2.0 for a fraction ranges optimization
Currently we leak the internal representation of them as two GValues that
contain a fraction. Without this we could store fraction ranges as
  data[0] = (min_n << 32) | (min_d)
  data[1] = (max_n << 32) | (max_d)
and wouldn't require an additional allocation per range.
2014-06-19 09:33:55 +02:00
Sebastian Dröge 9b7da39b68 value: Make sure to cast int range values to guints before storing them
Otherwise negative values will sets all of the 64 bits due to two's
complement's definition of negative values.

Also add a test for negative int ranges.
2014-06-19 09:33:54 +02:00
Sebastian Dröge d84d01aad4 value: Store integer ranges directly in a GValue without additional allocation
Micro optimization to save some allocations. Next step to do this
with fraction ranges too.
2014-06-19 09:09:07 +02:00
Sebastian Dröge f47a95f4cb value: Store our fundamental type GTypes in variables
Micro optimization to change a function call to a variable access
for all our basic types.
2014-06-19 08:06:55 +02:00
Edward Hervey b0b20b44e5 gstvalue: Speed up gst_value_intersect/_subtract
Both gst_value_intersect and gst_value_subtract will call
gst_value_compare if one of their arguments isn't a list.

gst_value_compare will then re-do a check to see if one of
the arguments is a list (for the special case of comparing a unitary
value with a list of length 1).

The problem is that the various G_VALUE_HOLDS represent an expensive
amount of calling gst_value_compare (almost half of it) to see if
the provided arguments are list. These checks can be done without
when we know that the arguments aren't lists.

* Create a new "nolist" gst_value_compare which avoids that special
  case comparision

Benchmarks:
 valgrind/callgrind: average speedup in instruction calls for
 gst_value_intersect and gst_value_subtract is around 56% (Makes 63%
 of the calls it used to take previously)

 tests/benchmarks/capsnego: With default settings (depth 4, children 3
 607 elements), time taken for transition from READY to PAUSED:
   Before : 00.391519153
   After  : 00.220397492
    56% of the time previously used, +77% speedup

https://bugzilla.gnome.org/show_bug.cgi?id=731756
2014-06-17 16:27:07 +02:00
Tim-Philipp Müller 8998cf840d datetime: change internal implementation to mini object
And move type stuff from GstValue to GstDateTime.
2014-06-03 23:49:21 +01: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
Nicolas Dufresne 64aa64cb80 value: Add support for GstAllocationParams comparision
This is useful to compare buffer pool configuaration.

https://bugzilla.gnome.org/show_bug.cgi?id=728268
2014-05-08 13:08:21 -04:00
Nicolas Dufresne 00614e2c2b value: Add support for GObject comparising in structures
This is useful to allow comparing pool configuration where a GstAllocator
is set.

https://bugzilla.gnome.org/show_bug.cgi?id=728268
2014-05-08 13:08:21 -04:00
Tim-Philipp Müller 4e1699e030 value: init flag mask more correctly 2014-05-04 14:52:01 +01: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