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

com.nextbreakpoint.ffmpeg4java.AVOption 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 AVOption {
 *     char *name;
 *     char *help;
 *     int offset;
 *     enum AVOptionType type;
 *     union {
 *         int64_t i64;
 *         double dbl;
 *         char *str;
 *         AVRational q;
 *         AVOptionArrayDef *arr;
 *     } default_val;
 *     double min;
 *     double max;
 *     int flags;
 *     char *unit;
 * }
 * }
 */
public class AVOption {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        Libffmpeg.C_POINTER.withName("name"),
        Libffmpeg.C_POINTER.withName("help"),
        Libffmpeg.C_INT.withName("offset"),
        Libffmpeg.C_INT.withName("type"),
        AVOption.default_val.layout().withName("default_val"),
        Libffmpeg.C_DOUBLE.withName("min"),
        Libffmpeg.C_DOUBLE.withName("max"),
        Libffmpeg.C_INT.withName("flags"),
        MemoryLayout.paddingLayout(4),
        Libffmpeg.C_POINTER.withName("unit")
    ).withName("AVOption");

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

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

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

    private static final long name$OFFSET = 0;

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

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

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

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

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

    private static final long help$OFFSET = 8;

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

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

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

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

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

    private static final long offset$OFFSET = 16;

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

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

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

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

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

    private static final long type$OFFSET = 20;

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

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

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

    /**
     * {@snippet lang=c :
     * union {
     *     int64_t i64;
     *     double dbl;
     *     char *str;
     *     AVRational q;
     *     AVOptionArrayDef *arr;
     * }
     * }
     */
    public static class default_val {

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

        private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout(
            Libffmpeg.C_LONG_LONG.withName("i64"),
            Libffmpeg.C_DOUBLE.withName("dbl"),
            Libffmpeg.C_POINTER.withName("str"),
            AVRational.layout().withName("q"),
            Libffmpeg.C_POINTER.withName("arr")
        ).withName("$anon$368:5");

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

        private static final OfLong i64$LAYOUT = (OfLong)$LAYOUT.select(groupElement("i64"));

        /**
         * Layout for field:
         * {@snippet lang=c :
         * int64_t i64
         * }
         */
        public static final OfLong i64$layout() {
            return i64$LAYOUT;
        }

        private static final long i64$OFFSET = 0;

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

        /**
         * Getter for field:
         * {@snippet lang=c :
         * int64_t i64
         * }
         */
        public static long i64(MemorySegment union) {
            return union.get(i64$LAYOUT, i64$OFFSET);
        }

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

        private static final OfDouble dbl$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("dbl"));

        /**
         * Layout for field:
         * {@snippet lang=c :
         * double dbl
         * }
         */
        public static final OfDouble dbl$layout() {
            return dbl$LAYOUT;
        }

        private static final long dbl$OFFSET = 0;

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

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

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

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

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

        private static final long str$OFFSET = 0;

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

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

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

        private static final GroupLayout q$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("q"));

        /**
         * Layout for field:
         * {@snippet lang=c :
         * AVRational q
         * }
         */
        public static final GroupLayout q$layout() {
            return q$LAYOUT;
        }

        private static final long q$OFFSET = 0;

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

        /**
         * Getter for field:
         * {@snippet lang=c :
         * AVRational q
         * }
         */
        public static MemorySegment q(MemorySegment union) {
            return union.asSlice(q$OFFSET, q$LAYOUT.byteSize());
        }

        /**
         * Setter for field:
         * {@snippet lang=c :
         * AVRational q
         * }
         */
        public static void q(MemorySegment union, MemorySegment fieldValue) {
            MemorySegment.copy(fieldValue, 0L, union, q$OFFSET, q$LAYOUT.byteSize());
        }

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

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

        private static final long arr$OFFSET = 0;

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

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

        /**
         * Setter for field:
         * {@snippet lang=c :
         * AVOptionArrayDef *arr
         * }
         */
        public static void arr(MemorySegment union, MemorySegment fieldValue) {
            union.set(arr$LAYOUT, arr$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 union
         */
        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);
        }
    }

    private static final GroupLayout default_val$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("default_val"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * union {
     *     int64_t i64;
     *     double dbl;
     *     char *str;
     *     AVRational q;
     *     AVOptionArrayDef *arr;
     * } default_val
     * }
     */
    public static final GroupLayout default_val$layout() {
        return default_val$LAYOUT;
    }

    private static final long default_val$OFFSET = 24;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * union {
     *     int64_t i64;
     *     double dbl;
     *     char *str;
     *     AVRational q;
     *     AVOptionArrayDef *arr;
     * } default_val
     * }
     */
    public static final long default_val$offset() {
        return default_val$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * union {
     *     int64_t i64;
     *     double dbl;
     *     char *str;
     *     AVRational q;
     *     AVOptionArrayDef *arr;
     * } default_val
     * }
     */
    public static MemorySegment default_val(MemorySegment struct) {
        return struct.asSlice(default_val$OFFSET, default_val$LAYOUT.byteSize());
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * union {
     *     int64_t i64;
     *     double dbl;
     *     char *str;
     *     AVRational q;
     *     AVOptionArrayDef *arr;
     * } default_val
     * }
     */
    public static void default_val(MemorySegment struct, MemorySegment fieldValue) {
        MemorySegment.copy(fieldValue, 0L, struct, default_val$OFFSET, default_val$LAYOUT.byteSize());
    }

    private static final OfDouble min$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("min"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * double min
     * }
     */
    public static final OfDouble min$layout() {
        return min$LAYOUT;
    }

    private static final long min$OFFSET = 32;

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

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

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

    private static final OfDouble max$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("max"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * double max
     * }
     */
    public static final OfDouble max$layout() {
        return max$LAYOUT;
    }

    private static final long max$OFFSET = 40;

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

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

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

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

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

    private static final long flags$OFFSET = 48;

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

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

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

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

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

    private static final long unit$OFFSET = 56;

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

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

    /**
     * Setter for field:
     * {@snippet lang=c :
     * char *unit
     * }
     */
    public static void unit(MemorySegment struct, MemorySegment fieldValue) {
        struct.set(unit$LAYOUT, unit$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