Commit graph

193 commits

Author SHA1 Message Date
Josep Torra b26c5b99f2 value: explicitly cast to the enum type
Fixes warning #188: enumerated type mixed with another type reported by ICC.
2011-08-26 14:11:14 +02:00
Sebastian Dröge 0a80b57d74 value: Consider "1" and "{1}" as equal in gst_value_compare()
Previously this was only done in the is_subset() check but
having it only there brings us into definition-hell where
"1" and "{1}" are subset of each other but not equal.
2011-05-30 11:33:57 +02:00
Tim-Philipp Müller 3a744ca442 value: add (de)serialisation function for uchar
.. since we sadly have a plugin in -good that has a uchar property
(cmmlenc)

https://bugzilla.gnome.org/show_bug.cgi?id=642522
2011-02-17 10:55:28 +00:00
Tim-Philipp Müller ee5b369ffd gstvalue: make new gst_value_list_merge() work properly
Fix freeing of partially-inited list value when both values
passed are equal and we want to return a single non-list
value as result. Fixes unit test. Also fix up docs a bit.

https://bugzilla.gnome.org/show_bug.cgi?id=637776
2011-01-03 15:57:20 +00:00
Stefan Kost 373be6f14e tags: don't produce duplicated entries when merging same value twice
Add a variant of gst_value_list_concat() that skips duplicates and use that when
merging taglists.

API: gst_value_list_merge()
2011-01-02 22:35:08 +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
Tim-Philipp Müller 5b25761f29 docs: add some gtk-doc Since: markers
Add some gtk-doc Since: markers, fix one Since: marker,
fix typo.
2010-10-16 16:53:49 +01:00
Thiago Santos e9312870e5 datetime: Use seconds as double
Use seconds as double to make API similar to glib's
gdatetime. Also move timezone parameter to the
first position, just like glib's.

https://bugzilla.gnome.org/show_bug.cgi?id=628408
2010-10-13 11:48:57 -03:00
Thiago Santos dd53349ad2 gstdatetime: Fix string serialization
Correctly serialize tzoffset as a gstvalue
2010-09-27 20:41:52 -03:00
Philippe Normand b2e6379be8 gstvalue: Add new GstInt64Range type
new GstInt64Range to store gint64 ranges.

API: GST_TYPE_INT64_RANGE
API: gst_value_set_int64_range
API: gst_value_get_int64_range_min
API: gst_value_get_int64_range_max

Fixes bug #627826.
2010-09-01 11:07:37 +02:00
Sebastian Dröge 8ca48752fb utils: Add gst_util_fraction_compare() to compare fractions
And use it for the fraction comparisons in gstvalue.c instead
of using comparisons by first converting the fractions to double.
Should fix bug #628174.

API: gst_util_fraction_compare()
2010-08-28 09:31:59 +02:00
Shixin Zeng d41997040b gst: make _get_type() in gst/* thread safe
This is not really necessary here because everything is
initialized from gst_init() already but using G_DEFINE_TYPE()
removes some copy&paste boilerplate code.
2010-08-06 19:35:59 +02:00
Thiago Santos b4870282cb gstvalue: Adds datetime functions
Adds a datetime functions to gstvalue

Fixes #594504
2010-07-26 11:57:50 -03:00
Edward Hervey 27410f3934 gstvalue: Improve gst_value_{set|get}_caps docs 2010-07-06 11:18:32 +02:00
Sebastian Dröge 4d8320e4c6 gstvalue: Add some more assertions and checks for valid input parameters 2010-06-14 15:45:11 +02:00
Sebastian Dröge 603c04f4fa gstvalue: Don't initialize arrays from variables 2010-06-14 08:18:00 +02:00
Sebastian Dröge 48438b6cc7 gstvalue: Add some assertion guards against invalid parameters to public API 2010-06-13 18:00:22 +02:00
Martin Bisson ab0763f0e8 value: Fixed serialization for short fourccs.
"Y16 " and "Y8  " were not displayed properly because the space
character is not alnum.  A unit test is also included.

Fixes bug #621282.
2010-06-12 08:07:34 +02:00
Stefan Kost ad619a4e84 value: use glib types in more places
Do a bunch of char -> gchar, int -> gint, double -> gdouble changes.
2010-06-07 12:22:44 +03:00
Stefan Kost c95a85f6cf value: just compute strlen() once 2010-06-07 12:22:44 +03:00
Martin Bisson 28fdbee35a value: Add support for parsing short fourccs from strings
For example "Y16 " and "Y8  ".
2010-06-07 08:21:00 +02:00
Benjamin Otte a9d1a493a7 Fixes for -Wwrite-strings
This changes some APIs in compatible ways:
- Some functions now take "const char *" arguments, not "char *"
- Some structs now have "conts char *" members, not "char *"
The changes may cause warnings when compiling with the right warning
flags. You've been warned.

Also adds -Wwrite-strings as a warning flag in configure.ac.

https://bugzilla.gnome.org/show_bug.cgi?id=611692
2010-03-10 20:50:10 +01:00
Benjamin Otte ec10b764b9 caps: Fail when fractions are followed by random text
Previous code treated "1/1yourmom" the same as "1/1" and "1wimsmom" the
same as "1". Now the code is stricter and will fail to convert a
fraction when followed by garbage text.
2010-03-09 19:18:21 +01:00
Benjamin Otte 4743e62be8 caps: Allow 1/max as the minimal fraction value > 0
This is useful for formats that require a valid framerate (like
theoraenc).
2010-03-08 22:26:34 +01:00
Edward Hervey a5626f239a gstvalue: Use fast gst_value_list_{size|get_value} macro accessors
gst_value_list_size and gst_value_list_get_value will do a series of
extra checks due to being public methods.
When we use them from within gstvalue.c we can directly use them without
the extra checks.
2009-12-07 09:51:04 +01:00
Stefan Kost f43f2bf960 docs: fix more bogus xrefs 2009-11-27 14:18:38 +02: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
Sebastian Dröge 0ed24bc50e utils: API: Add multiplication and addition functions for fractions
gst_util_fraction_add()
gst_util_fraction_multiply()

These work on plain integers instead of GValues to
keep the overhead as low as possible.
2009-11-16 09:56:32 +01:00
Sebastian Dröge e4257e8d5f gstutils: API: Add fraction helper functions
gst_util_greatest_common_divisor()
gst_util_double_to_fraction()
gst_util_fraction_to_double()

Using these instead of going over GValue has much lower overhead.

Also add float<->fraction transform functions for GValue.
2009-11-16 09:56:32 +01:00
Stefan Kost cfb4aa4627 build: sprintf, sscanf need stdio.h 2009-10-07 10:59:54 +03:00
Benjamin Otte fceba1d6fe docs: Fix typo in gst_value_union() 2009-09-07 16:16:19 +02:00
Stefan Kost f18bee2d8a value: add explanation for shortcut 2009-07-14 12:15:05 +03:00
Stefan Kost c686053aac value: fix can_intersect to behave like intersect
Add a quick return if two types are the same. Change the check for the
intersection function to be the same as the one used in intersect(). The
later tries both directions.
2009-07-14 08:32:23 +02:00
Jan Schmidt 7bf3554228 structure: Change NULL and empty string handling
Don't forbid the empty string "" in generic structures, only in taglists.
Properly allow the NULL string by adding special cases for serialising
and deserialising it. prop1=(string)NULL is the NULL string,
prop1=(string)"NULL" is the actual string with the value "NULL"
2009-07-13 18:28:37 +01: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
Tim-Philipp Müller 4530151ad2 gstvalue: more efficient value table lookup for fundamental types
Small micro-optimisation: look up value table for fundamental types
via an array dedicated to fundamental types instead of going through
a hash table lookup. Since there can be only 255 fundamental types,
the table size/efficiency trade-off should be acceptable, esp. since
the most commonly-used types are all fundamental types. The size of
the table could probably be minimised further if needed by allocating
the table dynamically and only expanding it on demand.
2009-06-11 19:02:40 +01:00
Tim-Philipp Müller e8bfd88f26 gstvalue: don't put GTypes into int variables
GTypes are not ints and as such are not guaranteed to fit into an int
(with the exception of fundamental types), so we really shouldn't put
them into int variables. Even if a rather unlikely obscure corner case,
this has actually been a problem at some point in the past, see commit
99f16655f4.
2009-06-11 18:48:50 +01:00
Tim-Philipp Müller 998b2392d3 Remove double semicolons at end of line 2009-06-08 17:13:17 +01:00
Wim Taymans 1769cc7297 gstvalue: remove type checks and redundant code 2009-06-07 17:32:35 +02:00
Wim Taymans 19f98d6418 value: fix fraction range lcopy function
This function seems to be broken for 3.5 years. Luckily nobody ever tried to
make a fraction range object property...
2009-06-07 15:43:57 +02:00
Wim Taymans 65f9b38138 gstvalue: performance improvements
Add a GType->GstValueTable hashtable mapping.
Avoid _get_type() multiple times when we can.
Use GSlice for fraction range dynamic memory
Add G_LIKELY when we can
Improve lookup of the value table using the hashtable
2009-06-07 15:35:12 +02:00
Jan Schmidt 766e7afc23 gststructure: Fix some memory leaks. Sprinkle G_LIKELY/UNLIKELY
Fix some memory leaks shown by the new serialisation/deserialisation unit
test. Split the gst_string_wrap function in gstvalue.c into components and
use them to make gst_string_take_and_wrap, which takes ownership of the
string, avoiding a strdup.

Add some G_LIKELY/UNLIKELY, and clean up some leaks in error paths.
2009-06-05 21:00:43 +01:00
Stefan Kost 47d9904eba structure: fix serialisation of nested structures.
Use string_warp/unwrap to escape delimiters, otherwise deserialisation fails.
Also move GST_ASCII_IS_STRING to private header to avoid keeping it in sync.
Also use '\0' when terminating a string for better readability.
2009-06-02 18:39:17 +03:00
Edward Hervey 971755842d Remove unused increments as detect by LLVM's CLang static analyzer. 2009-04-03 12:56:57 +02:00
Stefan Kost d27aea0391 gst/gstvalue.c: Don't crash if either of the string GValues is empty.
Original commit message from CVS:
* gst/gstvalue.c:
Don't crash if either of the string GValues is empty.
2008-11-17 21:25:39 +00:00
Wim Taymans 7f987200b5 gst/gstvalue.c: Reorganize some more, be more conservative with the GST_TYPE_ARRAY not being fixed and inline the tri...
Original commit message from CVS:
* gst/gstvalue.c: (gst_type_is_fixed), (gst_value_is_fixed):
Reorganize some more, be more conservative with the GST_TYPE_ARRAY not
being fixed and inline the trivial check.
2008-11-06 15:37:16 +00:00
Wim Taymans 18aeb9a41e gst/gstcaps.c: Callgrind micro optimisations.
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_copy), (_gst_caps_free),
(gst_caps_merge_structure), (gst_caps_get_structure),
(gst_caps_copy_nth), (gst_caps_set_simple),
(gst_caps_set_simple_valist), (gst_caps_is_fixed),
(gst_caps_is_equal_fixed), (gst_caps_intersect),
(gst_caps_subtract), (gst_caps_normalize), (gst_caps_do_simplify),
(gst_caps_to_string):
Callgrind micro optimisations.
Avoid array bounds checks and force inline of trivial function.
* gst/gstobject.c: (gst_object_set_name_default):
-1 is equivalent to letting glib to the strlen but then there is more
room for optimisations and it's not our fault.
* gst/gststructure.c: (gst_structure_id_empty_new_with_size):
no need to clear the array, we're cool.
* gst/gstvalue.c: (gst_type_is_fixed), (gst_value_is_fixed):
The most common _is_fixed() check is done on fundamental glib base
types so we check this first instead of doing a huge amount of
useless GST_TYPE_ARRAY calls.
2008-11-06 15:09:34 +00:00
Wim Taymans 209c57085c gst/gststructure.c: No need to memset, we can clear the value ourselves.
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_id_empty_new_with_size):
No need to memset, we can clear the value ourselves.
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_get_compare_func):
Some optimisations from a few callgrind sessions:
When checking if a type is fixed, check for trivial fundamental types
first before checking types for which we need to get the type followed
by the heavy duty type checks, this reduces the amount of
g_type_fundamental() calls a lot.
When getting the compare function, first check for our registered types.
If that fails, do the heavy duty g_type_is_a() checks, reduces the
amount of g_type_is_a() considerably.
2008-11-05 16:57:35 +00:00
Stefan Kost 5b29f0a1cc gst/gstpreset.c: Use g_unlink instead of unlink.
Original commit message from CVS:
* gst/gstpreset.c:
Use g_unlink instead of unlink.
* gst/gststructure.c:
Use glib type.
* gst/gstutils.c:
Add a FIXME:.
* gst/gsttaglist.c:
* gst/gsttypefind.c:
* gst/gstvalue.c:
Formatting & whitespaces.
2008-10-31 14:24:49 +00:00
Sebastian Dröge 14983d1810 gst/gstvalue.c: Fix typos.
Original commit message from CVS:
* gst/gstvalue.c:
Fix typos.
2008-07-22 09:24:37 +00:00