docs/gst/gstreamer-sections.txt: Add GST_CHECK_VERSION to the docs

Original commit message from CVS:
2008-02-01  Julien Moutte  <julien@fluendo.com>

* docs/gst/gstreamer-sections.txt: Add GST_CHECK_VERSION to the
docs
* gst/gstindex.c: (gst_index_class_init),
(gst_index_free_writer),
(gst_index_finalize), (gst_index_entry_free),
(gst_index_add_association): Fix memory leaks.
* gst/gstversion.h.in: Add GST_CHECK_VERSION macro.
* plugins/indexers/gstmemindex.c: (gst_mem_index_class_init),
(gst_mem_index_free_format), (gst_mem_index_free_id),
(gst_mem_index_finalize): Fix memory leaks.
* win32/common/config.h: Updated to CVS HEAD.
This commit is contained in:
Julien Moutte 2008-02-01 16:37:22 +00:00
parent 036d5105f5
commit 056d393725
6 changed files with 141 additions and 12 deletions

View file

@ -1,3 +1,15 @@
2008-02-01 Julien Moutte <julien@fluendo.com>
* docs/gst/gstreamer-sections.txt: Add GST_CHECK_VERSION to the docs
* gst/gstindex.c: (gst_index_class_init), (gst_index_free_writer),
(gst_index_finalize), (gst_index_entry_free),
(gst_index_add_association): Fix memory leaks.
* gst/gstversion.h.in: Add GST_CHECK_VERSION macro.
* plugins/indexers/gstmemindex.c: (gst_mem_index_class_init),
(gst_mem_index_free_format), (gst_mem_index_free_id),
(gst_mem_index_finalize): Fix memory leaks.
* win32/common/config.h: Updated to CVS HEAD.
2008-02-01 Stefan Kost <ensonic@users.sf.net>
* docs/README:

View file

@ -2318,6 +2318,7 @@ GST_VERSION_MAJOR
GST_VERSION_MINOR
GST_VERSION_MICRO
GST_VERSION_NANO
GST_CHECK_VERSION
</SECTION>

View file

@ -56,6 +56,7 @@ enum
static void gst_index_class_init (GstIndexClass * klass);
static void gst_index_init (GstIndex * index);
static void gst_index_finalize (GObject * object);
static void gst_index_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -171,6 +172,7 @@ gst_index_class_init (GstIndexClass * klass)
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_index_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_index_get_property);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_index_finalize);
g_object_class_install_property (gobject_class, ARG_RESOLVER,
g_param_spec_enum ("resolver", "Resolver",
@ -198,6 +200,34 @@ gst_index_init (GstIndex * index)
GST_DEBUG ("created new index");
}
static void
gst_index_free_writer (gpointer key, gpointer value, gpointer user_data)
{
GstIndexEntry *entry = (GstIndexEntry *) value;
if (entry) {
gst_index_entry_free (entry);
}
}
static void
gst_index_finalize (GObject * object)
{
GstIndex *index = GST_INDEX (object);
if (index->groups) {
g_list_foreach (index->groups, (GFunc) g_free, NULL);
g_list_free (index->groups);
index->groups = NULL;
}
if (index->writers) {
g_hash_table_foreach (index->writers, gst_index_free_writer, NULL);
g_hash_table_destroy (index->writers);
index->writers = NULL;
}
}
static void
gst_index_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
@ -470,6 +500,33 @@ gst_index_entry_copy (GstIndexEntry * entry)
void
gst_index_entry_free (GstIndexEntry * entry)
{
switch (entry->type) {
case GST_INDEX_ENTRY_ID:
if (entry->data.id.description) {
g_free (entry->data.id.description);
entry->data.id.description = NULL;
}
break;
case GST_INDEX_ENTRY_ASSOCIATION:
if (entry->data.assoc.assocs) {
g_free (entry->data.assoc.assocs);
entry->data.assoc.assocs = NULL;
}
break;
case GST_INDEX_ENTRY_OBJECT:
if (entry->data.object.key) {
g_free (entry->data.object.key);
entry->data.object.key = NULL;
}
break;
case GST_INDEX_ENTRY_FORMAT:
if (entry->data.format.key) {
g_free (entry->data.format.key);
entry->data.format.key = NULL;
}
break;
}
g_free (entry);
}

View file

@ -66,6 +66,23 @@ G_BEGIN_DECLS
*/
#define GST_VERSION_NANO (@PACKAGE_VERSION_NANO@)
/**
* GST_CHECK_VERSION:
* @major: a number indicating the major version
* @minor: a number indicating the minor version
* @micro: a number indicating the micro version
*
* Check whether a GStreamer version equal to or greater than
* major.minor.micro is present.
*
* Since: 0.10.18
*/
#define GST_CHECK_VERSION(major,minor,micro) \
(GST_VERSION_MAJOR > (major) || \
(GST_VERSION_MAJOR == (major) && GST_VERSION_MINOR > (minor)) || \
(GST_VERSION_MAJOR == (major) && GST_VERSION_MINOR == (minor) && \
GST_VERSION_MICRO >= (micro)))
G_END_DECLS
#endif /* __GST_VERSION_H__ */

View file

@ -107,7 +107,7 @@ enum
static void gst_mem_index_class_init (GstMemIndexClass * klass);
static void gst_mem_index_init (GstMemIndex * index);
static void gst_mem_index_dispose (GObject * object);
static void gst_mem_index_finalize (GObject * object);
static void gst_mem_index_add_entry (GstIndex * index, GstIndexEntry * entry);
static GstIndexEntry *gst_mem_index_get_assoc_entry (GstIndex * index, gint id,
@ -157,10 +157,11 @@ gst_mem_index_class_init (GstMemIndexClass * klass)
parent_class = g_type_class_peek_parent (klass);
gobject_class->dispose = gst_mem_index_dispose;
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_mem_index_finalize);
gstindex_class->add_entry = gst_mem_index_add_entry;
gstindex_class->get_assoc_entry = gst_mem_index_get_assoc_entry;
gstindex_class->add_entry = GST_DEBUG_FUNCPTR (gst_mem_index_add_entry);
gstindex_class->get_assoc_entry =
GST_DEBUG_FUNCPTR (gst_mem_index_get_assoc_entry);
}
static void
@ -173,11 +174,52 @@ gst_mem_index_init (GstMemIndex * index)
}
static void
gst_mem_index_dispose (GObject * object)
gst_mem_index_free_format (gpointer key, gpointer value, gpointer user_data)
{
//GstMemIndex *memindex = GST_MEM_INDEX (object);
GstMemIndexFormatIndex *index = (GstMemIndexFormatIndex *) value;
G_OBJECT_CLASS (parent_class)->dispose (object);
if (index->tree) {
g_tree_destroy (index->tree);
}
g_free (index);
}
static void
gst_mem_index_free_id (gpointer key, gpointer value, gpointer user_data)
{
GstMemIndexId *id_index = (GstMemIndexId *) value;
if (id_index->format_index) {
g_hash_table_foreach (id_index->format_index, gst_mem_index_free_format,
NULL);
g_hash_table_destroy (id_index->format_index);
id_index->format_index = NULL;
}
g_free (id_index);
}
static void
gst_mem_index_finalize (GObject * object)
{
GstMemIndex *memindex = GST_MEM_INDEX (object);
/* Delete the trees referencing the associations first */
if (memindex->id_index) {
g_hash_table_foreach (memindex->id_index, gst_mem_index_free_id, NULL);
g_hash_table_destroy (memindex->id_index);
memindex->id_index = NULL;
}
/* Then delete the associations themselves */
if (memindex->associations) {
g_list_foreach (memindex->associations, (GFunc) gst_index_entry_free, NULL);
g_list_free (memindex->associations);
memindex->associations = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void

View file

@ -24,7 +24,7 @@
/* #undef GST_GCOV_ENABLED */
/* Default errorlevel to use */
#define GST_LEVEL_DEFAULT GST_LEVEL_NONE
#define GST_LEVEL_DEFAULT GST_LEVEL_ERROR
/* GStreamer license */
#define GST_LICENSE "LGPL"
@ -33,7 +33,7 @@
#define GST_MAJORMINOR "0.10"
/* package name in plugins */
#define GST_PACKAGE_NAME "GStreamer source release"
#define GST_PACKAGE_NAME "GStreamer CVS/prerelease"
/* package origin */
#define GST_PACKAGE_ORIGIN "Unknown package origin"
@ -197,13 +197,13 @@
#define PACKAGE_NAME "GStreamer"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "GStreamer 0.10.17"
#define PACKAGE_STRING "GStreamer 0.10.17.1"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "gstreamer"
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.10.17"
#define PACKAGE_VERSION "0.10.17.1"
/* Define the plugin directory */
#ifdef _DEBUG
@ -219,7 +219,7 @@
#undef USE_POISONING
/* Version number of package */
#define VERSION "0.10.17"
#define VERSION "0.10.17.1"
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */