com.nextbreakpoint.ffmpeg4java.AVCodecParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.nextbreakpoint.ffmpeg4java.windows Show documentation
Show all versions of com.nextbreakpoint.ffmpeg4java.windows Show documentation
FFmpeg4Java provides a Java wrapper of FFmpeg library
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 AVCodecParser {
* int codec_ids[7];
* int priv_data_size;
* int (*parser_init)(AVCodecParserContext *);
* int (*parser_parse)(AVCodecParserContext *, AVCodecContext *, uint8_t **, int *, uint8_t *, int);
* void (*parser_close)(AVCodecParserContext *);
* int (*split)(AVCodecContext *, uint8_t *, int);
* }
* }
*/
public class AVCodecParser {
AVCodecParser() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
MemoryLayout.sequenceLayout(7, Libffmpeg.C_INT).withName("codec_ids"),
Libffmpeg.C_INT.withName("priv_data_size"),
Libffmpeg.C_POINTER.withName("parser_init"),
Libffmpeg.C_POINTER.withName("parser_parse"),
Libffmpeg.C_POINTER.withName("parser_close"),
Libffmpeg.C_POINTER.withName("split")
).withName("AVCodecParser");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final SequenceLayout codec_ids$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("codec_ids"));
/**
* Layout for field:
* {@snippet lang=c :
* int codec_ids[7]
* }
*/
public static final SequenceLayout codec_ids$layout() {
return codec_ids$LAYOUT;
}
private static final long codec_ids$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* int codec_ids[7]
* }
*/
public static final long codec_ids$offset() {
return codec_ids$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int codec_ids[7]
* }
*/
public static MemorySegment codec_ids(MemorySegment struct) {
return struct.asSlice(codec_ids$OFFSET, codec_ids$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* int codec_ids[7]
* }
*/
public static void codec_ids(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, codec_ids$OFFSET, codec_ids$LAYOUT.byteSize());
}
private static long[] codec_ids$DIMS = { 7 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* int codec_ids[7]
* }
*/
public static long[] codec_ids$dimensions() {
return codec_ids$DIMS;
}
private static final VarHandle codec_ids$ELEM_HANDLE = codec_ids$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* int codec_ids[7]
* }
*/
public static int codec_ids(MemorySegment struct, long index0) {
return (int)codec_ids$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* int codec_ids[7]
* }
*/
public static void codec_ids(MemorySegment struct, long index0, int fieldValue) {
codec_ids$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
private static final OfInt priv_data_size$LAYOUT = (OfInt)$LAYOUT.select(groupElement("priv_data_size"));
/**
* Layout for field:
* {@snippet lang=c :
* int priv_data_size
* }
*/
public static final OfInt priv_data_size$layout() {
return priv_data_size$LAYOUT;
}
private static final long priv_data_size$OFFSET = 28;
/**
* Offset for field:
* {@snippet lang=c :
* int priv_data_size
* }
*/
public static final long priv_data_size$offset() {
return priv_data_size$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int priv_data_size
* }
*/
public static int priv_data_size(MemorySegment struct) {
return struct.get(priv_data_size$LAYOUT, priv_data_size$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int priv_data_size
* }
*/
public static void priv_data_size(MemorySegment struct, int fieldValue) {
struct.set(priv_data_size$LAYOUT, priv_data_size$OFFSET, fieldValue);
}
/**
* {@snippet lang=c :
* int (*parser_init)(AVCodecParserContext *)
* }
*/
public static class parser_init {
parser_init() {
// Should not be called directly
}
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment _x0);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
Libffmpeg.C_INT,
Libffmpeg.C_POINTER
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(parser_init.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(parser_init.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 int invoke(MemorySegment funcPtr,MemorySegment _x0) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, _x0);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}
private static final AddressLayout parser_init$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("parser_init"));
/**
* Layout for field:
* {@snippet lang=c :
* int (*parser_init)(AVCodecParserContext *)
* }
*/
public static final AddressLayout parser_init$layout() {
return parser_init$LAYOUT;
}
private static final long parser_init$OFFSET = 32;
/**
* Offset for field:
* {@snippet lang=c :
* int (*parser_init)(AVCodecParserContext *)
* }
*/
public static final long parser_init$offset() {
return parser_init$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int (*parser_init)(AVCodecParserContext *)
* }
*/
public static MemorySegment parser_init(MemorySegment struct) {
return struct.get(parser_init$LAYOUT, parser_init$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int (*parser_init)(AVCodecParserContext *)
* }
*/
public static void parser_init(MemorySegment struct, MemorySegment fieldValue) {
struct.set(parser_init$LAYOUT, parser_init$OFFSET, fieldValue);
}
/**
* {@snippet lang=c :
* int (*parser_parse)(AVCodecParserContext *, AVCodecContext *, uint8_t **, int *, uint8_t *, int)
* }
*/
public static class parser_parse {
parser_parse() {
// Should not be called directly
}
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, MemorySegment _x3, MemorySegment _x4, int _x5);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
Libffmpeg.C_INT,
Libffmpeg.C_POINTER,
Libffmpeg.C_POINTER,
Libffmpeg.C_POINTER,
Libffmpeg.C_POINTER,
Libffmpeg.C_POINTER,
Libffmpeg.C_INT
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(parser_parse.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(parser_parse.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 int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, MemorySegment _x3, MemorySegment _x4, int _x5) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4, _x5);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}
private static final AddressLayout parser_parse$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("parser_parse"));
/**
* Layout for field:
* {@snippet lang=c :
* int (*parser_parse)(AVCodecParserContext *, AVCodecContext *, uint8_t **, int *, uint8_t *, int)
* }
*/
public static final AddressLayout parser_parse$layout() {
return parser_parse$LAYOUT;
}
private static final long parser_parse$OFFSET = 40;
/**
* Offset for field:
* {@snippet lang=c :
* int (*parser_parse)(AVCodecParserContext *, AVCodecContext *, uint8_t **, int *, uint8_t *, int)
* }
*/
public static final long parser_parse$offset() {
return parser_parse$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int (*parser_parse)(AVCodecParserContext *, AVCodecContext *, uint8_t **, int *, uint8_t *, int)
* }
*/
public static MemorySegment parser_parse(MemorySegment struct) {
return struct.get(parser_parse$LAYOUT, parser_parse$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int (*parser_parse)(AVCodecParserContext *, AVCodecContext *, uint8_t **, int *, uint8_t *, int)
* }
*/
public static void parser_parse(MemorySegment struct, MemorySegment fieldValue) {
struct.set(parser_parse$LAYOUT, parser_parse$OFFSET, fieldValue);
}
/**
* {@snippet lang=c :
* void (*parser_close)(AVCodecParserContext *)
* }
*/
public static class parser_close {
parser_close() {
// 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(parser_close.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(parser_close.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 parser_close$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("parser_close"));
/**
* Layout for field:
* {@snippet lang=c :
* void (*parser_close)(AVCodecParserContext *)
* }
*/
public static final AddressLayout parser_close$layout() {
return parser_close$LAYOUT;
}
private static final long parser_close$OFFSET = 48;
/**
* Offset for field:
* {@snippet lang=c :
* void (*parser_close)(AVCodecParserContext *)
* }
*/
public static final long parser_close$offset() {
return parser_close$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* void (*parser_close)(AVCodecParserContext *)
* }
*/
public static MemorySegment parser_close(MemorySegment struct) {
return struct.get(parser_close$LAYOUT, parser_close$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* void (*parser_close)(AVCodecParserContext *)
* }
*/
public static void parser_close(MemorySegment struct, MemorySegment fieldValue) {
struct.set(parser_close$LAYOUT, parser_close$OFFSET, fieldValue);
}
/**
* {@snippet lang=c :
* int (*split)(AVCodecContext *, uint8_t *, int)
* }
*/
public static class split {
split() {
// Should not be called directly
}
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment _x0, MemorySegment _x1, int _x2);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
Libffmpeg.C_INT,
Libffmpeg.C_POINTER,
Libffmpeg.C_POINTER,
Libffmpeg.C_INT
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(split.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(split.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 int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}
private static final AddressLayout split$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("split"));
/**
* Layout for field:
* {@snippet lang=c :
* int (*split)(AVCodecContext *, uint8_t *, int)
* }
*/
public static final AddressLayout split$layout() {
return split$LAYOUT;
}
private static final long split$OFFSET = 56;
/**
* Offset for field:
* {@snippet lang=c :
* int (*split)(AVCodecContext *, uint8_t *, int)
* }
*/
public static final long split$offset() {
return split$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int (*split)(AVCodecContext *, uint8_t *, int)
* }
*/
public static MemorySegment split(MemorySegment struct) {
return struct.get(split$LAYOUT, split$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int (*split)(AVCodecContext *, uint8_t *, int)
* }
*/
public static void split(MemorySegment struct, MemorySegment fieldValue) {
struct.set(split$LAYOUT, split$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);
}
}