mxf: Add convenience function for looking up primer tags

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3899>
This commit is contained in:
Edward Hervey 2023-02-06 15:57:58 +01:00 committed by Edward Hervey
parent aeb262a7e1
commit 56a50c3008
3 changed files with 11 additions and 5 deletions

View file

@ -141,9 +141,8 @@ mxf_metadata_mpeg_video_descriptor_handle_tag (MXFMetadataBase * metadata,
gboolean ret = TRUE; gboolean ret = TRUE;
MXFUL *tag_ul = NULL; MXFUL *tag_ul = NULL;
if (!(tag_ul = tag_ul = mxf_primer_tag_to_ul (primer, tag);
(MXFUL *) g_hash_table_lookup (primer->mappings, if (!tag_ul)
GUINT_TO_POINTER (((guint) tag)))))
return FALSE; return FALSE;
if (memcmp (tag_ul, &_single_sequence_ul, 16) == 0) { if (memcmp (tag_ul, &_single_sequence_ul, 16) == 0) {

View file

@ -1668,6 +1668,13 @@ mxf_local_tag_free (MXFLocalTag * tag)
g_free (tag); g_free (tag);
} }
MXFUL *
mxf_primer_tag_to_ul (const MXFPrimerPack * primer, guint16 tag)
{
return (MXFUL *) g_hash_table_lookup (primer->mappings,
GUINT_TO_POINTER (((guint) tag)));
}
gboolean gboolean
mxf_local_tag_add_to_hash_table (const MXFPrimerPack * primer, mxf_local_tag_add_to_hash_table (const MXFPrimerPack * primer,
guint16 tag, const guint8 * tag_data, guint16 tag_size, guint16 tag, const guint8 * tag_data, guint16 tag_size,
@ -1689,8 +1696,7 @@ mxf_local_tag_add_to_hash_table (const MXFPrimerPack * primer,
g_return_val_if_fail (*hash_table != NULL, FALSE); g_return_val_if_fail (*hash_table != NULL, FALSE);
ul = (MXFUL *) g_hash_table_lookup (primer->mappings, ul = mxf_primer_tag_to_ul (primer, tag);
GUINT_TO_POINTER (((guint) tag)));
if (ul) { if (ul) {
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG

View file

@ -265,6 +265,7 @@ void mxf_local_tag_free (MXFLocalTag *tag);
gboolean mxf_local_tag_add_to_hash_table (const MXFPrimerPack *primer, gboolean mxf_local_tag_add_to_hash_table (const MXFPrimerPack *primer,
guint16 tag, const guint8 *tag_data, guint16 tag_size, guint16 tag, const guint8 *tag_data, guint16 tag_size,
GHashTable **hash_table); GHashTable **hash_table);
MXFUL *mxf_primer_tag_to_ul (const MXFPrimerPack *primer, guint16 tag);
gboolean mxf_local_tag_insert (MXFLocalTag *tag, GHashTable **hash_table); gboolean mxf_local_tag_insert (MXFLocalTag *tag, GHashTable **hash_table);
#endif /* __MXF_TYPES_H__ */ #endif /* __MXF_TYPES_H__ */