use of org.bytedeco.javacpp.PointerScope in project javacv by bytedeco.
the class FFmpegFrameFilter method startUnsafe.
public synchronized void startUnsafe() throws Exception {
try (PointerScope scope = new PointerScope()) {
if (frame != null) {
throw new Exception("start() has already been called: Call stop() before calling start() again.");
}
image_frame = av_frame_alloc();
samples_frame = av_frame_alloc();
filt_frame = av_frame_alloc();
image_ptr = new BytePointer[] { null };
image_ptr2 = new BytePointer[] { null };
image_buf = new Buffer[] { null };
image_buf2 = new Buffer[] { null };
samples_ptr = new BytePointer[] { null };
samples_buf = new Buffer[] { null };
frame = new Frame();
if (image_frame == null || samples_frame == null || filt_frame == null) {
throw new Exception("Could not allocate frames");
}
if (filters != null && imageWidth > 0 && imageHeight > 0 && videoInputs > 0) {
startVideoUnsafe();
}
if (afilters != null && audioChannels > 0 && audioInputs > 0) {
startAudioUnsafe();
}
started = true;
}
}
Aggregations