Commit graph

150 commits

Author SHA1 Message Date
Sebastian Dröge
5860734aaf structure: Add date as a type abbreviation of GDate
See bug #646696.
2011-04-05 14:37:55 +02:00
Sebastian Dröge
eba33c1de1 structure: Don't allow invalid GDates in all structures and don't allow NULL GDates in taglists
Some code (e.g. gstvorbistag.c) assumes non-NULL GDates in taglists and
explodes otherwise and NULL or invalid GDates don't make much sense anyway.
2011-04-04 10:18:14 +02:00
Stefan Kost
d963503b26 structure: gst_structure_empty_new() does better error checking
No need to check for media_type!=NULL as the function we call that actual create
the structure does a full check anyway.
2011-03-08 10:07:17 +02:00
Stefan Kost
4d9e645551 caps,structure: trim trailing whitespace 2011-03-08 10:07:03 +02:00
Mart Raudsepp
e7569342b1 docs: add missing "Since: 0.10.31" marker for gst_structure_get_date_time() 2011-01-24 14:38:15 +00: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
Edward Hervey
6aa8ca37ee micro-optim: if (x) is cheaper than if (x > 0) for unsigned integers 2010-12-03 12:03:42 +01:00
Tim-Philipp Müller
608628d10d structure: micro-optimisation for some setter functions
Split out functions that do the actual work, so we avoid doing
the same g_return_if_fail() checks multiple times for each call.
2010-09-16 19:40:15 +01:00
Tim-Philipp Müller
7e5a9580ef structure: add gst_structure_{id_}take_value()
Add _set_value() variants that take ownership of the value passed
instead of making a copy of the value. This is useful for setting
values to things that aren't refcounted (e.g. GValueArrays or
strings or string arrays, etc.).

API: gst_structure_take_value()
API: gst_structure_id_take_value()

https://bugzilla.gnome.org/show_bug.cgi?id=629831
2010-09-16 19:39:58 +01: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
Thiago Santos
f2c18c6c98 gststructure: Adds datetime getter function
Adds gst_structure_get_date_time function

API: gst_structure_get_date_time

Fixes #594504
2010-07-26 11:57:52 -03:00
Thiago Santos
b4870282cb gstvalue: Adds datetime functions
Adds a datetime functions to gstvalue

Fixes #594504
2010-07-26 11:57:50 -03:00
Sebastian Dröge
88ec06f433 structure: Use a const GstStructure * as parameter for some more gst_structure_get variants 2010-07-16 17:33:38 +02:00
Sebastian Dröge
e35fe4ef9c structure: API: Add gst_structure_fixate_field_string() 2010-05-22 10:01:44 +02:00
Tim-Philipp Müller
24ce15bca7 structure: log what structure string we failed to parse 2010-04-14 23:53:26 +01:00
Sebastian Dröge
e305e49ef4 structure: Make structure abbreviations array one-time initialization threadsafe 2010-03-28 19:49:00 +02:00
Tim-Philipp Müller
0aa584917a structure: add mapping for (uint) to allow deserialisation of unsigned integers
Unsigned ints are used in taglists, would be nice to be able to
deserialise them, esp. in connection with the taginject API.
2010-03-23 19:23:22 +00:00
Mart Raudsepp
db949f66e0 docs: fix since tag for gst_structure_id_has_field_typed()
gst_structure_id_has_field_typed was added in 0.10.26, not 0.10.16.
Apparent typo in commit f9e3b72f when the API was added.
2010-03-17 11:03:15 +00:00
Tim-Philipp Müller
235910e227 gst: use #if GLIB_CHECK_VERSION instead of #ifndef GLIBMACRO
for better greppability at the time we bump GLib version requirements.
2010-03-17 11:03:15 +00:00
Edward Hervey
bbe26d36ba gst: Use G_VALUE_COLLECT_INIT if available
This brings total call speedups between 5% and 25%.
gst_caps_set_simple_valist: +5%
gst_structure_set_valist: + 10%
gst_structure_id_set_valist: +25%
gst_tag_list_add_valist: +5%

Measured using valgrind when run over the discovery of 200 media files.

Fixes #610256
2010-03-12 10:01:47 +01: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
Tim-Philipp Müller
51a462853a structure: remove superfluous guard against NULL
All callers of this static function already check for NULL-ness
themselves, so no need to do it again (and if we do it, we should
probably do so before dereferencing the pointer for the first time).
2010-01-16 19:44:35 +00:00
Tim-Philipp Müller
4cdf375b1a structure: micro-optimise some getters
Avoid checking the GType of the value twice (once on our side and
once in g_value_get_*()) by by-passing g_value_get() and accessing
the GValue structure directly.
2010-01-16 19:37:46 +00: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
Tim-Philipp Müller
ab5f2f4f5d Revert "structure: don't check type twice"
This reverts commit f864187bf5.

Reverting this as it changes behaviour and the documentation is
ambiguous about whether the caller must check the type first or
not (call must check type vs. returns NULL if not a string). If
GLib has been compiled with G_DISABLE_CHECKS then g_value_get_string()
may return complete garbage even if the value does not contain
a string. Better play it safe, esp. since the extra check is just
an integer comparison. For fundamental types we could return values
from the GValue structure directly if we really wanted to bypass
the extra check.
2009-11-18 09:22:57 +00:00
Stefan Kost
f864187bf5 structure: don't check type twice 2009-11-18 10:12:13 +02:00
Stefan Kost
da9b082808 structure: remove some blank lines (previous gst-indent failure) 2009-11-17 09:40:12 +02:00
Stefan Kost
94f6eced23 structure: use local variable earlier 2009-11-17 09:40:12 +02:00
Stefan Kost
7bd9299f3e structure: don't check enum types twice.
G_VALUE_HOLDS_ENUM(value) is defined as G_TYPE_CHECK_VALUE_TYPE (value,
 G_TYPE_ENUM). Just check for the right enum-type right away.
2009-11-17 09:40:12 +02:00
Stefan Kost
c84d17bcaf debug: add more debug logging to help tracking parsing errors 2009-11-13 15:46:40 +02:00
Sebastian Dröge
f9e3b72ff6 structure: API: Add gst_structure_id_has_field{,_typed} 2009-11-02 09:24:10 +01:00
Tim-Philipp Müller
9459a93cb4 tags: only emit a g_warning() for empty tag strings for git versions
For now, don't show a g_warning() for empty tag strings and NULL
tags with non-git versions; we should wait for the fixes in our
plugin modules to make it into a release before we enable this
unconditionally.
2009-07-16 13:59:07 +01: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
3c21f2d86c Spread branch prediction macros.
These are based on profiling several playback scenarios using playbin2.
2009-06-30 16:29:58 +02:00
Stefan Kost
dc9ca2e39c structure: fix int->gint to be in sync with the *.h and usage 2009-06-27 16:37:07 +03:00
Edward Hervey
0fc8410433 GstStructure: Use direct values for repetitive conditionals (for/while). 2009-06-24 11:00:27 +02:00
Tim-Philipp Müller
17f794deeb docs: make gtk-doc happy 2009-06-19 14:10:30 +01:00
Tim-Philipp Müller
cdd47a37e9 structure: add gst_structure_*_get*() vararg functions
Add a bunch of vararg getter convenience functions to complement
the vararg setter functions, and a basic unit test. Fixes #534208.

API: gst_structure_get()
API: gst_structure_id_get()
API: gst_structure_get_valist()
API: gst_structure_id_get_valist()
2009-06-10 09:39:12 +01:00
Tim-Philipp Müller
26b201273a docs: a few small API doc fixes and additions 2009-06-10 09:39:12 +01:00
Wim Taymans
c6e6e7c97b structure: no need to clear on init
We don't need to clear the field on init because we will do that again before we
are going to use the field later.
2009-06-07 14:30:28 +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
Tim-Philipp Müller
a565dbd1f3 structures: don't leak invalid or empty strings when we warn
Fixes minor memory leak in unit tests caused by the recent changes.
Since we're expected to take ownership of the GValue in the structure
field struct here, we need to unset it if we don't use it.
2009-06-01 10:10:20 +01:00
Tim-Philipp Müller
30c890c7a2 taglists: warn if someone tries to add empty or NULL string tags to a taglist
Also warn if an element or application tries to add a field with an
empty string to a structure (NULL strings are still needed and
allowed though) and do all those checks in the right function.

Fixes #559643.
2009-05-31 15:38:01 +01:00
Tim-Philipp Müller
c8acbbfde0 structure: add gst_structure_id_new() convenience function
Add convenience wrapper for gst_structure_id_empty_new() plus
gst_structure_id_set() and use it in a few places.

API: gst_structure_id_new()
2009-05-29 19:28:10 +01:00
Edward Hervey
759fe3452a gststructure: Only use methods used in g_* checks if glib checks are disabled 2009-04-04 14:35:34 +02:00
Edward Hervey
4028fa7149 gststructure: Remove dead assignment.
'type' is never used until line 1847 where it's overwritten.
2009-04-03 12:57:24 +02:00
Stefan Kost
1ec60ae392 apidocs: markup example as highlightable example and copy same for structure
structures can be printed like we can do for caps. Mark the example so that
gtk-doc can pretty print and xref it.
2009-03-06 21:59:20 +02: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