本文整理汇总了Java中org.jcodec.common.SeekableByteChannel.size方法的典型用法代码示例。如果您正苦于以下问题:Java SeekableByteChannel.size方法的具体用法?Java SeekableByteChannel.size怎么用?Java SeekableByteChannel.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jcodec.common.SeekableByteChannel
的用法示例。
在下文中一共展示了SeekableByteChannel.size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRootAtoms
import org.jcodec.common.SeekableByteChannel; //导入方法依赖的package包/类
public static List<Atom> getRootAtoms(SeekableByteChannel input) throws IOException {
input.position(0);
List<Atom> result = new ArrayList<Atom>();
long off = 0;
Header atom;
while (off < input.size()) {
input.position(off);
atom = Header.read(NIOUtils.fetchFrom(input, 16));
if (atom == null)
break;
result.add(new Atom(atom, off));
off += atom.getSize();
}
return result;
}
示例2: getData
import org.jcodec.common.SeekableByteChannel; //导入方法依赖的package包/类
@Override
public ByteBuffer getData() throws IOException {
ByteBuffer bb = ByteBuffer.allocate(packet.getSize());
SeekableByteChannel ch = null;
try {
ch = pool.getChannel();
if(packet.getFileOff() >= ch.size())
return null;
ch.position(packet.getFileOff());
ch.read(bb);
bb.flip();
return bb;
} finally {
if (ch != null)
ch.close();
}
}
示例3: parseHeader
import org.jcodec.common.SeekableByteChannel; //导入方法依赖的package包/类
public void parseHeader(SeekableByteChannel ff) throws IOException {
KLV kl;
header = readHeaderPartition(ff);
metadata = new ArrayList<MXFMetadata>();
partitions = new ArrayList<MXFPartition>();
long nextPartition = ff.size();
ff.position(header.getPack().getFooterPartition());
do {
long thisPartition = ff.position();
kl = KLV.readKL(ff);
ByteBuffer fetchFrom = NIOUtils.fetchFrom(ff, (int) kl.len);
header = MXFPartition.read(kl.key, fetchFrom, ff.position() - kl.offset, nextPartition);
if (header.getPack().getNbEssenceContainers() > 0)
partitions.add(0, header);
metadata.addAll(0, readPartitionMeta(ff, header));
ff.position(header.getPack().getPrevPartition());
nextPartition = thisPartition;
} while (header.getPack().getThisPartition() != 0);
}
示例4: WavTrack
import org.jcodec.common.SeekableByteChannel; //导入方法依赖的package包/类
public WavTrack(ByteChannelPool pool, Label... labels) throws IOException {
this.pool = pool;
SeekableByteChannel ch = null;
try {
ch = pool.getChannel();
header = WavHeader.read(Channels.newInputStream(ch));
size = header.dataSize <= 0 ? ch.size() : header.dataSize;
} finally {
ch.close();
}
se = MP4Muxer.audioSampleEntry("sowt", 1, header.fmt.bitsPerSample >> 3, header.fmt.numChannels,
header.fmt.sampleRate, Endian.LITTLE_ENDIAN);
ChannelBox chan = new ChannelBox();
if (labels != null && labels.length > 0) {
ChannelUtils.setLabels(labels, chan);
} else {
labels = new Label[header.getFormat().getChannels()];
for (int i = 0; i < labels.length; i++)
labels[i] = Label.Mono;
ChannelUtils.setLabels(labels, chan);
}
se.add(chan);
pktDataLen = FRAMES_PER_PKT * header.fmt.numChannels * (header.fmt.bitsPerSample >> 3);
pktDuration = (double) FRAMES_PER_PKT / header.fmt.sampleRate;
offset = header.dataOffset;
pts = 0;
frameNo = 0;
}
示例5: readKL
import org.jcodec.common.SeekableByteChannel; //导入方法依赖的package包/类
public static KLV readKL(SeekableByteChannel ch) throws IOException {
long offset = ch.position();
if (offset >= ch.size() - 1)
return null;
byte[] key = new byte[16];
ch.read(ByteBuffer.wrap(key));
long len = BER.decodeLength(ch);
long dataOffset = ch.position();
return new KLV(new UL(key), len, offset, dataOffset);
}