Changed default UNIX file permissions to "666"
authorjhurst <jhurst@cinecert.com>
Wed, 2 Mar 2016 18:57:41 +0000 (18:57 +0000)
committerjhurst <>
Wed, 2 Mar 2016 18:57:41 +0000 (18:57 +0000)
Changed default UNIX file permissions to "777"
Added missing initializer for caltime::offset
Fixed UL values for Aux Data files (per ST 429-14)
Added support for default TTML fonts (ST2052_TextParser)

src/KM_fileio.cpp
src/KM_tai.cpp
src/MDD.cpp
src/ST2052_TextParser.cpp

index ed8aa67c93a806a261784196777507c0d28ed360..27679318618e9204ebe3262e8077f66de1ce81bc 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2004-2014, John Hurst
+Copyright (c) 2004-2016, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -1052,7 +1052,7 @@ Kumu::Result_t
 Kumu::FileWriter::OpenWrite(const std::string& filename)
 {
   m_Filename = filename;
-  m_Handle = open(filename.c_str(), O_RDWR|O_CREAT|O_TRUNC, 0664);
+  m_Handle = open(filename.c_str(), O_RDWR|O_CREAT|O_TRUNC, 0666);
 
   if ( m_Handle == -1L )
     {
@@ -1069,7 +1069,7 @@ Kumu::Result_t
 Kumu::FileWriter::OpenModify(const std::string& filename)
 {
   m_Filename = filename;
-  m_Handle = open(filename.c_str(), O_RDWR|O_CREAT, 0664);
+  m_Handle = open(filename.c_str(), O_RDWR|O_CREAT, 0666);
 
   if ( m_Handle == -1L )
     {
@@ -1478,6 +1478,7 @@ Kumu::DirScanner::GetNext(char* filename)
   return RESULT_OK;
 }
 
+//------------------------------------------------------------------------------------------
 
 //
 Kumu::DirScannerEx::DirScannerEx() : m_Handle(0) {}
@@ -1614,7 +1615,7 @@ Kumu::CreateDirectoriesInPath(const std::string& Path)
 #ifdef KM_WIN32
          if ( _mkdir(tmp_path.c_str()) != 0 )
 #else // KM_WIN32
-         if ( mkdir(tmp_path.c_str(), 0775) != 0 )
+         if ( mkdir(tmp_path.c_str(), 0777) != 0 )
 #endif // KM_WIN32
            {
              DefaultLogSink().Error("CreateDirectoriesInPath mkdir %s: %s\n",
index 7cf363af123e5fa774989a3aa8369dbdc1f0202c..00a1231ea253330fceb8bfc5ba8c8081a73a3b6c 100644 (file)
@@ -190,6 +190,7 @@ Kumu::TAI::tai::now()
   ct.hour = st.wHour;
   ct.minute = st.wMinute;
   ct.second = st.wSecond;
+  ct.offset = 0;
   caltime_tai(&ct, this);
 #else
   struct timeval now;
index 7698ff514df016136c2ecf550c5d3a9637db3c5e..d8e2ee96f0465aacc16103d00226336a65c431c8 100644 (file)
@@ -917,14 +917,14 @@ static const ASDCP::MDDEntry s_MDD_Table[] = {
   { { 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x0e, // 293
       0x01, 0x03, 0x07, 0x01, 0x04, 0x00, 0x00, 0x00 },
     {0}, false, "SoundfieldGroupLabelSubDescriptor_GroupOfSoundfieldGroupsLinkID" },
-  { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x05, // 294
-      0x0e, 0x09, 0x06, 0x05, 0x00, 0x00, 0x00, 0x00 },
+  { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x0d, // 294
+      0x0d, 0x01, 0x03, 0x01, 0x02, 0x13, 0x02, 0x01 },
     {0}, false, "DCDataWrappingFrame" },
-  { { 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x02, 0x01, 0x05, // 295
-      0x0e, 0x09, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00 },
+  { { 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x02, 0x01, 0x0d, // 295
+      0x0d, 0x01, 0x03, 0x01, 0x17, 0x01, 0x0d, 0x00 },
     {0}, false, "DCDataEssence" },
-  { { 0x06, 0x0e, 0x2b, 0x34, 0x02, 0x53, 0x01, 0x05, // 296
-      0x0e, 0x09, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00 },
+  { { 0x06, 0x0e, 0x2b, 0x34, 0x02, 0x7f, 0x01, 0x01, // 296
+      0x0d, 0x01, 0x01, 0x01, 0x01, 0x01, 0x73, 0x00 },
     {0}, false, "DCDataDescriptor" },
   { { 0x06, 0x0e, 0x2b, 0x34, 0x02, 0x53, 0x01, 0x05, // 297
       0x0e, 0x09, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
index 06378753224150918f2c28fc875bd3c5a34c9de1..012f4ce53d53fda0c9e7cc1ef702e0de917151b5 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013-2015, John Hurst
+Copyright (c) 2013-2016, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -29,7 +29,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     \brief   AS-DCP library, PCM essence reader and writer implementation
 */
 
-
 #include "AS_02_internal.h"
 #include "KM_xml.h"
 #include <openssl/sha.h>
@@ -100,6 +99,24 @@ create_font_name_id(const std::string& font_name)
   return create_4122_type5_id(font_name, s_font_id_prefix);
 }
 
+//
+static Kumu::Mutex sg_default_font_family_list_lock;
+static std::set<std::string> sg_default_font_family_list;
+
+static void
+setup_default_font_family_list()
+{
+  sg_default_font_family_list.insert("default");
+  sg_default_font_family_list.insert("monospace");
+  sg_default_font_family_list.insert("sansSerif");
+  sg_default_font_family_list.insert("serif");
+  sg_default_font_family_list.insert("monospaceSansSerif");
+  sg_default_font_family_list.insert("monospaceSerif");
+  sg_default_font_family_list.insert("proportionalSansSerif");
+  sg_default_font_family_list.insert("proportionalSerif");
+}
+
+
 //------------------------------------------------------------------------------------------
 
 
@@ -156,8 +173,8 @@ AS_02::TimedText::Type5UUIDFilenameResolver::OpenRead(const std::string& dirname
                  else if ( memcmp(read_buffer, OpenTypeMagic, sizeof(OpenTypeMagic)) == 0
                            || memcmp(read_buffer, TrueTypeMagic, sizeof(TrueTypeMagic)) == 0 )
                    {
-                     fprintf(stderr, "wrap font!\n");
-                     UUID asset_id = create_font_name_id(next_item);
+                     std::string font_root_name = PathSetExtension(next_item, "");
+                     UUID asset_id = create_font_name_id(font_root_name);
                      m_ResourceMap.insert(ResourceMap::value_type(asset_id, next_item));
                    }
                }
@@ -325,8 +342,11 @@ public:
 Result_t
 AS_02::TimedText::ST2052_TextParser::h__TextParser::OpenRead()
 {
+  setup_default_font_family_list();
+
   if ( ! m_Root.ParseString(m_XMLDoc.c_str()) )
     {
+      DefaultLogSink(). Error("ST 2052-1 document is not well-formed.\n");
       return RESULT_FORMAT;
     }
 
@@ -362,16 +382,32 @@ AS_02::TimedText::ST2052_TextParser::h__TextParser::OpenRead()
 
   AttributeVisitor font_visitor("fontFamily");
   apply_visitor(m_Root, font_visitor);
+  char buf[64];
 
   for ( i = font_visitor.value_list.begin(); i != font_visitor.value_list.end(); ++i )
     {
       UUID font_id = create_font_name_id(*i);
-      TimedTextResourceDescriptor font_resource;
-      memcpy(font_resource.ResourceID, font_id.Value(), UUIDlen);
-      font_resource.Type = ASDCP::TimedText::MT_OPENTYPE;
-      m_TDesc.ResourceList.push_back(font_resource);
-      m_ResourceTypes.insert(ResourceTypeMap_t::value_type(UUID(font_resource.ResourceID),
-                                                          ASDCP::TimedText::MT_OPENTYPE));
+
+      if ( PathIsFile(font_id.EncodeHex(buf, 64))
+          || PathIsFile(*i+".ttf")
+          || PathIsFile(*i+".otf") )
+       {
+         TimedTextResourceDescriptor font_resource;
+         memcpy(font_resource.ResourceID, font_id.Value(), UUIDlen);
+         font_resource.Type = ASDCP::TimedText::MT_OPENTYPE;
+         m_TDesc.ResourceList.push_back(font_resource);
+         m_ResourceTypes.insert(ResourceTypeMap_t::value_type(UUID(font_resource.ResourceID),
+                                                              ASDCP::TimedText::MT_OPENTYPE));
+       }
+      else
+       {
+         AutoMutex l(sg_default_font_family_list_lock);
+         if ( sg_default_font_family_list.find(*i) == sg_default_font_family_list.end() )
+           {
+             DefaultLogSink(). Error("Unable to locate external font resource \"%s\".\n", i->c_str());
+             return RESULT_FORMAT;
+           }
+       }
     }
 
   return RESULT_OK;