commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
/* GStreamer
|
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
|
|
|
* Copyright (C) 2006 Josep Torra <josep@fluendo.com>
|
|
|
|
* 2006 Mathieu Garcia <matthieu@fluendo.com>
|
2007-10-13 17:20:09 +00:00
|
|
|
* 2006,2007 Stefan Kost <ensonic@users.sf.net>
|
2008-04-16 15:51:17 +00:00
|
|
|
* 2008 Sebastian Dröge <slomo@circular-chaos.org>
|
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
|
|
|
*
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
* gstregistrybinary.c: GstRegistryBinary object, support routines
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2008-03-07 13:19:12 +00:00
|
|
|
* modify it under the terms of the GNU Library General Public
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* FIXME:
|
|
|
|
* - keep registry binary blob and reference strings
|
2007-04-26 07:32:08 +00:00
|
|
|
* - don't free/unmmap contents when leaving gst_registry_binary_read_cache()
|
|
|
|
* - free at gst_deinit() / _priv_gst_registry_cleanup() ?
|
|
|
|
* - GstPlugin:
|
|
|
|
* - GST_PLUGIN_FLAG_CONST
|
2008-04-16 14:18:58 +00:00
|
|
|
* - GstPluginFeature, GstIndexFactory, GstElementFactory
|
2007-04-26 07:32:08 +00:00
|
|
|
* - needs Flags (GST_PLUGIN_FEATURE_FLAG_CONST)
|
|
|
|
* - can we turn loaded into flag?
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
* - why do we collect a list of binary chunks and not write immediately
|
gst/gstregistrybinary.*: use glib types, cleanup comments, impement interfaces and uri-types
Original commit message from CVS:
* gst/gstregistrybinary.c: (gst_registry_binary_write),
(gst_registry_binary_initialize_magic),
(gst_registry_binary_save_string), (gst_registry_binary_make_data),
(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):
* gst/gstregistrybinary.h:
use glib types, cleanup comments, impement interfaces and uri-types
2007-01-15 12:18:46 +00:00
|
|
|
* - because we need to process subchunks, before we can set e.g. nr_of_items
|
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
|
|
|
* in parent chunk
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
*/
|
|
|
|
|
2007-04-16 19:45:31 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2008-03-07 13:19:12 +00:00
|
|
|
#if defined (_MSC_VER) && _MSC_VER >= 1400
|
|
|
|
#include <io.h>
|
|
|
|
#endif
|
|
|
|
|
2007-04-16 19:45:31 +00:00
|
|
|
#include <gst/gst_private.h>
|
|
|
|
#include <gst/gstconfig.h>
|
|
|
|
#include <gst/gstelement.h>
|
|
|
|
#include <gst/gsttypefind.h>
|
|
|
|
#include <gst/gsttypefindfactory.h>
|
2012-10-16 16:27:04 +00:00
|
|
|
#include <gst/gstdevicemonitorfactory.h>
|
2007-04-16 19:45:31 +00:00
|
|
|
#include <gst/gsturi.h>
|
|
|
|
#include <gst/gstinfo.h>
|
|
|
|
#include <gst/gstenumtypes.h>
|
|
|
|
#include <gst/gstpadtemplate.h>
|
|
|
|
|
2009-03-14 23:07:40 +00:00
|
|
|
#include <gst/gstregistrychunks.h>
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
#include <gst/gstregistrybinary.h>
|
|
|
|
|
2007-04-26 07:32:08 +00:00
|
|
|
#include <glib/gstdio.h> /* for g_stat(), g_mapped_file(), ... */
|
2007-04-16 19:45:31 +00:00
|
|
|
|
2007-09-19 13:28:40 +00:00
|
|
|
#include "glib-compat-private.h"
|
|
|
|
|
2007-04-16 19:45:31 +00:00
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
#define GST_CAT_DEFAULT GST_CAT_REGISTRY
|
|
|
|
|
2009-03-26 11:07:56 +00:00
|
|
|
/* reading macros */
|
|
|
|
#define unpack_element(inptr, outptr, element, endptr, error_label) G_STMT_START{ \
|
|
|
|
if (inptr + sizeof(element) >= endptr) \
|
|
|
|
goto error_label; \
|
|
|
|
outptr = (element *) inptr; \
|
|
|
|
inptr += sizeof (element); \
|
2008-12-27 16:23:12 +00:00
|
|
|
}G_STMT_END
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
|
2008-03-23 11:29:54 +00:00
|
|
|
#define ALIGNMENT (sizeof (void *))
|
|
|
|
#define alignment(_address) (gsize)_address%ALIGNMENT
|
|
|
|
#define align(_ptr) _ptr += (( alignment(_ptr) == 0) ? 0 : ALIGNMENT-alignment(_ptr))
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
|
|
|
|
/* Registry saving */
|
|
|
|
|
2008-08-11 19:04:04 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
/* On win32, we can't use g_mkstmp(), because of cross-DLL file I/O problems.
|
|
|
|
* So, we just create the entire binary registry in memory, then write it out
|
|
|
|
* with g_file_set_contents(), which creates a temporary file internally
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct BinaryRegistryCache
|
|
|
|
{
|
|
|
|
const char *location;
|
|
|
|
guint8 *mem;
|
|
|
|
gssize len;
|
|
|
|
} BinaryRegistryCache;
|
|
|
|
|
|
|
|
static BinaryRegistryCache *
|
|
|
|
gst_registry_binary_cache_init (GstRegistry * registry, const char *location)
|
|
|
|
{
|
2010-03-28 16:05:36 +00:00
|
|
|
BinaryRegistryCache *cache = g_slice_new0 (BinaryRegistryCache);
|
2008-08-11 19:04:04 +00:00
|
|
|
cache->location = location;
|
|
|
|
return cache;
|
|
|
|
}
|
|
|
|
|
2010-03-10 18:17:42 +00:00
|
|
|
static int
|
|
|
|
gst_registry_binary_cache_write (BinaryRegistryCache * cache,
|
|
|
|
unsigned long offset, const void *data, int length)
|
|
|
|
{
|
|
|
|
cache->len = MAX (offset + length, cache->len);
|
|
|
|
cache->mem = g_realloc (cache->mem, cache->len);
|
|
|
|
|
|
|
|
memcpy (cache->mem + offset, data, length);
|
|
|
|
|
|
|
|
return length;
|
|
|
|
}
|
|
|
|
|
2008-08-11 19:04:04 +00:00
|
|
|
static gboolean
|
2009-03-14 23:07:40 +00:00
|
|
|
gst_registry_binary_cache_finish (BinaryRegistryCache * cache, gboolean success)
|
2008-08-11 19:04:04 +00:00
|
|
|
{
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
GError *error = NULL;
|
|
|
|
if (!g_file_set_contents (cache->location, (const gchar *) cache->mem,
|
|
|
|
cache->len, &error)) {
|
2008-11-20 20:44:56 +00:00
|
|
|
/* Probably the directory didn't exist; create it */
|
|
|
|
gchar *dir;
|
|
|
|
dir = g_path_get_dirname (cache->location);
|
|
|
|
g_mkdir_with_parents (dir, 0777);
|
|
|
|
g_free (dir);
|
|
|
|
|
2008-08-11 19:04:04 +00:00
|
|
|
g_error_free (error);
|
2008-11-20 20:44:56 +00:00
|
|
|
error = NULL;
|
|
|
|
|
|
|
|
if (!g_file_set_contents (cache->location, (const gchar *) cache->mem,
|
|
|
|
cache->len, &error)) {
|
2009-03-14 23:07:40 +00:00
|
|
|
/* Probably the directory didn't exist; create it */
|
|
|
|
gchar *dir;
|
|
|
|
dir = g_path_get_dirname (cache->location);
|
|
|
|
g_mkdir_with_parents (dir, 0777);
|
|
|
|
g_free (dir);
|
|
|
|
|
2008-11-20 20:44:56 +00:00
|
|
|
g_error_free (error);
|
2009-03-14 23:07:40 +00:00
|
|
|
error = NULL;
|
|
|
|
|
|
|
|
if (!g_file_set_contents (cache->location, (const gchar *) cache->mem,
|
|
|
|
cache->len, &error)) {
|
|
|
|
GST_ERROR ("Failed to write to cache file: %s", error->message);
|
|
|
|
g_error_free (error);
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
2008-11-20 20:44:56 +00:00
|
|
|
}
|
2008-08-11 19:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free (cache->mem);
|
2010-03-28 16:05:36 +00:00
|
|
|
g_slice_free (BinaryRegistryCache, cache);
|
2008-08-11 19:04:04 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
typedef struct BinaryRegistryCache
|
|
|
|
{
|
|
|
|
const char *location;
|
|
|
|
char *tmp_location;
|
|
|
|
unsigned long currentoffset;
|
2009-03-14 23:07:40 +00:00
|
|
|
int cache_fd;
|
2008-08-11 19:04:04 +00:00
|
|
|
} BinaryRegistryCache;
|
|
|
|
|
|
|
|
static BinaryRegistryCache *
|
|
|
|
gst_registry_binary_cache_init (GstRegistry * registry, const char *location)
|
|
|
|
{
|
2010-03-28 16:05:36 +00:00
|
|
|
BinaryRegistryCache *cache = g_slice_new0 (BinaryRegistryCache);
|
2008-08-11 19:04:04 +00:00
|
|
|
|
|
|
|
cache->location = location;
|
|
|
|
cache->tmp_location = g_strconcat (location, ".tmpXXXXXX", NULL);
|
2009-03-14 23:07:40 +00:00
|
|
|
cache->cache_fd = g_mkstemp (cache->tmp_location);
|
|
|
|
if (cache->cache_fd == -1) {
|
2010-12-05 05:06:34 +00:00
|
|
|
int ret;
|
|
|
|
GStatBuf statbuf;
|
2008-08-11 19:04:04 +00:00
|
|
|
gchar *dir;
|
|
|
|
|
|
|
|
/* oops, I bet the directory doesn't exist */
|
|
|
|
dir = g_path_get_dirname (location);
|
|
|
|
g_mkdir_with_parents (dir, 0777);
|
2010-12-05 05:06:34 +00:00
|
|
|
|
|
|
|
ret = g_stat (dir, &statbuf);
|
|
|
|
if (ret != -1 && (statbuf.st_mode & 0700) != 0700) {
|
|
|
|
g_chmod (dir, 0700);
|
|
|
|
}
|
|
|
|
|
2008-08-11 19:04:04 +00:00
|
|
|
g_free (dir);
|
|
|
|
|
|
|
|
/* the previous g_mkstemp call overwrote the XXXXXX placeholder ... */
|
|
|
|
g_free (cache->tmp_location);
|
|
|
|
cache->tmp_location = g_strconcat (location, ".tmpXXXXXX", NULL);
|
2009-03-14 23:07:40 +00:00
|
|
|
cache->cache_fd = g_mkstemp (cache->tmp_location);
|
2008-08-11 19:04:04 +00:00
|
|
|
|
2009-03-14 23:07:40 +00:00
|
|
|
if (cache->cache_fd == -1) {
|
2008-08-11 19:04:04 +00:00
|
|
|
GST_DEBUG ("g_mkstemp() failed: %s", g_strerror (errno));
|
|
|
|
g_free (cache->tmp_location);
|
2010-03-28 16:05:36 +00:00
|
|
|
g_slice_free (BinaryRegistryCache, cache);
|
2008-08-11 19:04:04 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2010-12-05 05:06:34 +00:00
|
|
|
|
|
|
|
ret = g_stat (cache->tmp_location, &statbuf);
|
|
|
|
if (ret != -1 && (statbuf.st_mode & 0600) != 0600) {
|
|
|
|
g_chmod (cache->tmp_location, 0600);
|
|
|
|
}
|
2008-08-11 19:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return cache;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-03-14 23:07:40 +00:00
|
|
|
gst_registry_binary_cache_write (BinaryRegistryCache * cache,
|
|
|
|
unsigned long offset, const void *data, int length)
|
2008-08-11 19:04:04 +00:00
|
|
|
{
|
|
|
|
long written;
|
|
|
|
if (offset != cache->currentoffset) {
|
2012-02-24 23:39:30 +00:00
|
|
|
if (lseek (cache->cache_fd, offset, SEEK_SET) < 0) {
|
|
|
|
GST_ERROR ("Seeking to new offset failed: %s", g_strerror (errno));
|
|
|
|
return -1;
|
2008-08-11 19:04:04 +00:00
|
|
|
}
|
2012-02-24 23:39:30 +00:00
|
|
|
GST_LOG ("Seeked from offset %lu to %lu", offset, cache->currentoffset);
|
2008-08-11 19:04:04 +00:00
|
|
|
cache->currentoffset = offset;
|
|
|
|
}
|
|
|
|
|
2009-03-14 23:07:40 +00:00
|
|
|
written = write (cache->cache_fd, data, length);
|
2008-08-11 19:04:04 +00:00
|
|
|
if (written != length) {
|
|
|
|
GST_ERROR ("Failed to write to cache file");
|
|
|
|
}
|
|
|
|
cache->currentoffset += written;
|
|
|
|
|
|
|
|
return written;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-03-14 23:07:40 +00:00
|
|
|
gst_registry_binary_cache_finish (BinaryRegistryCache * cache, gboolean success)
|
2008-08-11 19:04:04 +00:00
|
|
|
{
|
2009-03-26 14:16:55 +00:00
|
|
|
/* only fsync if we're actually going to use and rename the file below */
|
2009-03-14 23:07:40 +00:00
|
|
|
if (success && fsync (cache->cache_fd) < 0)
|
2009-03-26 14:16:55 +00:00
|
|
|
goto fsync_failed;
|
|
|
|
|
2009-03-14 23:07:40 +00:00
|
|
|
if (close (cache->cache_fd) < 0)
|
2008-08-11 19:04:04 +00:00
|
|
|
goto close_failed;
|
|
|
|
|
2012-02-24 23:19:51 +00:00
|
|
|
if (!success)
|
|
|
|
goto fail_after_close;
|
|
|
|
|
|
|
|
/* Only do the rename if we wrote the entire file successfully */
|
|
|
|
if (g_rename (cache->tmp_location, cache->location) < 0) {
|
|
|
|
GST_ERROR ("g_rename() failed: %s", g_strerror (errno));
|
|
|
|
goto rename_failed;
|
2008-08-11 19:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free (cache->tmp_location);
|
2010-03-28 16:05:36 +00:00
|
|
|
g_slice_free (BinaryRegistryCache, cache);
|
2008-08-11 19:04:04 +00:00
|
|
|
GST_INFO ("Wrote binary registry cache");
|
|
|
|
return TRUE;
|
|
|
|
|
2009-03-26 14:16:55 +00:00
|
|
|
/* ERRORS */
|
2008-08-11 19:04:04 +00:00
|
|
|
fail_after_close:
|
|
|
|
{
|
2008-10-30 14:15:14 +00:00
|
|
|
g_unlink (cache->tmp_location);
|
2008-08-11 19:04:04 +00:00
|
|
|
g_free (cache->tmp_location);
|
2010-03-28 16:05:36 +00:00
|
|
|
g_slice_free (BinaryRegistryCache, cache);
|
2008-08-11 19:04:04 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2009-03-26 14:16:55 +00:00
|
|
|
fsync_failed:
|
|
|
|
{
|
|
|
|
GST_ERROR ("fsync() failed: %s", g_strerror (errno));
|
|
|
|
goto fail_after_close;
|
|
|
|
}
|
2008-08-11 19:04:04 +00:00
|
|
|
close_failed:
|
|
|
|
{
|
|
|
|
GST_ERROR ("close() failed: %s", g_strerror (errno));
|
|
|
|
goto fail_after_close;
|
|
|
|
}
|
|
|
|
rename_failed:
|
|
|
|
{
|
|
|
|
GST_ERROR ("g_rename() failed: %s", g_strerror (errno));
|
|
|
|
goto fail_after_close;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
/*
|
2008-08-11 19:04:04 +00:00
|
|
|
* gst_registry_binary_write_chunk:
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
*
|
|
|
|
* Write from a memory location to the registry cache file
|
|
|
|
*
|
|
|
|
* Returns: %TRUE for success
|
|
|
|
*/
|
|
|
|
inline static gboolean
|
2009-03-14 23:07:40 +00:00
|
|
|
gst_registry_binary_write_chunk (BinaryRegistryCache * cache,
|
|
|
|
GstRegistryChunk * chunk, unsigned long *file_position)
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
{
|
2008-03-23 11:40:54 +00:00
|
|
|
gchar padder[ALIGNMENT] = { 0, };
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
int padsize = 0;
|
|
|
|
|
|
|
|
/* Padding to insert the struct that requiere word alignment */
|
2009-03-14 23:07:40 +00:00
|
|
|
if ((chunk->align) && (alignment (*file_position) != 0)) {
|
2008-03-23 11:23:30 +00:00
|
|
|
padsize = ALIGNMENT - alignment (*file_position);
|
2009-03-14 23:07:40 +00:00
|
|
|
if (gst_registry_binary_cache_write (cache, *file_position,
|
2008-08-11 19:04:04 +00:00
|
|
|
padder, padsize) != padsize) {
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
GST_ERROR ("Failed to write binary registry padder");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-08-11 19:04:04 +00:00
|
|
|
*file_position += padsize;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
}
|
|
|
|
|
2009-03-14 23:07:40 +00:00
|
|
|
if (gst_registry_binary_cache_write (cache, *file_position,
|
|
|
|
chunk->data, chunk->size) != chunk->size) {
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
GST_ERROR ("Failed to write binary registry element");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-04-16 14:18:58 +00:00
|
|
|
|
2009-03-14 23:07:40 +00:00
|
|
|
*file_position += chunk->size;
|
2008-08-11 19:04:04 +00:00
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-04-26 07:32:08 +00:00
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
/*
|
|
|
|
* gst_registry_binary_initialize_magic:
|
|
|
|
*
|
2007-04-25 11:44:29 +00:00
|
|
|
* Initialize the GstBinaryRegistryMagic, setting both our magic number and
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
* gstreamer major/minor version
|
|
|
|
*/
|
|
|
|
inline static gboolean
|
|
|
|
gst_registry_binary_initialize_magic (GstBinaryRegistryMagic * m)
|
|
|
|
{
|
2008-04-16 15:51:17 +00:00
|
|
|
memset (m, 0, sizeof (GstBinaryRegistryMagic));
|
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
if (!strncpy (m->magic, GST_MAGIC_BINARY_REGISTRY_STR,
|
|
|
|
GST_MAGIC_BINARY_REGISTRY_LEN)
|
2008-03-21 16:11:51 +00:00
|
|
|
|| !strncpy (m->version, GST_MAGIC_BINARY_VERSION_STR,
|
2008-03-21 15:52:14 +00:00
|
|
|
GST_MAGIC_BINARY_VERSION_LEN)) {
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
GST_ERROR ("Failed to write magic to the registry magic structure");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-04-16 14:18:58 +00:00
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_registry_binary_write_cache:
|
2007-07-25 13:00:23 +00:00
|
|
|
* @registry: a #GstRegistry
|
|
|
|
* @location: a filename
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
*
|
2007-07-25 13:00:23 +00:00
|
|
|
* Write the @registry to a cache to file at given @location.
|
2011-01-12 10:43:04 +00:00
|
|
|
*
|
2007-07-25 13:00:23 +00:00
|
|
|
* Returns: %TRUE on success.
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
2011-12-26 18:41:13 +00:00
|
|
|
priv_gst_registry_binary_write_cache (GstRegistry * registry, GList * plugins,
|
2011-08-29 11:27:26 +00:00
|
|
|
const char *location)
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
{
|
|
|
|
GList *walk;
|
2008-04-16 14:18:58 +00:00
|
|
|
GstBinaryRegistryMagic magic;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
GList *to_write = NULL;
|
|
|
|
unsigned long file_position = 0;
|
2008-08-11 19:04:04 +00:00
|
|
|
BinaryRegistryCache *cache;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
|
|
|
|
GST_INFO ("Building binary registry cache image");
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
|
|
|
|
|
2008-04-16 14:18:58 +00:00
|
|
|
if (!gst_registry_binary_initialize_magic (&magic))
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
goto fail;
|
|
|
|
|
|
|
|
/* iterate trough the list of plugins and fit them into binary structures */
|
2011-12-26 18:41:13 +00:00
|
|
|
for (walk = plugins; walk != NULL; walk = walk->next) {
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
GstPlugin *plugin = GST_PLUGIN (walk->data);
|
|
|
|
|
|
|
|
if (!plugin->filename)
|
|
|
|
continue;
|
|
|
|
|
2012-04-29 16:46:32 +00:00
|
|
|
if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_CACHED)) {
|
2010-07-08 19:04:54 +00:00
|
|
|
GStatBuf statbuf;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
|
2009-04-03 10:13:38 +00:00
|
|
|
if (g_stat (plugin->filename, &statbuf) < 0 ||
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
plugin->file_mtime != statbuf.st_mtime ||
|
|
|
|
plugin->file_size != statbuf.st_size)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-03-14 23:07:40 +00:00
|
|
|
if (!_priv_gst_registry_chunks_save_plugin (&to_write, registry, plugin)) {
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
GST_ERROR ("Can't write binary plugin information for \"%s\"",
|
|
|
|
plugin->filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-23 10:02:16 +00:00
|
|
|
_priv_gst_registry_chunks_save_global_header (&to_write, registry,
|
|
|
|
priv_gst_plugin_loading_get_whitelist_hash ());
|
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
GST_INFO ("Writing binary registry cache");
|
|
|
|
|
2008-08-11 19:04:04 +00:00
|
|
|
cache = gst_registry_binary_cache_init (registry, location);
|
|
|
|
if (!cache)
|
|
|
|
goto fail_free_list;
|
|
|
|
|
2008-04-16 14:18:58 +00:00
|
|
|
/* write magic */
|
2009-03-14 23:07:40 +00:00
|
|
|
if (gst_registry_binary_cache_write (cache, file_position,
|
2008-08-11 19:04:04 +00:00
|
|
|
&magic, sizeof (GstBinaryRegistryMagic)) !=
|
|
|
|
sizeof (GstBinaryRegistryMagic)) {
|
2008-04-16 14:18:58 +00:00
|
|
|
GST_ERROR ("Failed to write binary registry magic");
|
|
|
|
goto fail_free_list;
|
|
|
|
}
|
|
|
|
file_position += sizeof (GstBinaryRegistryMagic);
|
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
/* write out data chunks */
|
|
|
|
for (walk = to_write; walk; walk = g_list_next (walk)) {
|
2009-03-14 23:07:40 +00:00
|
|
|
GstRegistryChunk *cur = walk->data;
|
|
|
|
gboolean res;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
|
2009-03-14 23:07:40 +00:00
|
|
|
res = gst_registry_binary_write_chunk (cache, cur, &file_position);
|
2010-03-28 16:05:36 +00:00
|
|
|
|
|
|
|
_priv_gst_registry_chunk_free (cur);
|
2008-04-16 14:18:58 +00:00
|
|
|
walk->data = NULL;
|
2009-03-14 23:07:40 +00:00
|
|
|
if (!res)
|
|
|
|
goto fail_free_list;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
}
|
|
|
|
g_list_free (to_write);
|
|
|
|
|
2009-03-14 23:07:40 +00:00
|
|
|
if (!gst_registry_binary_cache_finish (cache, TRUE))
|
2008-08-11 19:04:04 +00:00
|
|
|
return FALSE;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* Errors */
|
2008-04-16 14:18:58 +00:00
|
|
|
fail_free_list:
|
|
|
|
{
|
|
|
|
for (walk = to_write; walk; walk = g_list_next (walk)) {
|
2009-03-14 23:07:40 +00:00
|
|
|
GstRegistryChunk *cur = walk->data;
|
2008-04-16 14:18:58 +00:00
|
|
|
|
2010-03-28 16:05:36 +00:00
|
|
|
if (cur)
|
|
|
|
_priv_gst_registry_chunk_free (cur);
|
2008-04-16 14:18:58 +00:00
|
|
|
}
|
|
|
|
g_list_free (to_write);
|
2008-08-11 19:04:04 +00:00
|
|
|
|
2008-10-08 10:07:15 +00:00
|
|
|
if (cache)
|
2009-03-14 23:07:40 +00:00
|
|
|
(void) gst_registry_binary_cache_finish (cache, FALSE);
|
2008-04-16 14:18:58 +00:00
|
|
|
/* fall through */
|
|
|
|
}
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
fail:
|
2007-12-16 18:29:25 +00:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
}
|
|
|
|
|
2007-04-26 07:32:08 +00:00
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
/* Registry loading */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* gst_registry_binary_check_magic:
|
|
|
|
*
|
|
|
|
* Check GstBinaryRegistryMagic validity.
|
2008-03-21 15:52:14 +00:00
|
|
|
* Return < 0 if something is wrong, -2 means
|
|
|
|
* that just the version of the registry is out of
|
|
|
|
* date, -1 is a general failure.
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
*/
|
2008-03-21 15:52:14 +00:00
|
|
|
static gint
|
2008-04-16 14:18:58 +00:00
|
|
|
gst_registry_binary_check_magic (gchar ** in, gsize size)
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
{
|
|
|
|
GstBinaryRegistryMagic *m;
|
|
|
|
|
2008-03-23 11:23:30 +00:00
|
|
|
align (*in);
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
GST_DEBUG ("Reading/casting for GstBinaryRegistryMagic at address %p", *in);
|
2009-03-26 11:07:56 +00:00
|
|
|
unpack_element (*in, m, GstBinaryRegistryMagic, (*in + size), fail);
|
2009-02-06 08:51:28 +00:00
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
if (strncmp (m->magic, GST_MAGIC_BINARY_REGISTRY_STR,
|
|
|
|
GST_MAGIC_BINARY_REGISTRY_LEN) != 0) {
|
2007-07-24 13:44:04 +00:00
|
|
|
GST_WARNING
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
("Binary registry magic is different : %02x%02x%02x%02x != %02x%02x%02x%02x",
|
|
|
|
GST_MAGIC_BINARY_REGISTRY_STR[0] & 0xff,
|
|
|
|
GST_MAGIC_BINARY_REGISTRY_STR[1] & 0xff,
|
|
|
|
GST_MAGIC_BINARY_REGISTRY_STR[2] & 0xff,
|
|
|
|
GST_MAGIC_BINARY_REGISTRY_STR[3] & 0xff, m->magic[0] & 0xff,
|
|
|
|
m->magic[1] & 0xff, m->magic[2] & 0xff, m->magic[3] & 0xff);
|
2008-03-21 15:52:14 +00:00
|
|
|
return -1;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
}
|
2008-03-21 16:11:51 +00:00
|
|
|
if (strncmp (m->version, GST_MAGIC_BINARY_VERSION_STR,
|
2008-03-21 15:52:14 +00:00
|
|
|
GST_MAGIC_BINARY_VERSION_LEN)) {
|
2007-07-24 13:44:04 +00:00
|
|
|
GST_WARNING ("Binary registry magic version is different : %s != %s",
|
2008-03-21 16:11:51 +00:00
|
|
|
GST_MAGIC_BINARY_VERSION_STR, m->version);
|
2008-03-21 15:52:14 +00:00
|
|
|
return -2;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
}
|
2008-04-16 14:18:58 +00:00
|
|
|
|
2008-03-21 15:52:14 +00:00
|
|
|
return 0;
|
2009-03-26 11:07:56 +00:00
|
|
|
|
|
|
|
fail:
|
|
|
|
GST_WARNING ("Not enough data for binary registry magic structure");
|
|
|
|
return -1;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_registry_binary_read_cache:
|
|
|
|
* @registry: a #GstRegistry
|
|
|
|
* @location: a filename
|
|
|
|
*
|
|
|
|
* Read the contents of the binary cache file at @location into @registry.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE on success.
|
|
|
|
*/
|
|
|
|
gboolean
|
2011-08-29 11:27:26 +00:00
|
|
|
priv_gst_registry_binary_read_cache (GstRegistry * registry,
|
|
|
|
const char *location)
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
{
|
|
|
|
GMappedFile *mapped = NULL;
|
|
|
|
gchar *contents = NULL;
|
|
|
|
gchar *in = NULL;
|
|
|
|
gsize size;
|
|
|
|
GError *err = NULL;
|
2007-04-26 07:32:08 +00:00
|
|
|
gboolean res = FALSE;
|
2010-06-23 10:02:16 +00:00
|
|
|
guint32 filter_env_hash = 0;
|
2008-03-21 15:52:14 +00:00
|
|
|
gint check_magic_result;
|
2008-11-03 12:29:10 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
GTimer *timer = NULL;
|
|
|
|
gdouble seconds;
|
|
|
|
#endif
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
|
|
|
|
/* make sure these types exist */
|
|
|
|
GST_TYPE_ELEMENT_FACTORY;
|
|
|
|
GST_TYPE_TYPE_FIND_FACTORY;
|
2012-10-16 16:27:04 +00:00
|
|
|
GST_TYPE_DEVICE_MONITOR_FACTORY;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
|
2008-11-03 12:29:10 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
timer = g_timer_new ();
|
2008-11-03 12:29:10 +00:00
|
|
|
#endif
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
|
|
|
|
mapped = g_mapped_file_new (location, FALSE, &err);
|
2009-06-29 09:23:31 +00:00
|
|
|
if (G_UNLIKELY (err != NULL)) {
|
2007-04-26 07:32:08 +00:00
|
|
|
GST_INFO ("Unable to mmap file %s : %s", location, err->message);
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
g_error_free (err);
|
2007-04-26 07:32:08 +00:00
|
|
|
err = NULL;
|
2009-03-14 23:07:40 +00:00
|
|
|
}
|
|
|
|
|
2009-12-04 14:00:44 +00:00
|
|
|
if (mapped == NULL) {
|
2009-03-14 23:07:40 +00:00
|
|
|
/* Error mmap-ing the cache, try a plain memory read */
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
|
2007-04-26 07:32:08 +00:00
|
|
|
g_file_get_contents (location, &contents, &size, &err);
|
|
|
|
if (err != NULL) {
|
|
|
|
GST_INFO ("Unable to read file %s : %s", location, err->message);
|
2009-02-02 13:19:57 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
2007-09-07 04:50:23 +00:00
|
|
|
g_timer_destroy (timer);
|
2009-02-02 13:19:57 +00:00
|
|
|
#endif
|
2007-04-26 07:32:08 +00:00
|
|
|
g_error_free (err);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
} else {
|
2009-12-04 14:00:44 +00:00
|
|
|
/* This can't fail if g_mapped_file_new() succeeded */
|
|
|
|
contents = g_mapped_file_get_contents (mapped);
|
|
|
|
size = g_mapped_file_get_length (mapped);
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
}
|
2009-03-26 11:07:56 +00:00
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
/* in is a cursor pointer, we initialize it with the begin of registry and is updated on each read */
|
|
|
|
in = contents;
|
2007-04-26 07:32:08 +00:00
|
|
|
GST_DEBUG ("File data at address %p", in);
|
2009-06-29 09:23:31 +00:00
|
|
|
if (G_UNLIKELY (size < sizeof (GstBinaryRegistryMagic))) {
|
2009-07-28 13:13:37 +00:00
|
|
|
GST_ERROR ("No or broken registry header for file at %s", location);
|
2007-04-26 07:32:08 +00:00
|
|
|
goto Error;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
}
|
2009-03-26 11:07:56 +00:00
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
/* check if header is valid */
|
2009-06-29 09:23:31 +00:00
|
|
|
if (G_UNLIKELY ((check_magic_result =
|
|
|
|
gst_registry_binary_check_magic (&in, size)) < 0)) {
|
2008-03-21 15:52:14 +00:00
|
|
|
|
|
|
|
if (check_magic_result == -1)
|
|
|
|
GST_ERROR
|
|
|
|
("Binary registry type not recognized (invalid magic) for file at %s",
|
|
|
|
location);
|
2007-04-26 07:32:08 +00:00
|
|
|
goto Error;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
}
|
|
|
|
|
2010-06-23 10:02:16 +00:00
|
|
|
if (!_priv_gst_registry_chunks_load_global_header (registry, &in,
|
|
|
|
contents + size, &filter_env_hash)) {
|
|
|
|
GST_ERROR ("Couldn't read global header chunk");
|
|
|
|
goto Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (filter_env_hash != priv_gst_plugin_loading_get_whitelist_hash ()) {
|
|
|
|
GST_INFO_OBJECT (registry, "Plugin loading filter environment changed, "
|
|
|
|
"ignoring plugin cache to force update with new filter environment");
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
/* check if there are plugins in the file */
|
2009-03-14 23:07:40 +00:00
|
|
|
if (G_UNLIKELY (!(((gsize) in + sizeof (GstRegistryChunkPluginElement)) <
|
2009-06-29 09:23:31 +00:00
|
|
|
(gsize) contents + size))) {
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
GST_INFO ("No binary plugins structure to read");
|
2007-04-26 07:32:08 +00:00
|
|
|
/* empty file, this is not an error */
|
|
|
|
} else {
|
2009-03-26 11:07:56 +00:00
|
|
|
gchar *end = contents + size;
|
2009-03-14 23:07:40 +00:00
|
|
|
/* read as long as we still have space for a GstRegistryChunkPluginElement */
|
2007-04-26 07:32:08 +00:00
|
|
|
for (;
|
2009-03-14 23:07:40 +00:00
|
|
|
((gsize) in + sizeof (GstRegistryChunkPluginElement)) <
|
2008-03-03 18:42:04 +00:00
|
|
|
(gsize) contents + size;) {
|
2007-07-17 09:44:51 +00:00
|
|
|
GST_DEBUG ("reading binary registry %" G_GSIZE_FORMAT "(%x)/%"
|
2008-03-03 18:42:04 +00:00
|
|
|
G_GSIZE_FORMAT, (gsize) in - (gsize) contents,
|
|
|
|
(guint) ((gsize) in - (gsize) contents), size);
|
2009-03-14 23:07:40 +00:00
|
|
|
if (!_priv_gst_registry_chunks_load_plugin (registry, &in, end, NULL)) {
|
2009-03-26 11:07:56 +00:00
|
|
|
GST_ERROR ("Problem while reading binary registry %s", location);
|
2007-04-26 07:32:08 +00:00
|
|
|
goto Error;
|
|
|
|
}
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-23 10:02:16 +00:00
|
|
|
done:
|
|
|
|
|
2008-11-03 12:29:10 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
g_timer_stop (timer);
|
|
|
|
seconds = g_timer_elapsed (timer, NULL);
|
2008-11-03 12:29:10 +00:00
|
|
|
#endif
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
|
|
|
|
GST_INFO ("loaded %s in %lf seconds", location, seconds);
|
|
|
|
|
2007-04-26 07:32:08 +00:00
|
|
|
res = TRUE;
|
2009-03-26 11:07:56 +00:00
|
|
|
/* TODO: once we re-use the pointers to registry contents, return here */
|
2007-04-26 07:32:08 +00:00
|
|
|
|
|
|
|
Error:
|
2008-11-03 12:29:10 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
2007-09-07 04:50:23 +00:00
|
|
|
g_timer_destroy (timer);
|
2008-11-03 12:29:10 +00:00
|
|
|
#endif
|
2007-04-26 07:32:08 +00:00
|
|
|
if (mapped) {
|
2009-12-03 18:48:11 +00:00
|
|
|
g_mapped_file_unref (mapped);
|
2007-04-26 07:32:08 +00:00
|
|
|
} else {
|
|
|
|
g_free (contents);
|
|
|
|
}
|
|
|
|
return res;
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* 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):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
}
|