本文整理汇总了C++中AP4_FAILED函数的典型用法代码示例。如果您正苦于以下问题:C++ AP4_FAILED函数的具体用法?C++ AP4_FAILED怎么用?C++ AP4_FAILED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AP4_FAILED函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*----------------------------------------------------------------------
| AP4_FileByteStream::AP4_FileByteStream
+---------------------------------------------------------------------*/
AP4_FileByteStream::AP4_FileByteStream(const char* name,
AP4_FileByteStream::Mode mode)
{
AP4_ByteStream* stream = NULL;
AP4_Result result = AP4_KodiFileByteStream::Create(this, name, mode, stream);
if (AP4_FAILED(result)) throw AP4_Exception(result);
m_Delegate = stream;
}
示例2:
/*----------------------------------------------------------------------
| AP4_DecryptingSampleReader::ReadSampleData
+---------------------------------------------------------------------*/
AP4_Result
AP4_DecryptingSampleReader::ReadSampleData(AP4_Sample& sample,
AP4_DataBuffer& sample_data)
{
AP4_Result result = sample.ReadData(m_DataBuffer);
if (AP4_FAILED(result)) return result;
return m_Decrypter->DecryptSampleData(m_DataBuffer, sample_data);
}
示例3:
/*----------------------------------------------------------------------
| AP4_OdafAtom::Create
+---------------------------------------------------------------------*/
AP4_OdafAtom*
AP4_OdafAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI08 version;
AP4_UI32 flags;
if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
if (version != 0) return NULL;
return new AP4_OdafAtom(size, version, flags, stream);
}
示例4:
/*----------------------------------------------------------------------
| AP4_TfhdAtom::Create
+---------------------------------------------------------------------*/
AP4_TfhdAtom*
AP4_TfhdAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI32 version;
AP4_UI32 flags;
if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
if (version > 0) return NULL;
if (size != ComputeSize(flags)) return NULL;
return new AP4_TfhdAtom(size, version, flags, stream);
}
示例5:
/*----------------------------------------------------------------------
| AP4_BlocAtom::Create
+---------------------------------------------------------------------*/
AP4_BlocAtom*
AP4_BlocAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI08 version;
AP4_UI32 flags;
if (size < AP4_FULL_ATOM_HEADER_SIZE) return NULL;
if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
if (version > 1) return NULL;
return new AP4_BlocAtom(size, version, flags, stream);
}
示例6: ReadFullHeader
/*----------------------------------------------------------------------
| AP4_PiffTrackEncryptionAtom::Create
+---------------------------------------------------------------------*/
AP4_PiffTrackEncryptionAtom*
AP4_PiffTrackEncryptionAtom::Create(AP4_Size size, AP4_ByteStream& stream)
{
AP4_UI08 version = 0;
AP4_UI32 flags = 0;
AP4_Result result = ReadFullHeader(stream, version, flags);
if (AP4_FAILED(result)) return NULL;
if (version != 0) return NULL;
return new AP4_PiffTrackEncryptionAtom(size, version, flags, stream);
}
示例7: while
/*----------------------------------------------------------------------
| AP4_RtpAtom::WriteFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_RtpAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
// description format
result = stream.WriteUI32(m_DescriptionFormat);
if (AP4_FAILED(result)) return result;
// sdp text
result = stream.Write(m_SdpText.c_str(), m_SdpText.length());
if (AP4_FAILED(result)) return result;
// pad with zeros if necessary
AP4_Size padding = m_Size-(AP4_ATOM_HEADER_SIZE+4+m_SdpText.length());
while (padding--) stream.WriteUI08(0);
return AP4_SUCCESS;
}
示例8:
/*----------------------------------------------------------------------
| AP4_IsmaTrackEncrypter::ProcessSample
+---------------------------------------------------------------------*/
AP4_Result
AP4_IsmaTrackEncrypter::ProcessSample(AP4_DataBuffer& data_in,
AP4_DataBuffer& data_out)
{
AP4_Result result = m_Cipher->EncryptSample(data_in, data_out, m_ByteOffset, false);
if (AP4_FAILED(result)) return result;
m_ByteOffset += data_in.GetDataSize();
return AP4_SUCCESS;
}
示例9: SetEncryptedPayload
/*----------------------------------------------------------------------
| AP4_OddaAtom::SetEncryptedPayload
+---------------------------------------------------------------------*/
AP4_Result
AP4_OddaAtom::SetEncryptedPayload(AP4_ByteStream& stream)
{
// the new encrypted data length is the size of the stream
AP4_LargeSize length;
AP4_Result result = stream.GetSize(length);
if (AP4_FAILED(result)) return result;
return SetEncryptedPayload(stream, length);
}
示例10:
/*----------------------------------------------------------------------
| AP4_UnknownSampleEntry::ReadFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_UnknownSampleEntry::ReadFields(AP4_ByteStream& stream)
{
// sample entry
AP4_Result result = AP4_SampleEntry::ReadFields(stream);
if (AP4_FAILED(result)) return result;
// read the payload
return stream.Read(m_Payload.UseData(), m_Payload.GetDataSize());
}
示例11: AP4_Movie_GetTrackByIndex
AP4_Track*
AP4_Movie_GetTrackByIndex(AP4_Movie* self, AP4_Ordinal index)
{
AP4_Track* track = NULL;
if (AP4_FAILED(self->GetTracks().Get(index, track))) {
return NULL;
} else {
return track;
}
}
示例12:
/*----------------------------------------------------------------------
| AP4_IsfmAtom::WriteFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_IsfmAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
// selective encryption
result = stream.WriteUI08(m_SelectiveEncryption ? 1 : 0);
if (AP4_FAILED(result)) return result;
// key indicator length
result = stream.WriteUI08(m_KeyIndicatorLength);
if (AP4_FAILED(result)) return result;
// IV length
result = stream.WriteUI08(m_IvLength);
if (AP4_FAILED(result)) return result;
return AP4_SUCCESS;
}
示例13: switch
/*----------------------------------------------------------------------
| AP4_Expandable::Write
+---------------------------------------------------------------------*/
AP4_Result
AP4_Expandable::Write(AP4_ByteStream& stream)
{
AP4_Result result;
// write the class id
switch (m_ClassIdSize) {
case CLASS_ID_SIZE_08:
result = stream.WriteUI08((AP4_UI08)m_ClassId);
if (AP4_FAILED(result)) return result;
break;
default:
return AP4_ERROR_INTERNAL;
}
// write the size
AP4_ASSERT(m_HeaderSize-1 <= 8);
AP4_ASSERT(m_HeaderSize >= 2);
unsigned int size = m_PayloadSize;
unsigned char bytes[8];
// last bytes of the encoded size
bytes[m_HeaderSize-2] = size&0x7F;
// leading bytes of the encoded size
for (int i=m_HeaderSize-3; i>=0; i--) {
// move to the next 7 bits
size >>= 7;
// output a byte with a top bit marker
bytes[i] = (size&0x7F) | 0x80;
}
result = stream.Write(bytes, m_HeaderSize-1);
if (AP4_FAILED(result)) return result;
// write the fields
WriteFields(stream);
return result;
}
示例14:
/*----------------------------------------------------------------------
| AP4_StsdAtom::Create
+---------------------------------------------------------------------*/
AP4_StsdAtom*
AP4_StsdAtom::Create(AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory)
{
AP4_UI08 version;
AP4_UI32 flags;
if (AP4_FAILED(AP4_Atom::ReadFullHeader(stream, version, flags))) return NULL;
if (version > 1) return NULL;
return new AP4_StsdAtom(size, version, flags, stream, atom_factory);
}
示例15: CreateAtomFromStream
/*----------------------------------------------------------------------
| AP4_AtomFactory::CreateAtomFromStream
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
AP4_Atom*& atom)
{
AP4_Size bytes_available = 0;
if (AP4_FAILED(stream.GetSize(bytes_available)) ||
bytes_available == 0) {
bytes_available = (AP4_Size)((unsigned long)(-1));
}
return CreateAtomFromStream(stream, bytes_available, atom, NULL);
}