equal
deleted
inserted
replaced
16 * License along with this library; if not, write to the |
16 * License along with this library; if not, write to the |
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 * Boston, MA 02111-1307, USA. |
18 * Boston, MA 02111-1307, USA. |
19 */ |
19 */ |
20 |
20 |
21 #ifdef __SYMBIAN32__ |
|
22 #include <gst_global.h> |
|
23 #endif |
|
24 #include <gst/gst.h> |
21 #include <gst/gst.h> |
25 |
22 |
26 #include <unistd.h> |
23 #include <unistd.h> |
27 #include <sys/mman.h> |
24 #include <sys/mman.h> |
28 #include <sys/stat.h> |
25 #include <sys/stat.h> |
193 gstindex_class->commit = gst_file_index_commit; |
190 gstindex_class->commit = gst_file_index_commit; |
194 gstindex_class->get_writer_id = gst_file_index_get_writer_id; |
191 gstindex_class->get_writer_id = gst_file_index_get_writer_id; |
195 |
192 |
196 g_object_class_install_property (gobject_class, ARG_LOCATION, |
193 g_object_class_install_property (gobject_class, ARG_LOCATION, |
197 g_param_spec_string ("location", "File Location", |
194 g_param_spec_string ("location", "File Location", |
198 "Location of the index file", NULL, G_PARAM_READWRITE)); |
195 "Location of the index file", NULL, |
|
196 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
199 } |
197 } |
200 |
198 |
201 static void |
199 static void |
202 gst_file_index_init (GstFileIndex * index) |
200 gst_file_index_init (GstFileIndex * index) |
203 { |
201 { |
216 if (index_id->array) { |
214 if (index_id->array) { |
217 if (is_mmapped) |
215 if (is_mmapped) |
218 munmap (index_id->array->data, ARRAY_TOTAL_SIZE (index_id)); |
216 munmap (index_id->array->data, ARRAY_TOTAL_SIZE (index_id)); |
219 g_array_free (index_id->array, !is_mmapped); |
217 g_array_free (index_id->array, !is_mmapped); |
220 } |
218 } |
221 g_free (index_id); |
219 g_slice_free (GstFileIndexId, index_id); |
222 } |
220 } |
223 |
221 |
224 static gboolean |
222 static gboolean |
225 _id_index_free_helper (gpointer _key, GstFileIndexId * index_id, |
223 _id_index_free_helper (gpointer _key, GstFileIndexId * index_id, |
226 GstFileIndex * index) |
224 GstFileIndex * index) |
403 GST_ERROR_OBJECT (index, |
401 GST_ERROR_OBJECT (index, |
404 "Can't open '%s': %s", path, g_strerror (errno)); |
402 "Can't open '%s': %s", path, g_strerror (errno)); |
405 continue; |
403 continue; |
406 } |
404 } |
407 |
405 |
408 id_index = g_new0 (GstFileIndexId, 1); |
406 id_index = g_slice_new0 (GstFileIndexId); |
409 id_index->id_desc = (char *) xmlGetProp (writer, (xmlChar *) "id"); |
407 id_index->id_desc = (char *) xmlGetProp (writer, (xmlChar *) "id"); |
410 |
408 |
411 for (wpart = writer->children; wpart; wpart = wpart->next) { |
409 for (wpart = writer->children; wpart; wpart = wpart->next) { |
412 if (strcmp ((char *) wpart->name, "formats") == 0) { |
410 if (strcmp ((char *) wpart->name, "formats") == 0) { |
413 xmlChar *count_str = xmlGetProp (wpart, (xmlChar *) "count"); |
411 xmlChar *count_str = xmlGetProp (wpart, (xmlChar *) "count"); |
668 GstFileIndexId *id_index; |
666 GstFileIndexId *id_index; |
669 |
667 |
670 id_index = g_hash_table_lookup (fileindex->id_index, &entry->id); |
668 id_index = g_hash_table_lookup (fileindex->id_index, &entry->id); |
671 |
669 |
672 if (!id_index) { |
670 if (!id_index) { |
673 id_index = g_new0 (GstFileIndexId, 1); |
671 id_index = g_slice_new0 (GstFileIndexId); |
674 |
672 |
675 id_index->id = entry->id; |
673 id_index->id = entry->id; |
676 id_index->id_desc = g_strdup (entry->data.id.description); |
674 id_index->id_desc = g_strdup (entry->data.id.description); |
677 |
675 |
678 /* It would be useful to know the GType of the writer so |
676 /* It would be useful to know the GType of the writer so |
972 row_data = id_index->array->data + mx * ARRAY_ROW_SIZE (id_index); |
970 row_data = id_index->array->data + mx * ARRAY_ROW_SIZE (id_index); |
973 } |
971 } |
974 |
972 |
975 /* entry memory management needs improvement FIXME */ |
973 /* entry memory management needs improvement FIXME */ |
976 if (!fileindex->ret_entry) |
974 if (!fileindex->ret_entry) |
977 fileindex->ret_entry = g_new0 (GstIndexEntry, 1); |
975 fileindex->ret_entry = g_slice_new0 (GstIndexEntry); |
978 entry = fileindex->ret_entry; |
976 entry = fileindex->ret_entry; |
979 if (entry->data.assoc.assocs) { |
977 if (entry->data.assoc.assocs) { |
980 g_free (entry->data.assoc.assocs); |
978 g_free (entry->data.assoc.assocs); |
981 entry->data.assoc.assocs = NULL; |
979 entry->data.assoc.assocs = NULL; |
982 } |
980 } |