本文整理汇总了C++中AP4_SUCCEEDED函数的典型用法代码示例。如果您正苦于以下问题:C++ AP4_SUCCEEDED函数的具体用法?C++ AP4_SUCCEEDED怎么用?C++ AP4_SUCCEEDED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AP4_SUCCEEDED函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TimeSeek
bool TimeSeek(double pts, bool preceeding)
{
AP4_Ordinal sampleIndex;
if (AP4_SUCCEEDED(SeekSample(m_Track->GetId(), static_cast<AP4_UI64>(pts*(double)m_Track->GetMediaTimeScale()), sampleIndex, preceeding)))
{
if (m_Decrypter)
m_Decrypter->SetSampleIndex(sampleIndex);
m_started = true;
return AP4_SUCCEEDED(ReadSample());
}
return false;
};
开发者ID:xbmcin,项目名称:XBMCinTC,代码行数:12,代码来源:main.cpp
示例2: main
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
if (argc != 2) {
PrintUsageAndExit();
}
const char* input_filename = argv[1];
// open the input
AP4_ByteStream* input = NULL;
AP4_Result result = AP4_FileByteStream::Create(input_filename, AP4_FileByteStream::STREAM_MODE_READ, input);
if (AP4_FAILED(result)) {
fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename);
return 1;
}
// get the movie
AP4_File* file = new AP4_File(*input, AP4_DefaultAtomFactory::Instance, true);
AP4_Movie* movie = file->GetMovie();
AP4_Atom* atom = NULL;
do {
// process the next atom
result = AP4_DefaultAtomFactory::Instance.CreateAtomFromStream(*input, atom);
if (AP4_SUCCEEDED(result)) {
printf("atom size=%lld\n", atom->GetSize());
if (atom->GetType() == AP4_ATOM_TYPE_MOOF) {
AP4_ContainerAtom* moof = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom);
if (moof) {
// remember where we are in the stream
AP4_Position position = 0;
input->Tell(position);
// process the movie fragment
ProcessMoof(movie, moof, input, position-atom->GetSize(), position+8);
// go back to where we were before processing the fragment
input->Seek(position);
}
} else {
delete atom;
}
}
} while (AP4_SUCCEEDED(result));
// cleanup
delete file;
input->Release();
return 0;
}
开发者ID:danelledeano,项目名称:VTech-InnoTab,代码行数:54,代码来源:FragmentParserTest.cpp
示例3: AP4_SUCCEEDED
/*----------------------------------------------------------------------
| AP4_AtomFactory::CreateAtomsFromStream
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomFactory::CreateAtomsFromStream(AP4_ByteStream& stream,
AP4_AtomParent& atoms)
{
AP4_LargeSize stream_size = 0;
AP4_Position stream_position = 0;
AP4_LargeSize bytes_available = (AP4_LargeSize)(-1);
if (AP4_SUCCEEDED(stream.GetSize(stream_size)) &&
stream_size != 0 &&
AP4_SUCCEEDED(stream.Tell(stream_position)) &&
stream_position <= stream_size) {
bytes_available = stream_size-stream_position;
}
return CreateAtomsFromStream(stream, bytes_available, atoms);
}
开发者ID:fumoboy007,项目名称:Bento4,代码行数:18,代码来源:Ap4AtomFactory.cpp
示例4: m_Movie
/*----------------------------------------------------------------------
| AP4_File::AP4_File
+---------------------------------------------------------------------*/
AP4_File::AP4_File(AP4_ByteStream& stream, AP4_AtomFactory& atom_factory) :
m_Movie(NULL)
{
// get all atoms
AP4_Atom* atom;
while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream, atom))) {
switch (atom->GetType()) {
case AP4_ATOM_TYPE_MOOV:
m_Movie = new AP4_Movie(dynamic_cast<AP4_MoovAtom*>(atom),
stream);
break;
case AP4_ATOM_TYPE_MOOF:
if (m_Movie) {
m_Movie->ProcessMoof(AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom),
stream);
}
delete atom;
break;
case AP4_ATOM_TYPE_FTYP:
//m_Movie = new AP4_Movie(dynamic_cast<AP4_FtypAtom*>(atom), stream);
m_FileType = dynamic_cast<AP4_FtypAtom*>(atom);
default:
m_OtherAtoms.Add(atom);
}
}
}
开发者ID:Tphive,项目名称:mpc-be,代码行数:29,代码来源:Ap4File.cpp
示例5:
/*----------------------------------------------------------------------
| AP4_TrackSampleSource::ReadNextSample
+---------------------------------------------------------------------*/
AP4_Result
AP4_TrackSampleSource::ReadNextSample(AP4_Sample& sample, AP4_DataBuffer& buffer)
{
AP4_Result result = m_Track->ReadSample(m_SampleIndex, sample, buffer);
if (AP4_SUCCEEDED(result)) ++m_SampleIndex;
return result;
}
开发者ID:Fluffiest,项目名称:mpc-hc,代码行数:10,代码来源:Ap4SampleSource.cpp
示例6: AP4_ContainerAtom
/*----------------------------------------------------------------------
| AP4_StsdAtom::AP4_StsdAtom
+---------------------------------------------------------------------*/
AP4_StsdAtom::AP4_StsdAtom(AP4_UI32 size,
AP4_UI08 version,
AP4_UI32 flags,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory) :
AP4_ContainerAtom(AP4_ATOM_TYPE_STSD, size, false, version, flags)
{
// read the number of entries
AP4_UI32 entry_count;
stream.ReadUI32(entry_count);
// save and switch the factory's context
atom_factory.PushContext(m_Type);
// read all entries
AP4_LargeSize bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
for (unsigned int i=0; i<entry_count; i++) {
AP4_Atom* atom;
if (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
bytes_available,
atom))) {
atom->SetParent(this);
m_Children.Add(atom);
}
}
// restore the saved context
atom_factory.PopContext();
// initialize the sample description cache
m_SampleDescriptions.EnsureCapacity(m_Children.ItemCount());
for (AP4_Ordinal i=0; i<m_Children.ItemCount(); i++) {
m_SampleDescriptions.Append(NULL);
}
}
开发者ID:AchimTuran,项目名称:inputstream.mpd,代码行数:38,代码来源:Ap4StsdAtom.cpp
示例7: AP4_ContainerAtom
/*----------------------------------------------------------------------
| AP4_StsdAtom::AP4_StsdAtom
+---------------------------------------------------------------------*/
AP4_StsdAtom::AP4_StsdAtom(AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory) :
AP4_ContainerAtom(AP4_ATOM_TYPE_STSD, size, true, stream)
{
// read the number of entries
AP4_UI32 entry_count;
stream.ReadUI32(entry_count);
// read all entries
AP4_Size bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
m_Data.SetDataSize(bytes_available);
stream.Read(m_Data.UseData(), m_Data.GetDataSize());
AP4_ByteStream* s = DNew AP4_MemoryByteStream(m_Data.UseData(), m_Data.GetDataSize());
for (unsigned int i=0; i<entry_count; i++) {
AP4_Atom* atom;
if (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(*s,
bytes_available,
atom,
this))) {
atom->SetParent(this);
m_Children.Add(atom);
}
}
s->Release();
// initialize the sample description cache
m_SampleDescriptions.EnsureCapacity(m_Children.ItemCount());
for (AP4_Ordinal i=0; i<m_Children.ItemCount(); i++) {
m_SampleDescriptions.Append(NULL);
}
}
开发者ID:334151798,项目名称:dwindow,代码行数:37,代码来源:Ap4StsdAtom.cpp
示例8:
/*----------------------------------------------------------------------
| AP4_IsmaDecryptingProcessor:CreateTrackHandler
+---------------------------------------------------------------------*/
AP4_Processor::TrackHandler*
AP4_IsmaDecryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
{
// find the stsd atom
AP4_StsdAtom* stsd = dynamic_cast<AP4_StsdAtom*>(
trak->FindChild("mdia/minf/stbl/stsd"));
// avoid tracks with no stsd atom (should not happen)
if (stsd == NULL) return NULL;
// we only look at the first sample description
AP4_SampleDescription* desc = stsd->GetSampleDescription(0);
AP4_SampleEntry* entry = stsd->GetSampleEntry(0);
if (desc == NULL || entry == NULL) return NULL;
if (desc->GetType() == AP4_SampleDescription::TYPE_ISMACRYP) {
// create a handler for this track
AP4_IsmaCrypSampleDescription* ismacryp_desc =
static_cast<AP4_IsmaCrypSampleDescription*>(desc);
if (ismacryp_desc->GetSchemeType() == AP4_ISMACRYP_SCHEME_TYPE_IAEC) {
const AP4_UI08* key;
const AP4_UI08* salt;
if (AP4_SUCCEEDED(m_KeyMap.GetKey(trak->GetId(), key, salt))) {
return new AP4_IsmaTrackDecrypter(key, salt, ismacryp_desc, entry);
}
}
}
return NULL;
}
开发者ID:AeonAxan,项目名称:mpc-hc,代码行数:32,代码来源:Ap4IsmaCryp.cpp
示例9: CreateAtomFromStream
/*----------------------------------------------------------------------
| AP4_AtomFactory::CreateAtomsFromStream
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomFactory::CreateAtomsFromStream(AP4_ByteStream& stream,
AP4_LargeSize bytes_available,
AP4_AtomParent& atoms)
{
AP4_Result result;
do {
AP4_Atom* atom = NULL;
result = CreateAtomFromStream(stream, bytes_available, atom);
if (AP4_SUCCEEDED(result) && atom != NULL) {
atoms.AddChild(atom);
}
} while (AP4_SUCCEEDED(result));
return AP4_SUCCESS;
}
开发者ID:fumoboy007,项目名称:Bento4,代码行数:19,代码来源:Ap4AtomFactory.cpp
示例10:
/*----------------------------------------------------------------------
| AP4_SubStream::WritePartial
+---------------------------------------------------------------------*/
AP4_Result
AP4_SubStream::WritePartial(const void* buffer,
AP4_Size bytes_to_write,
AP4_Size& bytes_written)
{
// default values
bytes_written = 0;
// shortcut
if (bytes_to_write == 0) {
return AP4_SUCCESS;
}
// clamp to range
if (m_Position+bytes_to_write > m_Size) {
bytes_to_write = (AP4_Size)(m_Size - m_Position);
}
// check for en of substream
if (bytes_to_write == 0) {
return AP4_ERROR_EOS;
}
// seek inside container
AP4_Result result;
result = m_Container.Seek(m_Offset+m_Position);
if (AP4_FAILED(result)) return result;
// write to container
result = m_Container.WritePartial(buffer, bytes_to_write, bytes_written);
if (AP4_SUCCEEDED(result)) {
m_Position += bytes_written;
}
return result;
}
开发者ID:Fluffiest,项目名称:mpc-hc,代码行数:38,代码来源:Ap4ByteStream.cpp
示例11: DumpRtpPackets
/*----------------------------------------------------------------------
| DumpRtpPackets
+---------------------------------------------------------------------*/
static AP4_Result
DumpRtpPackets(AP4_HintTrackReader& reader, const char* file_name)
{
// create the output stream
AP4_ByteStream* output;
try {
output = new AP4_FileByteStream(file_name,
AP4_FileByteStream::STREAM_MODE_WRITE);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open output file (%s)\n", file_name);
return AP4_FAILURE;
}
// read the packets from the reader and write them in the output stream
AP4_DataBuffer data(1500);
AP4_TimeStamp ts;
while(AP4_SUCCEEDED(reader.GetNextPacket(data, ts))) {
output->Write(data.GetData(), data.GetDataSize());
AP4_Debug("#########\n\tpacket contains %d bytes\n", data.GetDataSize());
AP4_Debug("\tsent at time stamp %d\n\n", ts);
}
output->Release();
return AP4_SUCCESS;
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:29,代码来源:Mp4RtpHintInfo.cpp
示例12: AddTypeHandler
/*----------------------------------------------------------------------
| AP4_DefaultAtomFactory::Initialize
+---------------------------------------------------------------------*/
AP4_Result
AP4_DefaultAtomFactory::Initialize()
{
// register built-in type handlers
AP4_Result result = AddTypeHandler(new AP4_MetaDataAtomTypeHandler(this));
if (AP4_SUCCEEDED(result)) m_Initialized = true;
return result;
}
开发者ID:fumoboy007,项目名称:Bento4,代码行数:11,代码来源:Ap4AtomFactory.cpp
示例13: GetSample
virtual AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample) {
AP4_Result result = m_Track->GetSample(index, sample);
if (AP4_SUCCEEDED(result)) {
if (m_ForcedSync[index]) {
sample.SetSync(true);
}
}
return result;
}
开发者ID:garybruckheimer,项目名称:raypackSuite,代码行数:9,代码来源:Mp4Fragment.cpp
示例14:
/*----------------------------------------------------------------------
| AP4_TrefTypeAtom::AddTrackId
+---------------------------------------------------------------------*/
AP4_Result
AP4_TrefTypeAtom::AddTrackId(AP4_UI32 track_id)
{
AP4_Result result = m_TrackIds.Append(track_id);
if (AP4_SUCCEEDED(result)) {
m_Size32 += 4;
}
return result;
}
开发者ID:9aa5,项目名称:Bento4,代码行数:12,代码来源:Ap4TrefTypeAtom.cpp
示例15: AP4_DYNAMIC_CAST
/*----------------------------------------------------------------------
| AP4_OmaDcfAtomDecrypter::DecryptAtoms
+---------------------------------------------------------------------*/
AP4_Result
AP4_OmaDcfAtomDecrypter::DecryptAtoms(AP4_AtomParent& atoms,
AP4_Processor::ProgressListener* /*listener*/,
AP4_BlockCipherFactory* block_cipher_factory,
AP4_ProtectionKeyMap& key_map)
{
// default factory
if (block_cipher_factory == NULL) {
block_cipher_factory = &AP4_DefaultBlockCipherFactory::Instance;
}
unsigned int index = 1;
for (AP4_List<AP4_Atom>::Item* item = atoms.GetChildren().FirstItem();
item;
item = item->GetNext()) {
AP4_Atom* atom = item->GetData();
if (atom->GetType() != AP4_ATOM_TYPE_ODRM) continue;
// check that we have the key
const AP4_DataBuffer* key = key_map.GetKey(index++);
if (key == NULL) return AP4_ERROR_INVALID_PARAMETERS;
// check that we have all the atoms we need
AP4_ContainerAtom* odrm = AP4_DYNAMIC_CAST(AP4_ContainerAtom, atom);
if (odrm == NULL) continue; // not enough info
AP4_OdheAtom* odhe = AP4_DYNAMIC_CAST(AP4_OdheAtom, odrm->GetChild(AP4_ATOM_TYPE_ODHE));
if (odhe == NULL) continue; // not enough info
AP4_OddaAtom* odda = AP4_DYNAMIC_CAST(AP4_OddaAtom, odrm->GetChild(AP4_ATOM_TYPE_ODDA));;
if (odda == NULL) continue; // not enough info
AP4_OhdrAtom* ohdr = AP4_DYNAMIC_CAST(AP4_OhdrAtom, odhe->GetChild(AP4_ATOM_TYPE_OHDR));
if (ohdr == NULL) continue; // not enough info
// do nothing if the atom is not encrypted
if (ohdr->GetEncryptionMethod() == AP4_OMA_DCF_ENCRYPTION_METHOD_NULL) {
continue;
}
// create the byte stream
AP4_ByteStream* cipher_stream = NULL;
AP4_Result result = CreateDecryptingStream(*odrm,
key->GetData(),
key->GetDataSize(),
block_cipher_factory,
cipher_stream);
if (AP4_SUCCEEDED(result)) {
// replace the odda atom's payload with the decrypted stream
odda->SetEncryptedPayload(*cipher_stream, ohdr->GetPlaintextLength());
cipher_stream->Release();
// the atom will now be in the clear
ohdr->SetEncryptionMethod(AP4_OMA_DCF_ENCRYPTION_METHOD_NULL);
ohdr->SetPaddingScheme(AP4_OMA_DCF_PADDING_SCHEME_NONE);
}
}
return AP4_SUCCESS;
}
开发者ID:satram,项目名称:Bento4,代码行数:60,代码来源:Ap4OmaDcf.cpp
示例16: result
/*----------------------------------------------------------------------
| AP4_KodiFileByteStream::Flush
+---------------------------------------------------------------------*/
AP4_Result
AP4_KodiFileByteStream::Flush()
{
int ret_val = 0;
xbmc->FlushFile(m_File);
AP4_Result result((ret_val > 0) ? AP4_FAILURE : AP4_SUCCESS);
if (AP4_SUCCEEDED(result) && GetObserver())
return GetObserver()->OnFlush(this);
return result;
}
开发者ID:xbmcin,项目名称:XBMCinTC,代码行数:13,代码来源:Ap4KodiFileByteStream.cpp
示例17:
/*----------------------------------------------------------------------
| AP4_SyntheticSampleTable::GetSampleDescription
+---------------------------------------------------------------------*/
AP4_SampleDescription*
AP4_SyntheticSampleTable::GetSampleDescription(AP4_Ordinal index)
{
AP4_SampleDescription* description;
if (AP4_SUCCEEDED(m_SampleDescriptions.Get(index, description))) {
return description;
} else {
return NULL;
}
}
开发者ID:334151798,项目名称:dwindow,代码行数:13,代码来源:Ap4SyntheticSampleTable.cpp
示例18:
/*----------------------------------------------------------------------
| AP4_SubStream::Seek
+---------------------------------------------------------------------*/
AP4_Result
AP4_SubStream::Seek(AP4_Offset offset)
{
if (offset > m_Size) return AP4_FAILURE;
AP4_Result result;
result = m_Container.Seek(m_Offset+offset);
if (AP4_SUCCEEDED(result)) {
m_Position = offset;
}
return result;
}
开发者ID:Fluffiest,项目名称:splayer,代码行数:14,代码来源:Ap4ByteStream.cpp
示例19:
/*----------------------------------------------------------------------
| AP4_TrackSampleSource::ReadNextSample
+---------------------------------------------------------------------*/
AP4_Result
AP4_TrackSampleSource::ReadNextSample(AP4_Sample& sample, AP4_DataBuffer& buffer, AP4_UI32& track_id)
{
AP4_Result result = m_Track->ReadSample(m_SampleIndex, sample, buffer);
if (AP4_SUCCEEDED(result)) {
++m_SampleIndex;
track_id = m_Track->GetId();
} else {
track_id = 0;
}
return result;
}
开发者ID:9aa5,项目名称:Bento4,代码行数:15,代码来源:Ap4SampleSource.cpp
示例20: while
/*----------------------------------------------------------------------
| AP4_ContainerAtom::ReadChildren
+---------------------------------------------------------------------*/
void
AP4_ContainerAtom::ReadChildren(AP4_AtomFactory& atom_factory,
AP4_ByteStream& stream,
AP4_Size size)
{
AP4_Atom* atom;
AP4_Size bytes_available = size;
while (AP4_SUCCEEDED(
atom_factory.CreateAtomFromStream(stream, bytes_available, atom, this))) {
atom->SetParent(this);
m_Children.Add(atom);
}
}
开发者ID:334151798,项目名称:dwindow,代码行数:16,代码来源:Ap4ContainerAtom.cpp
注:本文中的AP4_SUCCEEDED函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论