本文整理汇总了C++中Kumu::DefaultLogSink方法的典型用法代码示例。如果您正苦于以下问题:C++ Kumu::DefaultLogSink方法的具体用法?C++ Kumu::DefaultLogSink怎么用?C++ Kumu::DefaultLogSink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kumu
的用法示例。
在下文中一共展示了Kumu::DefaultLogSink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
ASDCP::Result_t
ASDCP::MPEG2::Parser::h__Parser::OpenRead(const std::string& filename)
{
ui32_t read_count = 0;
Result_t result = m_FileReader.OpenRead(filename);
if ( ASDCP_SUCCESS(result) )
result = m_FileReader.Read(m_TmpBuffer.Data(), m_TmpBuffer.Capacity(), &read_count);
if ( ASDCP_SUCCESS(result) )
{
const byte_t* p = m_TmpBuffer.RoData();
// the mxflib parser demanded the file start with a sequence header.
// Since no one complained and that's the easiest thing to implement,
// I have left it that way. Let me know if you want to be able to
// locate the first GOP in the stream.
ui32_t i = 0;
while ( p[i] == 0 ) i++;
if ( i < 2 || p[i] != 1 || ! ( p[i+1] == SEQ_START || p[i+1] == PIC_START ) )
{
DefaultLogSink().Error("Frame buffer does not begin with a PIC or SEQ start code.\n");
return RESULT_RAW_FORMAT;
}
if ( ASDCP_SUCCESS(result) )
{
m_Parser.SetDelegate(&m_ParamsDelegate);
result = m_Parser.Parse(p, read_count);
}
}
if ( ASDCP_SUCCESS(result) )
{
ui64_t tmp = m_FileReader.Size() / 65536; // a gross approximation
m_ParamsDelegate.m_VDesc.ContainerDuration = (ui32_t) tmp;
m_Parser.SetDelegate(&m_ParserDelegate);
m_FileReader.Seek(0);
}
if ( ASDCP_FAILURE(result) )
{
DefaultLogSink().Error("Unable to identify a wrapping mode for the essence in file \"%s\"\n", filename.c_str());
m_FileReader.Close();
}
return result;}
示例2: erase
bool
ASDCP::MXF::UTF16String::Unarchive(Kumu::MemIOReader* Reader)
{
erase();
const ui16_t* p = (ui16_t*)Reader->CurrentData();
ui32_t length = Reader->Remainder() / 2;
char mb_buf[MB_LEN_MAX+1];
for ( ui32_t i = 0; i < length; i++ )
{
int count = wctomb(mb_buf, KM_i16_BE(p[i]));
if ( count == -1 )
{
DefaultLogSink().Error("Unable to decode wide character 0x%04hx\n", p[i]);
return false;
}
assert(count <= MB_LEN_MAX);
mb_buf[count] = 0;
this->append(mb_buf);
}
Reader->SkipOffset(length*2);
return true;
}
示例3: OpenReadFrame
Result_t OpenReadFrame(const char* filename, FrameBuffer& FB)
{
ASDCP_TEST_NULL_STR(filename);
m_File.Close();
Result_t result = m_File.OpenRead(filename);
if ( ASDCP_SUCCESS(result) )
{
Kumu::fsize_t file_size = m_File.Size();
if ( FB.Capacity() < file_size )
{
DefaultLogSink().Error("FrameBuf.Capacity: %u frame length: %u\n", FB.Capacity(), (ui32_t)file_size);
return RESULT_SMALLBUF;
}
}
ui32_t read_count;
if ( ASDCP_SUCCESS(result) )
result = m_File.Read(FB.Data(), FB.Capacity(), &read_count);
if ( ASDCP_SUCCESS(result) )
FB.Size(read_count);
return result;
}
示例4: DefaultLogSink
bool
ASDCP::MXF::TLVReader::FindTL(const MDDEntry& Entry)
{
if ( m_Lookup == 0 )
{
DefaultLogSink().Error("No Lookup service\n");
return false;
}
TagValue TmpTag;
if ( m_Lookup->TagForKey(Entry.ul, TmpTag) != RESULT_OK )
{
if ( Entry.tag.a == 0 )
{
// DefaultLogSink().Debug("No such UL in this TL list: %s (%02x %02x)\n",
// Entry.name, Entry.tag.a, Entry.tag.b);
return false;
}
TmpTag = Entry.tag;
}
TagMap::iterator e_i = m_ElementMap.find(TmpTag);
if ( e_i != m_ElementMap.end() )
{
m_size = (*e_i).second.first;
m_capacity = m_size + (*e_i).second.second;
return true;
}
// DefaultLogSink().Debug("Not Found (%02x %02x): %s\n", TmpTag.a, TmpTag.b, Entry.name);
return false;
}
示例5: DefaultLogSink
void
print_ssl_error()
{
char err_buf[256];
unsigned long errval = ERR_get_error();
DefaultLogSink().Error("OpenSSL: %s\n", ERR_error_string(errval, err_buf));
}
示例6: TmpID
Result_t
ASDCP::TimedText::DCSubtitleParser::h__SubtitleParser::ReadAncillaryResource(const byte_t* uuid, FrameBuffer& FrameBuf,
const IResourceResolver& Resolver) const
{
FrameBuf.AssetID(uuid);
UUID TmpID(uuid);
char buf[64];
ResourceTypeMap_t::const_iterator rmi = m_ResourceTypes.find(TmpID);
if ( rmi == m_ResourceTypes.end() )
{
DefaultLogSink().Error("Unknown ancillary resource id: %s\n", TmpID.EncodeHex(buf, 64));
return RESULT_RANGE;
}
Result_t result = Resolver.ResolveRID(uuid, FrameBuf);
if ( KM_SUCCESS(result) )
{
if ( (*rmi).second == MT_PNG )
FrameBuf.MIMEType("image/png");
else if ( (*rmi).second == MT_OPENTYPE )
FrameBuf.MIMEType("application/x-font-opentype");
else
FrameBuf.MIMEType("application/octet-stream");
}
return result;
}
示例7: if
bool
ASDCP::MXF::UTF16String::Archive(Kumu::MemIOWriter* Writer) const
{
if ( size() > IdentBufferLen )
{
DefaultLogSink().Error("String length exceeds maximum %u bytes\n", IdentBufferLen);
return false;
}
const char* mbp = c_str();
wchar_t wcp;
ui32_t remainder = size();
ui32_t length = size();
ui32_t i = 0;
while ( i < length )
{
int count = mbtowc(&wcp, mbp+i, remainder);
if ( count == -1 )
{
DefaultLogSink().Error("Error decoding multi-byte sequence starting at offset %u\n", i);
return false;
}
else if ( count == 0 )
{
break;
}
bool result = Writer->WriteUi16BE((ui16_t)wcp);
if ( result == false )
{
DefaultLogSink().Error("No more space in memory IO writer\n");
return false;
}
i += count;
remainder -= count;
}
return true;
}
示例8: Goto_SLICE
inline Result_t Goto_SLICE()
{
switch ( m_State )
{
case ST_PIC:
case ST_EXT:
m_State = ST_SLICE;
return RESULT_OK;
}
DefaultLogSink().Error("Slice follows %s\n", StringParserState(m_State));
return RESULT_STATE;
}
示例9: DefaultLogSink
Result_t
ASDCP::TimedText::LocalFilenameResolver::OpenRead(const std::string& dirname)
{
if ( PathIsDirectory(dirname) )
{
m_Dirname = dirname;
return RESULT_OK;
}
DefaultLogSink().Error("Path '%s' is not a directory, defaulting to '.'\n", dirname.c_str());
m_Dirname = ".";
return RESULT_FALSE;
}
示例10: Goto_SEQ
inline Result_t Goto_SEQ()
{
switch ( m_State )
{
case ST_INIT:
case ST_EXT:
m_State = ST_SEQ;
return RESULT_OK;
}
DefaultLogSink().Error("SEQ follows %s\n", StringParserState(m_State));
return RESULT_STATE;
}
示例11: DefaultLogSink
ASDCP::Result_t
ASDCP::KLVPacket::InitFromBuffer(const byte_t* buf, ui32_t buf_len)
{
m_KeyStart = m_ValueStart = 0;
m_KLLength = m_ValueLength = 0;
if ( memcmp(buf, SMPTE_UL_START, 4) != 0 )
{
DefaultLogSink().Error("Unexpected UL preamble: %02x.%02x.%02x.%02x\n",
buf[0], buf[1], buf[2], buf[3]);
return RESULT_FAIL;
}
ui32_t ber_len = Kumu::BER_length(buf + SMPTE_UL_LENGTH);
if ( ber_len > ( buf_len - SMPTE_UL_LENGTH ) )
{
DefaultLogSink().Error("BER encoding length exceeds buffer size\n");
return RESULT_FAIL;
}
if ( ber_len == 0 )
{
DefaultLogSink().Error("KLV format error, zero BER length not allowed\n");
return RESULT_FAIL;
}
ui64_t tmp_size;
if ( ! Kumu::read_BER(buf + SMPTE_UL_LENGTH, &tmp_size) )
return RESULT_FAIL;
assert (tmp_size <= 0xFFFFFFFFL);
m_ValueLength = (ui32_t) tmp_size;
m_KLLength = SMPTE_UL_LENGTH + Kumu::BER_length(buf + SMPTE_UL_LENGTH);
m_KeyStart = buf;
m_ValueStart = buf + m_KLLength;
return RESULT_OK;
}
示例12: RID
Result_t
ASDCP::TimedText::LocalFilenameResolver::ResolveRID(const byte_t* uuid, TimedText::FrameBuffer& FrameBuf) const
{
Result_t result = RESULT_NOT_FOUND;
char buf[64];
UUID RID(uuid);
PathList_t found_list;
FindInPath(PathMatchRegex(RID.EncodeHex(buf, 64)), m_Dirname, found_list);
if ( found_list.size() == 1 )
{
FileReader Reader;
DefaultLogSink().Debug("retrieving resource %s from file %s\n", buf, found_list.front().c_str());
result = Reader.OpenRead(found_list.front().c_str());
if ( KM_SUCCESS(result) )
{
ui32_t read_count, read_size = Reader.Size();
result = FrameBuf.Capacity(read_size);
if ( KM_SUCCESS(result) )
result = Reader.Read(FrameBuf.Data(), read_size, &read_count);
if ( KM_SUCCESS(result) )
FrameBuf.Size(read_count);
}
}
else if ( ! found_list.empty() )
{
DefaultLogSink().Error("More than one file in %s matches %s.\n", m_Dirname.c_str(), buf);
result = RESULT_RAW_FORMAT;
}
return result;
}
示例13: Goto_GOP
inline Result_t Goto_GOP()
{
switch ( m_State )
{
case ST_EXT:
case ST_SEQ:
m_State = ST_GOP;
return RESULT_OK;
default:
break;
}
DefaultLogSink().Error("GOP follows %s\n", StringParserState(m_State));
return RESULT_STATE;
}
示例14: Goto_EXT
inline Result_t Goto_EXT()
{
switch ( m_State )
{
case ST_PIC:
case ST_EXT:
case ST_SEQ:
case ST_GOP:
m_State = ST_EXT;
return RESULT_OK;
}
DefaultLogSink().Error("EXT follows %s\n", StringParserState(m_State));
return RESULT_STATE;
}
示例15: assert
ASDCP::Result_t
ASDCP::KLVPacket::WriteKLToBuffer(ASDCP::FrameBuffer& Buffer, const UL& label, ui32_t length)
{
assert(label.HasValue());
if ( Buffer.Size() + kl_length > Buffer.Capacity() )
{
DefaultLogSink().Error("Small write buffer\n");
return RESULT_FAIL;
}
memcpy(Buffer.Data() + Buffer.Size(), label.Value(), label.Size());
if ( ! Kumu::write_BER(Buffer.Data() + Buffer.Size() + SMPTE_UL_LENGTH, length, MXF_BER_LENGTH) )
return RESULT_FAIL;
Buffer.Size(Buffer.Size() + kl_length);
return RESULT_OK;
}