本文整理汇总了Java中com.coremedia.iso.boxes.fragment.TrackRunBox.getEntries方法的典型用法代码示例。如果您正苦于以下问题:Java TrackRunBox.getEntries方法的具体用法?Java TrackRunBox.getEntries怎么用?Java TrackRunBox.getEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.coremedia.iso.boxes.fragment.TrackRunBox
的用法示例。
在下文中一共展示了TrackRunBox.getEntries方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDuration
import com.coremedia.iso.boxes.fragment.TrackRunBox; //导入方法依赖的package包/类
@Override
public long getDuration() {
long dur = 0;
for (IsoFile fragment : fragments) {
TrackRunBox trun = (TrackRunBox) Path.getPath(fragment, "/moof[0]/traf[0]/trun[0]");
for (TrackRunBox.Entry entry : trun.getEntries()) {
dur += entry.getSampleDuration();
}
}
return dur;
}
示例2: getCompositionTimeEntries
import com.coremedia.iso.boxes.fragment.TrackRunBox; //导入方法依赖的package包/类
@Override
public List<CompositionTimeToSample.Entry> getCompositionTimeEntries() {
List<CompositionTimeToSample.Entry> entries = new LinkedList<CompositionTimeToSample.Entry>();
for (IsoFile fragment : fragments) {
TrackRunBox trun = (TrackRunBox) Path.getPath(fragment, "/moof[0]/traf[0]/trun[0]");
for (TrackRunBox.Entry entry : trun.getEntries()) {
entries.add(new CompositionTimeToSample.Entry(l2i(entry.getSampleCompositionTimeOffset()), 1));
}
}
return entries;
}
示例3: getOffsets
import com.coremedia.iso.boxes.fragment.TrackRunBox; //导入方法依赖的package包/类
Map<Long, Long> getOffsets(MovieFragmentBox moof, long trackId, TrackExtendsBox trex) {
Map<Long, Long> offsets2Sizes = new HashMap<Long, Long>();
List<TrackFragmentBox> traf = moof.getBoxes(TrackFragmentBox.class);
for (TrackFragmentBox trackFragmentBox : traf) {
if (trackFragmentBox.getTrackFragmentHeaderBox().getTrackId() == trackId) {
long baseDataOffset;
if (trackFragmentBox.getTrackFragmentHeaderBox().hasBaseDataOffset()) {
baseDataOffset = trackFragmentBox.getTrackFragmentHeaderBox().getBaseDataOffset();
} else {
baseDataOffset = moof.getOffset();
}
for (TrackRunBox trun : trackFragmentBox.getBoxes(TrackRunBox.class)) {
long sampleBaseOffset = baseDataOffset + trun.getDataOffset();
final TrackFragmentHeaderBox tfhd = ((TrackFragmentBox) trun.getParent()).getTrackFragmentHeaderBox();
long offset = 0;
for (TrackRunBox.Entry entry : trun.getEntries()) {
final long sampleSize;
if (trun.isSampleSizePresent()) {
sampleSize = entry.getSampleSize();
offsets2Sizes.put(offset + sampleBaseOffset, sampleSize);
offset += sampleSize;
} else {
if (tfhd.hasDefaultSampleSize()) {
sampleSize = tfhd.getDefaultSampleSize();
offsets2Sizes.put(offset + sampleBaseOffset, sampleSize);
offset += sampleSize;
} else {
if (trex == null) {
throw new RuntimeException("File doesn't contain trex box but track fragments aren't fully self contained. Cannot determine sample size.");
}
sampleSize = trex.getDefaultSampleSize();
offsets2Sizes.put(offset + sampleBaseOffset, sampleSize);
offset += sampleSize;
}
}
}
}
}
}
return offsets2Sizes;
}