summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2016-03-02 18:57:41 +0000
committerjhurst <>2016-03-02 18:57:41 +0000
commit1bc2108d63e525a45c66d5de6236dbb5037cdb92 (patch)
treef5b83030d065d0ece0fc9af84e7443fa4dd85bf7 /src
parent72b713cf2bad317c51f737ad8f3a2cf214f6da9d (diff)
Changed default UNIX file permissions to "666"
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)
Diffstat (limited to 'src')
-rw-r--r--src/KM_fileio.cpp9
-rw-r--r--src/KM_tai.cpp1
-rw-r--r--src/MDD.cpp12
-rw-r--r--src/ST2052_TextParser.cpp56
4 files changed, 58 insertions, 20 deletions
diff --git a/src/KM_fileio.cpp b/src/KM_fileio.cpp
index ed8aa67..2767931 100644
--- a/src/KM_fileio.cpp
+++ b/src/KM_fileio.cpp
@@ -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",
diff --git a/src/KM_tai.cpp b/src/KM_tai.cpp
index 7cf363a..00a1231 100644
--- a/src/KM_tai.cpp
+++ b/src/KM_tai.cpp
@@ -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;
diff --git a/src/MDD.cpp b/src/MDD.cpp
index 7698ff5..d8e2ee9 100644
--- a/src/MDD.cpp
+++ b/src/MDD.cpp
@@ -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 },
diff --git a/src/ST2052_TextParser.cpp b/src/ST2052_TextParser.cpp
index 0637875..012f4ce 100644
--- a/src/ST2052_TextParser.cpp
+++ b/src/ST2052_TextParser.cpp
@@ -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;