Added a new UL matching operator MatchIgnorePlaceholder()
authorjhurst <jhurst@cinecert.com>
Wed, 10 Nov 2021 20:51:41 +0000 (12:51 -0800)
committerjhurst <jhurst@cinecert.com>
Wed, 10 Nov 2021 20:51:41 +0000 (12:51 -0800)
src/Dict.cpp
src/KLV.h
src/MXFTypes.cpp

index 752b81a9fee32f297d422d98bb0b230e0309a46a..d890f83b899e220e2dea0dbe2494adf7adc7059b 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2006-2018, John Hurst
+Copyright (c) 2006-2021, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -322,6 +322,10 @@ ASDCP::Dictionary::FindULAnyVersion(const byte_t* ul_buf) const
        {
          found_entry = &m_MDD_Table[lower->second];
        }
+      else if ( found_entry == 0 && lower->first.MatchIgnorePlaceholder(target) )
+       {
+         found_entry = &m_MDD_Table[lower->second];
+       }
       else if ( found_entry != 0 && ! lower->first.MatchIgnoreStream(target) )
        {
          break;
index 727efb01b3f814f2785461714d889961d5d8ccd6..6eca9d03909cf5d745667168d7f29de1846324be 100755 (executable)
--- a/src/KLV.h
+++ b/src/KLV.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2005-2018, John Hurst
+Copyright (c) 2005-2021, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -109,6 +109,7 @@ inline const char* ui64sz(ui64_t i, char* buf)
       bool operator==(const UL& rhs) const;
       bool MatchIgnoreStream(const UL& rhs) const;
       bool MatchExact(const UL& rhs) const;
+      bool MatchIgnorePlaceholder(const UL& rhs) const;
     };
 
   // UMID
index 58fb18464dfc23741c79e93b19e68d20b58afc54..19e70ca2ca0f3c7f76c74d86ccd6712346f551e4 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2005-2019, John Hurst
+Copyright (c) 2005-2021, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -91,6 +91,32 @@ ASDCP::UL::MatchIgnoreStream(const UL& rhs) const
   return false;
 }
 
+//
+bool
+ASDCP::UL::MatchIgnorePlaceholder(const UL& rhs) const
+{
+  if ( m_Value[0] == rhs.m_Value[0] &&
+       m_Value[1] == rhs.m_Value[1] &&
+       m_Value[2] == rhs.m_Value[2] &&
+       m_Value[3] == rhs.m_Value[3] &&
+       ( m_Value[4] == 0x7f || m_Value[4] == rhs.m_Value[4] ) &&
+       ( m_Value[5] == 0x7f || m_Value[5] == rhs.m_Value[5] ) &&
+       ( m_Value[6] == 0x7f || m_Value[6] == rhs.m_Value[6] ) &&
+       //       m_Value[7] == rhs.m_Value[7] &&  // version is ignored when performing lookups
+       ( m_Value[8] == 0x7f || m_Value[8] == rhs.m_Value[8] ) &&
+       ( m_Value[9] == 0x7f || m_Value[9] == rhs.m_Value[9] ) &&
+       ( m_Value[10] == 0x7f || m_Value[10] == rhs.m_Value[10] ) &&
+       ( m_Value[11] == 0x7f || m_Value[11] == rhs.m_Value[11] ) &&
+       ( m_Value[12] == 0x7f || m_Value[12] == rhs.m_Value[12] ) &&
+       ( m_Value[13] == 0x7f || m_Value[13] == rhs.m_Value[13] ) &&
+       ( m_Value[14] == 0x7f || m_Value[14] == rhs.m_Value[14] ) &&
+       ( m_Value[15] == 0x7f || m_Value[15] == rhs.m_Value[15] )
+       )
+    return true;
+
+  return false;
+}
+
 //
 bool
 ASDCP::UL::MatchExact(const UL& rhs) const