本文整理汇总了Java中com.coremedia.iso.boxes.Box类的典型用法代码示例。如果您正苦于以下问题:Java Box类的具体用法?Java Box怎么用?Java Box使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Box类属于com.coremedia.iso.boxes包,在下文中一共展示了Box类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: finishMovie
import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
public void finishMovie(boolean error) throws Exception {
if (mdat.getContentSize() != 0) {
flushCurrentMdat();
}
for (Track track : currentMp4Movie.getTracks()) {
List<Sample> samples = track.getSamples();
long[] sizes = new long[samples.size()];
for (int i = 0; i < sizes.length; i++) {
sizes[i] = samples.get(i).getSize();
}
track2SampleSizes.put(track, sizes);
}
Box moov = createMovieBox(currentMp4Movie);
moov.getBox(fc);
fos.flush();
fc.close();
fos.close();
}
示例2: getBoxes
import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends Box> List<T> getBoxes(Class<T> clazz, boolean recursive) {
List<T> boxesToBeReturned = new ArrayList<T>(2);
for (Box boxe : boxes) { //clazz.isInstance(boxe) / clazz == boxe.getClass()?
if (clazz == boxe.getClass()) {
boxesToBeReturned.add((T) boxe);
}
if (recursive && boxe instanceof ContainerBox) {
boxesToBeReturned.addAll((((ContainerBox) boxe).getBoxes(clazz, recursive)));
}
}
// Optimize here! Spare object creation work on arrays directly! System.arrayCopy
return boxesToBeReturned;
//return (T[]) boxesToBeReturned.toArray();
}
示例3: getBoxes
import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends Box> List<T> getBoxes(Class<T> clazz, boolean recursive) {
List<T> boxesToBeReturned = new ArrayList<T>(2);
for (Box boxe : boxes) {
//clazz.isInstance(boxe) / clazz == boxe.getClass()?
// I hereby finally decide to use isInstance
if (clazz.isInstance(boxe)) {
boxesToBeReturned.add((T) boxe);
}
if (recursive && boxe instanceof ContainerBox) {
boxesToBeReturned.addAll(((ContainerBox) boxe).getBoxes(clazz, recursive));
}
}
return boxesToBeReturned;
}
示例4: parse
import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
private void parse() throws IOException {
boolean done = false;
while (!done) {
try {
Box box = boxParser.parseBox(byteChannel, this);
if (box != null) {
// System.err.println(box.getType());
boxes.add(box);
} else {
done = true;
}
} catch (EOFException e) {
done = true;
}
}
}
示例5: getBoxes
import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends Box> List<T> getBoxes(Class<T> clazz, boolean recursive) {
List<T> boxesToBeReturned = new ArrayList<T>(2);
for (Box boxe : boxes) { //clazz.isInstance(boxe) / clazz == boxe.getClass()?
if (clazz == boxe.getClass()) {
boxesToBeReturned.add((T) boxe);
}
if (recursive && boxe instanceof ContainerBox) {
boxesToBeReturned.addAll(((ContainerBox) boxe).getBoxes(clazz, recursive));
}
}
// Optimize here! Spare object creation work on arrays directly! System.arrayCopy
return boxesToBeReturned;
//return (T[]) boxesToBeReturned.toArray();
}
示例6: createTrex
import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
protected Box createTrex(Movie movie, Track track) {
TrackExtendsBox trex = new TrackExtendsBox();
trex.setTrackId(track.getTrackMetaData().getTrackId());
trex.setDefaultSampleDescriptionIndex(1);
trex.setDefaultSampleDuration(0);
trex.setDefaultSampleSize(0);
SampleFlags sf = new SampleFlags();
if ("soun".equals(track.getHandler())) {
// as far as I know there is no audio encoding
// where the sample are not self contained.
sf.setSampleDependsOn(2);
sf.setSampleIsDependedOn(2);
}
trex.setDefaultSampleFlags(sf);
return trex;
}
示例7: 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()]);
}
示例8: createStbl
import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
protected Box createStbl(Track track) {
SampleTableBox stbl = new SampleTableBox();
createStsd(track, stbl);
createStts(track, stbl);
createStss(track, stbl);
createStsc(track, stbl);
createStsz(track, stbl);
createStco(track, stbl);
return stbl;
}
示例9: 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;
}
示例10: 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;
}
示例11: writeChildBoxes
import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
protected final void writeChildBoxes(ByteBuffer bb) {
WritableByteChannel wbc = new ByteBufferByteChannel(bb);
for (Box box : boxes) {
try {
box.getBox(wbc);
} catch (IOException e) {
// cannot happen since my WritableByteChannel won't throw any excpetion
throw new RuntimeException("Cannot happen.", e);
}
}
}
示例12: 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;
}
示例13: getContentSize
import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
@Override
protected long getContentSize() {
long contentSize = 0;
for (Box boxe : boxes) {
contentSize += boxe.getSize();
}
return contentSize;
}
示例14: createStbl
import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
private Box createStbl(Track track) {
SampleTableBox stbl = new SampleTableBox();
createStsd(track, stbl);
createStts(track, stbl);
createStss(track, stbl);
createStsc(track, stbl);
createStsz(track, stbl);
createStco(track, stbl);
return stbl;
}
示例15: getBoxes
import com.coremedia.iso.boxes.Box; //导入依赖的package包/类
public <T extends Box> List<T> getBoxes(Class<T> clazz, boolean recursive) {
//todo recursive?
if (clazz.isAssignableFrom(appleDataBox.getClass())) {
return (List<T>) Collections.singletonList(appleDataBox);
}
return null;
}