Search in sources :

Example 11 with PointerScope

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;
    }
}
Also used : PointerScope(org.bytedeco.javacpp.PointerScope)

Aggregations

PointerScope (org.bytedeco.javacpp.PointerScope)11 BytePointer (org.bytedeco.javacpp.BytePointer)8 IOException (java.io.IOException)6 IntPointer (org.bytedeco.javacpp.IntPointer)6 PointerPointer (org.bytedeco.javacpp.PointerPointer)6 ByteBuffer (java.nio.ByteBuffer)5 DoublePointer (org.bytedeco.javacpp.DoublePointer)4 FloatPointer (org.bytedeco.javacpp.FloatPointer)4 ShortPointer (org.bytedeco.javacpp.ShortPointer)4 FloatBuffer (java.nio.FloatBuffer)3 ShortBuffer (java.nio.ShortBuffer)3 Pointer (org.bytedeco.javacpp.Pointer)3 DoubleBuffer (java.nio.DoubleBuffer)2 IntBuffer (java.nio.IntBuffer)2 BufferedInputStream (java.io.BufferedInputStream)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 UByteIndexer (org.bytedeco.javacpp.indexer.UByteIndexer)1 Test (org.junit.Test)1