/*
-Copyright (c) 2006-2009, John Hurst
+Copyright (c) 2006-2016, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
m_md_lookup.clear();
memset(m_MDD_Table, 0, sizeof(m_MDD_Table));
- for ( ui32_t x = 0; x < (ui32_t)ASDCP::MDD_Max; x++ )
+ for ( ui32_t x = 0; x < (ui32_t)ASDCP::MDD_Max; ++x )
{
if ( x == MDD_PartitionMetadata_IndexSID_DEPRECATED // 30
|| x == MDD_PartitionMetadata_BodySID_DEPRECATED // 32
+ || x == MDD_PartitionMetadata_OperationalPattern_DEPRECATED // 33
|| x == MDD_PartitionMetadata_EssenceContainers_DEPRECATED // 34
|| x == MDD_IndexTableSegmentBase_IndexSID_DEPRECATED // 56
|| x == MDD_IndexTableSegmentBase_BodySID_DEPRECATED // 57
|| x == MDD_PartitionArray_RandomIndexMetadata_BodySID_DEPRECATED // 73
+ || x == MDD_Preface_OperationalPattern_DEPRECATED // 84
|| x == MDD_Preface_EssenceContainers_DEPRECATED // 85
|| x == MDD_EssenceContainerData_IndexSID_DEPRECATED // 103
|| x == MDD_EssenceContainerData_BodySID_DEPRECATED // 104
+ || x == MDD_TimedTextResourceSubDescriptor_EssenceStreamID_DEPRECATED // 264
|| x == MDD_DMSegment_DataDefinition_DEPRECATED // 266
|| x == MDD_DMSegment_Duration_DEPRECATED // 267
- || x == MDD_PartitionMetadata_OperationalPattern_DEPRECATED // 33
- || x == MDD_Preface_OperationalPattern_DEPRECATED // 84
- || x == MDD_TimedTextResourceSubDescriptor_EssenceStreamID_DEPRECATED // 264
)
continue;
UL TmpUL(Entry.ul);
+#define MDD_AUTHORING_MODE
#ifdef MDD_AUTHORING_MODE
char buf[64];
std::map<ASDCP::UL, ui32_t>::iterator ii = m_md_lookup.find(TmpUL);
//
const ASDCP::MDDEntry*
-ASDCP::Dictionary::FindUL(const byte_t* ul_buf) const
+ASDCP::Dictionary::FindULAnyVersion(const byte_t* ul_buf) const
{
assert(m_MDD_Table[0].name[0]);
- std::map<UL, ui32_t>::const_iterator i = m_md_lookup.find(UL(ul_buf));
-
- if ( i == m_md_lookup.end() )
- {
- byte_t tmp_ul[SMPTE_UL_LENGTH];
- memcpy(tmp_ul, ul_buf, SMPTE_UL_LENGTH);
- tmp_ul[SMPTE_UL_LENGTH-1] = 0;
+ byte_t search_ul[SMPTE_UL_LENGTH];
+ memcpy(search_ul, ul_buf, SMPTE_UL_LENGTH);
+ memset(search_ul+7, 0, SMPTE_UL_LENGTH-7);
- i = m_md_lookup.find(UL(tmp_ul));
+ UL target(ul_buf);
+ const ASDCP::MDDEntry *found_entry = 0;
- if ( i == m_md_lookup.end() )
+ std::map<UL, ui32_t>::const_iterator lower = m_md_lookup.lower_bound(UL(search_ul));
+
+ for ( ; lower != m_md_lookup.end(); ++lower )
+ {
+ if ( lower->first.MatchExact(target) )
+ {
+ found_entry = &m_MDD_Table[lower->second];
+ break;
+ }
+ else if ( found_entry == 0 && lower->first.MatchIgnoreStream(target) )
+ {
+ found_entry = &m_MDD_Table[lower->second];
+ }
+ else if ( found_entry != 0 && ! lower->first.MatchIgnoreStream(target) )
{
- char buf[64];
- UL TmpUL(ul_buf);
- Kumu::DefaultLogSink().Warn("UL Dictionary: unknown UL: %s\n", TmpUL.EncodeString(buf, 64));
- return 0;
+ break;
}
}
+ if ( found_entry == 0 )
+ {
+ char buf[64];
+ Kumu::DefaultLogSink().Warn("UL Dictionary: unknown UL: %s\n", target.EncodeString(buf, 64));
+ }
+
+ return found_entry;
+}
+
+//
+const ASDCP::MDDEntry*
+ASDCP::Dictionary::FindULExact(const byte_t* ul_buf) const
+{
+ assert(m_MDD_Table[0].name[0]);
+ std::map<UL, ui32_t>::const_iterator i = m_md_lookup.find(UL(ul_buf));
+
+ if ( i == m_md_lookup.end() )
+ {
+ char buf[64];
+ UL tmp_ul(ul_buf);
+ Kumu::DefaultLogSink().Warn("UL Dictionary: unknown UL: %s\n", tmp_ul.EncodeString(buf, 64));
+ return 0;
+ }
+
return &m_MDD_Table[i->second];
}