本文整理汇总了C++中Sequence::getDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ Sequence::getDuration方法的具体用法?C++ Sequence::getDuration怎么用?C++ Sequence::getDuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence::getDuration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void OP1AFile::UpdateTrackMetadata(GenericPackage *package, int64_t origin, int64_t duration)
{
vector<GenericTrack*> tracks = package->getTracks();
size_t i;
for (i = 0; i < tracks.size(); i++) {
Track *track = dynamic_cast<Track*>(tracks[i]);
if (!track)
continue;
track->setOrigin(origin);
Sequence *sequence = dynamic_cast<Sequence*>(track->getSequence());
BMX_ASSERT(sequence);
vector<StructuralComponent*> components = sequence->getStructuralComponents();
if (sequence->getDuration() < 0) {
sequence->setDuration(duration);
BMX_ASSERT(components.size() == 1);
components[0]->setDuration(duration);
}
if (components.size() == 1) {
TimecodeComponent *timecode_component = dynamic_cast<TimecodeComponent*>(components[0]);
if (timecode_component) {
Timecode start_timecode = mStartTimecode;
start_timecode.AddOffset(- origin, mFrameRate);
timecode_component->setRoundedTimecodeBase(start_timecode.GetRoundedTCBase());
timecode_component->setDropFrame(start_timecode.IsDropFrame());
timecode_component->setStartTimecode(start_timecode.GetOffset());
}
}
}
}
示例2: GetSampleRate
void AS02Track::UpdatePackageMetadata(GenericPackage *package)
{
SourcePackage *source_package = dynamic_cast<SourcePackage*>(package);
FileDescriptor *file_descriptor = 0;
if (source_package && source_package->haveDescriptor())
file_descriptor = dynamic_cast<FileDescriptor*>(source_package->getDescriptor());
vector<GenericTrack*> tracks = package->getTracks();
// update track origin in file source package tracks and
// duration in sequences, timecode components and source clips
size_t i;
for (i = 0; i < tracks.size(); i++) {
Track *track = dynamic_cast<Track*>(tracks[i]);
BMX_ASSERT(track);
if (source_package)
track->setOrigin(mOutputStartOffset);
Sequence *sequence = dynamic_cast<Sequence*>(track->getSequence());
BMX_ASSERT(sequence);
vector<StructuralComponent*> components = sequence->getStructuralComponents();
if (sequence->getDuration() < 0) {
if (source_package)
sequence->setDuration(GetDuration());
else
sequence->setDuration(GetOutputDuration(false));
BMX_ASSERT(components.size() == 1);
if (source_package)
components[0]->setDuration(GetDuration());
else
components[0]->setDuration(GetOutputDuration(false));
}
if (source_package && components.size() == 1) {
TimecodeComponent *timecode_component = dynamic_cast<TimecodeComponent*>(components[0]);
if (timecode_component) {
Timecode sp_start_timecode = mClip->mStartTimecode;
sp_start_timecode.AddOffset(- mOutputStartOffset, GetSampleRate());
timecode_component->setRoundedTimecodeBase(sp_start_timecode.GetRoundedTCBase());
timecode_component->setDropFrame(sp_start_timecode.IsDropFrame());
timecode_component->setStartTimecode(sp_start_timecode.GetOffset());
}
}
}
// update the container duration in the file descriptor
if (file_descriptor)
file_descriptor->setContainerDuration(mContainerDuration);
}