/*
-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
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) )
{
- char buf[64];
- UL TmpUL(ul_buf);
- Kumu::DefaultLogSink().Warn("UL Dictionary: unknown UL: %s\n", TmpUL.EncodeString(buf, 64));
- return 0;
+ 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) )
+ {
+ 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];