From 43117a8d8699ca1b6522d473e7996978c36b7de7 Mon Sep 17 00:00:00 2001 From: Zaheer Merali Date: Mon, 16 Mar 2009 17:29:16 +0000 Subject: mxf: Replace g_hash_table_get_values with code working with glib 2.6. Fixes #575565 --- gst/mxf/mxfdemux.c | 15 ++++++++++----- gst/mxf/mxfmetadata.c | 25 +++++++++++++++++-------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index 902d89ed..cd3ed8ad 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -489,6 +489,15 @@ gst_mxf_demux_handle_primer_pack (GstMXFDemux * demux, const MXFUL * key, return GST_FLOW_OK; } +#if !GLIB_CHECK_VERSION (2, 16, 0) +static void +set_resolve_state_none (gpointer key, gpointer value, gpointer user_data) +{ + MXFMetadataBase *m = (MXFMetadataBase *) value; + m->resolved = MXF_METADATA_BASE_RESOLVE_STATE_NONE; +} +#endif + static GstFlowReturn gst_mxf_demux_resolve_references (GstMXFDemux * demux) { @@ -515,11 +524,7 @@ gst_mxf_demux_resolve_references (GstMXFDemux * demux) m->resolved = MXF_METADATA_BASE_RESOLVE_STATE_NONE; } #else - values = g_hash_table_get_values (demux->metadata); - for (l = values; l; l = l->next) { - m = l->data; - m->resolved = MXF_METADATA_BASE_RESOLVE_STATE_NONE; - } + g_hash_table_foreach (demux->metadata, set_resolve_state_none, NULL); #endif #if GLIB_CHECK_VERSION (2, 16, 0) diff --git a/gst/mxf/mxfmetadata.c b/gst/mxf/mxfmetadata.c index 7e724ae0..3fa52f81 100644 --- a/gst/mxf/mxfmetadata.c +++ b/gst/mxf/mxfmetadata.c @@ -62,6 +62,14 @@ mxf_metadata_base_resolve_default (MXFMetadataBase * self, return TRUE; } +#if !GLIB_CHECK_VERSION (2, 16, 0) +static void +build_values_in_hash_table (gpointer key, gpointer value, GList ** valuelist) +{ + *valuelist = g_list_prepend (*valuelist, value); +} +#endif + static GstStructure * mxf_metadata_base_to_structure_default (MXFMetadataBase * self) { @@ -96,9 +104,10 @@ mxf_metadata_base_to_structure_default (MXFMetadataBase * self) g_hash_table_iter_init (&iter, self->other_tags); #else - GList *l, *values; + GList *l, *values = NULL; - values = g_hash_table_get_values (self->other_tags); + g_hash_table_foreach (self->other_tags, build_values_in_hash_table, + &values); #endif g_value_init (&va, GST_TYPE_ARRAY); @@ -1227,9 +1236,9 @@ mxf_metadata_essence_container_data_resolve (MXFMetadataBase * m, g_hash_table_iter_init (&iter, metadata); #else - GList *l, *values; + GList *l, *values = NULL; - values = g_hash_table_get_values (metadata); + g_hash_table_foreach (metadata, build_values_in_hash_table, &values); #endif #if GLIB_CHECK_VERSION (2, 16, 0) @@ -2586,9 +2595,9 @@ mxf_metadata_source_clip_resolve (MXFMetadataBase * m, GHashTable * metadata) g_hash_table_iter_init (&iter, metadata); #else - GList *l, *values; + GList *l, *values = NULL; - values = g_hash_table_get_values (metadata); + g_hash_table_foreach (metadata, build_values_in_hash_table, &values); #endif #if GLIB_CHECK_VERSION (2, 16, 0) @@ -3457,8 +3466,8 @@ mxf_metadata_generic_picture_essence_descriptor_to_structure (MXFMetadataBase * { GstStructure *ret = MXF_METADATA_BASE_CLASS - (mxf_metadata_generic_picture_essence_descriptor_parent_class)->to_structure - (m); + (mxf_metadata_generic_picture_essence_descriptor_parent_class)-> + to_structure (m); MXFMetadataGenericPictureEssenceDescriptor *self = MXF_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (m); gchar str[48]; -- cgit v1.2.1