本文整理汇总了Java中com.googlecode.mp4parser.authoring.Track.getSamples方法的典型用法代码示例。如果您正苦于以下问题:Java Track.getSamples方法的具体用法?Java Track.getSamples怎么用?Java Track.getSamples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.googlecode.mp4parser.authoring.Track
的用法示例。
在下文中一共展示了Track.getSamples方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBitrate
import com.googlecode.mp4parser.authoring.Track; //导入方法依赖的package包/类
public long getBitrate(Track track) {
long bitrate = 0;
for (ByteBuffer sample : track.getSamples()) {
bitrate += sample.limit();
}
bitrate *= 8; // from bytes to bits
bitrate /= ((double) getDuration(track)) / track.getTrackMetaData().getTimescale(); // per second
return bitrate;
}
示例2: build
import com.googlecode.mp4parser.authoring.Track; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public IsoFile build(Movie movie) {
LOG.fine("Creating movie " + movie);
for (Track track : movie.getTracks()) {
// getting the samples may be a time consuming activity
List<ByteBuffer> samples = track.getSamples();
putSamples(track, samples);
long[] sizes = new long[samples.size()];
for (int i = 0; i < sizes.length; i++) {
sizes[i] = samples.get(i).limit();
}
putSampleSizes(track, sizes);
}
IsoFile isoFile = new IsoFile();
// ouch that is ugly but I don't know how to do it else
List<String> minorBrands = new LinkedList<String>();
minorBrands.add("isom");
minorBrands.add("iso2");
minorBrands.add("avc1");
isoFile.addBox(new FileTypeBox("isom", 0, minorBrands));
isoFile.addBox(createMovieBox(movie));
InterleaveChunkMdat mdat = new InterleaveChunkMdat(movie);
isoFile.addBox(mdat);
/*
dataOffset is where the first sample starts. In this special mdat the samples always start
at offset 16 so that we can use the same offset for large boxes and small boxes
*/
long dataOffset = mdat.getDataOffset();
for (StaticChunkOffsetBox chunkOffsetBox : chunkOffsetBoxes) {
long[] offsets = chunkOffsetBox.getChunkOffsets();
for (int i = 0; i < offsets.length; i++) {
offsets[i] += dataOffset;
}
}
return isoFile;
}