Commit graph

72 commits

Author SHA1 Message Date
Tim-Philipp Müller
c6554049de registry: deprecate useless gst_registry_xml_{read|write}_cache()
The only reason these two functions are still around is that at some
point in the past they were in a public header, so we can't really
remove them now even though they should have been private all along
(and aren't really particularly useful). Since these are just empty
stubs now that do nothing but return FALSE and will be removed in
0.11 anyway, we may just as well deprecate them formally.
2010-01-06 19:19:40 +00:00
Sebastian Dröge
08ae8a1afb registry: Use GMappedFile for reading the registry
Fixes bug #603787.
2009-12-04 15:19:11 +01:00
Javier Jardón
ca974b1a8f registry: Substitute deprecated GLib symbol: g_mapped_file_free
Use g_mapped_file_unref if Glib >= 2.22 is available

Fixes bug #560442.
2009-12-04 14:50:46 +01:00
Jan Schmidt
51675e0c2a registry: Add registry helper phase 1
Phase 1 of adding the registry scan helper
2009-10-06 19:51:42 +01:00
Stefan Kost
1949360f9b binaryregistry: don't crash in cleaning up on error.
Don't dereference NULL pointers.
2009-09-11 21:20:57 +03:00
Stefan Kost
e4ee7831e3 registry: add filename to debug message, like elsewhere 2009-08-06 15:30:32 +03:00
Stefan Kost
1a44bd93d6 gstregistrybinary: add +1 after error checking
The current code made the error checking pointless by changing -1 to 0 in error
cases. Also don't leak a pad template on error.
2009-07-20 20:59:29 +03:00
Stefan Kost
de1e991dec binaryregistry: don't unref NULL if we have an early read error 2009-07-20 11:06:22 +03:00
Edward Hervey
b50ba09164 binaryregistry: Use local values in while/for loops, use branch prediction macros 2009-06-30 16:30:07 +02: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
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
Stefan Kost
ed88db818b registry: allow plugins to cache extra data in registry. Fixes #570233
Add a GstStructure to GstPlugin. Plugins can retieve it in plugin_init and
access the cached info or build the cache and store it there.
2009-06-07 23:48:59 +03:00
Stefan Kost
158895f56b registry: don't free node-date and deref again. Fixes #580579
When writing a cache chunk fails, we were freeing the node and jump to a final
cleanup which dereferenced a null pointer. Leve freeing the node to the cleanup
code in fail_free_list. (sorry for committing wrong fix before).
2009-05-22 23:16:00 +03:00
Stefan Kost
4faa75ab35 registry: don't free node-date and deref again. Fixes #580579
When writing a cache chunk fails, we were freeing the node and jump to a final
cleanup which dereferenced a null pointer. Leve freeing the node to the cleanup
code in fail_free_list.
2009-05-22 23:10:00 +03:00
Wim Taymans
761b0e39c1 Avoid unneeded type checks 2009-05-11 22:35:09 +02:00
Edward Hervey
9557542722 gstregistrybinary: remove variable only used for a check.
that variable isn't used anywhere else within that block.
2009-04-03 12:57:24 +02:00
Stefan Kost
2806a409ed binaryregistry: init variable, that is referenced in error case below the fail: label 2009-03-27 17:32:29 +02:00
Stefan Kost
82c9b78f86 binaryregistry: check for not reading beyond the data area. Fixes #576842
Check all reads against the end of the data region. Roll back registration of
partial reads.
2009-03-27 15:34:25 +02:00
Tim-Philipp Müller
cc0978bd85 registry: do fsync() before close() and rename()
This helps prevent filesystem/data inconsistencies in certain
circumstances on certain filesystems (like ext4, xfs, ubifs).
Also see bug #562976.
2009-03-26 14:51:49 +00:00
Stefan Kost
6911aa59be binary registry: Don't attempt to parse empty caps 2009-02-25 16:03:25 +02:00
Sebastian Dröge
70fcf4a201 registry: Set typefind factory caps to NULL instead of empty caps if they originally were NULL 2009-02-25 14:19:54 +01:00
Sebastian Dröge
fdc03c2841 registrybinary: Check if typefind factory caps are NULL before copying them 2009-02-24 15:10:15 +01:00
Stefan Kost
b87960ae5d binary registry: Rewrite sanity check to actualy catch something.
The previous commit was bogus, as was the check before. We just point m to the file data,
so neither it nor its members will be NULL. Better check if we have enough data.
2009-02-06 10:51:28 +02:00
Stefan Kost
c69a262889 binary registry: comparing arrays against NULL is useless 2009-02-05 15:56:19 +02:00
Stefan Kost
9cda224a0d leak: Don't leak type name in failure cases. 2009-02-04 16:17:34 +02:00
Peter Kjellerstedt
846d56b865 gstregistrybinary: Make it compile with GST_DISABLE_GST_DEBUG. 2009-02-02 14:19:57 +01:00
Sebastian Dröge
1af5d201fc Allocate everything that is written to the registry with g_malloc0()
Allocate every structure that is directly written to the binary
registry with g_malloc0(). Otherwise some parts of it will be
uninitialized (struct padding because of alignment, etc) and
valgrind will complain about it.
2009-01-30 10:31:30 +01:00
Jan Schmidt
a626dff72c Make sure to take a copy of the strings we're going to free later. 2009-01-29 15:54:45 +00:00
Tim-Philipp Müller
2ae03ba72f Add API for making a GStreamer plugin 'dependent' on external files, directories or environment variables, so that GS...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt::
* gst/gst_private.h: (GstPluginDep), (_GstPluginPrivate):
* gst/gstplugin.c: (gst_plugin_init), (gst_plugin_finalize),
(gst_plugin_class_init), (gst_plugin_list_free),
(gst_plugin_ext_dep_get_env_vars_hash),
(_priv_plugin_deps_env_vars_changed),
(gst_plugin_ext_dep_extract_env_vars_paths),
(gst_plugin_ext_dep_get_hash_from_stat_entry),
(gst_plugin_ext_dep_direntry_matches),
(gst_plugin_ext_dep_scan_dir_and_match_names),
(gst_plugin_ext_dep_scan_path_with_filenames),
(gst_plugin_ext_dep_get_stat_hash),
(_priv_plugin_deps_files_changed), (gst_plugin_ext_dep_free),
(gst_plugin_ext_dep_strv_equal), (gst_plugin_ext_dep_equals),
(gst_plugin_add_dependency), (gst_plugin_add_dependency_simple):
* gst/gstplugin.h: (GstPluginPrivate), (GstPluginFlags),
(GST_PLUGIN_DEPENDENCY_FLAG_NONE),
(GST_PLUGIN_DEPENDENCY_FLAG_RECURSE),
(GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY),
(GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX),
(GstPluginDependencyFlags), (GstPluginFilter):
* gst/gstregistry.c: (gst_registry_scan_path_level):
* gst/gstregistrybinary.c: (gst_registry_binary_save_feature),
(gst_registry_binary_save_plugin_dep),
(gst_registry_binary_save_plugin),
(gst_registry_binary_load_feature),
(gst_registry_binary_load_plugin_dep_strv),
(gst_registry_binary_load_plugin_dep),
(gst_registry_binary_load_plugin):
* gst/gstregistrybinary.h: (GST_MAGIC_BINARY_VERSION_STR),
(GstBinaryPluginElement), (_GstBinaryDep), (GstBinaryDep):
* gst/gstregistryxml.c: (gst_registry_xml_save_plugin):
Add API for making a GStreamer plugin 'dependent' on external files,
directories or environment variables, so that GStreamer knows when
it needs to re-load GStreamer plugins that wrap other plugin systems.
Fixes bug #350477.
API: add gst_plugin_add_dependency()
API: add gst_plugin_add_dependency_simple()
2009-01-06 17:58:59 +00:00
Tim-Philipp Müller
13089a438a gst/gstregistrybinary.c: Wrap multi-line macros in G_STMT_{START|END}.
Original commit message from CVS:
* gst/gstregistrybinary.c: (unpack_element), (unpack_const_string),
(unpack_string)::
Wrap multi-line macros in G_STMT_{START|END}.
2008-12-27 16:23:12 +00:00
Michael Smith
8b1ed490b3 gst/gstregistrybinary.c: In win32 codepath, if we fail to write the registry, create the directory for it and try aga...
Original commit message from CVS:
* gst/gstregistrybinary.c:
In win32 codepath, if we fail to write the registry, create the
directory for it and try again, matching the behaviour in non-win32
codepaths.
2008-11-20 20:44:56 +00:00
Sebastian Dröge
681e4d01c8 gst/gstregistrybinary.*: Don't write and check a CRC for the binary registry file. It's guaranteed that the registry ...
Original commit message from CVS:
* gst/gstregistrybinary.c: (gst_registry_binary_write_chunk),
(gst_registry_binary_initialize_magic),
(gst_registry_binary_write_cache),
(gst_registry_binary_check_magic):
* gst/gstregistrybinary.h:
Don't write and check a CRC for the binary registry file. It's
guaranteed that the registry is completely written (it's first written
to a temporary file and then moved) and if the registry was corrupted
by some hardware failure we would have bigger problems.
Bump binary registry version to 0.10.21.1 for this as it's an
incompatible change and to ensure that the registry gets rebuild
after the update.
This saves some milliseconds for reading/writing the registry.
Fixes bug #560399.
2008-11-12 10:39:25 +00:00
Stefan Kost
1d61cb0381 gst/gstregistrybinary.c: Don't bother with the GTimer if we don't output the results.
Original commit message from CVS:
* gst/gstregistrybinary.c:
Don't bother with the GTimer if we don't output the results.
2008-11-03 12:29:10 +00:00
Stefan Kost
0d430a59ef gst/gstregistrybinary.c: Oh my, studip, stupid me. Remove double stat() call.
Original commit message from CVS:
* gst/gstregistrybinary.c:
Oh my, studip, stupid me. Remove double stat() call.
2008-10-31 15:54:44 +00:00
Stefan Kost
588ab506b9 gst/: Use g_unlink() as none of these are directories.
Original commit message from CVS:
* gst/gstregistrybinary.c:
* gst/gstregistryxml.c:
Use g_unlink() as none of these are directories.
2008-10-30 14:15:14 +00:00
Sebastian Dröge
2d2a55a2a4 gst/gstregistrybinary.c: If we can't get a cache file don't try to save something to it.
Original commit message from CVS:
* gst/gstregistrybinary.c: (gst_registry_binary_write_cache):
If we can't get a cache file don't try to save something to it.
Dereferencing NULL pointers usually isn't a good idea.
2008-10-08 10:07:15 +00:00
Michael Smith
945bf1bdd3 gst/gstregistrybinary.c: Don't use g_mkstmp() on win32, it's unsafe if glib is using a different libc.
Original commit message from CVS:
* gst/gstregistrybinary.c:
Don't use g_mkstmp() on win32, it's unsafe if glib is using a different
libc.
Fixes #544776.
2008-08-11 19:04:04 +00:00
Sebastian Dröge
4bfb1fe70c Remove GST_DISABLE_(ENUMTYPES|INDEX|URI) everywhere.
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* docs/gst/gstreamer.types:
* docs/gst/gstreamer.types.in:
* gst/Makefile.am:
* gst/gst.c:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_set_index_func):
* gst/gstconfig.h.in:
* gst/gstelement.c: (gst_element_get_index):
* gst/gstregistrybinary.c: (gst_registry_binary_save_feature),
(gst_registry_binary_load_feature),
(gst_registry_binary_read_cache):
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache), (gst_registry_xml_save_feature):
* plugins/Makefile.am:
* tools/gst-indent:
* tools/gst-inspect.c: (print_index_info), (print_element_list),
(print_plugin_features), (print_element_features):
* tools/gst-xmlinspect.c: (print_event_masks),
(print_element_info):
* win32/common/gstconfig.h:
Remove GST_DISABLE_(ENUMTYPES|INDEX|URI) everywhere.
Disabling the indexers and URI handler code will only reduce the
required amount of memory by a very small amount but on the other hand
requires much more maintaince work. Apart from that many places of
code are broken when disabling them.
Disabling the enum types doesn't reduce the required amount of memory
by more than a few bytes and makes it hard to fix bugs like #539772,
i.e. use the enums as GObject properties.
2008-07-31 15:20:32 +00:00
Tim-Philipp Müller
944de3aa68 gst/gstplugin.c: Print error debug message if plugin description fields that should be set are NULL.
Original commit message from CVS:
* gst/gstplugin.c: (CHECK_PLUGIN_DESC_FIELD), (gst_plugin_load_file):
Print error debug message if plugin description fields that should
be set are NULL.
* gst/gstregistrybinary.c: (gst_registry_binary_save_const_string):
Don't crash if the string to serialise is NULL (it really should
not be, but apparently this used to work with the xml registry ...).
2008-07-02 14:43:40 +00:00
Sebastian Dröge
a8d43712da gst/gstclock.c: Make some checks actually useful.
Original commit message from CVS:
* gst/gstclock.c: (gst_clock_set_calibration):
Make some checks actually useful.
* gst/gstregistrybinary.c: (gst_registry_binary_load_plugin):
Remove some unused code. Unsigned integers tend to be >= 0.
2008-05-04 14:25:07 +00:00
Stefan Kost
c7acfbaf43 gst/gstregistrybinary.c: Add a warning of we hit unhandled factories when saving.
Original commit message from CVS:
* gst/gstregistrybinary.c:
Add a warning of we hit unhandled factories when saving.
More debug logging detail, but move to LOG category.
2008-04-24 08:27:59 +00:00
Sebastian Dröge
c7a7548481 gst/gstregistrybinary.c: Return the old CRC instead of 0 if we give a NULL buffer or a buffer with a length of 0.
Original commit message from CVS:
* gst/gstregistrybinary.c: (_gst_crc32):
Return the old CRC instead of 0 if we give a NULL buffer
or a buffer with a length of 0.
2008-04-19 15:42:19 +00:00
Sebastian Dröge
89b0dc88d2 gst/gstregistrybinary.c: Initialize the registry magic with zeroes.
Original commit message from CVS:
* gst/gstregistrybinary.c: (gst_registry_binary_initialize_magic):
Initialize the registry magic with zeroes.
2008-04-16 15:51:17 +00:00
Sebastian Dröge
550392c6da gst/gstregistrybinary.*: Add crc32 checksum to the binary registry file and check this before accepting a registry file.
Original commit message from CVS:
* gst/gstregistrybinary.c: (_gst_crc32),
(gst_registry_binary_write),
(gst_registry_binary_initialize_magic),
(gst_registry_binary_write_cache),
(gst_registry_binary_check_magic),
(gst_registry_binary_read_cache):
* gst/gstregistrybinary.h:
Add crc32 checksum to the binary registry file and check this before
accepting a registry file.
Also free the data list when writing to the registry file fails.
2008-04-16 14:18:58 +00:00
Sebastian Dröge
dc71d29b62 gst/gstregistrybinary.c: If an element supports the Uri interface, returns a valid pointer to the supported URI proto...
Original commit message from CVS:
* gst/gstregistrybinary.c: (gst_registry_binary_save_feature),
(gst_registry_binary_load_feature),
(gst_registry_binary_load_plugin):
If an element supports the Uri interface, returns a valid pointer
to the supported URI protocols but this pointer contains nothing
don't try to save that as it will corrupt the registry.
Don't unref the plugin if we added it to the registry already but
fail to load a feature as gst_registry_add_plugin() takes ownership
of the plugin.
Improve debugging a bit.
2008-04-16 13:16:44 +00:00
Sebastian Dröge
42a2ece0d2 gst/gstregistrybinary.c: Fix a typo in a debug message and revert change from yesterday as gst_registry_add_plugin() ...
Original commit message from CVS:
* gst/gstregistrybinary.c: (gst_registry_binary_load_feature),
(gst_registry_binary_load_plugin):
Fix a typo in a debug message and revert change from yesterday as
gst_registry_add_plugin() will only fail if something is really wrong
already and we can't survive it anyway.
2008-04-14 12:12:22 +00:00
Sebastian Dröge
938da2d4e2 gst/gstregistrybinary.c: If gst_registry_add_plugin() fails our reference to the plugin is invalid so don't try to us...
Original commit message from CVS:
* gst/gstregistrybinary.c: (gst_registry_binary_load_plugin):
If gst_registry_add_plugin() fails our reference to the plugin is
invalid so don't try to use it anymore and instead error out.
2008-04-13 13:54:55 +00:00
Sebastian Dröge
c375cef8c0 gst/gstregistrybinary.c: Rename constant everywhere and don't forget one occurence.
Original commit message from CVS:
* gst/gstregistrybinary.c: (gst_registry_binary_write):
Rename constant everywhere and don't forget one occurence.
2008-03-23 11:40:54 +00:00
Sebastian Dröge
6c85176725 gst/gstregistrybinary.c: Align memory to the pointer size even if the architecture allows unaligned memory access. Un...
Original commit message from CVS:
* gst/gstregistrybinary.c: (gst_registry_binary_write):
Align memory to the pointer size even if the architecture allows
unaligned memory access. Unaligned memory access usually comes with
performance penality.
2008-03-23 11:29:54 +00:00
Sebastian Dröge
79bd94558c gst/gstregistrybinary.c: Align memory to the pointer size instead of always 32 bit. Fixes unaligned memory accesses o...
Original commit message from CVS:
* gst/gstregistrybinary.c: (gst_registry_binary_write),
(gst_registry_binary_check_magic),
(gst_registry_binary_load_pad_template),
(gst_registry_binary_load_feature),
(gst_registry_binary_load_plugin):
Align memory to the pointer size instead of always 32 bit. Fixes
unaligned memory accesses on ia64 and friends.
* gst/gstregistrybinary.h:
Bump binary registry format version for this as it changes the
format on those architectures that don't have unaligned access
and 64 bit pointers.
2008-03-23 11:23:30 +00:00