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

com.nextbreakpoint.ffmpeg4java.AVIndexEntry 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 AVIndexEntry {
 *     int64_t pos;
 *     int64_t timestamp;
 *     int flags : 2;
 *     int size : 30;
 *     int min_distance;
 * }
 * }
 */
public class AVIndexEntry {

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

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        Libffmpeg.C_LONG_LONG.withName("pos"),
        Libffmpeg.C_LONG_LONG.withName("timestamp"),
        MemoryLayout.paddingLayout(4),
        Libffmpeg.C_INT.withName("min_distance")
    ).withName("AVIndexEntry");

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

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

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

    private static final long pos$OFFSET = 0;

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

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

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

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

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

    private static final long timestamp$OFFSET = 8;

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

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

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

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

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

    private static final long min_distance$OFFSET = 20;

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

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

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