本文整理汇总了Java中com.coremedia.iso.boxes.Box.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java Box.getSize方法的具体用法?Java Box.getSize怎么用?Java Box.getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.coremedia.iso.boxes.Box
的用法示例。
在下文中一共展示了Box.getSize方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initIsoFile
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
private void initIsoFile(IsoFile isoFile) {
this.isoFile = isoFile;
// find all mdats first to be able to use them later with explicitly looking them up
long currentOffset = 0;
LinkedList<MediaDataBox> mdats = new LinkedList<MediaDataBox>();
for (Box b : this.isoFile.getBoxes()) {
long currentSize = b.getSize();
if ("mdat".equals(b.getType())) {
if (b instanceof MediaDataBox) {
long contentOffset = currentOffset + ((MediaDataBox) b).getHeader().limit();
mdatStartCache.put((MediaDataBox) b, contentOffset);
mdatEndCache.put((MediaDataBox) b, contentOffset + currentSize);
mdats.add((MediaDataBox) b);
} else {
throw new RuntimeException("Sample need to be in mdats and mdats need to be instanceof MediaDataBox");
}
}
currentOffset += currentSize;
}
this.mdats = mdats.toArray(new MediaDataBox[mdats.size()]);
}
示例2: getContentSize
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
protected long getContentSize() {
long contentSize = 4; // flags and version
for (Box boxe : boxes) {
contentSize += boxe.getSize();
}
return contentSize;
}
示例3: getNumOfBytesToFirstChild
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
public long getNumOfBytesToFirstChild() {
long sizeOfChildren = 0;
for (Box box : boxes) {
sizeOfChildren += box.getSize();
}
return getSize() - sizeOfChildren;
}
示例4: getContentSize
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
@Override
protected long getContentSize() {
long contentSize = 8;
for (Box boxe : boxes) {
contentSize += boxe.getSize();
}
return contentSize;
}
示例5: getDataOffset
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
public long getDataOffset() {
Box b = this;
long offset = 16;
while (b.getParent() != null) {
for (Box box : b.getParent().getBoxes()) {
if (b == box) {
break;
}
offset += box.getSize();
}
b = b.getParent();
}
return offset;
}
示例6: getContentSize
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
@Override
protected long getContentSize() {
long size = 8;
for (Box box : boxes) {
size += box.getSize();
}
return size;
}
示例7: getSize
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
@Override
public long getSize() {
long size = 0;
for (Box box : boxes) {
size += box.getSize();
}
return size;
}
示例8: getContentSize
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
@Override
protected long getContentSize() {
long size = 8;
for (Box box : boxes) {
size += box.getSize();
}
size += vc1Content.length;
return size;
}
示例9: getContentSize
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
protected long getContentSize() {
long contentSize = 18;
contentSize += boxRecord.getSize();
contentSize += styleRecord.getSize();
for (Box boxe : boxes) {
contentSize += boxe.getSize();
}
return contentSize;
}
示例10: getContentSize
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
@Override
protected long getContentSize() {
long contentSize = 28;
contentSize += soundVersion > 0 ? 16 : 0;
contentSize += soundVersion == 2 ? 20 : 0;
for (Box boxe : boxes) {
contentSize += boxe.getSize();
}
return contentSize;
}
示例11: getContentSize
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
protected long getContentSize() {
long contentSize = 78;
for (Box boxe : boxes) {
contentSize += boxe.getSize();
}
return contentSize;
}
示例12: getOffset
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
@DoNotParseDetail
public long getOffset() {
Box b = this;
long offset = 0;
while (b.getParent() != null) {
for (Box box : b.getParent().getBoxes()) {
if (b == box) {
break;
}
offset += box.getSize();
}
b = b.getParent();
}
return offset;
}
示例13: createTfra
import com.coremedia.iso.boxes.Box; //导入方法依赖的package包/类
/**
* Creates a 'tfra' - track fragment random access box for the given track with the isoFile.
* The tfra contains a map of random access points with time as key and offset within the isofile
* as value.
*
* @param track the concerned track
* @param isoFile the track is contained in
* @return a track fragment random access box.
*/
protected Box createTfra(Track track, IsoFile isoFile) {
TrackFragmentRandomAccessBox tfra = new TrackFragmentRandomAccessBox();
tfra.setVersion(1); // use long offsets and times
List<TrackFragmentRandomAccessBox.Entry> offset2timeEntries = new LinkedList<TrackFragmentRandomAccessBox.Entry>();
List<Box> boxes = isoFile.getBoxes();
long offset = 0;
long duration = 0;
for (Box box : boxes) {
if (box instanceof MovieFragmentBox) {
List<TrackFragmentBox> trafs = ((MovieFragmentBox) box).getBoxes(TrackFragmentBox.class);
for (int i = 0; i < trafs.size(); i++) {
TrackFragmentBox traf = trafs.get(i);
if (traf.getTrackFragmentHeaderBox().getTrackId() == track.getTrackMetaData().getTrackId()) {
// here we are at the offset required for the current entry.
List<TrackRunBox> truns = traf.getBoxes(TrackRunBox.class);
for (int j = 0; j < truns.size(); j++) {
List<TrackFragmentRandomAccessBox.Entry> offset2timeEntriesThisTrun = new LinkedList<TrackFragmentRandomAccessBox.Entry>();
TrackRunBox trun = truns.get(j);
for (int k = 0; k < trun.getEntries().size(); k++) {
TrackRunBox.Entry trunEntry = trun.getEntries().get(k);
SampleFlags sf = null;
if (k == 0 && trun.isFirstSampleFlagsPresent()) {
sf = trun.getFirstSampleFlags();
} else if (trun.isSampleFlagsPresent()) {
sf = trunEntry.getSampleFlags();
} else {
List<MovieExtendsBox> mvexs = isoFile.getMovieBox().getBoxes(MovieExtendsBox.class);
for (MovieExtendsBox mvex : mvexs) {
List<TrackExtendsBox> trexs = mvex.getBoxes(TrackExtendsBox.class);
for (TrackExtendsBox trex : trexs) {
if (trex.getTrackId() == track.getTrackMetaData().getTrackId()) {
sf = trex.getDefaultSampleFlags();
}
}
}
}
if (sf == null) {
throw new RuntimeException("Could not find any SampleFlags to indicate random access or not");
}
if (sf.getSampleDependsOn() == 2) {
offset2timeEntriesThisTrun.add(new TrackFragmentRandomAccessBox.Entry(
duration,
offset,
i + 1, j + 1, k + 1));
}
duration += trunEntry.getSampleDuration();
}
if (offset2timeEntriesThisTrun.size() == trun.getEntries().size() && trun.getEntries().size() > 0) {
// Oooops every sample seems to be random access sample
// is this an audio track? I don't care.
// I just use the first for trun sample for tfra random access
offset2timeEntries.add(offset2timeEntriesThisTrun.get(0));
} else {
offset2timeEntries.addAll(offset2timeEntriesThisTrun);
}
}
}
}
}
offset += box.getSize();
}
tfra.setEntries(offset2timeEntries);
tfra.setTrackId(track.getTrackMetaData().getTrackId());
return tfra;
}