Commit graph

153 commits

Author SHA1 Message Date
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
Wim Taymans 5b5be74fc5 gst/: Fix 2 caps leaks.
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_deserialize_caps):
* gst/parse/grammar.y:
Fix 2 caps leaks.
2008-04-17 08:45:19 +00:00
Stefan Kost 4a638e29d9 Add GST_PARAM_CONTROLLABLE and GST_PARAM_USER_SHIFT. Move paramspec docs to own section.
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* gst/gstparamspecs.c:
* gst/gstparamspecs.h:
Add GST_PARAM_CONTROLLABLE and GST_PARAM_USER_SHIFT. Move paramspec
docs to own section.
* gst/gstvalue.c:
This now only documents GValue.
* docs/libs/gstreamer-libs-sections.txt:
* libs/gst/controller/gstcontroller.h:
Remove GST_PARAM_CONTROLLABLE.
2008-04-15 06:16:33 +00:00
Wim Taymans 28188a3e6e gst/gstvalue.c: Transform a GstObject to a more meaningfull string that includes the object type in addition to its n...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_transform_object_string):
Transform a GstObject to a more meaningfull string that includes the
object type in addition to its name.
2008-03-24 10:29:05 +00:00
Laurent Glayal c2683ff751 gst/gstvalue.c: Optimisation: bail out of the loop as early as possible (#500143).
Original commit message from CVS:
Based on patch by: Laurent Glayal  <spglegle yahoo fr>
* gst/gstvalue.c: (gst_value_is_fixed):
Optimisation: bail out of the loop as early as possible (#500143).
2007-12-28 14:34:34 +00:00
Tim-Philipp Müller 5cb869bfdf gst/: Bunch of gratuitous nano-optimisations.
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_to_string):
* gst/gstinfo.c: (gst_debug_construct_term_color):
* gst/gstparse.c: (gst_parse_launchv):
* gst/gstutils.c: (gst_util_dump_mem):
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string):
Bunch of gratuitous nano-optimisations.
2007-12-28 14:15:53 +00:00
Stefan Kost 4fffa41e1c gst/gstvalue.*: Add more missing "Since:" tags to docs.
Original commit message from CVS:
* gst/gstvalue.c:
* gst/gstvalue.h:
Add more missing "Since:" tags to docs.
2007-12-12 14:04:14 +00:00
Tim-Philipp Müller eac0501386 gst/gstvalue.c: Remove unused and uninitialised type variables that were still exported for some reason (they were ne...
Original commit message from CVS:
* gst/gstvalue.c:
Remove unused and uninitialised type variables that were still
exported for some reason (they were never in any header files
though).
2007-11-06 11:41:32 +00:00
Edgard Lima 0e3a0fdf35 Added GstStructure to gst_value_table and its related functions.
Original commit message from CVS:

* gst/gstcaps.c: (gst_caps_to_string),
(gst_caps_from_string_inplace):
* gst/gststructure.c: (gst_structure_get_abbrs),
(gst_structure_to_string), (gst_structure_from_string):
* gst/gstvalue.c: (gst_value_set_structure),
(gst_value_get_structure), (gst_value_serialize_structure),
(gst_value_deserialize_structure), (_gst_value_initialize):
* gst/gstvalue.h:
* tests/check/gst/gststructure.c: (GST_START_TEST),
(gst_structure_suite):
* tests/check/gst/gstvalue.c: (GST_START_TEST):
Added GstStructure to gst_value_table and its related functions.
Changed gst_structure_to_string to print ';' in the end.
Changed gst_caps_to_string to not print ';' beteween its
fields (structures) anymore and remove the lastes ';' from latest
structure. Now it is possible to have nested structures.
In addition, backward compatibilty is assured by accepting '\0' as
end delimiter. Fixes: #487969.
API: add gst_value_set_structure()
API: add gst_value_get_structure()
2007-10-22 08:53:26 +00:00
Stefan Kost 68ba3b4384 gst/: Add some more comments and debug output. Quote structure name to fix deserialisation of some strings.
Original commit message from CVS:
* gst/gststructure.c:
* gst/gstvalue.c:
Add some more comments and debug output. Quote structure name to fix
deserialisation of some strings.
2007-10-15 11:19:36 +00:00
Wim Taymans e7f433f720 gst/: Fix small typos in the docs.
Original commit message from CVS:
* gst/gstobject.h:
* gst/gstvalue.c:
Fix small typos in the docs.
2007-09-24 11:46:35 +00:00
Stefan Kost d53d6fb8a8 Another conditional doc check.
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer.types.in:
Another conditional doc check.
* gst/gstmessage.c:
* gst/gstparamspecs.h:
* gst/gstregistrybinary.c: (gst_registry_binary_read_cache):
* gst/gstvalue.c:
* gst/gstxml.h:
API-doc fixes.
2007-07-25 13:00:23 +00:00
Tim-Philipp Müller 505f3889ca API: add GstParamSpecFraction, so elements can have fraction properties without lots of painful string parsing (#4446...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c:
* gst/gst.h:
* gst/gstparamspecs.c: (_gst_param_fraction_init),
(_gst_param_fraction_set_default), (_gst_param_fraction_validate),
(_gst_param_fraction_values_cmp),
(gst_param_spec_fraction_get_type), (gst_param_spec_fraction):
* gst/gstparamspecs.h:
* gst/gstvalue.c:
* tests/check/Makefile.am:
* tests/check/gst/.cvsignore:
* tests/check/gst/gstparamspecs.c: (gst_dummy_obj_base_init),
(gst_dummy_obj_class_init), (gst_dummy_obj_init),
(gst_dummy_obj_set_property), (gst_dummy_obj_get_property),
(GST_START_TEST), (gst_param_spec_suite):
API: add GstParamSpecFraction, so elements can have fraction
properties without lots of painful string parsing (#444648).
2007-06-06 11:18:12 +00:00
Tim-Philipp Müller 4e12ed7a53 gst/gstvalue.c: Make docs for gst_value_compare() mention return enums that actually exist.
Original commit message from CVS:
* gst/gstvalue.c:
Make docs for gst_value_compare() mention return enums that
actually exist.
2007-06-05 13:49:10 +00:00
Wim Taymans ebd9a6d04b gst/gstvalue.c: Implement GstObject -> string transform so we print object names when serializing GValues containing ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_transform_object_string),
(_gst_value_initialize):
Implement GstObject -> string transform so we print object names
when serializing GValues containing GstObjects.
2007-02-28 16:57:49 +00:00
Stefan Kost ea55e1357e configure.ac: comment about refining the xml deps
Original commit message from CVS:
* configure.ac:
comment about refining the xml deps
* docs/manuals.mak:
comments about moving away from jade for docs
* gst/gst.c:
recommit the ifdefs to use the binary registry
* gst/gstbin.c: (gst_bin_change_state_func):
this break is obsolete
* gst/gstelementfactory.h:
better GST_ELEMENT_DETAILS docs, add comment about translation
* gst/gstinfo.h:
remove eol slash
* gst/gstobject.c: (gst_signal_object_get_type):
add G_UNLIKELY as usual
* gst/gstpad.c: (gst_pad_event_default):
add fall trhu comment
* gst/gstregistrybinary.c: (gst_registry_binary_write),
(gst_registry_binary_initialize_magic),
(gst_registry_binary_save_string),
(gst_registry_binary_save_pad_template),
(gst_registry_binary_save_feature),
(gst_registry_binary_save_plugin),
(gst_registry_binary_write_cache),
(gst_registry_binary_check_magic),
(gst_registry_binary_load_pad_template),
(gst_registry_binary_load_feature),
(gst_registry_binary_load_plugin),
(gst_registry_binary_read_cache):
comment typo and formatting
* gst/gstutils.c: (gst_element_state_get_name),
(gst_element_state_change_return_get_name):
remove obsolete breaks
* gst/gstvalue.c: (gst_date_get_type), (_gst_value_initialize):
add FIXME 0.11 and remove cpp comment
2007-01-29 15:54:09 +00:00
Thomas Vander Stichele c254a2345b tell us what's not implemented
Original commit message from CVS:
tell us what's not implemented
2007-01-02 09:31:45 +00:00
Jan Schmidt 79703a24e6 gst/gstvalue.c: If someone is foolish enough to compare 2 fractions with denominator = 0, return UNORDERED rather tha...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_compare_fraction):
If someone is foolish enough to compare 2 fractions with denominator =
0, return UNORDERED rather than aborting.
2006-11-29 16:39:32 +00:00
Stefan Kost d3da3ed47b gst/gstvalue.c: check for validity of dates
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_set_date), (gst_date_copy):
check for validity of dates
2006-10-18 08:54:30 +00:00
Tim-Philipp Müller f3c07d5d20 gst/gstformat.c: Fix locking order (must take lock before using n_values).
Original commit message from CVS:
* gst/gstformat.c: (gst_format_register):
Fix locking order (must take lock before using n_values).
* gst/gstvalue.c: (gst_value_serialize_enum),
(gst_value_deserialize_enum_iter_cmp),
(gst_value_deserialize_enum):
Fix serialisation/deserialisation of custom registered GstFormats.
* tests/check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Unit test for custom format serialisation/deserialisation.
2006-09-17 19:26:16 +00:00
Stefan Kost 6ab8345121 gst/gstvalue.*: Use these optimizations only internaly.
Original commit message from CVS:
* gst/gstvalue.c:
* gst/gstvalue.h:
Use these optimizations only internaly.
2006-08-20 15:55:12 +00:00
Stefan Kost fe851cf2e4 gst/gstvalue.*: Saves the expensive lookup of the compare function in many cases (#345444)
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_compare_list),
(gst_value_compare_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_get_compare_func), (gst_value_compare),
(gst_value_compare_with_func):
* gst/gstvalue.h:
Saves the expensive lookup of the compare function in many cases
(#345444)
2006-08-20 14:30:20 +00:00
Wim Taymans 6487eb661e gst/gstvalue.c: Fix GstValueList comparison code. Fixes #347293.
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_compare_list):
Fix GstValueList comparison code. Fixes #347293.
* tests/check/gst/gstvalue.c: (GST_START_TEST):
Check to test GstValueList comparison.
2006-07-31 16:34:41 +00:00
Jan Schmidt 7e61004213 Make GstValueArray comparison be order dependent as designed.
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_compare_list),
(gst_value_compare_array), (_gst_value_initialize):
* tests/check/gst/gstvalue.c: (GST_START_TEST):
Make GstValueArray comparison be order dependent as designed.
Add checks for value lists and value array comparisons.
Fixes #347221
2006-07-11 20:14:20 +00:00
Thomas Vander Stichele 5855b0ef94 gst/: remove GLib 2.6 compatibility code
Original commit message from CVS:

* gst/glib-compat-private.h:
* gst/glib-compat.c:
* gst/glib-compat.h:
* gst/gstvalue.c: (gst_value_serialize_flags):
remove GLib 2.6 compatibility code
2006-06-13 08:20:24 +00:00
Wim Taymans 7e972ee6b9 Add G_UNLIKELY in type registration.
Original commit message from CVS:
* gst/gsterror.c: (gst_g_error_get_type):
* gst/gstpadtemplate.c: (gst_pad_template_get_type),
(gst_static_pad_template_get_type):
* gst/gsttaglist.c: (gst_tag_list_get_type):
* gst/gsttagsetter.c: (gst_tag_setter_get_type):
* gst/gsttypefindfactory.c: (gst_type_find_factory_get_type):
* gst/gsturi.c: (gst_uri_handler_get_type):
* gst/gstvalue.c: (gst_date_get_type):
* gst/gstxml.c: (gst_xml_get_type):
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_type),
(gst_base_sink_preroll_object), (gst_base_sink_get_position):
* libs/gst/base/gstbasesrc.c: (gst_base_src_get_type):
Add G_UNLIKELY in type registration.
2006-06-12 08:55:21 +00:00
Jan Schmidt 8bf748a28e gst/gstvalue.c: Handle NULL input and output pointers silently as a failed conversion, rather than g_warnings.
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_deserialize_fraction):
Handle NULL input and output pointers silently as a failed conversion,
rather than g_warnings.
2006-05-26 09:19:24 +00:00
Thomas Vander Stichele 46de58b721 gst/gstvalue.c: fix a leak if no flags are set
Original commit message from CVS:

* gst/gstvalue.c: (gst_value_serialize_flags):
fix a leak if no flags are set
* tests/check/gst/gstvalue.c: (GST_START_TEST):
fix leak in tests
2006-05-10 15:38:53 +00:00
Thomas Vander Stichele b4e05d624b gst/: make sure some essential types used by events are registered as part of gst_init()
Original commit message from CVS:
* gst/gstevent.c: (_gst_event_initialize):
* gst/gstformat.c: (_gst_format_initialize):
make sure some essential types used by events are registered
as part of gst_init()
* gst/gstvalue.c: (gst_value_serialize_flags):
if no flags are set, serialize them to a value that represents NONE
so that deserializing them works
* tests/check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
add tests for serialization and deserialization of flags
2006-05-10 14:05:46 +00:00
Wim Taymans ef7f163300 gst/: Remove pre glib2.8 compatibility, fixes #340508
Original commit message from CVS:
* gst/glib-compat.c:
* gst/gst.c: (init_pre):
* gst/gstobject.c: (gst_object_init), (gst_object_ref),
(gst_object_unref), (gst_object_replace), (gst_object_dispose),
(gst_object_dispatch_properties_changed):
* gst/gstobject.h:
* gst/gstregistryxml.c: (gst_registry_xml_read_cache):
* gst/gststructure.c: (gst_structure_set_valist):
* gst/gstvalue.c: (gst_date_get_type), (_gst_value_initialize):
Remove pre glib2.8 compatibility, fixes #340508
2006-05-05 08:17:22 +00:00
Michael Smith 530851afcf gst/gstvalue.c: Avoid NULL dereference when trying to serialize flags containing invalid values.
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_flags):
Avoid NULL dereference when trying to serialize flags containing
invalid values.
2006-04-28 13:51:00 +00:00
Wim Taymans 1089154f2a gst/gstvalue.c: Don't try to serialize a GValue with a NULL buffer.
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_buffer),
(gst_value_deserialize_buffer):
Don't try to serialize a GValue with a NULL buffer.
Fixes #339821.
* tests/check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added check for serialisation of NULL buffers.
2006-04-28 13:13:23 +00:00
Wim Taymans 37d77aaeee Small documentation fixes.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbuffer.h:
* gst/gstvalue.c:
* libs/gst/base/gstbasetransform.h:
Small documentation fixes.
2006-03-07 15:08:57 +00:00
Tim-Philipp Müller a4957224a8 gst/gstvalue.c: Document thread-unsafety of gst_value_register_foo_func() when used at the same time as gst_value_foo...
Original commit message from CVS:
* gst/gstvalue.c:
Document thread-unsafety of gst_value_register_foo_func()
when used at the same time as gst_value_foo() (#322628).
2006-03-07 11:47:24 +00:00
Wim Taymans a19398105c gst/gstbin.c: Help the compiler a bit with type registration.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_get_type), (gst_bin_handle_message_func):
Help the compiler a bit with type registration.
Use existing forward cod path instead of duplicating it when
handling a message.

* gst/gstbus.c: (gst_bus_get_type):
* gst/gstcaps.c: (gst_caps_get_type), (gst_static_caps_get_type):
* gst/gstchildproxy.c: (gst_child_proxy_get_type):
* gst/gstclock.c: (gst_clock_get_type):
* gst/gstelement.c: (gst_element_get_type),
* gst/gstelementfactory.c: (gst_element_factory_get_type):
* gst/gstindexfactory.c: (gst_index_factory_get_type):
* gst/gstminiobject.c: (gst_mini_object_get_type):
* gst/gstpad.c: (gst_pad_get_type):
* gst/gstsegment.c: (gst_segment_get_type):
* gst/gststructure.c: (gst_structure_get_type):
* gst/gstsystemclock.c: (gst_system_clock_get_type):
* gst/gsttask.c: (gst_task_get_type), (gst_task_join):
* gst/gstvalue.c:
Help compiler with type registration.

* plugins/elements/gstqueue.c: (gst_queue_handle_sink_event):
Small doc update.
2006-02-28 10:52:02 +00:00
Stefan Kost a53172d79d doc fixes, to link to function, just write gst_cool_function(), don't prefix with '#'
Original commit message from CVS:
* gst/gstcaps.c:
* gst/gstelement.c: (gst_element_send_event):
* gst/gstevent.c:
* gst/gstinfo.c:
* gst/gstiterator.c:
* gst/gstiterator.h:
* gst/gstpad.c: (gst_pad_send_event):
* gst/gststructure.c:
* gst/gsturi.c:
* gst/gstutils.c:
* gst/gstvalue.c:
* libs/gst/base/gstadapter.c:
doc fixes, to link to function, just write gst_cool_function(), don't
prefix with '#'
2006-01-27 22:34:51 +00:00
Thomas Vander Stichele 2dedb46c7e gst/gstvalue.c: make the G_TYPE_DATE instantiation work if debug is disabled
Original commit message from CVS:

* gst/gstvalue.c: (_gst_value_initialize):
make the G_TYPE_DATE instantiation work if debug is disabled
2006-01-07 10:04:36 +00:00
Thomas Vander Stichele ef7dedbfc8 gst/gstvalue.c: floor is not needed, F is always positive; this obviates the need for adding -lm when building withou...
Original commit message from CVS:

* gst/gstvalue.c: (gst_value_transform_double_fraction):
floor is not needed, F is always positive; this obviates the
need for adding -lm when building without libxml
2005-12-12 10:59:12 +00:00
Thomas Vander Stichele 288f61d21f expand tabs
Original commit message from CVS:
expand tabs
2005-12-06 19:29:15 +00:00
Thomas Vander Stichele 9055674a03 add some explicit casts update dsp files; also installs the debug build in \gstreamer\debug to separate it from the n...
Original commit message from CVS:
add some explicit casts
update dsp files; also installs the debug build in \gstreamer\debug to separate it from the non-debug build
2005-11-30 10:13:54 +00:00
Tim-Philipp Müller 676421cf07 gst/gstvalue.c: Improve documentation for gst_value_union().
Original commit message from CVS:
* gst/gstvalue.c:
Improve documentation for gst_value_union().
* gst/gstvalue.h:
Change return value for union, intersect and subtract functions
from gint to gboolean.
2005-11-27 19:52:49 +00:00