/*
-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
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 )
{
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 )
{
return RESULT_OK;
}
+//------------------------------------------------------------------------------------------
//
Kumu::DirScannerEx::DirScannerEx() : m_Handle(0) {}
#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",
ct.hour = st.wHour;
ct.minute = st.wMinute;
ct.second = st.wSecond;
+ ct.offset = 0;
caltime_tai(&ct, this);
#else
struct timeval now;
{ { 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 },
/*
-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
\brief AS-DCP library, PCM essence reader and writer implementation
*/
-
#include "AS_02_internal.h"
#include "KM_xml.h"
#include <openssl/sha.h>
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");
+}
+
+
//------------------------------------------------------------------------------------------
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));
}
}
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;
}
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;