本文整理匯總了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");
}