org.jcodec.containers.mps.MTSDemuxer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcodec Show documentation
Show all versions of jcodec Show documentation
Pure Java implementation of video/audio codecs and formats
package org.jcodec.containers.mps;
import gnu.trove.map.hash.TIntObjectHashMap;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.util.ArrayList;
import java.util.List;
import org.jcodec.common.NIOUtils;
import org.jcodec.common.SeekableByteChannel;
import org.jcodec.containers.mps.MPSDemuxer.Track;
import org.junit.Assert;
/**
* This class is part of JCodec ( www.jcodec.org ) This software is distributed
* under FreeBSD License
*
* MPEG TS demuxer
*
* @author The JCodec project
*
*/
public class MTSDemuxer {
private int guid = -1;
private MPSDemuxer psDemuxer;
public MTSDemuxer(final SeekableByteChannel channel) throws IOException {
psDemuxer = new MPSDemuxer(new SeekableByteChannel() {
public boolean isOpen() {
return true;
}
public void close() throws IOException {
}
public int read(ByteBuffer dst) throws IOException {
MTSPacket packet = getPacket(channel);
int rem = packet.payload.remaining();
NIOUtils.write(dst, packet.payload);
return rem - packet.payload.remaining();
}
public int write(ByteBuffer src) throws IOException {
return 0;
}
public long position() throws IOException {
return 0;
}
public SeekableByteChannel position(long newPosition) throws IOException {
return null;
}
public long size() throws IOException {
return 0;
}
public SeekableByteChannel truncate(long size) throws IOException {
return null;
}
});
}
public List