index 5c59c2be1121ee5fdc929fec0ccc9fdb0c116db2..c8c8fb1f5d5eaa80650b07dd0b078ad2ee8ed713 100644 (file)
#include <fcntl.h>
#include <string.h>
+#ifdef GST_DISABLE_DEPRECATED
+#include <libxml/parser.h>
+#endif
+
+#include "gstindexers.h"
+
#define GST_TYPE_FILE_INDEX \
(gst_file_index_get_type ())
#define GST_FILE_INDEX(obj) \
ARG_LOCATION,
};
-static void gst_file_index_class_init (GstFileIndexClass * klass);
-static void gst_file_index_init (GstFileIndex * index);
static void gst_file_index_dispose (GObject * object);
static void
@@ -142,33 +146,9 @@ static GstIndexEntry *gst_file_index_get_assoc_entry (GstIndex * index, gint id,
#define CLASS(file_index) GST_FILE_INDEX_CLASS (G_OBJECT_GET_CLASS (file_index))
-static GstIndex *parent_class = NULL;
+GType gst_file_index_get_type (void);
-GType
-gst_file_index_get_type (void)
-{
- static GType file_index_type = 0;
-
- if (!file_index_type) {
- static const GTypeInfo file_index_info = {
- sizeof (GstFileIndexClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_file_index_class_init,
- NULL,
- NULL,
- sizeof (GstFileIndex),
- 1,
- (GInstanceInitFunc) gst_file_index_init,
- NULL
- };
-
- file_index_type =
- g_type_register_static (GST_TYPE_INDEX, "GstFileIndex",
- &file_index_info, 0);
- }
- return file_index_type;
-}
+G_DEFINE_TYPE (GstFileIndex, gst_file_index, GST_TYPE_INDEX);
static void
gst_file_index_class_init (GstFileIndexClass * klass)
gobject_class = (GObjectClass *) klass;
gstindex_class = (GstIndexClass *) klass;
- parent_class = g_type_class_peek_parent (klass);
-
gobject_class->dispose = gst_file_index_dispose;
gobject_class->set_property = gst_file_index_set_property;
gobject_class->get_property = gst_file_index_get_property;
g_object_class_install_property (gobject_class, ARG_LOCATION,
g_param_spec_string ("location", "File Location",
- "Location of the index file", NULL, G_PARAM_READWRITE));
+ "Location of the index file", NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
static void
munmap (index_id->array->data, ARRAY_TOTAL_SIZE (index_id));
g_array_free (index_id->array, !is_mmapped);
}
- g_free (index_id);
+ g_slice_free (GstFileIndexId, index_id);
}
static gboolean
gst_index_entry_free (index->ret_entry); /* hack */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (gst_file_index_parent_class)->dispose (object);
}
struct fi_find_writer_context
GstFileIndexId *ii;
};
-void
+static void
_fi_find_writer (gpointer key, gpointer val, gpointer data)
{
struct fi_find_writer_context *cx = data;
continue;
}
- id_index = g_new0 (GstFileIndexId, 1);
+ id_index = g_slice_new0 (GstFileIndexId);
id_index->id_desc = (char *) xmlGetProp (writer, (xmlChar *) "id");
for (wpart = writer->children; wpart; wpart = wpart->next) {
_file_index_id_save_xml (gpointer _key, GstFileIndexId * ii, xmlNodePtr writers)
{
const gint bufsize = 16;
- gchar buf[bufsize];
+ gchar buf[16];
xmlNodePtr writer;
xmlNodePtr formats;
gint xx;
id_index = g_hash_table_lookup (fileindex->id_index, &entry->id);
if (!id_index) {
- id_index = g_new0 (GstFileIndexId, 1);
+ id_index = g_slice_new0 (GstFileIndexId);
id_index->id = entry->id;
id_index->id_desc = g_strdup (entry->data.id.description);
}
/* this is a hack, we should use a private structure instead */
- sample.format = 0;
+ sample.format = GST_FORMAT_UNDEFINED;
sample.value = GST_INDEX_ASSOC_VALUE (entry, 0);
exact =
}
{
- gchar row_data[ARRAY_ROW_SIZE (id_index)];
+ gchar *row_data = (gchar *) g_malloc (ARRAY_ROW_SIZE (id_index));
gint fx;
gint32 flags_host = GST_INDEX_ASSOC_FLAGS (entry);
}
g_array_insert_vals (id_index->array, mx, row_data, 1);
+
+ g_free (row_data);
}
}
}
/* this is a hack, we should use a private structure instead */
- sample.format = formatx;
+ sample.format = (GstFormat) formatx;
sample.value = value;
exact = _fc_bsearch (id_index->array, ARRAY_ROW_SIZE (id_index),
/* entry memory management needs improvement FIXME */
if (!fileindex->ret_entry)
- fileindex->ret_entry = g_new0 (GstIndexEntry, 1);
+ fileindex->ret_entry = g_slice_new0 (GstIndexEntry);
entry = fileindex->ret_entry;
if (entry->data.assoc.assocs) {
g_free (entry->data.assoc.assocs);
{
gint32 flags_be = ARRAY_ROW_FLAGS (row_data);
- GST_INDEX_ASSOC_FLAGS (entry) = GINT32_FROM_BE (flags_be);
+ GST_INDEX_ASSOC_FLAGS (entry) = (GstAssocFlags) GINT32_FROM_BE (flags_be);
for (xx = 0; xx < id_index->nformats; xx++) {
gint64 val_be = ARRAY_ROW_VALUE (row_data, xx);
return FALSE;
}
- GST_PLUGIN_FEATURE (factory)->plugin_name = g_strdup (plugin->desc.name);
+ GST_PLUGIN_FEATURE (factory)->plugin_name = plugin->desc.name;
GST_PLUGIN_FEATURE (factory)->loaded = TRUE;
gst_registry_add_feature (gst_registry_get_default (),