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

com.nextbreakpoint.ffmpeg4java.AVChapter 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 AVChapter {
 *     int64_t id;
 *     AVRational time_base;
 *     int64_t start;
 *     int64_t end;
 *     AVDictionary *metadata;
 * }
 * }
 */
public class AVChapter {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        Libffmpeg.C_LONG_LONG.withName("id"),
        AVRational.layout().withName("time_base"),
        Libffmpeg.C_LONG_LONG.withName("start"),
        Libffmpeg.C_LONG_LONG.withName("end"),
        Libffmpeg.C_POINTER.withName("metadata")
    ).withName("AVChapter");

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

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

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

    private static final long id$OFFSET = 0;

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

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

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

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

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

    private static final long time_base$OFFSET = 8;

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

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

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

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

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

    private static final long start$OFFSET = 16;

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

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

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

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

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

    private static final long end$OFFSET = 24;

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

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

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

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

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

    private static final long metadata$OFFSET = 32;

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

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

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