| /* GStreamer |
| * Copyright (C) 2008-2009 Sebastian Dröge <sebastian.droege@collabora.co.uk> |
| * |
| * This library is free software; you can redistribute it and/or |
| * modify it under the terms of the GNU Library General Public |
| * License as published by the Free Software Foundation; either |
| * version 2 of the License, or (at your option) any later version. |
| * |
| * This library is distributed in the hope that it will be useful, |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| * Library General Public License for more details. |
| * |
| * You should have received a copy of the GNU Library General Public |
| * License along with this library; if not, write to the |
| * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
| * Boston, MA 02110-1301, USA. |
| */ |
| |
| /* Implementation of SMPTE S380M - Descriptive Metadata Scheme-1 */ |
| |
| /* TODO: |
| * - What are the "locators"? |
| * - Create sensible tags from this |
| */ |
| |
| #ifdef HAVE_CONFIG_H |
| #include "config.h" |
| #endif |
| |
| #include <gst/gst.h> |
| #include <string.h> |
| |
| #include "mxfdms1.h" |
| #include "mxftypes.h" |
| |
| GST_DEBUG_CATEGORY_EXTERN (mxf_debug); |
| #define GST_CAT_DEFAULT mxf_debug |
| |
| G_DEFINE_ABSTRACT_TYPE (MXFDMS1, mxf_dms1, MXF_TYPE_DESCRIPTIVE_METADATA); |
| |
| static gboolean |
| mxf_dms1_handle_tag (MXFMetadataBase * metadata, MXFPrimerPack * primer, |
| guint16 tag, const guint8 * tag_data, guint tag_size) |
| { |
| MXFDMS1 *self = MXF_DMS1 (metadata); |
| gboolean ret = TRUE; |
| #ifndef GST_DISABLE_GST_DEBUG |
| gchar str[48]; |
| #endif |
| MXFUL *tag_ul = NULL; |
| static const guint8 instance_uid_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x01, 0x01, |
| 0x01, 0x15, 0x02, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 generation_uid_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x02, 0x05, |
| 0x20, 0x07, 0x01, 0x08, 0x00, 0x00, 0x00 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &instance_uid_ul, 16) == 0) { |
| if (tag_size != 16) |
| goto error; |
| memcpy (&MXF_METADATA_BASE (self)->instance_uid, tag_data, 16); |
| GST_DEBUG (" instance uid = %s", |
| mxf_uuid_to_string (&MXF_METADATA_BASE (self)->instance_uid, str)); |
| } else if (memcmp (tag_ul, &generation_uid_ul, 16) == 0) { |
| if (tag_size != 16) |
| goto error; |
| memcpy (&MXF_METADATA_BASE (self)->generation_uid, tag_data, 16); |
| GST_DEBUG (" generation uid = %s", |
| mxf_uuid_to_string (&MXF_METADATA_BASE (self)->generation_uid, str)); |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS (mxf_dms1_parent_class)->handle_tag |
| (metadata, primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR ("Invalid DMS1 local tag 0x%04x of size %u", tag, tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_init (MXFDMS1 * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_class_init (MXFDMS1Class * klass) |
| { |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| metadatabase_class->handle_tag = mxf_dms1_handle_tag; |
| dm_class->scheme = 0x01; |
| } |
| |
| G_DEFINE_ABSTRACT_TYPE (MXFDMS1TextLanguage, mxf_dms1_text_language, |
| MXF_TYPE_DMS1); |
| |
| static gboolean |
| mxf_dms1_text_language_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1TextLanguage *self = MXF_DMS1_TEXT_LANGUAGE (metadata); |
| gboolean ret = TRUE; |
| MXFUL *tag_ul = NULL; |
| static const guint8 extended_text_language_code_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x07, 0x03, |
| 0x01, 0x01, 0x02, 0x02, 0x11, 0x00, 0x00 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &extended_text_language_code_ul, 16) == 0) { |
| if (tag_size > 12) |
| goto error; |
| |
| memcpy (self->extended_text_language_code, tag_data, tag_size); |
| GST_DEBUG (" extended text language code = %s", |
| self->extended_text_language_code); |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS |
| (mxf_dms1_text_language_parent_class)->handle_tag (metadata, primer, |
| tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR ("Invalid DMS1 text language local tag 0x%04x of size %u", tag, |
| tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_text_language_init (MXFDMS1TextLanguage * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_text_language_class_init (MXFDMS1TextLanguageClass * klass) |
| { |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| |
| metadatabase_class->handle_tag = mxf_dms1_text_language_handle_tag; |
| } |
| |
| G_DEFINE_ABSTRACT_TYPE (MXFDMS1Thesaurus, mxf_dms1_thesaurus, |
| MXF_TYPE_DMS1_TEXT_LANGUAGE); |
| |
| static void |
| mxf_dms1_thesaurus_finalize (GObject * object) |
| { |
| MXFDMS1Thesaurus *self = MXF_DMS1_THESAURUS (object); |
| |
| g_free (self->thesaurus_name); |
| self->thesaurus_name = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_thesaurus_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_thesaurus_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1Thesaurus *self = MXF_DMS1_THESAURUS (metadata); |
| gboolean ret = TRUE; |
| MXFUL *tag_ul = NULL; |
| static const guint8 thesaurus_name_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x03, |
| 0x02, 0x01, 0x02, 0x02, 0x01, 0x00, 0x00 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &thesaurus_name_ul, 16) == 0) { |
| self->thesaurus_name = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" thesaurus name = %s", GST_STR_NULL (self->thesaurus_name)); |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS (mxf_dms1_thesaurus_parent_class)->handle_tag |
| (metadata, primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| } |
| |
| static void |
| mxf_dms1_thesaurus_init (MXFDMS1Thesaurus * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_thesaurus_class_init (MXFDMS1ThesaurusClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| |
| object_class->finalize = mxf_dms1_thesaurus_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_thesaurus_handle_tag; |
| } |
| |
| static void |
| mxf_dms1_framework_interface_init (gpointer g_iface, gpointer iface_data) |
| { |
| } |
| |
| G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MXFDMS1Framework, mxf_dms1_framework, |
| MXF_TYPE_DMS1, |
| G_IMPLEMENT_INTERFACE (MXF_TYPE_DESCRIPTIVE_METADATA_FRAMEWORK, |
| mxf_dms1_framework_interface_init)); |
| |
| static void |
| mxf_dms1_framework_finalize (GObject * object) |
| { |
| MXFDMS1Framework *self = MXF_DMS1_FRAMEWORK (object); |
| |
| g_free (self->framework_thesaurus_name); |
| self->framework_thesaurus_name = NULL; |
| |
| g_free (self->framework_title); |
| self->framework_title = NULL; |
| |
| g_free (self->metadata_server_locators_uids); |
| self->metadata_server_locators_uids = NULL; |
| |
| g_free (self->titles_sets_uids); |
| self->titles_sets_uids = NULL; |
| |
| g_free (self->titles_sets); |
| self->titles_sets = NULL; |
| |
| g_free (self->annotation_sets_uids); |
| self->annotation_sets_uids = NULL; |
| |
| g_free (self->annotation_sets); |
| self->annotation_sets = NULL; |
| |
| g_free (self->participant_sets_uids); |
| self->participant_sets_uids = NULL; |
| |
| g_free (self->participant_sets); |
| self->participant_sets = NULL; |
| |
| g_free (self->location_sets_uids); |
| self->location_sets_uids = NULL; |
| |
| g_free (self->location_sets); |
| self->location_sets = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_framework_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_framework_resolve (MXFMetadataBase * m, GHashTable * metadata) |
| { |
| MXFDMS1Framework *self = MXF_DMS1_FRAMEWORK (m); |
| MXFMetadataBase *current = NULL; |
| guint i; |
| |
| if (self->titles_sets) |
| memset (self->titles_sets, 0, sizeof (gpointer) * self->n_titles_sets); |
| else |
| self->titles_sets = g_new0 (MXFDMS1Titles *, self->n_titles_sets); |
| |
| if (self->annotation_sets) |
| memset (self->annotation_sets, 0, |
| sizeof (gpointer) * self->n_annotation_sets); |
| else |
| self->annotation_sets = |
| g_new0 (MXFDMS1Annotation *, self->n_annotation_sets); |
| |
| if (self->participant_sets) |
| memset (self->participant_sets, 0, |
| sizeof (gpointer) * self->n_participant_sets); |
| else |
| self->participant_sets = |
| g_new0 (MXFDMS1Participant *, self->n_participant_sets); |
| |
| if (self->location_sets) |
| memset (self->location_sets, 0, sizeof (gpointer) * self->n_location_sets); |
| else |
| self->location_sets = g_new0 (MXFDMS1Location *, self->n_location_sets); |
| |
| for (i = 0; i < self->n_titles_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->titles_sets_uids[i]); |
| |
| if (current && MXF_IS_DMS1_TITLES (current)) { |
| self->titles_sets[i] = MXF_DMS1_TITLES (current); |
| } |
| } |
| |
| for (i = 0; i < self->n_annotation_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->annotation_sets_uids[i]); |
| if (current && MXF_IS_DMS1_ANNOTATION (current)) { |
| self->annotation_sets[i] = MXF_DMS1_ANNOTATION (current); |
| } |
| } |
| |
| for (i = 0; i < self->n_participant_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->participant_sets_uids[i]); |
| if (current && MXF_IS_DMS1_PARTICIPANT (current)) { |
| self->participant_sets[i] = MXF_DMS1_PARTICIPANT (current); |
| } |
| } |
| |
| current = g_hash_table_lookup (metadata, &self->contacts_list_set_uid); |
| if (current && MXF_IS_DMS1_CONTACTS_LIST (current)) { |
| self->contacts_list_set = MXF_DMS1_CONTACTS_LIST (current); |
| } |
| |
| for (i = 0; i < self->n_location_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->location_sets_uids[i]); |
| if (current && MXF_IS_DMS1_LOCATION (current)) { |
| self->location_sets[i] = MXF_DMS1_LOCATION (current); |
| } |
| } |
| |
| return MXF_METADATA_BASE_CLASS (mxf_dms1_framework_parent_class)->resolve (m, |
| metadata); |
| } |
| |
| static gboolean |
| mxf_dms1_framework_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1Framework *self = MXF_DMS1_FRAMEWORK (metadata); |
| gboolean ret = TRUE; |
| #ifndef GST_DISABLE_GST_DEBUG |
| gchar str[48]; |
| #endif |
| MXFUL *tag_ul = NULL; |
| static const guint8 framework_extended_text_language_code_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x07, 0x03, |
| 0x01, 0x01, 0x02, 0x02, 0x13, 0x00, 0x00 |
| }; |
| static const guint8 framework_thesaurus_name_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x03, |
| 0x02, 0x01, 0x02, 0x15, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 framework_title_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x01, |
| 0x05, 0x0f, 0x01, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 primary_extended_spoken_language_code_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x07, 0x03, |
| 0x01, 0x01, 0x02, 0x03, 0x11, 0x00, 0x00 |
| }; |
| static const guint8 secondary_extended_spoken_language_code_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x07, 0x03, |
| 0x01, 0x01, 0x02, 0x03, 0x12, 0x00, 0x00 |
| }; |
| static const guint8 original_extended_spoken_language_code_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x07, 0x03, |
| 0x01, 0x01, 0x02, 0x03, 0x13, 0x00, 0x00 |
| }; |
| static const guint8 metadata_server_locators_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x06, 0x0C, 0x00, 0x00 |
| }; |
| static const guint8 titles_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x04, 0x00 |
| }; |
| static const guint8 annotation_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x0d, 0x00 |
| }; |
| static const guint8 participant_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x13, 0x00 |
| }; |
| static const guint8 contacts_list_set_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x02, 0x40, 0x22, 0x00 |
| }; |
| static const guint8 location_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x03, 0x40, 0x16, 0x00 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &framework_extended_text_language_code_ul, 16) == 0) { |
| if (tag_size > 12) |
| goto error; |
| memcpy (&self->framework_extended_text_language_code, tag_data, tag_size); |
| GST_DEBUG (" framework extended text language code = %s", |
| self->framework_extended_text_language_code); |
| } else if (memcmp (tag_ul, &framework_thesaurus_name_ul, 16) == 0) { |
| self->framework_thesaurus_name = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" framework thesaurus name = %s", |
| GST_STR_NULL (self->framework_thesaurus_name)); |
| } else if (memcmp (tag_ul, &framework_title_ul, 16) == 0) { |
| self->framework_title = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" framework title = %s", GST_STR_NULL (self->framework_title)); |
| } else if (memcmp (tag_ul, &primary_extended_spoken_language_code_ul, |
| 16) == 0) { |
| if (tag_size > 12) |
| goto error; |
| memcpy (&self->primary_extended_spoken_language_code, tag_data, tag_size); |
| GST_DEBUG (" primary extended spoken language code = %s", |
| self->primary_extended_spoken_language_code); |
| } else if (memcmp (tag_ul, &secondary_extended_spoken_language_code_ul, |
| 16) == 0) { |
| if (tag_size > 12) |
| goto error; |
| memcpy (&self->secondary_extended_spoken_language_code, tag_data, tag_size); |
| GST_DEBUG (" secondary extended spoken language code = %s", |
| self->secondary_extended_spoken_language_code); |
| } else if (memcmp (tag_ul, &original_extended_spoken_language_code_ul, |
| 16) == 0) { |
| if (tag_size > 12) |
| goto error; |
| memcpy (&self->original_extended_spoken_language_code, tag_data, tag_size); |
| GST_DEBUG (" original extended spoken language code = %s", |
| self->original_extended_spoken_language_code); |
| } else if (memcmp (tag_ul, &metadata_server_locators_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->metadata_server_locators_uids, |
| &self->n_metadata_server_locators, tag_data, tag_size)) |
| goto error; |
| |
| GST_DEBUG (" number of metadata server locators = %u", |
| self->n_metadata_server_locators); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_metadata_server_locators; i++) { |
| GST_DEBUG (" metadata server locator %u = %s", i, |
| mxf_uuid_to_string (&self->metadata_server_locators_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &titles_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->titles_sets_uids, &self->n_titles_sets, |
| tag_data, tag_size)) |
| goto error; |
| |
| GST_DEBUG (" number of titles sets = %u", self->n_titles_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_titles_sets; i++) { |
| GST_DEBUG (" titles sets %u = %s", i, |
| mxf_uuid_to_string (&self->titles_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &annotation_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->annotation_sets_uids, |
| &self->n_annotation_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of annotation sets = %u", self->n_annotation_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_annotation_sets; i++) { |
| GST_DEBUG (" annotation sets %u = %s", i, |
| mxf_uuid_to_string (&self->annotation_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &participant_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->participant_sets_uids, |
| &self->n_participant_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of participant sets = %u", self->n_participant_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_participant_sets; i++) { |
| GST_DEBUG (" participant sets %u = %s", i, |
| mxf_uuid_to_string (&self->participant_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &contacts_list_set_ul, 16) == 0) { |
| if (tag_size != 16) |
| goto error; |
| |
| memcpy (&self->contacts_list_set_uid, tag_data, 16); |
| GST_DEBUG (" contacts list = %s", |
| mxf_uuid_to_string (&self->contacts_list_set_uid, str)); |
| } else if (memcmp (tag_ul, &location_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->location_sets_uids, |
| &self->n_location_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of location sets = %u", self->n_location_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_location_sets; i++) { |
| GST_DEBUG (" location sets %u = %s", i, |
| mxf_uuid_to_string (&self->location_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS (mxf_dms1_framework_parent_class)->handle_tag |
| (metadata, primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR ("Invalid DMS1 framework local tag 0x%04x of size %u", tag, |
| tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_framework_init (MXFDMS1Framework * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_framework_class_init (MXFDMS1FrameworkClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| |
| object_class->finalize = mxf_dms1_framework_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_framework_handle_tag; |
| metadatabase_class->resolve = mxf_dms1_framework_resolve; |
| } |
| |
| G_DEFINE_ABSTRACT_TYPE (MXFDMS1ProductionClipFramework, |
| mxf_dms1_production_clip_framework, MXF_TYPE_DMS1_FRAMEWORK); |
| |
| static void |
| mxf_dms1_production_clip_framework_finalize (GObject * object) |
| { |
| MXFDMS1ProductionClipFramework *self = |
| MXF_DMS1_PRODUCTION_CLIP_FRAMEWORK (object); |
| |
| g_free (self->captions_description_sets_uids); |
| self->captions_description_sets_uids = NULL; |
| |
| g_free (self->captions_description_sets); |
| self->captions_description_sets = NULL; |
| |
| g_free (self->contract_sets_uids); |
| self->contract_sets_uids = NULL; |
| |
| g_free (self->contract_sets); |
| self->contract_sets = NULL; |
| |
| G_OBJECT_CLASS |
| (mxf_dms1_production_clip_framework_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_production_clip_framework_resolve (MXFMetadataBase * m, |
| GHashTable * metadata) |
| { |
| MXFDMS1ProductionClipFramework *self = MXF_DMS1_PRODUCTION_CLIP_FRAMEWORK (m); |
| MXFMetadataBase *current = NULL; |
| guint i; |
| |
| if (self->captions_description_sets) |
| memset (self->captions_description_sets, 0, |
| sizeof (gpointer) * self->n_captions_description_sets); |
| else |
| self->captions_description_sets = |
| g_new0 (MXFDMS1CaptionsDescription *, |
| self->n_captions_description_sets); |
| |
| if (self->contract_sets) |
| memset (self->contract_sets, 0, |
| sizeof (gpointer) * self->n_captions_description_sets); |
| else |
| self->contract_sets = g_new0 (MXFDMS1Contract *, self->n_contract_sets); |
| |
| current = g_hash_table_lookup (metadata, &self->picture_format_set_uid); |
| if (current && MXF_IS_DMS1_PICTURE_FORMAT (current)) { |
| self->picture_format = MXF_DMS1_PICTURE_FORMAT (current); |
| } |
| |
| for (i = 0; i < self->n_captions_description_sets; i++) { |
| current = |
| g_hash_table_lookup (metadata, |
| &self->captions_description_sets_uids[i]); |
| if (current && MXF_IS_DMS1_CAPTIONS_DESCRIPTION (current)) { |
| self->captions_description_sets[i] = |
| MXF_DMS1_CAPTIONS_DESCRIPTION (current); |
| } |
| } |
| |
| for (i = 0; i < self->n_contract_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->contract_sets_uids[i]); |
| if (current && MXF_IS_DMS1_CONTRACT (current)) { |
| self->contract_sets[i] = MXF_DMS1_CONTRACT (current); |
| } |
| } |
| |
| current = g_hash_table_lookup (metadata, &self->project_set_uid); |
| if (current && MXF_IS_DMS1_PROJECT (current)) { |
| self->project_set = MXF_DMS1_PROJECT (current); |
| } |
| |
| return |
| MXF_METADATA_BASE_CLASS |
| (mxf_dms1_production_clip_framework_parent_class)->resolve (m, metadata); |
| } |
| |
| static gboolean |
| mxf_dms1_production_clip_framework_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1ProductionClipFramework *self = |
| MXF_DMS1_PRODUCTION_CLIP_FRAMEWORK (metadata); |
| gboolean ret = TRUE; |
| #ifndef GST_DISABLE_GST_DEBUG |
| gchar str[48]; |
| #endif |
| MXFUL *tag_ul = NULL; |
| static const guint8 picture_format_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x02, 0x40, 0x1d, 0x00 |
| }; |
| static const guint8 captions_description_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x0c, 0x00 |
| }; |
| static const guint8 contract_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x19, 0x00 |
| }; |
| static const guint8 project_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x02, 0x40, 0x21, 0x00 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &picture_format_ul, 16) == 0) { |
| if (tag_size != 16) |
| goto error; |
| |
| memcpy (&self->picture_format_set_uid, tag_data, 16); |
| GST_DEBUG (" picture format set = %s", |
| mxf_uuid_to_string (&self->picture_format_set_uid, str)); |
| } else if (memcmp (tag_ul, &captions_description_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->captions_description_sets_uids, |
| &self->n_captions_description_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of captions description sets = %u", |
| self->n_captions_description_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_captions_description_sets; i++) { |
| GST_DEBUG (" captions description sets %u = %s", i, |
| mxf_uuid_to_string (&self->captions_description_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &contract_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->contract_sets_uids, |
| &self->n_contract_sets, tag_data, tag_size)) |
| goto error; |
| |
| GST_DEBUG (" number of contract sets = %u", self->n_contract_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_contract_sets; i++) { |
| GST_DEBUG (" contract sets %u = %s", i, |
| mxf_uuid_to_string (&self->contract_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &project_ul, 16) == 0) { |
| if (tag_size != 16) |
| goto error; |
| |
| memcpy (&self->project_set_uid, tag_data, 16); |
| GST_DEBUG (" project set = %s", mxf_uuid_to_string (&self->project_set_uid, |
| str)); |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS |
| (mxf_dms1_production_clip_framework_parent_class)->handle_tag (metadata, |
| primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR |
| ("Invalid DMS1 production-clip framework local tag 0x%04x of size %u", |
| tag, tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_production_clip_framework_init (MXFDMS1ProductionClipFramework * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_production_clip_framework_class_init |
| (MXFDMS1ProductionClipFrameworkClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| |
| object_class->finalize = mxf_dms1_production_clip_framework_finalize; |
| metadatabase_class->handle_tag = |
| mxf_dms1_production_clip_framework_handle_tag; |
| metadatabase_class->resolve = mxf_dms1_production_clip_framework_resolve; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1ProductionFramework, mxf_dms1_production_framework, |
| MXF_TYPE_DMS1_PRODUCTION_CLIP_FRAMEWORK); |
| |
| static void |
| mxf_dms1_production_framework_finalize (GObject * object) |
| { |
| MXFDMS1ProductionFramework *self = MXF_DMS1_PRODUCTION_FRAMEWORK (object); |
| |
| g_free (self->integration_indication); |
| self->integration_indication = NULL; |
| |
| g_free (self->identification_sets_uids); |
| self->identification_sets_uids = NULL; |
| |
| g_free (self->identification_sets); |
| self->identification_sets = NULL; |
| |
| g_free (self->group_relationship_sets_uids); |
| self->group_relationship_sets_uids = NULL; |
| |
| g_free (self->group_relationship_sets); |
| self->group_relationship_sets = NULL; |
| |
| g_free (self->branding_sets_uids); |
| self->branding_sets_uids = NULL; |
| |
| g_free (self->branding_sets); |
| self->branding_sets = NULL; |
| |
| g_free (self->event_sets_uids); |
| self->event_sets_uids = NULL; |
| |
| g_free (self->event_sets); |
| self->event_sets = NULL; |
| |
| g_free (self->award_sets_uids); |
| self->award_sets_uids = NULL; |
| |
| g_free (self->award_sets); |
| self->award_sets = NULL; |
| |
| g_free (self->setting_period_sets_uids); |
| self->setting_period_sets_uids = NULL; |
| |
| g_free (self->setting_period_sets); |
| self->setting_period_sets = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_production_framework_parent_class)->finalize |
| (object); |
| } |
| |
| static gboolean |
| mxf_dms1_production_framework_resolve (MXFMetadataBase * m, |
| GHashTable * metadata) |
| { |
| MXFDMS1ProductionFramework *self = MXF_DMS1_PRODUCTION_FRAMEWORK (m); |
| MXFMetadataBase *current = NULL; |
| guint i; |
| |
| if (self->identification_sets) |
| memset (self->identification_sets, 0, |
| sizeof (gpointer) * self->n_identification_sets); |
| else |
| self->identification_sets = |
| g_new0 (MXFDMS1Identification *, self->n_identification_sets); |
| |
| if (self->group_relationship_sets) |
| memset (self->group_relationship_sets, 0, |
| sizeof (gpointer) * self->n_group_relationship_sets); |
| else |
| self->group_relationship_sets = |
| g_new0 (MXFDMS1GroupRelationship *, self->n_group_relationship_sets); |
| |
| if (self->branding_sets) |
| memset (self->branding_sets, 0, sizeof (gpointer) * self->n_branding_sets); |
| else |
| self->branding_sets = g_new0 (MXFDMS1Branding *, self->n_branding_sets); |
| |
| if (self->event_sets) |
| memset (self->event_sets, 0, sizeof (gpointer) * self->n_event_sets); |
| else |
| self->event_sets = g_new0 (MXFDMS1Event *, self->n_event_sets); |
| |
| if (self->award_sets) |
| memset (self->award_sets, 0, sizeof (gpointer) * self->n_award_sets); |
| else |
| self->award_sets = g_new0 (MXFDMS1Award *, self->n_award_sets); |
| |
| if (self->setting_period_sets) |
| memset (self->setting_period_sets, 0, |
| sizeof (gpointer) * self->n_setting_period_sets); |
| else |
| self->setting_period_sets = |
| g_new0 (MXFDMS1SettingPeriod *, self->n_setting_period_sets); |
| |
| for (i = 0; i < self->n_identification_sets; i++) { |
| current = |
| g_hash_table_lookup (metadata, &self->identification_sets_uids[i]); |
| if (current && MXF_IS_DMS1_IDENTIFICATION (current)) { |
| self->identification_sets[i] = MXF_DMS1_IDENTIFICATION (current); |
| } |
| } |
| |
| for (i = 0; i < self->n_group_relationship_sets; i++) { |
| current = |
| g_hash_table_lookup (metadata, &self->group_relationship_sets_uids[i]); |
| if (current && MXF_IS_DMS1_GROUP_RELATIONSHIP (current)) { |
| self->group_relationship_sets[i] = MXF_DMS1_GROUP_RELATIONSHIP (current); |
| } |
| } |
| |
| for (i = 0; i < self->n_branding_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->branding_sets_uids[i]); |
| if (current && MXF_IS_DMS1_BRANDING (current)) { |
| self->branding_sets[i] = MXF_DMS1_BRANDING (current); |
| } |
| } |
| |
| for (i = 0; i < self->n_event_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->event_sets_uids[i]); |
| if (current && MXF_IS_DMS1_EVENT (current)) { |
| self->event_sets[i] = MXF_DMS1_EVENT (current); |
| } |
| } |
| |
| for (i = 0; i < self->n_award_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->award_sets_uids[i]); |
| if (current && MXF_IS_DMS1_AWARD (current)) { |
| self->award_sets[i] = MXF_DMS1_AWARD (current); |
| } |
| } |
| |
| for (i = 0; i < self->n_setting_period_sets; i++) { |
| current = |
| g_hash_table_lookup (metadata, &self->setting_period_sets_uids[i]); |
| if (current && MXF_IS_DMS1_SETTING_PERIOD (current)) { |
| self->setting_period_sets[i] = MXF_DMS1_SETTING_PERIOD (current); |
| } |
| } |
| |
| return |
| MXF_METADATA_BASE_CLASS |
| (mxf_dms1_production_framework_parent_class)->resolve (m, metadata); |
| } |
| |
| static gboolean |
| mxf_dms1_production_framework_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1ProductionFramework *self = MXF_DMS1_PRODUCTION_FRAMEWORK (metadata); |
| gboolean ret = TRUE; |
| #ifndef GST_DISABLE_GST_DEBUG |
| gchar str[48]; |
| #endif |
| MXFUL *tag_ul = NULL; |
| static const guint8 integration_indication_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x05, |
| 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 identification_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x06, 0x00 |
| }; |
| static const guint8 group_relationship_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x05, 0x00 |
| }; |
| static const guint8 branding_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x08, 0x00 |
| }; |
| static const guint8 event_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x09, 0x00 |
| }; |
| static const guint8 award_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x0b, 0x00 |
| }; |
| static const guint8 setting_period_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x0e, 0x01 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &integration_indication_ul, 16) == 0) { |
| self->integration_indication = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" integration indication = %s", |
| GST_STR_NULL (self->integration_indication)); |
| } else if (memcmp (tag_ul, &identification_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->identification_sets_uids, |
| &self->n_identification_sets, tag_data, tag_size)) |
| goto error; |
| |
| GST_DEBUG (" number of identification sets = %u", |
| self->n_identification_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_identification_sets; i++) { |
| GST_DEBUG (" identification sets %u = %s", i, |
| mxf_uuid_to_string (&self->identification_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &group_relationship_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->group_relationship_sets_uids, |
| &self->n_group_relationship_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of group relationship sets = %u", |
| self->n_group_relationship_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_group_relationship_sets; i++) { |
| GST_DEBUG (" group relationship sets %u = %s", i, |
| mxf_uuid_to_string (&self->group_relationship_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &branding_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->branding_sets_uids, |
| &self->n_branding_sets, tag_data, tag_size)) |
| goto error; |
| |
| GST_DEBUG (" number of branding sets = %u", self->n_branding_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_branding_sets; i++) { |
| GST_DEBUG (" branding sets %u = %s", i, |
| mxf_uuid_to_string (&self->branding_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &event_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->event_sets_uids, &self->n_event_sets, |
| tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of event sets = %u", self->n_event_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_event_sets; i++) { |
| GST_DEBUG (" event sets %u = %s", i, |
| mxf_uuid_to_string (&self->event_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &award_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->award_sets_uids, &self->n_award_sets, |
| tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of award sets = %u", self->n_award_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_award_sets; i++) { |
| GST_DEBUG (" award sets %u = %s", i, |
| mxf_uuid_to_string (&self->award_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &setting_period_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->setting_period_sets_uids, |
| &self->n_setting_period_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of setting period sets = %u", |
| self->n_setting_period_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_setting_period_sets; i++) { |
| GST_DEBUG (" setting period sets %u = %s", i, |
| mxf_uuid_to_string (&self->setting_period_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS |
| (mxf_dms1_production_framework_parent_class)->handle_tag (metadata, |
| primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR ("Invalid DMS1 production framework local tag 0x%04x of size %u", |
| tag, tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_production_framework_init (MXFDMS1ProductionFramework * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_production_framework_class_init (MXFDMS1ProductionFrameworkClass * |
| klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| object_class->finalize = mxf_dms1_production_framework_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_production_framework_handle_tag; |
| metadatabase_class->resolve = mxf_dms1_production_framework_resolve; |
| |
| dm_class->type = 0x010100; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1ClipFramework, mxf_dms1_clip_framework, |
| MXF_TYPE_DMS1_PRODUCTION_CLIP_FRAMEWORK); |
| |
| static void |
| mxf_dms1_clip_framework_finalize (GObject * object) |
| { |
| MXFDMS1ClipFramework *self = MXF_DMS1_CLIP_FRAMEWORK (object); |
| |
| g_free (self->clip_kind); |
| self->clip_kind = NULL; |
| |
| g_free (self->slate_information); |
| self->slate_information = NULL; |
| |
| g_free (self->scripting_sets_uids); |
| self->scripting_sets_uids = NULL; |
| |
| g_free (self->scripting_sets); |
| self->scripting_sets = NULL; |
| |
| g_free (self->shot_sets_uids); |
| self->shot_sets_uids = NULL; |
| |
| g_free (self->shot_sets); |
| self->shot_sets = NULL; |
| |
| g_free (self->device_parameters_sets_uids); |
| self->device_parameters_sets_uids = NULL; |
| |
| g_free (self->device_parameters_sets); |
| self->device_parameters_sets = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_clip_framework_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_clip_framework_resolve (MXFMetadataBase * m, GHashTable * metadata) |
| { |
| MXFDMS1ClipFramework *self = MXF_DMS1_CLIP_FRAMEWORK (m); |
| MXFMetadataBase *current = NULL; |
| guint i; |
| |
| if (self->scripting_sets) |
| memset (self->scripting_sets, 0, |
| sizeof (gpointer) * self->n_scripting_sets); |
| else |
| self->scripting_sets = g_new0 (MXFDMS1Scripting *, self->n_scripting_sets); |
| |
| if (self->shot_sets) |
| memset (self->shot_sets, 0, sizeof (gpointer) * self->n_shot_sets); |
| else |
| self->shot_sets = g_new0 (MXFDMS1Shot *, self->n_shot_sets); |
| |
| if (self->device_parameters_sets) |
| memset (self->device_parameters_sets, 0, |
| sizeof (gpointer) * self->n_device_parameters_sets); |
| else |
| self->device_parameters_sets = |
| g_new0 (MXFDMS1DeviceParameters *, self->n_device_parameters_sets); |
| |
| for (i = 0; i < self->n_scripting_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->scripting_sets_uids[i]); |
| |
| if (current && MXF_IS_DMS1_SCRIPTING (current)) { |
| self->scripting_sets[i] = MXF_DMS1_SCRIPTING (current); |
| } |
| } |
| |
| for (i = 0; i < self->n_shot_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->shot_sets_uids[i]); |
| if (current && MXF_IS_DMS1_SHOT (current)) { |
| self->shot_sets[i] = MXF_DMS1_SHOT (current); |
| } |
| } |
| |
| for (i = 0; i < self->n_device_parameters_sets; i++) { |
| current = |
| g_hash_table_lookup (metadata, &self->device_parameters_sets_uids[i]); |
| if (current && MXF_IS_DMS1_DEVICE_PARAMETERS (current)) { |
| self->device_parameters_sets[i] = MXF_DMS1_DEVICE_PARAMETERS (current); |
| } |
| } |
| |
| current = g_hash_table_lookup (metadata, &self->processing_set_uid); |
| if (current && MXF_IS_DMS1_PROCESSING (current)) { |
| self->processing_set = MXF_DMS1_PROCESSING (current); |
| } |
| |
| return |
| MXF_METADATA_BASE_CLASS (mxf_dms1_clip_framework_parent_class)->resolve |
| (m, metadata); |
| } |
| |
| static gboolean |
| mxf_dms1_clip_framework_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1ClipFramework *self = MXF_DMS1_CLIP_FRAMEWORK (metadata); |
| gboolean ret = TRUE; |
| #ifndef GST_DISABLE_GST_DEBUG |
| gchar str[96]; |
| #endif |
| MXFUL *tag_ul = NULL; |
| static const guint8 clip_kind_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x03, |
| 0x02, 0x05, 0x04, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 clip_number_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x01, |
| 0x05, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 extended_clip_id_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x07, 0x01, |
| 0x01, 0x15, 0x09, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 clip_creation_date_and_time_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x07, 0x07, |
| 0x02, 0x01, 0x10, 0x01, 0x04, 0x00, 0x00 |
| }; |
| static const guint8 take_number_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x01, 0x01, |
| 0x05, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 slate_information_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x03, |
| 0x02, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 scripting_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x0f, 0x00 |
| }; |
| static const guint8 shot_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x11, 0x02 |
| }; |
| static const guint8 device_parameters_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x1e, 0x00 |
| }; |
| static const guint8 processing_set_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x02, 0x40, 0x20, 0x00 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &clip_kind_ul, 16) == 0) { |
| self->clip_kind = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" clip kind = %s", GST_STR_NULL (self->clip_kind)); |
| } else if (memcmp (tag_ul, &clip_number_ul, 16) == 0) { |
| if (tag_size > 32) |
| goto error; |
| |
| memcpy (self->clip_number, tag_data, tag_size); |
| GST_DEBUG (" clip number = %s", self->clip_number); |
| } else if (memcmp (tag_ul, &extended_clip_id_ul, 16) == 0) { |
| if (tag_size != 32 && tag_size != 64) |
| goto error; |
| |
| memcpy (self->extended_clip_id, tag_data, tag_size); |
| self->extended_clip_id_full = (tag_size == 64); |
| |
| GST_DEBUG (" extended clip id (1) = %s", |
| mxf_umid_to_string ((MXFUMID *) & self->extended_clip_id, str)); |
| if (tag_size == 64) |
| GST_DEBUG (" extended clip id (2) = %s", |
| mxf_umid_to_string ((MXFUMID *) & self->extended_clip_id[32], str)); |
| } else if (memcmp (tag_ul, &clip_creation_date_and_time_ul, 16) == 0) { |
| if (!mxf_timestamp_parse (&self->clip_creation_date_and_time, tag_data, |
| tag_size)) |
| goto error; |
| GST_DEBUG (" clip creation date and time = %s", |
| mxf_timestamp_to_string (&self->clip_creation_date_and_time, str)); |
| } else if (memcmp (tag_ul, &take_number_ul, 16) == 0) { |
| if (tag_size != 2) |
| goto error; |
| |
| self->take_number = GST_READ_UINT16_BE (tag_data); |
| GST_DEBUG (" take number = %u", self->take_number); |
| } else if (memcmp (tag_ul, &slate_information_ul, 16) == 0) { |
| self->slate_information = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" slate information = %s", |
| GST_STR_NULL (self->slate_information)); |
| } else if (memcmp (tag_ul, &scripting_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->scripting_sets_uids, |
| &self->n_scripting_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of scripting sets = %u", self->n_scripting_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_scripting_sets; i++) { |
| GST_DEBUG (" scripting sets %u = %s", i, |
| mxf_uuid_to_string (&self->scripting_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &shot_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->shot_sets_uids, &self->n_shot_sets, |
| tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of shot sets = %u", self->n_shot_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_shot_sets; i++) { |
| GST_DEBUG (" shot sets %u = %s", i, |
| mxf_uuid_to_string (&self->shot_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &device_parameters_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->device_parameters_sets_uids, |
| &self->n_device_parameters_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of device parameters sets = %u", |
| self->n_device_parameters_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_device_parameters_sets; i++) { |
| GST_DEBUG (" device parameters sets %u = %s", i, |
| mxf_uuid_to_string (&self->device_parameters_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &processing_set_ul, 16) == 0) { |
| if (tag_size != 16) |
| goto error; |
| |
| memcpy (&self->processing_set_uid, tag_data, 16); |
| GST_DEBUG (" processing set = %s", |
| mxf_uuid_to_string (&self->processing_set_uid, str)); |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS |
| (mxf_dms1_clip_framework_parent_class)->handle_tag (metadata, primer, |
| tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR ("Invalid DMS1 clip framework local tag 0x%04x of size %u", tag, |
| tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_clip_framework_init (MXFDMS1ClipFramework * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_clip_framework_class_init (MXFDMS1ClipFrameworkClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| object_class->finalize = mxf_dms1_clip_framework_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_clip_framework_handle_tag; |
| metadatabase_class->resolve = mxf_dms1_clip_framework_resolve; |
| dm_class->type = 0x010200; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1SceneFramework, mxf_dms1_scene_framework, |
| MXF_TYPE_DMS1_FRAMEWORK); |
| |
| static void |
| mxf_dms1_scene_framework_finalize (GObject * object) |
| { |
| MXFDMS1SceneFramework *self = MXF_DMS1_SCENE_FRAMEWORK (object); |
| |
| g_free (self->setting_period_sets_uids); |
| self->setting_period_sets_uids = NULL; |
| |
| g_free (self->setting_period_sets); |
| self->setting_period_sets = NULL; |
| |
| g_free (self->shot_scene_sets_uids); |
| self->shot_scene_sets_uids = NULL; |
| |
| g_free (self->shot_scene_sets); |
| self->shot_scene_sets = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_scene_framework_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_scene_framework_resolve (MXFMetadataBase * m, GHashTable * metadata) |
| { |
| MXFDMS1SceneFramework *self = MXF_DMS1_SCENE_FRAMEWORK (m); |
| MXFMetadataBase *current = NULL; |
| guint i; |
| |
| if (self->setting_period_sets) |
| memset (self->setting_period_sets, 0, |
| sizeof (gpointer) * self->n_setting_period_sets); |
| else |
| self->setting_period_sets = |
| g_new0 (MXFDMS1SettingPeriod *, self->n_setting_period_sets); |
| |
| if (self->shot_scene_sets) |
| memset (self->shot_scene_sets, 0, |
| sizeof (gpointer) * self->n_shot_scene_sets); |
| else |
| self->shot_scene_sets = g_new0 (MXFDMS1Shot *, self->n_shot_scene_sets); |
| |
| for (i = 0; i < self->n_setting_period_sets; i++) { |
| current = |
| g_hash_table_lookup (metadata, &self->setting_period_sets_uids[i]); |
| if (current && MXF_IS_DMS1_SETTING_PERIOD (current)) { |
| self->setting_period_sets[i] = MXF_DMS1_SETTING_PERIOD (current); |
| } |
| } |
| |
| for (i = 0; i < self->n_shot_scene_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->shot_scene_sets_uids[i]); |
| if (current && MXF_IS_DMS1_SHOT (current)) { |
| self->shot_scene_sets[i] = MXF_DMS1_SHOT (current); |
| } |
| } |
| |
| return |
| MXF_METADATA_BASE_CLASS (mxf_dms1_scene_framework_parent_class)->resolve |
| (m, metadata); |
| } |
| |
| static gboolean |
| mxf_dms1_scene_framework_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1SceneFramework *self = MXF_DMS1_SCENE_FRAMEWORK (metadata); |
| gboolean ret = TRUE; |
| #ifndef GST_DISABLE_GST_DEBUG |
| gchar str[48]; |
| #endif |
| MXFUL *tag_ul = NULL; |
| static const guint8 scene_number_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x01, 0x01, |
| 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 setting_period_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x0e, 0x02 |
| }; |
| static const guint8 shot_scene_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x11, 0x01 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &scene_number_ul, 16) == 0) { |
| if (tag_size > 32) |
| goto error; |
| |
| memcpy (self->scene_number, tag_data, tag_size); |
| GST_DEBUG (" scene number = %s", self->scene_number); |
| } else if (memcmp (tag_ul, &setting_period_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->setting_period_sets_uids, |
| &self->n_setting_period_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of setting period sets = %u", |
| self->n_setting_period_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_setting_period_sets; i++) { |
| GST_DEBUG (" setting period sets %u = %s", i, |
| mxf_uuid_to_string (&self->setting_period_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &shot_scene_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->shot_scene_sets_uids, |
| &self->n_shot_scene_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of shot sets = %u", self->n_shot_scene_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_shot_scene_sets; i++) { |
| GST_DEBUG (" shot sets %u = %s", i, |
| mxf_uuid_to_string (&self->shot_scene_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS |
| (mxf_dms1_scene_framework_parent_class)->handle_tag (metadata, primer, |
| tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR ("Invalid DMS1 scene framework local tag 0x%04x of size %u", tag, |
| tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_scene_framework_init (MXFDMS1SceneFramework * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_scene_framework_class_init (MXFDMS1SceneFrameworkClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| object_class->finalize = mxf_dms1_scene_framework_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_scene_framework_handle_tag; |
| metadatabase_class->resolve = mxf_dms1_scene_framework_resolve; |
| dm_class->type = 0x010300; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1Titles, mxf_dms1_titles, MXF_TYPE_DMS1_TEXT_LANGUAGE); |
| |
| static void |
| mxf_dms1_titles_finalize (GObject * object) |
| { |
| MXFDMS1Titles *self = MXF_DMS1_TITLES (object); |
| |
| g_free (self->main_title); |
| self->main_title = NULL; |
| |
| g_free (self->secondary_title); |
| self->secondary_title = NULL; |
| |
| g_free (self->working_title); |
| self->working_title = NULL; |
| |
| g_free (self->original_title); |
| self->original_title = NULL; |
| |
| g_free (self->version_title); |
| self->version_title = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_titles_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_titles_handle_tag (MXFMetadataBase * metadata, MXFPrimerPack * primer, |
| guint16 tag, const guint8 * tag_data, guint tag_size) |
| { |
| MXFDMS1Titles *self = MXF_DMS1_TITLES (metadata); |
| gboolean ret = TRUE; |
| MXFUL *tag_ul = NULL; |
| static const guint8 main_title_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x03, 0x01, |
| 0x05, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 secondary_title_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x03, 0x01, |
| 0x05, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 working_title_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x01, |
| 0x05, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 original_title_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x01, |
| 0x05, 0x0b, 0x01, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 version_title_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x03, 0x01, |
| 0x05, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &main_title_ul, 16) == 0) { |
| self->main_title = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" main title = %s", GST_STR_NULL (self->main_title)); |
| } else if (memcmp (tag_ul, &secondary_title_ul, 16) == 0) { |
| self->secondary_title = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" secondary title = %s", GST_STR_NULL (self->secondary_title)); |
| } else if (memcmp (tag_ul, &working_title_ul, 16) == 0) { |
| self->working_title = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" working title = %s", GST_STR_NULL (self->working_title)); |
| } else if (memcmp (tag_ul, &original_title_ul, 16) == 0) { |
| self->original_title = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" original title = %s", GST_STR_NULL (self->original_title)); |
| } else if (memcmp (tag_ul, &version_title_ul, 16) == 0) { |
| self->version_title = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" version title = %s", GST_STR_NULL (self->version_title)); |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS (mxf_dms1_titles_parent_class)->handle_tag |
| (metadata, primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| } |
| |
| static void |
| mxf_dms1_titles_init (MXFDMS1Titles * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_titles_class_init (MXFDMS1TitlesClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| object_class->finalize = mxf_dms1_titles_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_titles_handle_tag; |
| dm_class->type = 0x100100; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1Identification, mxf_dms1_identification, |
| MXF_TYPE_DMS1_THESAURUS); |
| |
| static void |
| mxf_dms1_identification_finalize (GObject * object) |
| { |
| MXFDMS1Identification *self = MXF_DMS1_IDENTIFICATION (object); |
| |
| g_free (self->identifier_value); |
| self->identifier_value = NULL; |
| |
| g_free (self->identification_issuing_authority); |
| self->identification_issuing_authority = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_identification_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_identification_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1Identification *self = MXF_DMS1_IDENTIFICATION (metadata); |
| #ifndef GST_DISABLE_GST_DEBUG |
| gchar str[48]; |
| #endif |
| gboolean ret = TRUE; |
| MXFUL *tag_ul = NULL; |
| static const guint8 identifier_kind_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x01, |
| 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 identifier_value_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x01, |
| 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 identification_locator_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x01, |
| 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 identification_issuing_authority_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x02, |
| 0x0a, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &identifier_kind_ul, 16) == 0) { |
| if (tag_size > 32) |
| goto error; |
| |
| memcpy (self->identifier_kind, tag_data, tag_size); |
| GST_DEBUG (" identifier kind = %s", self->identifier_kind); |
| } else if (memcmp (tag_ul, &identifier_value_ul, 16) == 0) { |
| self->identifier_value = g_memdup (tag_data, tag_size); |
| self->identifier_value_length = tag_size; |
| GST_DEBUG (" identifier value length = %u", tag_size); |
| } else if (memcmp (tag_ul, &identification_locator_ul, 16) == 0) { |
| if (tag_size != 16) |
| goto error; |
| |
| memcpy (&self->identification_locator, tag_data, 16); |
| |
| GST_DEBUG (" identification locator = %s", |
| mxf_uuid_to_string (&self->identification_locator, str)); |
| } else if (memcmp (tag_ul, &identification_issuing_authority_ul, 16) == 0) { |
| self->identification_issuing_authority = |
| mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" identification issuing authority = %s", |
| GST_STR_NULL (self->identification_issuing_authority)); |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS |
| (mxf_dms1_identification_parent_class)->handle_tag (metadata, primer, |
| tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR ("Invalid DMS1 identification local tag 0x%04x of size %u", tag, |
| tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_identification_init (MXFDMS1Identification * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_identification_class_init (MXFDMS1IdentificationClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| object_class->finalize = mxf_dms1_identification_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_identification_handle_tag; |
| dm_class->type = 0x110100; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1GroupRelationship, mxf_dms1_group_relationship, |
| MXF_TYPE_DMS1_THESAURUS); |
| |
| static void |
| mxf_dms1_group_relationship_finalize (GObject * object) |
| { |
| MXFDMS1GroupRelationship *self = MXF_DMS1_GROUP_RELATIONSHIP (object); |
| |
| g_free (self->programming_group_kind); |
| self->programming_group_kind = NULL; |
| |
| g_free (self->programming_group_title); |
| self->programming_group_title = NULL; |
| |
| g_free (self->group_synopsis); |
| self->group_synopsis = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_group_relationship_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_group_relationship_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1GroupRelationship *self = MXF_DMS1_GROUP_RELATIONSHIP (metadata); |
| gboolean ret = TRUE; |
| MXFUL *tag_ul = NULL; |
| static const guint8 programming_group_kind_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x02, |
| 0x02, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 programming_group_title_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x02, |
| 0x02, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 group_synopsis_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x03, |
| 0x02, 0x01, 0x06, 0x08, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 numerical_position_in_sequence_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x01, 0x06, |
| 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 total_number_in_the_sequence_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 episodic_start_number_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x02, |
| 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 episodic_end_number_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x02, |
| 0x02, 0x05, 0x02, 0x03, 0x01, 0x00, 0x00 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &programming_group_kind_ul, 16) == 0) { |
| self->programming_group_kind = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" programming group kind = %s", |
| GST_STR_NULL (self->programming_group_kind)); |
| } else if (memcmp (tag_ul, &programming_group_title_ul, 16) == 0) { |
| self->programming_group_title = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" programming group title = %s", |
| GST_STR_NULL (self->programming_group_title)); |
| } else if (memcmp (tag_ul, &group_synopsis_ul, 16) == 0) { |
| self->group_synopsis = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" group synopsis = %s", GST_STR_NULL (self->group_synopsis)); |
| } else if (memcmp (tag_ul, &numerical_position_in_sequence_ul, 16) == 0) { |
| if (tag_size != 4) |
| goto error; |
| |
| self->numerical_position_in_sequence = GST_READ_UINT32_BE (tag_data); |
| GST_DEBUG (" numerical position in sequence = %u", |
| self->numerical_position_in_sequence); |
| } else if (memcmp (tag_ul, &total_number_in_the_sequence_ul, 16) == 0) { |
| if (tag_size != 4) |
| goto error; |
| |
| self->total_number_in_the_sequence = GST_READ_UINT32_BE (tag_data); |
| GST_DEBUG (" total number in the sequence = %u", |
| self->total_number_in_the_sequence); |
| } else if (memcmp (tag_ul, &episodic_start_number_ul, 16) == 0) { |
| if (tag_size != 2) |
| goto error; |
| |
| self->episodic_start_number = GST_READ_UINT16_BE (tag_data); |
| GST_DEBUG (" episodic start number = %u", self->episodic_start_number); |
| } else if (memcmp (tag_ul, &episodic_end_number_ul, 16) == 0) { |
| if (tag_size != 2) |
| goto error; |
| |
| self->episodic_end_number = GST_READ_UINT16_BE (tag_data); |
| GST_DEBUG (" episodic end number = %u", self->episodic_end_number); |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS |
| (mxf_dms1_group_relationship_parent_class)->handle_tag (metadata, |
| primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR ("Invalid DMS1 group relationship local tag 0x%04x of size %u", tag, |
| tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_group_relationship_init (MXFDMS1GroupRelationship * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_group_relationship_class_init (MXFDMS1GroupRelationshipClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| object_class->finalize = mxf_dms1_group_relationship_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_group_relationship_handle_tag; |
| dm_class->type = 0x120100; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1Branding, mxf_dms1_branding, MXF_TYPE_DMS1_TEXT_LANGUAGE); |
| |
| static void |
| mxf_dms1_branding_finalize (GObject * object) |
| { |
| MXFDMS1Branding *self = MXF_DMS1_BRANDING (object); |
| |
| g_free (self->brand_main_title); |
| self->brand_main_title = NULL; |
| |
| g_free (self->brand_original_title); |
| self->brand_original_title = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_branding_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_branding_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1Branding *self = MXF_DMS1_BRANDING (metadata); |
| gboolean ret = TRUE; |
| MXFUL *tag_ul = NULL; |
| static const guint8 brand_main_title_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x01, |
| 0x05, 0x0D, 0x01, 0x00, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 brand_original_title_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x01, |
| 0x05, 0x0E, 0x01, 0x00, 0x00, 0x00, 0x00 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &brand_main_title_ul, 16) == 0) { |
| self->brand_main_title = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" brand main title = %s", |
| GST_STR_NULL (self->brand_main_title)); |
| } else if (memcmp (tag_ul, &brand_original_title_ul, 16) == 0) { |
| self->brand_original_title = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" brand original title = %s", |
| GST_STR_NULL (self->brand_original_title)); |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS (mxf_dms1_branding_parent_class)->handle_tag |
| (metadata, primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| } |
| |
| static void |
| mxf_dms1_branding_init (MXFDMS1Branding * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_branding_class_init (MXFDMS1BrandingClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| object_class->finalize = mxf_dms1_branding_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_branding_handle_tag; |
| dm_class->type = 0x130100; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1Event, mxf_dms1_event, MXF_TYPE_DMS1_THESAURUS); |
| |
| static void |
| mxf_dms1_event_finalize (GObject * object) |
| { |
| MXFDMS1Event *self = MXF_DMS1_EVENT (object); |
| |
| g_free (self->event_indication); |
| self->event_indication = NULL; |
| |
| g_free (self->publication_sets_uids); |
| self->publication_sets_uids = NULL; |
| |
| g_free (self->publication_sets); |
| self->publication_sets = NULL; |
| |
| g_free (self->annotation_sets_uids); |
| self->annotation_sets_uids = NULL; |
| |
| g_free (self->annotation_sets); |
| self->annotation_sets = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_event_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_event_resolve (MXFMetadataBase * m, GHashTable * metadata) |
| { |
| MXFDMS1Event *self = MXF_DMS1_EVENT (m); |
| MXFMetadataBase *current = NULL; |
| guint i; |
| |
| if (self->publication_sets) |
| memset (self->publication_sets, 0, |
| sizeof (gpointer) * self->n_publication_sets); |
| else |
| self->publication_sets = |
| g_new0 (MXFDMS1Publication *, self->n_publication_sets); |
| |
| if (self->annotation_sets) |
| memset (self->annotation_sets, 0, |
| sizeof (gpointer) * self->n_annotation_sets); |
| else |
| self->annotation_sets = |
| g_new0 (MXFDMS1Annotation *, self->n_annotation_sets); |
| |
| for (i = 0; i < self->n_publication_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->publication_sets_uids[i]); |
| if (current && MXF_IS_DMS1_PUBLICATION (current)) { |
| self->publication_sets[i] = MXF_DMS1_PUBLICATION (current); |
| } |
| } |
| |
| for (i = 0; i < self->n_annotation_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->annotation_sets_uids[i]); |
| if (current && MXF_IS_DMS1_ANNOTATION (current)) { |
| self->annotation_sets[i] = MXF_DMS1_ANNOTATION (current); |
| } |
| } |
| |
| return MXF_METADATA_BASE_CLASS (mxf_dms1_event_parent_class)->resolve (m, |
| metadata); |
| } |
| |
| static gboolean |
| mxf_dms1_event_handle_tag (MXFMetadataBase * metadata, MXFPrimerPack * primer, |
| guint16 tag, const guint8 * tag_data, guint tag_size) |
| { |
| MXFDMS1Event *self = MXF_DMS1_EVENT (metadata); |
| gboolean ret = TRUE; |
| #ifndef GST_DISABLE_GST_DEBUG |
| gchar str[48]; |
| #endif |
| MXFUL *tag_ul = NULL; |
| static const guint8 event_indication_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x05, |
| 0x01, 0x01, 0x02, 0x01, 0x00, 0x00, 0x00 |
| }; |
| static const guint8 event_start_date_and_time_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x01, 0x07, |
| 0x02, 0x01, 0x02, 0x07, 0x02, 0x00, 0x00 |
| }; |
| static const guint8 event_end_date_and_time_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x01, 0x07, |
| 0x02, 0x01, 0x02, 0x09, 0x02, 0x00, 0x00 |
| }; |
| static const guint8 publication_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x0a, 0x00 |
| }; |
| static const guint8 annotation_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x08, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x0d, 0x01 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &event_indication_ul, 16) == 0) { |
| self->event_indication = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" event indication = %s", |
| GST_STR_NULL (self->event_indication)); |
| } else if (memcmp (tag_ul, &event_start_date_and_time_ul, 16) == 0) { |
| if (tag_size > 32) |
| goto error; |
| |
| memcpy (self->event_start_date_and_time, tag_data, tag_size); |
| GST_DEBUG (" event start date and time = %s", |
| self->event_start_date_and_time); |
| } else if (memcmp (tag_ul, &event_end_date_and_time_ul, 16) == 0) { |
| if (tag_size > 32) |
| goto error; |
| |
| memcpy (self->event_end_date_and_time, tag_data, tag_size); |
| GST_DEBUG (" event end date and time = %s", self->event_end_date_and_time); |
| } else if (memcmp (tag_ul, &publication_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->publication_sets_uids, |
| &self->n_publication_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of publication sets = %u", self->n_publication_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_publication_sets; i++) { |
| GST_DEBUG (" publication sets %u = %s", i, |
| mxf_uuid_to_string (&self->publication_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &annotation_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->annotation_sets_uids, |
| &self->n_annotation_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of annotation sets = %u", self->n_annotation_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_annotation_sets; i++) { |
| GST_DEBUG (" annotation sets %u = %s", i, |
| mxf_uuid_to_string (&self->annotation_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS (mxf_dms1_event_parent_class)->handle_tag |
| (metadata, primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR ("Invalid DMS1 event local tag 0x%04x of size %u", tag, tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_event_init (MXFDMS1Event * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_event_class_init (MXFDMS1EventClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| object_class->finalize = mxf_dms1_event_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_event_handle_tag; |
| metadatabase_class->resolve = mxf_dms1_event_resolve; |
| dm_class->type = 0x140100; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1Publication, mxf_dms1_publication, MXF_TYPE_DMS1); |
| |
| static void |
| mxf_dms1_publication_finalize (GObject * object) |
| { |
| MXFDMS1Publication *self = MXF_DMS1_PUBLICATION (object); |
| |
| g_free (self->publication_organisation_name); |
| self->publication_organisation_name = NULL; |
| |
| g_free (self->publication_service_name); |
| self->publication_service_name = NULL; |
| |
| g_free (self->publication_medium); |
| self->publication_medium = NULL; |
| |
| g_free (self->publication_region); |
| self->publication_region = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_publication_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_publication_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1Publication *self = MXF_DMS1_PUBLICATION (metadata); |
| gboolean ret = TRUE; |
| MXFUL *tag_ul = NULL; |
| static const guint8 publication_organisation_name_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x02, |
| 0x10, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 publication_service_name_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x02, |
| 0x10, 0x02, 0x01, 0x02, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 publication_medium_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x02, |
| 0x10, 0x02, 0x01, 0x03, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 publication_region_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x02, |
| 0x10, 0x02, 0x01, 0x04, 0x01, 0x00, 0x00 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &publication_organisation_name_ul, 16) == 0) { |
| self->publication_organisation_name = |
| mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" publication organisation name = %s", |
| GST_STR_NULL (self->publication_organisation_name)); |
| } else if (memcmp (tag_ul, &publication_service_name_ul, 16) == 0) { |
| self->publication_service_name = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" publication service name = %s", |
| GST_STR_NULL (self->publication_service_name)); |
| } else if (memcmp (tag_ul, &publication_medium_ul, 16) == 0) { |
| self->publication_medium = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" publication medium = %s", |
| GST_STR_NULL (self->publication_medium)); |
| } else if (memcmp (tag_ul, &publication_region_ul, 16) == 0) { |
| self->publication_region = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" publication region = %s", |
| GST_STR_NULL (self->publication_region)); |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS (mxf_dms1_publication_parent_class)->handle_tag |
| (metadata, primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| } |
| |
| static void |
| mxf_dms1_publication_init (MXFDMS1Publication * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_publication_class_init (MXFDMS1PublicationClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| object_class->finalize = mxf_dms1_publication_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_publication_handle_tag; |
| dm_class->type = 0x140200; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1Award, mxf_dms1_award, MXF_TYPE_DMS1_THESAURUS); |
| |
| static void |
| mxf_dms1_award_finalize (GObject * object) |
| { |
| MXFDMS1Award *self = MXF_DMS1_AWARD (object); |
| |
| g_free (self->festival); |
| self->festival = NULL; |
| |
| g_free (self->award_name); |
| self->award_name = NULL; |
| |
| g_free (self->award_classification); |
| self->award_classification = NULL; |
| |
| g_free (self->nomination_category); |
| self->nomination_category = NULL; |
| |
| g_free (self->participant_sets_uids); |
| self->participant_sets_uids = NULL; |
| |
| g_free (self->participant_sets); |
| self->participant_sets = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_award_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_award_resolve (MXFMetadataBase * m, GHashTable * metadata) |
| { |
| MXFDMS1Award *self = MXF_DMS1_AWARD (m); |
| MXFMetadataBase *current = NULL; |
| guint i; |
| |
| if (self->participant_sets) |
| memset (self->participant_sets, 0, |
| sizeof (gpointer) * self->n_participant_sets); |
| else |
| self->participant_sets = |
| g_new0 (MXFDMS1Participant *, self->n_participant_sets); |
| |
| for (i = 0; i < self->n_participant_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->participant_sets_uids[i]); |
| if (current && MXF_IS_DMS1_PARTICIPANT (current)) { |
| self->participant_sets[i] = MXF_DMS1_PARTICIPANT (current); |
| } |
| } |
| |
| return MXF_METADATA_BASE_CLASS (mxf_dms1_award_parent_class)->resolve (m, |
| metadata); |
| } |
| |
| static gboolean |
| mxf_dms1_award_handle_tag (MXFMetadataBase * metadata, MXFPrimerPack * primer, |
| guint16 tag, const guint8 * tag_data, guint tag_size) |
| { |
| MXFDMS1Award *self = MXF_DMS1_AWARD (metadata); |
| gboolean ret = TRUE; |
| #ifndef GST_DISABLE_GST_DEBUG |
| gchar str[48]; |
| #endif |
| MXFUL *tag_ul = NULL; |
| static const guint8 festival_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x03, |
| 0x02, 0x02, 0x01, 0x03, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 festival_date_and_time_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x07, |
| 0x02, 0x01, 0x02, 0x07, 0x10, 0x01, 0x00 |
| }; |
| static const guint8 award_name_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x03, |
| 0x02, 0x02, 0x01, 0x04, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 award_classification_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x03, |
| 0x02, 0x02, 0x01, 0x05, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 nomination_category_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x03, |
| 0x02, 0x02, 0x01, 0x06, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 participant_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x03, 0x40, 0x13, 0x01 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &festival_ul, 16) == 0) { |
| self->festival = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" festival = %s", GST_STR_NULL (self->festival)); |
| } else if (memcmp (tag_ul, &festival_date_and_time_ul, 16) == 0) { |
| if (tag_size > 32) |
| goto error; |
| |
| memcpy (self->festival_date_and_time, tag_data, tag_size); |
| GST_DEBUG (" festival date and time = %s", |
| GST_STR_NULL (self->festival_date_and_time)); |
| } else if (memcmp (tag_ul, &award_name_ul, 16) == 0) { |
| self->award_name = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" award name = %s", GST_STR_NULL (self->award_name)); |
| } else if (memcmp (tag_ul, &award_classification_ul, 16) == 0) { |
| self->award_classification = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" award classification = %s", |
| GST_STR_NULL (self->award_classification)); |
| } else if (memcmp (tag_ul, &nomination_category_ul, 16) == 0) { |
| self->nomination_category = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" nomination category = %s", |
| GST_STR_NULL (self->nomination_category)); |
| } else if (memcmp (tag_ul, &participant_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->participant_sets_uids, |
| &self->n_participant_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of participant sets = %u", self->n_participant_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_participant_sets; i++) { |
| GST_DEBUG (" participant sets %u = %s", i, |
| mxf_uuid_to_string (&self->participant_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS (mxf_dms1_award_parent_class)->handle_tag |
| (metadata, primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR ("Invalid DMS1 award local tag 0x%04x of size %u", tag, tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_award_init (MXFDMS1Award * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_award_class_init (MXFDMS1AwardClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| object_class->finalize = mxf_dms1_award_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_award_handle_tag; |
| metadatabase_class->resolve = mxf_dms1_award_resolve; |
| dm_class->type = 0x150100; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1CaptionsDescription, mxf_dms1_captions_description, |
| MXF_TYPE_DMS1_THESAURUS); |
| |
| static void |
| mxf_dms1_captions_description_finalize (GObject * object) |
| { |
| MXFDMS1CaptionsDescription *self = MXF_DMS1_CAPTIONS_DESCRIPTION (object); |
| |
| g_free (self->caption_kind); |
| self->caption_kind = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_captions_description_parent_class)->finalize |
| (object); |
| } |
| |
| static gboolean |
| mxf_dms1_captions_description_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1CaptionsDescription *self = MXF_DMS1_CAPTIONS_DESCRIPTION (metadata); |
| gboolean ret = TRUE; |
| MXFUL *tag_ul = NULL; |
| static const guint8 extended_captions_language_code_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x07, 0x03, |
| 0x01, 0x01, 0x02, 0x02, 0x12, 0x00, 0x00 |
| }; |
| static const guint8 caption_kind_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04, 0x04, |
| 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &extended_captions_language_code_ul, 16) == 0) { |
| if (tag_size > 12) |
| goto error; |
| |
| memcpy (self->extended_captions_language_code, tag_data, tag_size); |
| GST_DEBUG (" extended captions language code = %s", |
| self->extended_captions_language_code); |
| } else if (memcmp (tag_ul, &caption_kind_ul, 16) == 0) { |
| self->caption_kind = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" caption kind = %s", GST_STR_NULL (self->caption_kind)); |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS |
| (mxf_dms1_captions_description_parent_class)->handle_tag (metadata, |
| primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR ("Invalid DMS1 captions description local tag 0x%04x of size %u", |
| tag, tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_captions_description_init (MXFDMS1CaptionsDescription * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_captions_description_class_init (MXFDMS1CaptionsDescriptionClass * |
| klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| object_class->finalize = mxf_dms1_captions_description_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_captions_description_handle_tag; |
| dm_class->type = 0x160100; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1Annotation, mxf_dms1_annotation, MXF_TYPE_DMS1_THESAURUS); |
| |
| static void |
| mxf_dms1_annotation_finalize (GObject * object) |
| { |
| MXFDMS1Annotation *self = MXF_DMS1_ANNOTATION (object); |
| |
| g_free (self->annotation_kind); |
| self->annotation_kind = NULL; |
| |
| g_free (self->annotation_synopsis); |
| self->annotation_synopsis = NULL; |
| |
| g_free (self->annotation_description); |
| self->annotation_description = NULL; |
| |
| g_free (self->related_material_description); |
| self->related_material_description = NULL; |
| |
| g_free (self->classification_sets_uids); |
| self->classification_sets_uids = NULL; |
| |
| g_free (self->classification_sets); |
| self->classification_sets = NULL; |
| |
| g_free (self->related_material_locators); |
| self->related_material_locators = NULL; |
| |
| g_free (self->participant_sets_uids); |
| self->participant_sets_uids = NULL; |
| |
| g_free (self->participant_sets); |
| self->participant_sets = NULL; |
| |
| G_OBJECT_CLASS (mxf_dms1_annotation_parent_class)->finalize (object); |
| } |
| |
| static gboolean |
| mxf_dms1_annotation_resolve (MXFMetadataBase * m, GHashTable * metadata) |
| { |
| MXFDMS1Annotation *self = MXF_DMS1_ANNOTATION (m); |
| MXFMetadataBase *current = NULL; |
| guint i; |
| |
| if (self->classification_sets) |
| memset (self->classification_sets, 0, |
| sizeof (gpointer) * self->n_classification_sets); |
| else |
| self->classification_sets = |
| g_new0 (MXFDMS1Classification *, self->n_classification_sets); |
| |
| if (self->participant_sets) |
| memset (self->participant_sets, 0, |
| sizeof (gpointer) * self->n_participant_sets); |
| else |
| self->participant_sets = |
| g_new0 (MXFDMS1Participant *, self->n_participant_sets); |
| |
| for (i = 0; i < self->n_classification_sets; i++) { |
| current = |
| g_hash_table_lookup (metadata, &self->classification_sets_uids[i]); |
| if (current && MXF_IS_DMS1_CLASSIFICATION (current)) { |
| self->classification_sets[i] = MXF_DMS1_CLASSIFICATION (current); |
| } |
| } |
| |
| current = g_hash_table_lookup (metadata, &self->cue_words_set_uid); |
| if (current && MXF_IS_DMS1_CUE_WORDS (current)) { |
| self->cue_words_set = MXF_DMS1_CUE_WORDS (current); |
| } |
| |
| for (i = 0; i < self->n_participant_sets; i++) { |
| current = g_hash_table_lookup (metadata, &self->participant_sets_uids[i]); |
| if (current && MXF_IS_DMS1_PARTICIPANT (current)) { |
| self->participant_sets[i] = MXF_DMS1_PARTICIPANT (current); |
| } |
| } |
| |
| return MXF_METADATA_BASE_CLASS (mxf_dms1_annotation_parent_class)->resolve (m, |
| metadata); |
| } |
| |
| static gboolean |
| mxf_dms1_annotation_handle_tag (MXFMetadataBase * metadata, |
| MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, |
| guint tag_size) |
| { |
| MXFDMS1Annotation *self = MXF_DMS1_ANNOTATION (metadata); |
| gboolean ret = TRUE; |
| #ifndef GST_DISABLE_GST_DEBUG |
| gchar str[48]; |
| #endif |
| MXFUL *tag_ul = NULL; |
| static const guint8 annotation_kind_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x03, |
| 0x02, 0x01, 0x06, 0x0e, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 annotation_synopsis_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x03, |
| 0x02, 0x01, 0x06, 0x09, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 annotation_description_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x03, |
| 0x02, 0x01, 0x06, 0x0a, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 related_material_description_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x03, |
| 0x02, 0x01, 0x06, 0x0f, 0x01, 0x00, 0x00 |
| }; |
| static const guint8 classification_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x05, 0x40, 0x10, 0x00 |
| }; |
| static const guint8 cue_words_set_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x02, 0x40, 0x23, 0x01 |
| }; |
| static const guint8 related_material_locators_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05, 0x06, |
| 0x01, 0x01, 0x04, 0x06, 0x0d, 0x00, 0x00 |
| }; |
| static const guint8 participant_sets_ul[] = { |
| 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x07, 0x06, |
| 0x01, 0x01, 0x04, 0x03, 0x40, 0x13, 0x03 |
| }; |
| |
| if (!(tag_ul = |
| (MXFUL *) g_hash_table_lookup (primer->mappings, |
| GUINT_TO_POINTER (((guint) tag))))) |
| return FALSE; |
| |
| if (memcmp (tag_ul, &annotation_kind_ul, 16) == 0) { |
| self->annotation_kind = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" annotation kind = %s", GST_STR_NULL (self->annotation_kind)); |
| } else if (memcmp (tag_ul, &annotation_synopsis_ul, 16) == 0) { |
| self->annotation_synopsis = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" annotation synopsis = %s", |
| GST_STR_NULL (self->annotation_synopsis)); |
| } else if (memcmp (tag_ul, &annotation_description_ul, 16) == 0) { |
| self->annotation_description = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" annotation description = %s", |
| GST_STR_NULL (self->annotation_description)); |
| } else if (memcmp (tag_ul, &related_material_description_ul, 16) == 0) { |
| self->related_material_description = mxf_utf16_to_utf8 (tag_data, tag_size); |
| GST_DEBUG (" related material description = %s", |
| GST_STR_NULL (self->related_material_description)); |
| } else if (memcmp (tag_ul, &classification_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->classification_sets_uids, |
| &self->n_classification_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of classification sets = %u", |
| self->n_classification_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_classification_sets; i++) { |
| GST_DEBUG (" classification sets %u = %s", i, |
| mxf_uuid_to_string (&self->classification_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &cue_words_set_ul, 16) == 0) { |
| if (tag_size != 16) |
| goto error; |
| |
| memcpy (&self->cue_words_set_uid, tag_data, 16); |
| GST_DEBUG (" cue words set = %s", |
| mxf_uuid_to_string (&self->cue_words_set_uid, str)); |
| } else if (memcmp (tag_ul, &related_material_locators_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->related_material_locators, |
| &self->n_related_material_locators, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of related material locators = %u", |
| self->n_related_material_locators); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_related_material_locators; i++) { |
| GST_DEBUG (" related material locators %u = %s", i, |
| mxf_uuid_to_string (&self->related_material_locators[i], str)); |
| } |
| } |
| #endif |
| } else if (memcmp (tag_ul, &participant_sets_ul, 16) == 0) { |
| if (!mxf_uuid_array_parse (&self->participant_sets_uids, |
| &self->n_participant_sets, tag_data, tag_size)) |
| goto error; |
| GST_DEBUG (" number of participant sets = %u", self->n_participant_sets); |
| #ifndef GST_DISABLE_GST_DEBUG |
| { |
| guint i; |
| for (i = 0; i < self->n_participant_sets; i++) { |
| GST_DEBUG (" participant sets %u = %s", i, |
| mxf_uuid_to_string (&self->participant_sets_uids[i], str)); |
| } |
| } |
| #endif |
| } else { |
| ret = |
| MXF_METADATA_BASE_CLASS (mxf_dms1_annotation_parent_class)->handle_tag |
| (metadata, primer, tag, tag_data, tag_size); |
| } |
| |
| return ret; |
| |
| error: |
| |
| GST_ERROR ("Invalid DMS1 annotation local tag 0x%04x of size %u", tag, |
| tag_size); |
| |
| return FALSE; |
| } |
| |
| static void |
| mxf_dms1_annotation_init (MXFDMS1Annotation * self) |
| { |
| } |
| |
| static void |
| mxf_dms1_annotation_class_init (MXFDMS1AnnotationClass * klass) |
| { |
| GObjectClass *object_class = (GObjectClass *) klass; |
| MXFMetadataBaseClass *metadatabase_class = (MXFMetadataBaseClass *) klass; |
| MXFDescriptiveMetadataClass *dm_class = (MXFDescriptiveMetadataClass *) klass; |
| |
| object_class->finalize = mxf_dms1_annotation_finalize; |
| metadatabase_class->handle_tag = mxf_dms1_annotation_handle_tag; |
| metadatabase_class->resolve = mxf_dms1_annotation_resolve; |
| dm_class->type = 0x170100; |
| } |
| |
| G_DEFINE_TYPE (MXFDMS1SettingPeriod, mxf_dms1_setting_period, |
| MXF_TYPE_DMS1_THESAURUS); |
| |
| static void |
| mxf_dms1_setting_period_finalize (GObject * object) |
| { |
| MXFDMS1SettingPeriod *self = MXF_DMS1_SETTING_PERIOD (object); |
| |
| g_free (self->time_period_keyword); |
| self->time_period_keyword = NULL; |
| |
| |