本文整理汇总了Java中org.jcodec.api.JCodecException类的典型用法代码示例。如果您正苦于以下问题:Java JCodecException类的具体用法?Java JCodecException怎么用?Java JCodecException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JCodecException类属于org.jcodec.api包,在下文中一共展示了JCodecException类的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: JcodecFrameGrab
点赞 3
import org.jcodec.api.JCodecException; //导入依赖的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();
}
开发者ID:vitrivr,
项目名称:cineast,
代码行数:21,
代码来源:JcodecFrameGrab.java
示例2: decodeLeadingFrames
点赞 3
import org.jcodec.api.JCodecException; //导入依赖的package包/类
private void decodeLeadingFrames() throws IOException, JCodecException {
SeekableDemuxerTrack sdt = sdt();
int curFrame = (int) sdt.getCurFrame();
int keyFrame = detectKeyFrame(curFrame);
sdt.gotoFrame(keyFrame);
Packet frame = sdt.nextFrame();
decoder = detectDecoder(sdt, frame);
while (frame.getFrameNo() < curFrame) {
decoder.decodeFrame(frame, getBuffer());
frame = sdt.nextFrame();
}
sdt.gotoFrame(curFrame);
}
开发者ID:vitrivr,
项目名称:cineast,
代码行数:17,
代码来源:JcodecFrameGrab.java
示例3: decodeLeadingFrames
点赞 3
import org.jcodec.api.JCodecException; //导入依赖的package包/类
private void decodeLeadingFrames() throws IOException, JCodecException {
SeekableDemuxerTrack sdt = sdt();
int curFrame = (int) sdt.getCurFrame();
int keyFrame = detectKeyFrame(curFrame);
sdt.gotoFrame(keyFrame);
Packet frame = sdt.nextFrame();
decoder = detectDecoder(sdt, frame);
while (frame.getFrameNo() < curFrame) {
decoder.decodeFrame8Bit(frame, getBuffer());
frame = sdt.nextFrame();
}
sdt.gotoFrame(curFrame);
}
开发者ID:arisona,
项目名称:ether,
代码行数:17,
代码来源:FrameGrab.java
示例4: deserialize
点赞 2
import org.jcodec.api.JCodecException; //导入依赖的package包/类
@Override
public CameraServerData deserialize(byte[] buffer, int bufferPosition) {
int pos = bufferPosition;
String name = Serialization.readString(buffer, pos);
pos += name.length() + Serialization.SIZE_OF_INT;
int frameNum = Serialization.readInt(buffer, pos);
try {
return new CameraServerData(name, readFrame(name, frameNum));
} catch (IOException | JCodecException e) {
log.log(Level.WARNING, "Could not read frame " + frameNum, e);
return new CameraServerData(name, null);
}
}
开发者ID:wpilibsuite,
项目名称:shuffleboard,
代码行数:14,
代码来源:CameraServerDataSerializer.java
示例5: sdt
点赞 2
import org.jcodec.api.JCodecException; //导入依赖的package包/类
private SeekableDemuxerTrack sdt() throws JCodecException {
if (!(videoTrack instanceof SeekableDemuxerTrack)) {
throw new JCodecException("Not a seekable track");
}
return (SeekableDemuxerTrack) videoTrack;
}
开发者ID:vitrivr,
项目名称:cineast,
代码行数:8,
代码来源:JcodecFrameGrab.java
示例6: detectDecoder
点赞 2
import org.jcodec.api.JCodecException; //导入依赖的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");
}
开发者ID:vitrivr,
项目名称:cineast,
代码行数:12,
代码来源:JcodecFrameGrab.java
示例7: getCurrentFrameNum
点赞 2
import org.jcodec.api.JCodecException; //导入依赖的package包/类
public long getCurrentFrameNum(){
try {
return sdt().getCurFrame();
} catch (JCodecException e) {
LOGGER.warn(LogHelper.getStackTrace(e));
}
return -1;
}
开发者ID:vitrivr,
项目名称:cineast,
代码行数:9,
代码来源:JcodecFrameGrab.java
示例8: JCodecAccess
点赞 2
import org.jcodec.api.JCodecException; //导入依赖的package包/类
public JCodecAccess(URLVideoSource src, int numPlays) throws IOException, URISyntaxException {
super(src, numPlays);
this.channel = NIOUtils.readableFileChannel(new File(src.getURL().toURI()));
try {
this.grab = new FrameGrab(channel);
} catch(JCodecException e) {
throw new IOException(e);
}
}
开发者ID:arisona,
项目名称:ether,
代码行数:10,
代码来源:JCodecAccess.java
示例9: FrameGrab
点赞 2
import org.jcodec.api.JCodecException; //导入依赖的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();
}
开发者ID:arisona,
项目名称:ether,
代码行数:40,
代码来源:FrameGrab.java
示例10: detectDecoder
点赞 2
import org.jcodec.api.JCodecException; //导入依赖的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");
}
开发者ID:arisona,
项目名称:ether,
代码行数:10,
代码来源:FrameGrab.java
示例11: getFrame
点赞 2
import org.jcodec.api.JCodecException; //导入依赖的package包/类
/**
* Get frame at a specified second as AWT image
*
* @param file
* @param second
* @return
* @throws IOException
* @throws JCodecException
*/
public static BufferedImage getFrame(File file, double second) throws IOException, JCodecException {
FileChannelWrapper ch = null;
try {
ch = NIOUtils.readableFileChannel(file);
return ((FrameGrab) new FrameGrab(ch).seekToSecondPrecise(second)).getFrame();
} finally {
NIOUtils.closeQuietly(ch);
}
}
开发者ID:PenoaksDev,
项目名称:OpenSpaceDVR,
代码行数:19,
代码来源:FrameGrab.java
示例12: readFrame
点赞 2
import org.jcodec.api.JCodecException; //导入依赖的package包/类
private Image readFrame(String cameraName, int frameNum) throws IOException, JCodecException {
File videoFile = videoFileFor(getCurrentFile(), cameraName);
BufferedImage frame = AWTFrameGrab.getFrame(videoFile, frameNum);
return SwingFXUtils.toFXImage(frame, null);
}
开发者ID:wpilibsuite,
项目名称:shuffleboard,
代码行数:6,
代码来源:CameraServerDataSerializer.java
示例13: goToPrevKeyframe
点赞 2
import org.jcodec.api.JCodecException; //导入依赖的package包/类
private void goToPrevKeyframe() throws IOException, JCodecException {
sdt().gotoFrame(detectKeyFrame((int) sdt().getCurFrame()));
}
开发者ID:vitrivr,
项目名称:cineast,
代码行数:4,
代码来源:JcodecFrameGrab.java
示例14: FrameGrab
点赞 2
import org.jcodec.api.JCodecException; //导入依赖的package包/类
public FrameGrab(SeekableByteChannel in) throws IOException, JCodecException {
super(in);
}
开发者ID:PenoaksDev,
项目名称:OpenSpaceDVR,
代码行数:4,
代码来源:FrameGrab.java
示例15: seekToSecondPrecise
点赞 1
import org.jcodec.api.JCodecException; //导入依赖的package包/类
/**
* Position frame grabber to a specific second in a movie. As a result the
* next decoded frame will be precisely at the requested second.
*
* WARNING: potentially very slow. Use only when you absolutely need precise
* seek. Tries to seek to exactly the requested second and for this it might
* have to decode a sequence of frames from the closes key frame. Depending
* on GOP structure this may be as many as 500 frames.
*
* @param second
* @return
* @throws IOException
* @throws JCodecException
*/
public JcodecFrameGrab seekToSecondPrecise(double second) throws IOException, JCodecException {
sdt().seek(second);
decodeLeadingFrames();
return this;
}
开发者ID:vitrivr,
项目名称:cineast,
代码行数:20,
代码来源:JcodecFrameGrab.java
示例16: seekToFramePrecise
点赞 1
import org.jcodec.api.JCodecException; //导入依赖的package包/类
/**
* Position frame grabber to a specific frame in a movie. As a result the
* next decoded frame will be precisely the requested frame number.
*
* WARNING: potentially very slow. Use only when you absolutely need precise
* seek. Tries to seek to exactly the requested frame and for this it might
* have to decode a sequence of frames from the closes key frame. Depending
* on GOP structure this may be as many as 500 frames.
*
* @param frameNumber
* @return
* @throws IOException
* @throws JCodecException
*/
public JcodecFrameGrab seekToFramePrecise(int frameNumber) throws IOException, JCodecException {
sdt().gotoFrame(frameNumber);
decodeLeadingFrames();
return this;
}
开发者ID:vitrivr,
项目名称:cineast,
代码行数:20,
代码来源:JcodecFrameGrab.java
示例17: seekToSecondSloppy
点赞 1
import org.jcodec.api.JCodecException; //导入依赖的package包/类
/**
* Position frame grabber to a specific second in a movie.
*
* Performs a sloppy seek, meaning that it may actually not seek to exact
* second requested, instead it will seek to the closest key frame
*
* NOTE: fast, as it just seeks to the closest previous key frame and
* doesn't try to decode frames in the middle
*
* @param second
* @return
* @throws IOException
* @throws JCodecException
*/
public JcodecFrameGrab seekToSecondSloppy(double second) throws IOException, JCodecException {
sdt().seek(second);
goToPrevKeyframe();
return this;
}
开发者ID:vitrivr,
项目名称:cineast,
代码行数:20,
代码来源:JcodecFrameGrab.java
示例18: seekToFrameSloppy
点赞 1
import org.jcodec.api.JCodecException; //导入依赖的package包/类
/**
* Position frame grabber to a specific frame in a movie
*
* Performs a sloppy seek, meaning that it may actually not seek to exact
* frame requested, instead it will seek to the closest key frame
*
* NOTE: fast, as it just seeks to the closest previous key frame and
* doesn't try to decode frames in the middle
*
* @param frameNumber
* @return
* @throws IOException
* @throws JCodecException
*/
public JcodecFrameGrab seekToFrameSloppy(int frameNumber) throws IOException, JCodecException {
sdt().gotoFrame(frameNumber);
goToPrevKeyframe();
return this;
}
开发者ID:vitrivr,
项目名称:cineast,
代码行数:20,
代码来源:JcodecFrameGrab.java
示例19: seekToSecondPrecise
点赞 1
import org.jcodec.api.JCodecException; //导入依赖的package包/类
/**
* Position frame grabber to a specific second in a movie. As a result the
* next decoded frame will be precisely at the requested second.
*
* WARNING: potentially very slow. Use only when you absolutely need precise
* seek. Tries to seek to exactly the requested second and for this it might
* have to decode a sequence of frames from the closes key frame. Depending
* on GOP structure this may be as many as 500 frames.
*
* @param second
* @return
* @throws IOException
* @throws JCodecException
*/
public FrameGrab seekToSecondPrecise(double second) throws IOException, JCodecException {
sdt().seek(second);
decodeLeadingFrames();
return this;
}
开发者ID:arisona,
项目名称:ether,
代码行数:20,
代码来源:FrameGrab.java
示例20: seekToFramePrecise
点赞 1
import org.jcodec.api.JCodecException; //导入依赖的package包/类
/**
* Position frame grabber to a specific frame in a movie. As a result the
* next decoded frame will be precisely the requested frame number.
*
* WARNING: potentially very slow. Use only when you absolutely need precise
* seek. Tries to seek to exactly the requested frame and for this it might
* have to decode a sequence of frames from the closes key frame. Depending
* on GOP structure this may be as many as 500 frames.
*
* @param frameNumber
* @return
* @throws IOException
* @throws JCodecException
*/
public FrameGrab seekToFramePrecise(int frameNumber) throws IOException, JCodecException {
sdt().gotoFrame(frameNumber);
decodeLeadingFrames();
return this;
}
开发者ID:arisona,
项目名称:ether,
代码行数:20,
代码来源:FrameGrab.java
示例21: seekToSecondSloppy
点赞 1
import org.jcodec.api.JCodecException; //导入依赖的package包/类
/**
* Position frame grabber to a specific second in a movie.
*
* Performs a sloppy seek, meaning that it may actually not seek to exact
* second requested, instead it will seek to the closest key frame
*
* NOTE: fast, as it just seeks to the closest previous key frame and
* doesn't try to decode frames in the middle
*
* @param second
* @return
* @throws IOException
* @throws JCodecException
*/
public FrameGrab seekToSecondSloppy(double second) throws IOException, JCodecException {
sdt().seek(second);
goToPrevKeyframe();
return this;
}
开发者ID:arisona,
项目名称:ether,
代码行数:20,
代码来源:FrameGrab.java
示例22: seekToFrameSloppy
点赞 1
import org.jcodec.api.JCodecException; //导入依赖的package包/类
/**
* Position frame grabber to a specific frame in a movie
*
* Performs a sloppy seek, meaning that it may actually not seek to exact
* frame requested, instead it will seek to the closest key frame
*
* NOTE: fast, as it just seeks to the closest previous key frame and
* doesn't try to decode frames in the middle
*
* @param frameNumber
* @return
* @throws IOException
* @throws JCodecException
*/
public FrameGrab seekToFrameSloppy(int frameNumber) throws IOException, JCodecException {
sdt().gotoFrame(frameNumber);
goToPrevKeyframe();
return this;
}
开发者ID:arisona,
项目名称:ether,
代码行数:20,
代码来源:FrameGrab.java
示例23: getFrameSloppy
点赞 1
import org.jcodec.api.JCodecException; //导入依赖的package包/类
/**
* Get a specified frame by number from an already open demuxer track (
* sloppy mode, i.e. nearest keyframe )
*
* @param vt
* @param decoder
* @param frameNumber
* @return
* @throws IOException
* @throws JCodecException
*/
public static BufferedImage getFrameSloppy(SeekableDemuxerTrack vt, ContainerAdaptor decoder, int frameNumber)
throws IOException, JCodecException {
return ((FrameGrab) new FrameGrab(vt, decoder).seekToFrameSloppy(frameNumber)).getFrame();
}
开发者ID:PenoaksDev,
项目名称:OpenSpaceDVR,
代码行数:16,
代码来源:FrameGrab.java