mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
mxf: Unconditionally use GLib 2.16 API
This commit is contained in:
parent
182e751b5d
commit
53128c5b4f
3 changed files with 1 additions and 129 deletions
|
@ -483,32 +483,11 @@ gst_mxf_demux_handle_primer_pack (GstMXFDemux * demux, const MXFUL * key,
|
||||||
return GST_FLOW_OK;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
build_values_in_hash_table (gpointer key, gpointer value, gpointer user_data)
|
|
||||||
{
|
|
||||||
GList **valuelist = (GList **) (user_data);
|
|
||||||
|
|
||||||
*valuelist = g_list_prepend (*valuelist, value);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_mxf_demux_resolve_references (GstMXFDemux * demux)
|
gst_mxf_demux_resolve_references (GstMXFDemux * demux)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
#else
|
|
||||||
GList *l, *values = NULL;
|
|
||||||
#endif
|
|
||||||
MXFMetadataBase *m = NULL;
|
MXFMetadataBase *m = NULL;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstTagList *taglist;
|
GstTagList *taglist;
|
||||||
|
@ -523,26 +502,15 @@ gst_mxf_demux_resolve_references (GstMXFDemux * demux)
|
||||||
g_static_rw_lock_writer_unlock (&demux->metadata_lock);
|
g_static_rw_lock_writer_unlock (&demux->metadata_lock);
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
g_hash_table_iter_init (&iter, demux->metadata);
|
g_hash_table_iter_init (&iter, demux->metadata);
|
||||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer) & m)) {
|
while (g_hash_table_iter_next (&iter, NULL, (gpointer) & m)) {
|
||||||
m->resolved = MXF_METADATA_BASE_RESOLVE_STATE_NONE;
|
m->resolved = MXF_METADATA_BASE_RESOLVE_STATE_NONE;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
g_hash_table_foreach (demux->metadata, set_resolve_state_none, NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
g_hash_table_iter_init (&iter, demux->metadata);
|
g_hash_table_iter_init (&iter, demux->metadata);
|
||||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer) & m)) {
|
while (g_hash_table_iter_next (&iter, NULL, (gpointer) & m)) {
|
||||||
gboolean resolved;
|
gboolean resolved;
|
||||||
#else
|
|
||||||
g_hash_table_foreach (demux->metadata, build_values_in_hash_table, &values);
|
|
||||||
for (l = values; l; l = l->next) {
|
|
||||||
gboolean resolved;
|
|
||||||
|
|
||||||
m = l->data;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
resolved = mxf_metadata_base_resolve (m, demux->metadata);
|
resolved = mxf_metadata_base_resolve (m, demux->metadata);
|
||||||
|
|
||||||
|
@ -564,19 +532,11 @@ gst_mxf_demux_resolve_references (GstMXFDemux * demux)
|
||||||
gst_element_found_tags (GST_ELEMENT (demux), taglist);
|
gst_element_found_tags (GST_ELEMENT (demux), taglist);
|
||||||
gst_structure_free (structure);
|
gst_structure_free (structure);
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
g_list_free (values);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_static_rw_lock_writer_unlock (&demux->metadata_lock);
|
g_static_rw_lock_writer_unlock (&demux->metadata_lock);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
#if !GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
g_list_free (values);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
demux->metadata_resolved = FALSE;
|
demux->metadata_resolved = FALSE;
|
||||||
g_static_rw_lock_writer_unlock (&demux->metadata_lock);
|
g_static_rw_lock_writer_unlock (&demux->metadata_lock);
|
||||||
|
|
||||||
|
|
|
@ -62,15 +62,6 @@ mxf_metadata_base_resolve_default (MXFMetadataBase * self,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
static void
|
|
||||||
build_values_in_hash_table (gpointer key, gpointer value, gpointer user_data)
|
|
||||||
{
|
|
||||||
GList **valuelist = (GList **) (user_data);
|
|
||||||
*valuelist = g_list_prepend (*valuelist, value);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static GstStructure *
|
static GstStructure *
|
||||||
mxf_metadata_base_to_structure_default (MXFMetadataBase * self)
|
mxf_metadata_base_to_structure_default (MXFMetadataBase * self)
|
||||||
{
|
{
|
||||||
|
@ -100,26 +91,12 @@ mxf_metadata_base_to_structure_default (MXFMetadataBase * self)
|
||||||
GValue v = { 0, };
|
GValue v = { 0, };
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
|
|
||||||
g_hash_table_iter_init (&iter, self->other_tags);
|
g_hash_table_iter_init (&iter, self->other_tags);
|
||||||
#else
|
|
||||||
GList *l, *values = NULL;
|
|
||||||
|
|
||||||
g_hash_table_foreach (self->other_tags, build_values_in_hash_table,
|
|
||||||
&values);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_value_init (&va, GST_TYPE_ARRAY);
|
g_value_init (&va, GST_TYPE_ARRAY);
|
||||||
|
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer) & tag)) {
|
while (g_hash_table_iter_next (&iter, NULL, (gpointer) & tag)) {
|
||||||
#else
|
|
||||||
for (l = values; l; l = l->next) {
|
|
||||||
tag = l->data;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_value_init (&v, GST_TYPE_STRUCTURE);
|
g_value_init (&v, GST_TYPE_STRUCTURE);
|
||||||
s = gst_structure_id_empty_new (MXF_QUARK (TAG));
|
s = gst_structure_id_empty_new (MXF_QUARK (TAG));
|
||||||
|
|
||||||
|
@ -140,10 +117,6 @@ mxf_metadata_base_to_structure_default (MXFMetadataBase * self)
|
||||||
|
|
||||||
gst_structure_id_set_value (ret, MXF_QUARK (OTHER_TAGS), &va);
|
gst_structure_id_set_value (ret, MXF_QUARK (OTHER_TAGS), &va);
|
||||||
g_value_unset (&va);
|
g_value_unset (&va);
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
g_list_free (values);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -261,22 +234,11 @@ mxf_metadata_base_to_buffer (MXFMetadataBase * self, MXFPrimerPack * primer)
|
||||||
/* Add unknown tags */
|
/* Add unknown tags */
|
||||||
if (self->other_tags) {
|
if (self->other_tags) {
|
||||||
MXFLocalTag *tmp;
|
MXFLocalTag *tmp;
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
|
|
||||||
g_hash_table_iter_init (&iter, self->other_tags);
|
g_hash_table_iter_init (&iter, self->other_tags);
|
||||||
#else
|
|
||||||
GList *l, *values;
|
|
||||||
|
|
||||||
values = g_hash_table_get_values (self->other_tags);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer) & t)) {
|
while (g_hash_table_iter_next (&iter, NULL, (gpointer) & t)) {
|
||||||
#else
|
|
||||||
for (l = values; l; l = l->next) {
|
|
||||||
t = l->data;
|
|
||||||
#endif
|
|
||||||
tmp = g_slice_dup (MXFLocalTag, t);
|
tmp = g_slice_dup (MXFLocalTag, t);
|
||||||
if (t->g_slice) {
|
if (t->g_slice) {
|
||||||
tmp->data = g_slice_alloc (t->size);
|
tmp->data = g_slice_alloc (t->size);
|
||||||
|
@ -287,10 +249,6 @@ mxf_metadata_base_to_buffer (MXFMetadataBase * self, MXFPrimerPack * primer)
|
||||||
}
|
}
|
||||||
tags = g_list_prepend (tags, tmp);
|
tags = g_list_prepend (tags, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
g_list_free (values);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
l = g_list_last (tags);
|
l = g_list_last (tags);
|
||||||
|
@ -1646,22 +1604,11 @@ mxf_metadata_essence_container_data_resolve (MXFMetadataBase * m,
|
||||||
MXFMetadataEssenceContainerData *self =
|
MXFMetadataEssenceContainerData *self =
|
||||||
MXF_METADATA_ESSENCE_CONTAINER_DATA (m);
|
MXF_METADATA_ESSENCE_CONTAINER_DATA (m);
|
||||||
MXFMetadataBase *current = NULL;
|
MXFMetadataBase *current = NULL;
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
|
|
||||||
g_hash_table_iter_init (&iter, metadata);
|
g_hash_table_iter_init (&iter, metadata);
|
||||||
#else
|
|
||||||
GList *l, *values = NULL;
|
|
||||||
|
|
||||||
g_hash_table_foreach (metadata, build_values_in_hash_table, &values);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer) & current)) {
|
while (g_hash_table_iter_next (&iter, NULL, (gpointer) & current)) {
|
||||||
#else
|
|
||||||
for (l = values; l; l = l->next) {
|
|
||||||
current = l->data;
|
|
||||||
#endif
|
|
||||||
if (MXF_IS_METADATA_SOURCE_PACKAGE (current)) {
|
if (MXF_IS_METADATA_SOURCE_PACKAGE (current)) {
|
||||||
MXFMetadataSourcePackage *package = MXF_METADATA_SOURCE_PACKAGE (current);
|
MXFMetadataSourcePackage *package = MXF_METADATA_SOURCE_PACKAGE (current);
|
||||||
|
|
||||||
|
@ -1675,10 +1622,6 @@ mxf_metadata_essence_container_data_resolve (MXFMetadataBase * m,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
g_list_free (values);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!self->linked_package) {
|
if (!self->linked_package) {
|
||||||
GST_ERROR ("Couldn't resolve a package");
|
GST_ERROR ("Couldn't resolve a package");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -3390,22 +3333,11 @@ mxf_metadata_source_clip_resolve (MXFMetadataBase * m, GHashTable * metadata)
|
||||||
{
|
{
|
||||||
MXFMetadataSourceClip *self = MXF_METADATA_SOURCE_CLIP (m);
|
MXFMetadataSourceClip *self = MXF_METADATA_SOURCE_CLIP (m);
|
||||||
MXFMetadataBase *current = NULL;
|
MXFMetadataBase *current = NULL;
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
|
|
||||||
g_hash_table_iter_init (&iter, metadata);
|
g_hash_table_iter_init (&iter, metadata);
|
||||||
#else
|
|
||||||
GList *l, *values = NULL;
|
|
||||||
|
|
||||||
g_hash_table_foreach (metadata, build_values_in_hash_table, &values);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer) & current)) {
|
while (g_hash_table_iter_next (&iter, NULL, (gpointer) & current)) {
|
||||||
#else
|
|
||||||
for (l = values; l; l = l->next) {
|
|
||||||
current = l->data;
|
|
||||||
#endif
|
|
||||||
if (MXF_IS_METADATA_SOURCE_PACKAGE (current)) {
|
if (MXF_IS_METADATA_SOURCE_PACKAGE (current)) {
|
||||||
MXFMetadataGenericPackage *p = MXF_METADATA_GENERIC_PACKAGE (current);
|
MXFMetadataGenericPackage *p = MXF_METADATA_GENERIC_PACKAGE (current);
|
||||||
|
|
||||||
|
@ -3416,10 +3348,6 @@ mxf_metadata_source_clip_resolve (MXFMetadataBase * m, GHashTable * metadata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
g_list_free (values);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return
|
return
|
||||||
MXF_METADATA_BASE_CLASS (mxf_metadata_source_clip_parent_class)->resolve
|
MXF_METADATA_BASE_CLASS (mxf_metadata_source_clip_parent_class)->resolve
|
||||||
(m, metadata);
|
(m, metadata);
|
||||||
|
|
|
@ -1458,32 +1458,16 @@ mxf_primer_pack_to_buffer (const MXFPrimerPack * pack)
|
||||||
if (pack->mappings) {
|
if (pack->mappings) {
|
||||||
guint local_tag;
|
guint local_tag;
|
||||||
MXFUL *ul;
|
MXFUL *ul;
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
|
|
||||||
g_hash_table_iter_init (&iter, pack->mappings);
|
g_hash_table_iter_init (&iter, pack->mappings);
|
||||||
#else
|
|
||||||
GList *l, *keys;
|
|
||||||
|
|
||||||
keys = g_hash_table_get_keys (pack->mappings);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
while (g_hash_table_iter_next (&iter, (gpointer) & local_tag,
|
while (g_hash_table_iter_next (&iter, (gpointer) & local_tag,
|
||||||
(gpointer) & ul)) {
|
(gpointer) & ul)) {
|
||||||
#else
|
|
||||||
for (l = keys; l; l = l->next) {
|
|
||||||
local_tag = GPOINTER_TO_UINT (l->data);
|
|
||||||
ul = g_hash_table_lookup (pack->mappings, GUINT_TO_POINTER (local_tag));
|
|
||||||
#endif
|
|
||||||
GST_WRITE_UINT16_BE (data, local_tag);
|
GST_WRITE_UINT16_BE (data, local_tag);
|
||||||
memcpy (data + 2, ul, 16);
|
memcpy (data + 2, ul, 16);
|
||||||
data += 18;
|
data += 18;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION (2, 16, 0)
|
|
||||||
g_list_free (keys);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue