当前位置: 首页>>代码示例>>C++>>正文


C++ Kumu类代码示例

本文整理汇总了C++中Kumu的典型用法代码示例。如果您正苦于以下问题:C++ Kumu类的具体用法?C++ Kumu怎么用?C++ Kumu使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Kumu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
  }
开发者ID:SeanFarinha,项目名称:opendcp,代码行数:27,代码来源:DCData_ByteStream_Parser.cpp

示例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;
}
开发者ID:lucat,项目名称:opendcp-1,代码行数:26,代码来源:MXFTypes.cpp

示例3: KM_RESULT_STATE_HERE

// Open the file for writing. The file must not exist. Returns error if
// the operation cannot be completed.
Result_t
AS_02::JP2K::MXFWriter::h__Writer::OpenWrite(const std::string& filename,
					     ASDCP::MXF::FileDescriptor* essence_descriptor,
					     ASDCP::MXF::InterchangeObject_list_t& essence_sub_descriptor_list,
					     const AS_02::IndexStrategy_t& IndexStrategy,
					     const ui32_t& PartitionSpace_sec, const ui32_t& HeaderSize)
{
  if ( ! m_State.Test_BEGIN() )
    {
      KM_RESULT_STATE_HERE();
	return RESULT_STATE;
    }

  if ( m_IndexStrategy != AS_02::IS_FOLLOW )
    {
      DefaultLogSink().Error("Only strategy IS_FOLLOW is supported at this time.\n");
      return Kumu::RESULT_NOTIMPL;
    }

  Result_t result = m_File.OpenWrite(filename.c_str());

  if ( KM_SUCCESS(result) )
    {
      m_IndexStrategy = IndexStrategy;
      m_PartitionSpace = PartitionSpace_sec; // later converted to edit units by SetSourceStream()
      m_HeaderSize = HeaderSize;

      if ( essence_descriptor->GetUL() != UL(m_Dict->ul(MDD_RGBAEssenceDescriptor))
	   && essence_descriptor->GetUL() != UL(m_Dict->ul(MDD_CDCIEssenceDescriptor)) )
	{
	  DefaultLogSink().Error("Essence descriptor is not a RGBAEssenceDescriptor or CDCIEssenceDescriptor.\n");
	  essence_descriptor->Dump();
	  return RESULT_AS02_FORMAT;
	}

      m_EssenceDescriptor = essence_descriptor;

      ASDCP::MXF::InterchangeObject_list_t::iterator i;
      for ( i = essence_sub_descriptor_list.begin(); i != essence_sub_descriptor_list.end(); ++i )
	{
	  if ( (*i)->GetUL() != UL(m_Dict->ul(MDD_JPEG2000PictureSubDescriptor)) )
	    {
	      DefaultLogSink().Error("Essence sub-descriptor is not a JPEG2000PictureSubDescriptor.\n");
	      (*i)->Dump();
	    }

	  m_EssenceSubDescriptorList.push_back(*i);
	  GenRandomValue((*i)->InstanceUID);
	  m_EssenceDescriptor->SubDescriptors.push_back((*i)->InstanceUID);
	  *i = 0; // parent will only free the ones we don't keep
	}

      result = m_State.Goto_INIT();
    }

  return result;
}
开发者ID:ArthurGeorget,项目名称:asdcplib,代码行数:59,代码来源:AS_02_JP2K.cpp

示例4: 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;
}
开发者ID:lucat,项目名称:opendcp-1,代码行数:43,代码来源:MXFTypes.cpp

示例5: 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;
}
开发者ID:SeanFarinha,项目名称:opendcp,代码行数:38,代码来源:KLV.cpp

示例6: TmpBuffer

ASDCP::Result_t
ASDCP::RF64::SimpleRF64Header::ReadFromFile(const Kumu::FileReader& InFile, ui32_t* data_start)
{
  ui32_t read_count = 0;
  ui32_t local_data_start = 0;
  ASDCP::PCM::FrameBuffer TmpBuffer(Wav::MaxWavHeader);

  if ( data_start == 0 )
    data_start = &local_data_start;

  Result_t result = InFile.Read(TmpBuffer.Data(), TmpBuffer.Capacity(), &read_count);

  if ( ASDCP_SUCCESS(result) )
    result = ReadFromBuffer(TmpBuffer.RoData(), read_count, data_start);
  else
    DefaultLogSink().Error("Failed to read %d bytes from file\n", Wav::MaxWavHeader);

    return result;
}
开发者ID:ArthurGeorget,项目名称:asdcplib,代码行数:19,代码来源:Wav.cpp

示例7: 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;
}
开发者ID:SeanFarinha,项目名称:opendcp,代码行数:19,代码来源:KLV.cpp

示例8: 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;}
开发者ID:MarcAntoine-Arnaud,项目名称:asdcplib,代码行数:49,代码来源:MPEG2_Parser.cpp

示例9: 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;
}
开发者ID:lucat,项目名称:opendcp-1,代码行数:35,代码来源:MXFTypes.cpp

示例10: 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));
}
开发者ID:johnahartman,项目名称:opendcp,代码行数:7,代码来源:AS_DCP_AES.cpp

示例11: 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;
}
开发者ID:navrocky,项目名称:asdcplib,代码行数:32,代码来源:TimedText_Parser.cpp

示例12: assert

ASDCP::Result_t
AS_02::TimedText::MXFWriter::h__Writer::SetSourceStream(ASDCP::TimedText::TimedTextDescriptor const& TDesc)
{
  if ( ! m_State.Test_INIT() )
    {
      KM_RESULT_STATE_HERE();
      return RESULT_STATE;
    }

  assert(m_Dict);
  m_TDesc = TDesc;

  Result_t result = TimedText_TDesc_to_MD(m_TDesc);

  if ( KM_SUCCESS(result) )
    {
      ResourceList_t::const_iterator i;
      for ( i = m_TDesc.ResourceList.begin() ; i != m_TDesc.ResourceList.end(); ++i )
	{
	  TimedTextResourceSubDescriptor* resourceSubdescriptor = new TimedTextResourceSubDescriptor(m_Dict);
	  GenRandomValue(resourceSubdescriptor->InstanceUID);
	  resourceSubdescriptor->AncillaryResourceID.Set((*i).ResourceID);
	  resourceSubdescriptor->MIMEMediaType = MIME2str((*i).Type);
	  resourceSubdescriptor->EssenceStreamID = m_EssenceStreamID++;
	  m_EssenceSubDescriptorList.push_back((FileDescriptor*)resourceSubdescriptor);
	  m_EssenceDescriptor->SubDescriptors.push_back(resourceSubdescriptor->InstanceUID);

	  // 72 == sizeof K, L, instanceuid, uuid + sizeof int32 + tag/len * 4
	  m_HeaderSize += ( resourceSubdescriptor->MIMEMediaType.ArchiveLength() * 2 /*ArchiveLength is broken*/ ) + 72;
	}
    }
  
  if ( KM_SUCCESS(result) )
    {
      result = WriteAS02Header(TIMED_TEXT_PACKAGE_LABEL, UL(m_Dict->ul(MDD_TimedTextWrappingClip)),
			       "Data Track", UL(m_EssenceUL), UL(m_Dict->ul(MDD_TimedTextEssence)),
			       TDesc.EditRate, derive_timecode_rate_from_edit_rate(TDesc.EditRate));
    }
 
  if ( KM_SUCCESS(result) )
    {
      this->m_IndexWriter.SetPrimerLookup(&this->m_HeaderPart.m_Primer);
    }

  if ( KM_SUCCESS(result) )
    {
      memcpy(m_EssenceUL, m_Dict->ul(MDD_TimedTextEssence), SMPTE_UL_LENGTH);
      m_EssenceUL[SMPTE_UL_LENGTH-1] = 1; // first (and only) essence container
      result = m_State.Goto_READY();
    }

  return result;
}
开发者ID:ArthurGeorget,项目名称:asdcplib,代码行数:53,代码来源:AS_02_TimedText.cpp

示例13: 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;
    }
开发者ID:MarcAntoine-Arnaud,项目名称:asdcplib,代码行数:13,代码来源:MPEG2_Parser.cpp

示例14: 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;
    }
开发者ID:MarcAntoine-Arnaud,项目名称:asdcplib,代码行数:13,代码来源:MPEG2_Parser.cpp

示例15: 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;
}
开发者ID:navrocky,项目名称:asdcplib,代码行数:13,代码来源:TimedText_Parser.cpp


注:本文中的Kumu类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。