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

com.nextbreakpoint.ffmpeg4java.AVChannelLayout 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 AVChannelLayout {
 *     enum AVChannelOrder order;
 *     int nb_channels;
 *     union {
 *         uint64_t mask;
 *         AVChannelCustom *map;
 *     } u;
 *     void *opaque;
 * }
 * }
 */
public class AVChannelLayout {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        Libffmpeg.C_INT.withName("order"),
        Libffmpeg.C_INT.withName("nb_channels"),
        AVChannelLayout.u.layout().withName("u"),
        Libffmpeg.C_POINTER.withName("opaque")
    ).withName("AVChannelLayout");

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

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

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

    private static final long order$OFFSET = 0;

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

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

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

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

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

    private static final long nb_channels$OFFSET = 4;

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

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

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

    /**
     * {@snippet lang=c :
     * union {
     *     uint64_t mask;
     *     AVChannelCustom *map;
     * }
     * }
     */
    public static class u {

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

        private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout(
            Libffmpeg.C_LONG_LONG.withName("mask"),
            Libffmpeg.C_POINTER.withName("map")
        ).withName("$anon$320:5");

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

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

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

        private static final long mask$OFFSET = 0;

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

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

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

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

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

        private static final long map$OFFSET = 0;

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

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

        /**
         * Setter for field:
         * {@snippet lang=c :
         * AVChannelCustom *map
         * }
         */
        public static void map(MemorySegment union, MemorySegment fieldValue) {
            union.set(map$LAYOUT, map$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 u$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("u"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * union {
     *     uint64_t mask;
     *     AVChannelCustom *map;
     * } u
     * }
     */
    public static final GroupLayout u$layout() {
        return u$LAYOUT;
    }

    private static final long u$OFFSET = 8;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * union {
     *     uint64_t mask;
     *     AVChannelCustom *map;
     * } u
     * }
     */
    public static final long u$offset() {
        return u$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * union {
     *     uint64_t mask;
     *     AVChannelCustom *map;
     * } u
     * }
     */
    public static MemorySegment u(MemorySegment struct) {
        return struct.asSlice(u$OFFSET, u$LAYOUT.byteSize());
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * union {
     *     uint64_t mask;
     *     AVChannelCustom *map;
     * } u
     * }
     */
    public static void u(MemorySegment struct, MemorySegment fieldValue) {
        MemorySegment.copy(fieldValue, 0L, struct, u$OFFSET, u$LAYOUT.byteSize());
    }

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

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

    private static final long opaque$OFFSET = 16;

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

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

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