All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nextbreakpoint.ffmpeg4java.AVHWFramesContext Maven / Gradle / Ivy

The newest version!
// Generated by jextract

package com.nextbreakpoint.ffmpeg4java;

import java.lang.invoke.*;
import java.lang.foreign.*;
import java.nio.ByteOrder;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

import static java.lang.foreign.ValueLayout.*;
import static java.lang.foreign.MemoryLayout.PathElement.*;

/**
 * {@snippet lang=c :
 * struct AVHWFramesContext {
 *     AVClass *av_class;
 *     AVBufferRef *device_ref;
 *     AVHWDeviceContext *device_ctx;
 *     void *hwctx;
 *     void (*free)(struct AVHWFramesContext *);
 *     void *user_opaque;
 *     AVBufferPool *pool;
 *     int initial_pool_size;
 *     enum AVPixelFormat format;
 *     enum AVPixelFormat sw_format;
 *     int width;
 *     int height;
 * }
 * }
 */
public class AVHWFramesContext {

    AVHWFramesContext() {
        // Should not be called directly
    }

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        Libffmpeg.C_POINTER.withName("av_class"),
        Libffmpeg.C_POINTER.withName("device_ref"),
        Libffmpeg.C_POINTER.withName("device_ctx"),
        Libffmpeg.C_POINTER.withName("hwctx"),
        Libffmpeg.C_POINTER.withName("free"),
        Libffmpeg.C_POINTER.withName("user_opaque"),
        Libffmpeg.C_POINTER.withName("pool"),
        Libffmpeg.C_INT.withName("initial_pool_size"),
        Libffmpeg.C_INT.withName("format"),
        Libffmpeg.C_INT.withName("sw_format"),
        Libffmpeg.C_INT.withName("width"),
        Libffmpeg.C_INT.withName("height"),
        MemoryLayout.paddingLayout(4)
    ).withName("AVHWFramesContext");

    /**
     * The layout of this struct
     */
    public static final GroupLayout layout() {
        return $LAYOUT;
    }

    private static final AddressLayout av_class$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("av_class"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * AVClass *av_class
     * }
     */
    public static final AddressLayout av_class$layout() {
        return av_class$LAYOUT;
    }

    private static final long av_class$OFFSET = 0;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * AVClass *av_class
     * }
     */
    public static final long av_class$offset() {
        return av_class$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * AVClass *av_class
     * }
     */
    public static MemorySegment av_class(MemorySegment struct) {
        return struct.get(av_class$LAYOUT, av_class$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * AVClass *av_class
     * }
     */
    public static void av_class(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(av_class$LAYOUT, av_class$OFFSET, fieldValue);
    }

    private static final AddressLayout device_ref$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("device_ref"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * AVBufferRef *device_ref
     * }
     */
    public static final AddressLayout device_ref$layout() {
        return device_ref$LAYOUT;
    }

    private static final long device_ref$OFFSET = 8;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * AVBufferRef *device_ref
     * }
     */
    public static final long device_ref$offset() {
        return device_ref$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * AVBufferRef *device_ref
     * }
     */
    public static MemorySegment device_ref(MemorySegment struct) {
        return struct.get(device_ref$LAYOUT, device_ref$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * AVBufferRef *device_ref
     * }
     */
    public static void device_ref(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(device_ref$LAYOUT, device_ref$OFFSET, fieldValue);
    }

    private static final AddressLayout device_ctx$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("device_ctx"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * AVHWDeviceContext *device_ctx
     * }
     */
    public static final AddressLayout device_ctx$layout() {
        return device_ctx$LAYOUT;
    }

    private static final long device_ctx$OFFSET = 16;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * AVHWDeviceContext *device_ctx
     * }
     */
    public static final long device_ctx$offset() {
        return device_ctx$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * AVHWDeviceContext *device_ctx
     * }
     */
    public static MemorySegment device_ctx(MemorySegment struct) {
        return struct.get(device_ctx$LAYOUT, device_ctx$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * AVHWDeviceContext *device_ctx
     * }
     */
    public static void device_ctx(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(device_ctx$LAYOUT, device_ctx$OFFSET, fieldValue);
    }

    private static final AddressLayout hwctx$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("hwctx"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * void *hwctx
     * }
     */
    public static final AddressLayout hwctx$layout() {
        return hwctx$LAYOUT;
    }

    private static final long hwctx$OFFSET = 24;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * void *hwctx
     * }
     */
    public static final long hwctx$offset() {
        return hwctx$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * void *hwctx
     * }
     */
    public static MemorySegment hwctx(MemorySegment struct) {
        return struct.get(hwctx$LAYOUT, hwctx$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * void *hwctx
     * }
     */
    public static void hwctx(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(hwctx$LAYOUT, hwctx$OFFSET, fieldValue);
    }

    /**
     * {@snippet lang=c :
     * void (*free)(struct AVHWFramesContext *)
     * }
     */
    public static class free {

        free() {
            // Should not be called directly
        }

        /**
         * The function pointer signature, expressed as a functional interface
         */
        public interface Function {
            void apply(MemorySegment _x0);
        }

        private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
            Libffmpeg.C_POINTER
        );

        /**
         * The descriptor of this function pointer
         */
        public static FunctionDescriptor descriptor() {
            return $DESC;
        }

        private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(free.Function.class, "apply", $DESC);

        /**
         * Allocates a new upcall stub, whose implementation is defined by {@code fi}.
         * The lifetime of the returned segment is managed by {@code arena}
         */
        public static MemorySegment allocate(free.Function fi, Arena arena) {
            return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
        }

        private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);

        /**
         * Invoke the upcall stub {@code funcPtr}, with given parameters
         */
        public static void invoke(MemorySegment funcPtr,MemorySegment _x0) {
            try {
                 DOWN$MH.invokeExact(funcPtr, _x0);
            } catch (Throwable ex$) {
                throw new AssertionError("should not reach here", ex$);
            }
        }
    }

    private static final AddressLayout free$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("free"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * void (*free)(struct AVHWFramesContext *)
     * }
     */
    public static final AddressLayout free$layout() {
        return free$LAYOUT;
    }

    private static final long free$OFFSET = 32;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * void (*free)(struct AVHWFramesContext *)
     * }
     */
    public static final long free$offset() {
        return free$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * void (*free)(struct AVHWFramesContext *)
     * }
     */
    public static MemorySegment free(MemorySegment struct) {
        return struct.get(free$LAYOUT, free$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * void (*free)(struct AVHWFramesContext *)
     * }
     */
    public static void free(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(free$LAYOUT, free$OFFSET, fieldValue);
    }

    private static final AddressLayout user_opaque$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("user_opaque"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * void *user_opaque
     * }
     */
    public static final AddressLayout user_opaque$layout() {
        return user_opaque$LAYOUT;
    }

    private static final long user_opaque$OFFSET = 40;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * void *user_opaque
     * }
     */
    public static final long user_opaque$offset() {
        return user_opaque$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * void *user_opaque
     * }
     */
    public static MemorySegment user_opaque(MemorySegment struct) {
        return struct.get(user_opaque$LAYOUT, user_opaque$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * void *user_opaque
     * }
     */
    public static void user_opaque(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(user_opaque$LAYOUT, user_opaque$OFFSET, fieldValue);
    }

    private static final AddressLayout pool$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("pool"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * AVBufferPool *pool
     * }
     */
    public static final AddressLayout pool$layout() {
        return pool$LAYOUT;
    }

    private static final long pool$OFFSET = 48;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * AVBufferPool *pool
     * }
     */
    public static final long pool$offset() {
        return pool$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * AVBufferPool *pool
     * }
     */
    public static MemorySegment pool(MemorySegment struct) {
        return struct.get(pool$LAYOUT, pool$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * AVBufferPool *pool
     * }
     */
    public static void pool(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(pool$LAYOUT, pool$OFFSET, fieldValue);
    }

    private static final OfInt initial_pool_size$LAYOUT = (OfInt)$LAYOUT.select(groupElement("initial_pool_size"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int initial_pool_size
     * }
     */
    public static final OfInt initial_pool_size$layout() {
        return initial_pool_size$LAYOUT;
    }

    private static final long initial_pool_size$OFFSET = 56;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int initial_pool_size
     * }
     */
    public static final long initial_pool_size$offset() {
        return initial_pool_size$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int initial_pool_size
     * }
     */
    public static int initial_pool_size(MemorySegment struct) {
        return struct.get(initial_pool_size$LAYOUT, initial_pool_size$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int initial_pool_size
     * }
     */
    public static void initial_pool_size(MemorySegment struct, int fieldValue) {
        struct.set(initial_pool_size$LAYOUT, initial_pool_size$OFFSET, fieldValue);
    }

    private static final OfInt format$LAYOUT = (OfInt)$LAYOUT.select(groupElement("format"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * enum AVPixelFormat format
     * }
     */
    public static final OfInt format$layout() {
        return format$LAYOUT;
    }

    private static final long format$OFFSET = 60;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * enum AVPixelFormat format
     * }
     */
    public static final long format$offset() {
        return format$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * enum AVPixelFormat format
     * }
     */
    public static int format(MemorySegment struct) {
        return struct.get(format$LAYOUT, format$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * enum AVPixelFormat format
     * }
     */
    public static void format(MemorySegment struct, int fieldValue) {
        struct.set(format$LAYOUT, format$OFFSET, fieldValue);
    }

    private static final OfInt sw_format$LAYOUT = (OfInt)$LAYOUT.select(groupElement("sw_format"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * enum AVPixelFormat sw_format
     * }
     */
    public static final OfInt sw_format$layout() {
        return sw_format$LAYOUT;
    }

    private static final long sw_format$OFFSET = 64;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * enum AVPixelFormat sw_format
     * }
     */
    public static final long sw_format$offset() {
        return sw_format$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * enum AVPixelFormat sw_format
     * }
     */
    public static int sw_format(MemorySegment struct) {
        return struct.get(sw_format$LAYOUT, sw_format$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * enum AVPixelFormat sw_format
     * }
     */
    public static void sw_format(MemorySegment struct, int fieldValue) {
        struct.set(sw_format$LAYOUT, sw_format$OFFSET, fieldValue);
    }

    private static final OfInt width$LAYOUT = (OfInt)$LAYOUT.select(groupElement("width"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int width
     * }
     */
    public static final OfInt width$layout() {
        return width$LAYOUT;
    }

    private static final long width$OFFSET = 68;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int width
     * }
     */
    public static final long width$offset() {
        return width$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int width
     * }
     */
    public static int width(MemorySegment struct) {
        return struct.get(width$LAYOUT, width$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int width
     * }
     */
    public static void width(MemorySegment struct, int fieldValue) {
        struct.set(width$LAYOUT, width$OFFSET, fieldValue);
    }

    private static final OfInt height$LAYOUT = (OfInt)$LAYOUT.select(groupElement("height"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * int height
     * }
     */
    public static final OfInt height$layout() {
        return height$LAYOUT;
    }

    private static final long height$OFFSET = 72;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * int height
     * }
     */
    public static final long height$offset() {
        return height$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * int height
     * }
     */
    public static int height(MemorySegment struct) {
        return struct.get(height$LAYOUT, height$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * int height
     * }
     */
    public static void height(MemorySegment struct, int fieldValue) {
        struct.set(height$LAYOUT, height$OFFSET, fieldValue);
    }

    /**
     * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
     * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
     */
    public static MemorySegment asSlice(MemorySegment array, long index) {
        return array.asSlice(layout().byteSize() * index);
    }

    /**
     * The size (in bytes) of this struct
     */
    public static long sizeof() { return layout().byteSize(); }

    /**
     * Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
     */
    public static MemorySegment allocate(SegmentAllocator allocator) {
        return allocator.allocate(layout());
    }

    /**
     * Allocate an array of size {@code elementCount} using {@code allocator}.
     * The returned segment has size {@code elementCount * layout().byteSize()}.
     */
    public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
        return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
    }

    /**
     * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
     * The returned segment has size {@code layout().byteSize()}
     */
    public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) {
        return reinterpret(addr, 1, arena, cleanup);
    }

    /**
     * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
     * The returned segment has size {@code elementCount * layout().byteSize()}
     */
    public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) {
        return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy