本文整理汇总了Java中org.jcodec.api.UnsupportedFormatException类的典型用法代码示例。如果您正苦于以下问题:Java UnsupportedFormatException类的具体用法?Java UnsupportedFormatException怎么用?Java UnsupportedFormatException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UnsupportedFormatException类属于org.jcodec.api包,在下文中一共展示了UnsupportedFormatException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JcodecFrameGrab
import org.jcodec.api.UnsupportedFormatException; //导入依赖的package包/类
public JcodecFrameGrab(SeekableByteChannel in) throws IOException, JCodecException {
ByteBuffer header = ByteBuffer.allocate(65536);
in.read(header);
header.flip();
Format detectFormat = JCodecUtil.detectFormat(header);
switch (detectFormat) {
case MOV:
MP4Demuxer d1 = new MP4Demuxer(in);
videoTrack = d1.getVideoTrack();
break;
case MPEG_PS:
throw new UnsupportedFormatException("MPEG PS is temporarily unsupported.");
case MPEG_TS:
throw new UnsupportedFormatException("MPEG TS is temporarily unsupported.");
default:
throw new UnsupportedFormatException("Container format is not supported by JCodec");
}
decodeLeadingFrames();
}
示例2: detectDecoder
import org.jcodec.api.UnsupportedFormatException; //导入依赖的package包/类
private ContainerAdaptor detectDecoder(SeekableDemuxerTrack videoTrack, Packet frame) throws JCodecException {
if (videoTrack instanceof AbstractMP4DemuxerTrack) {
SampleEntry se = ((AbstractMP4DemuxerTrack) videoTrack).getSampleEntries()[((MP4Packet) frame).getEntryNo()];
VideoDecoder byFourcc = byFourcc(se.getHeader().getFourcc());
if (byFourcc instanceof H264Decoder) {
return new AVCMP4Adaptor(((AbstractMP4DemuxerTrack) videoTrack).getSampleEntries());
}
}
throw new UnsupportedFormatException("Codec is not supported");
}
示例3: FrameGrab
import org.jcodec.api.UnsupportedFormatException; //导入依赖的package包/类
public FrameGrab(SeekableByteChannel in) throws IOException, JCodecException {
ByteBuffer header = ByteBuffer.allocate(65536);
in.read(header);
header.flip();
Format detectFormat = JCodecUtil.detectFormat(header);
switch (detectFormat) {
case MOV:
MP4Demuxer d1 = new MP4Demuxer(in);
videoTrack = d1.getVideoTrack();
if(!(d1.getAudioTracks().isEmpty())) {
audioTrack = d1.getAudioTracks().get(0);
AudioSampleEntry as = (AudioSampleEntry) audioTrack.getSampleEntries()[0];
audioInfo = new AudioFormat(
as.getFormat().isSigned() ? Encoding.PCM_SIGNED : Encoding.PCM_UNSIGNED,
as.getFormat().getSampleRate(),
as.getFormat().getSampleSizeInBits(),
as.getFormat().getChannels(),
as.getFormat().getFrameSize(),
as.getFormat().getFrameRate(),
as.getFormat().isBigEndian());
audioDecoder = audioDecoder(as.getFourcc());
audioBuffer = ByteBuffer.allocate(96000 * audioInfo.getFrameSize() * 10);
} else {
audioTrack = null;
audioInfo = null;
audioDecoder = null;
audioBuffer = null;
}
break;
case MPEG_PS:
throw new UnsupportedFormatException("MPEG PS is temporarily unsupported.");
case MPEG_TS:
throw new UnsupportedFormatException("MPEG TS is temporarily unsupported.");
default:
throw new UnsupportedFormatException("Container format is not supported by JCodec");
}
decodeLeadingFrames();
}
示例4: detectDecoder
import org.jcodec.api.UnsupportedFormatException; //导入依赖的package包/类
private ContainerAdaptor detectDecoder(SeekableDemuxerTrack videoTrack, Packet frame) throws JCodecException {
if (videoTrack instanceof AbstractMP4DemuxerTrack) {
SampleEntry se = ((AbstractMP4DemuxerTrack) videoTrack).getSampleEntries()[((MP4Packet) frame).getEntryNo()];
VideoDecoder byFourcc = videoDecoder(se.getHeader().getFourcc());
if (byFourcc instanceof H264Decoder)
return new AVCMP4Adaptor(((AbstractMP4DemuxerTrack) videoTrack).getSampleEntries());
}
throw new UnsupportedFormatException("Codec is not supported");
}