├── .gitignore ├── Makefile ├── README.md ├── ffmpeg4java-examples ├── pom.xml ├── sample.mpg └── src │ └── main │ └── java │ └── com │ └── nextbreakpoint │ └── ffmpeg4java │ └── ConvertVideoMain.java ├── ffmpeg4java-linux ├── dump.sh ├── extract.sh ├── includes.txt ├── libffmpeg.h ├── native │ ├── Dockerfile │ ├── Makefile │ ├── ffmpeg.patch │ └── scripts │ │ ├── checkout.sh │ │ ├── clean.sh │ │ ├── compile.sh │ │ ├── configure.sh │ │ └── copy.sh ├── output.txt ├── pom.xml ├── source └── src │ └── main │ ├── java │ ├── com │ │ └── nextbreakpoint │ │ │ └── ffmpeg4java │ │ │ ├── AVBufferRef.java │ │ │ ├── AVCPBProperties.java │ │ │ ├── AVChannelCustom.java │ │ │ ├── AVChannelLayout.java │ │ │ ├── AVChapter.java │ │ │ ├── AVClass.java │ │ │ ├── AVCodec.java │ │ │ ├── AVCodecContext.java │ │ │ ├── AVCodecDescriptor.java │ │ │ ├── AVCodecHWConfig.java │ │ │ ├── AVCodecParameters.java │ │ │ ├── AVCodecParser.java │ │ │ ├── AVCodecParserContext.java │ │ │ ├── AVComponentDescriptor.java │ │ │ ├── AVDeviceInfo.java │ │ │ ├── AVDeviceInfoList.java │ │ │ ├── AVDeviceRect.java │ │ │ ├── AVDictionaryEntry.java │ │ │ ├── AVFilter.java │ │ │ ├── AVFilterChain.java │ │ │ ├── AVFilterContext.java │ │ │ ├── AVFilterFormatsConfig.java │ │ │ ├── AVFilterGraph.java │ │ │ ├── AVFilterGraphSegment.java │ │ │ ├── AVFilterInOut.java │ │ │ ├── AVFilterLink.java │ │ │ ├── AVFilterPadParams.java │ │ │ ├── AVFilterParams.java │ │ │ ├── AVFormatContext.java │ │ │ ├── AVFrame.java │ │ │ ├── AVFrameSideData.java │ │ │ ├── AVHWAccel.java │ │ │ ├── AVHWDeviceContext.java │ │ │ ├── AVHWFramesConstraints.java │ │ │ ├── AVHWFramesContext.java │ │ │ ├── AVIOContext.java │ │ │ ├── AVIODirEntry.java │ │ │ ├── AVIOInterruptCB.java │ │ │ ├── AVIndexEntry.java │ │ │ ├── AVInputFormat.java │ │ │ ├── AVOpenCallback.java │ │ │ ├── AVOption.java │ │ │ ├── AVOptionArrayDef.java │ │ │ ├── AVOptionRange.java │ │ │ ├── AVOptionRanges.java │ │ │ ├── AVOutputFormat.java │ │ │ ├── AVPacket.java │ │ │ ├── AVPacketList.java │ │ │ ├── AVPacketSideData.java │ │ │ ├── AVPanScan.java │ │ │ ├── AVPixFmtDescriptor.java │ │ │ ├── AVProbeData.java │ │ │ ├── AVProducerReferenceTime.java │ │ │ ├── AVProfile.java │ │ │ ├── AVProgram.java │ │ │ ├── AVRational.java │ │ │ ├── AVRegionOfInterest.java │ │ │ ├── AVStream.java │ │ │ ├── AVStreamGroup.java │ │ │ ├── AVStreamGroupTileGrid.java │ │ │ ├── AVSubtitle.java │ │ │ ├── AVSubtitleRect.java │ │ │ ├── Libffmpeg.java │ │ │ ├── Libffmpeg_1.java │ │ │ ├── Libffmpeg_2.java │ │ │ ├── RcOverride.java │ │ │ ├── SwsFilter.java │ │ │ ├── SwsVector.java │ │ │ ├── av_buffer_create$free.java │ │ │ ├── av_buffer_pool_init$alloc.java │ │ │ ├── av_buffer_pool_init2$alloc.java │ │ │ ├── av_buffer_pool_init2$pool_free.java │ │ │ ├── av_format_control_message.java │ │ │ ├── av_intfloat32.java │ │ │ ├── av_intfloat64.java │ │ │ ├── av_log_set_callback$callback.java │ │ │ ├── avcodec_default_execute$func.java │ │ │ ├── avcodec_default_execute2$func.java │ │ │ ├── avfilter_action_func.java │ │ │ ├── avfilter_execute_func.java │ │ │ ├── avio_alloc_context$read_packet.java │ │ │ ├── avio_alloc_context$seek.java │ │ │ ├── avio_alloc_context$write_packet.java │ │ │ └── max_align_t.java │ └── module-info.java │ └── resources │ └── META-INF │ ├── LGPL v2.1.txt │ ├── LICENSE.txt │ └── NOTICE.txt ├── ffmpeg4java-macos ├── dump.sh ├── extract.sh ├── includes.txt ├── libffmpeg.h ├── native │ ├── Makefile │ ├── ffmpeg.patch │ └── scripts │ │ ├── checkout.sh │ │ ├── clean.sh │ │ ├── compile.sh │ │ ├── configure.sh │ │ └── copy.sh ├── output.txt ├── pom.xml ├── source └── src │ └── main │ ├── java │ ├── com │ │ └── nextbreakpoint │ │ │ └── ffmpeg4java │ │ │ ├── AVBufferRef.java │ │ │ ├── AVCPBProperties.java │ │ │ ├── AVChannelCustom.java │ │ │ ├── AVChannelLayout.java │ │ │ ├── AVChapter.java │ │ │ ├── AVClass.java │ │ │ ├── AVCodec.java │ │ │ ├── AVCodecContext.java │ │ │ ├── AVCodecDescriptor.java │ │ │ ├── AVCodecHWConfig.java │ │ │ ├── AVCodecParameters.java │ │ │ ├── AVCodecParser.java │ │ │ ├── AVCodecParserContext.java │ │ │ ├── AVComponentDescriptor.java │ │ │ ├── AVDeviceInfo.java │ │ │ ├── AVDeviceInfoList.java │ │ │ ├── AVDeviceRect.java │ │ │ ├── AVDictionaryEntry.java │ │ │ ├── AVFilter.java │ │ │ ├── AVFilterChain.java │ │ │ ├── AVFilterContext.java │ │ │ ├── AVFilterFormatsConfig.java │ │ │ ├── AVFilterGraph.java │ │ │ ├── AVFilterGraphSegment.java │ │ │ ├── AVFilterInOut.java │ │ │ ├── AVFilterLink.java │ │ │ ├── AVFilterPadParams.java │ │ │ ├── AVFilterParams.java │ │ │ ├── AVFormatContext.java │ │ │ ├── AVFrame.java │ │ │ ├── AVFrameSideData.java │ │ │ ├── AVHWAccel.java │ │ │ ├── AVHWDeviceContext.java │ │ │ ├── AVHWFramesConstraints.java │ │ │ ├── AVHWFramesContext.java │ │ │ ├── AVIOContext.java │ │ │ ├── AVIODirEntry.java │ │ │ ├── AVIOInterruptCB.java │ │ │ ├── AVIndexEntry.java │ │ │ ├── AVInputFormat.java │ │ │ ├── AVOpenCallback.java │ │ │ ├── AVOption.java │ │ │ ├── AVOptionArrayDef.java │ │ │ ├── AVOptionRange.java │ │ │ ├── AVOptionRanges.java │ │ │ ├── AVOutputFormat.java │ │ │ ├── AVPacket.java │ │ │ ├── AVPacketList.java │ │ │ ├── AVPacketSideData.java │ │ │ ├── AVPanScan.java │ │ │ ├── AVPixFmtDescriptor.java │ │ │ ├── AVProbeData.java │ │ │ ├── AVProducerReferenceTime.java │ │ │ ├── AVProfile.java │ │ │ ├── AVProgram.java │ │ │ ├── AVRational.java │ │ │ ├── AVRegionOfInterest.java │ │ │ ├── AVStream.java │ │ │ ├── AVStreamGroup.java │ │ │ ├── AVStreamGroupTileGrid.java │ │ │ ├── AVSubtitle.java │ │ │ ├── AVSubtitleRect.java │ │ │ ├── Libffmpeg.java │ │ │ ├── Libffmpeg_1.java │ │ │ ├── Libffmpeg_2.java │ │ │ ├── RcOverride.java │ │ │ ├── SwsFilter.java │ │ │ ├── SwsVector.java │ │ │ ├── av_buffer_create$free.java │ │ │ ├── av_buffer_pool_init$alloc.java │ │ │ ├── av_buffer_pool_init2$alloc.java │ │ │ ├── av_buffer_pool_init2$pool_free.java │ │ │ ├── av_format_control_message.java │ │ │ ├── av_intfloat32.java │ │ │ ├── av_intfloat64.java │ │ │ ├── av_log_set_callback$callback.java │ │ │ ├── avcodec_default_execute$func.java │ │ │ ├── avcodec_default_execute2$func.java │ │ │ ├── avfilter_action_func.java │ │ │ ├── avfilter_execute_func.java │ │ │ ├── avio_alloc_context$read_packet.java │ │ │ ├── avio_alloc_context$seek.java │ │ │ └── avio_alloc_context$write_packet.java │ └── module-info.java │ └── resources │ └── META-INF │ ├── LGPL v2.1.txt │ ├── LICENSE.txt │ └── NOTICE.txt ├── ffmpeg4java-tests ├── fixture-frame-10.png ├── fixture-frame-20.png ├── fixture-frame-30.png ├── fixture-frame-40.png ├── fixture-video-48.mpg ├── pom.xml └── src │ └── test │ └── java │ └── com │ └── nextbreakpoint │ └── ffmpeg4java │ └── FFmpeg4JavaTest.java ├── ffmpeg4java-windows ├── dump.sh ├── extract.sh ├── includes.txt ├── libffmpeg.h ├── native │ ├── Dockerfile │ ├── Makefile │ ├── ffmpeg.patch │ └── scripts │ │ ├── checkout.sh │ │ ├── clean.sh │ │ ├── compile.sh │ │ ├── configure.sh │ │ └── copy.sh ├── output.txt ├── pom.xml ├── source └── src │ └── main │ ├── java │ ├── com │ │ └── nextbreakpoint │ │ │ └── ffmpeg4java │ │ │ ├── AVBufferRef.java │ │ │ ├── AVCPBProperties.java │ │ │ ├── AVChannelCustom.java │ │ │ ├── AVChannelLayout.java │ │ │ ├── AVChapter.java │ │ │ ├── AVClass.java │ │ │ ├── AVCodec.java │ │ │ ├── AVCodecContext.java │ │ │ ├── AVCodecDescriptor.java │ │ │ ├── AVCodecHWConfig.java │ │ │ ├── AVCodecParameters.java │ │ │ ├── AVCodecParser.java │ │ │ ├── AVCodecParserContext.java │ │ │ ├── AVComponentDescriptor.java │ │ │ ├── AVDeviceInfo.java │ │ │ ├── AVDeviceInfoList.java │ │ │ ├── AVDeviceRect.java │ │ │ ├── AVDictionaryEntry.java │ │ │ ├── AVFilter.java │ │ │ ├── AVFilterChain.java │ │ │ ├── AVFilterContext.java │ │ │ ├── AVFilterFormatsConfig.java │ │ │ ├── AVFilterGraph.java │ │ │ ├── AVFilterGraphSegment.java │ │ │ ├── AVFilterInOut.java │ │ │ ├── AVFilterLink.java │ │ │ ├── AVFilterPadParams.java │ │ │ ├── AVFilterParams.java │ │ │ ├── AVFormatContext.java │ │ │ ├── AVFrame.java │ │ │ ├── AVFrameSideData.java │ │ │ ├── AVHWAccel.java │ │ │ ├── AVHWDeviceContext.java │ │ │ ├── AVHWFramesConstraints.java │ │ │ ├── AVHWFramesContext.java │ │ │ ├── AVIOContext.java │ │ │ ├── AVIODirEntry.java │ │ │ ├── AVIOInterruptCB.java │ │ │ ├── AVIndexEntry.java │ │ │ ├── AVInputFormat.java │ │ │ ├── AVOpenCallback.java │ │ │ ├── AVOption.java │ │ │ ├── AVOptionArrayDef.java │ │ │ ├── AVOptionRange.java │ │ │ ├── AVOptionRanges.java │ │ │ ├── AVOutputFormat.java │ │ │ ├── AVPacket.java │ │ │ ├── AVPacketList.java │ │ │ ├── AVPacketSideData.java │ │ │ ├── AVPanScan.java │ │ │ ├── AVPixFmtDescriptor.java │ │ │ ├── AVProbeData.java │ │ │ ├── AVProducerReferenceTime.java │ │ │ ├── AVProfile.java │ │ │ ├── AVProgram.java │ │ │ ├── AVRational.java │ │ │ ├── AVRegionOfInterest.java │ │ │ ├── AVStream.java │ │ │ ├── AVStreamGroup.java │ │ │ ├── AVStreamGroupTileGrid.java │ │ │ ├── AVSubtitle.java │ │ │ ├── AVSubtitleRect.java │ │ │ ├── Libffmpeg.java │ │ │ ├── Libffmpeg_1.java │ │ │ ├── Libffmpeg_2.java │ │ │ ├── RcOverride.java │ │ │ ├── SwsFilter.java │ │ │ ├── SwsVector.java │ │ │ ├── av_buffer_create$free.java │ │ │ ├── av_buffer_pool_init$alloc.java │ │ │ ├── av_buffer_pool_init2$alloc.java │ │ │ ├── av_buffer_pool_init2$pool_free.java │ │ │ ├── av_format_control_message.java │ │ │ ├── av_intfloat32.java │ │ │ ├── av_intfloat64.java │ │ │ ├── av_log_set_callback$callback.java │ │ │ ├── avcodec_default_execute$func.java │ │ │ ├── avcodec_default_execute2$func.java │ │ │ ├── avfilter_action_func.java │ │ │ ├── avfilter_execute_func.java │ │ │ ├── avio_alloc_context$read_packet.java │ │ │ ├── avio_alloc_context$seek.java │ │ │ └── avio_alloc_context$write_packet.java │ └── module-info.java │ └── resources │ └── META-INF │ ├── LGPL v2.1.txt │ ├── LICENSE.txt │ └── NOTICE.txt ├── legal ├── LGPL v2.1.txt ├── LICENSE.txt └── NOTICE.txt ├── maven-version-rules.xml └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea 3 | /ffmpeg4java-macos/native/ffmpeg/ 4 | /ffmpeg4java-linux/native/ffmpeg/ 5 | /ffmpeg4java-windows/native/ffmpeg/ 6 | /ffmpeg4java-windows/src/main/resources/ffmpeg4java.dll 7 | /ffmpeg4java-linux/src/main/resources/libffmpeg4java.so 8 | /ffmpeg4java-macos/src/main/resources/libffmpeg4java.dylib 9 | /ffmpeg4java-examples/output.mp4 10 | /ffmpeg4java-tests/test-frame-10.png 11 | /ffmpeg4java-tests/test-frame-20.png 12 | /ffmpeg4java-tests/test-frame-30.png 13 | /ffmpeg4java-tests/test-frame-40.png 14 | /ffmpeg4java-tests/test-video-48.mpg 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean 2 | clean: 3 | mvn clean 4 | 5 | .PHONY: compile 6 | compile: 7 | mvn compile 8 | 9 | .PHONY: package 10 | package: 11 | mvn package -DskipTests=true 12 | 13 | .PHONY: install 14 | install: 15 | mvn install -DskipTests=true 16 | 17 | .PHONY: extract 18 | extract: 19 | test $(system) 20 | @echo System = $(system) 21 | cd ffmpeg4java-$(system) && ./extract.sh 22 | 23 | .PHONY: dump 24 | dump: 25 | test $(system) 26 | @echo System = $(system) 27 | cd ffmpeg4java-$(system) && ./dump.sh 28 | 29 | .PHONY: verify 30 | verify: 31 | test $(system) 32 | @echo System = $(system) 33 | #MAVEN_OPTS="--enable-preview --enable-native-access=ALL-UNNAMED -Djava.library.path=ffmpeg4java-tests/target/lib -Djextract.trace.downcalls=false -Xlog:library" mvn verify -P$(system) 34 | MAVEN_OPTS="--enable-preview --enable-native-access=ALL-UNNAMED -Djava.library.path=ffmpeg4java-tests/target/lib -Djextract.trace.downcalls=false $(properties)" mvn verify -P$(system) 35 | 36 | .PHONY: copy-legal 37 | copy-legal: 38 | cp legal/*.txt ffmpeg4java-macos/src/main/resources/META-INF/ 39 | cp legal/*.txt ffmpeg4java-linux/src/main/resources/META-INF/ 40 | cp legal/*.txt ffmpeg4java-windows/src/main/resources/META-INF/ 41 | 42 | .PHONY: dist 43 | dist: 44 | rm -fR dist 45 | mkdir -p dist 46 | cp ffmpeg4java-macos/target/com.nextbreakpoint.ffmpeg4java.macos-*.jar dist 47 | cp ffmpeg4java-linux/target/com.nextbreakpoint.ffmpeg4java.linux-*.jar dist 48 | cp ffmpeg4java-windows/target/com.nextbreakpoint.ffmpeg4java.windows-*.jar dist 49 | 50 | 51 | .PHONY: github-release 52 | github-release: 53 | mvn -Dchannel=github clean package de.jutzig:github-release-plugin:release -Dgithub.draft=true 54 | 55 | .PHONY: maven-release 56 | maven-release: 57 | mvn -Dchannel=ossrh clean deploy 58 | 59 | .PHONY: set-version 60 | set-version: 61 | test $(version) 62 | mvn versions:set -DnewVersion=$(version) 63 | mvn versions:commit 64 | -------------------------------------------------------------------------------- /ffmpeg4java-examples/sample.mpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbreakpoint/ffmpeg4java/b132cbcdc2aa9a46feeea39f580b48dd0a982e5e/ffmpeg4java-examples/sample.mpg -------------------------------------------------------------------------------- /ffmpeg4java-linux/dump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FFMPEG_HOME=$(pwd)/native/ffmpeg 4 | 5 | export PATH=$PATH:${JEXTRACT_HOME}/bin 6 | 7 | jextract --dump-includes includes.txt \ 8 | --include-dir "${FFMPEG_HOME}" \ 9 | libffmpeg.h -------------------------------------------------------------------------------- /ffmpeg4java-linux/extract.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FFMPEG_HOME=$(pwd)/native/ffmpeg 4 | 5 | export PATH=$PATH:${JEXTRACT_HOME}/bin 6 | 7 | jextract @includes.txt \ 8 | --output src/main/java \ 9 | --target-package com.nextbreakpoint.ffmpeg4java \ 10 | --include-dir "${FFMPEG_HOME}" \ 11 | --use-system-load-library \ 12 | --library ffmpeg4java \ 13 | --header-class-name Libffmpeg \ 14 | libffmpeg.h -------------------------------------------------------------------------------- /ffmpeg4java-linux/libffmpeg.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/native/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | RUN apt-get update -y && apt-get -y install git make gcc=4:11.2.0-1ubuntu1 g++=4:11.2.0-1ubuntu1 4 | 5 | WORKDIR /var/native 6 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/native/Makefile: -------------------------------------------------------------------------------- 1 | INSTALL_PATH := $(CURDIR)/../src/main/resources 2 | 3 | .PHONY: checkout 4 | checkout: 5 | ./scripts/checkout.sh 6 | 7 | .PHONY: configure 8 | configure: 9 | ./scripts/configure.sh 10 | 11 | .PHONY: compile 12 | compile: 13 | ./scripts/compile.sh 14 | 15 | .PHONY: clean 16 | clean: 17 | ./scripts/clean.sh 18 | 19 | .PHONY: install 20 | install: 21 | ./scripts/copy.sh $(INSTALL_PATH) 22 | 23 | .PHONY: all 24 | all: build-lib install 25 | 26 | .PHONY: build-image 27 | build-image: 28 | docker build -t ffmpeg4java-linux . 29 | 30 | .PHONY: build-lib 31 | build-lib: build-image 32 | docker run --rm -i -v $(CURDIR):/var/native ffmpeg4java-linux make checkout configure compile 33 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/native/ffmpeg.patch: -------------------------------------------------------------------------------- 1 | diff --git a/libswscale/Makefile b/libswscale/Makefile 2 | index 757997b401..4c950e6c43 100644 3 | --- a/libswscale/Makefile 4 | +++ b/libswscale/Makefile 5 | @@ -9,7 +9,6 @@ OBJS = alphablend.o \ 6 | hscale.o \ 7 | hscale_fast_bilinear.o \ 8 | gamma.o \ 9 | - half2float.o \ 10 | input.o \ 11 | options.o \ 12 | output.o \ 13 | diff --git a/libswscale/half2float.c b/libswscale/half2float.c 14 | deleted file mode 100644 15 | index 1b023f96a5..0000000000 16 | --- a/libswscale/half2float.c 17 | +++ /dev/null 18 | @@ -1,19 +0,0 @@ 19 | -/* 20 | - * This file is part of FFmpeg. 21 | - * 22 | - * FFmpeg is free software; you can redistribute it and/or 23 | - * modify it under the terms of the GNU Lesser General Public 24 | - * License as published by the Free Software Foundation; either 25 | - * version 2.1 of the License, or (at your option) any later version. 26 | - * 27 | - * FFmpeg is distributed in the hope that it will be useful, 28 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | - * Lesser General Public License for more details. 31 | - * 32 | - * You should have received a copy of the GNU Lesser General Public 33 | - * License along with FFmpeg; if not, write to the Free Software 34 | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 35 | - */ 36 | - 37 | -#include "libavutil/half2float.c" 38 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/native/scripts/checkout.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | FFMPEG_HOME=$(pwd)/ffmpeg 6 | 7 | if [ ! -d "$FFMPEG_HOME" ]; then 8 | git clone https://git.ffmpeg.org/ffmpeg.git "$FFMPEG_HOME" 9 | else 10 | pushd "$FFMPEG_HOME" 11 | git fetch 12 | popd 13 | fi 14 | 15 | pushd "$FFMPEG_HOME" 16 | git checkout af25a4bfd2503caf3ee485b27b99b620302f5718 17 | popd 18 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/native/scripts/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FFMPEG_HOME=$(pwd)/ffmpeg 6 | 7 | cd "$FFMPEG_HOME" || exit 8 | 9 | make clean 10 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/native/scripts/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FFMPEG_HOME=$(pwd)/ffmpeg 6 | 7 | LIB_TYPE=64 8 | 9 | cd "$FFMPEG_HOME" || exit 10 | 11 | git reset --hard 12 | patch -p1 -N < ../ffmpeg.patch 13 | 14 | make 15 | 16 | gcc --verbose \ 17 | -o libffmpeg4java.so \ 18 | -shared \ 19 | -m${LIB_TYPE} \ 20 | -Wall \ 21 | -fpic \ 22 | -Wl,--no-undefined \ 23 | -Wl,-Bsymbolic \ 24 | -Wl,--whole-archive \ 25 | libavformat/libavformat.a \ 26 | libavdevice/libavdevice.a \ 27 | libavfilter/libavfilter.a \ 28 | libavcodec/libavcodec.a \ 29 | libavutil/libavutil.a \ 30 | libswscale/libswscale.a \ 31 | libswresample/libswresample.a \ 32 | -Wl,--no-whole-archive \ 33 | -lm 34 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/native/scripts/configure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FFMPEG_HOME=$(pwd)/ffmpeg 6 | 7 | LIB_TYPE=64 8 | LIB_ARCH=x86_$LIB_TYPE 9 | 10 | cd "$FFMPEG_HOME" || exit 11 | 12 | ./configure \ 13 | --extra-cflags="-m${LIB_TYPE}" \ 14 | --extra-ldflags="-m${LIB_TYPE}" \ 15 | --arch=${LIB_ARCH} \ 16 | --enable-static \ 17 | --disable-shared \ 18 | --enable-pic \ 19 | --enable-pthreads \ 20 | --disable-programs \ 21 | --disable-debug \ 22 | --disable-mmx 23 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/native/scripts/copy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | mkdir -p "$1" && cp ffmpeg/libffmpeg4java.so "$1" 6 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/output.txt: -------------------------------------------------------------------------------- 1 | WARNING: Skipping va_list (type is not supported) 2 | WARNING: Skipping __gnuc_va_list (type is not supported) 3 | WARNING: Skipping __clang_max_align_nonce2 (type LongDouble is not supported) 4 | WARNING: Skipping AVBPrint (type Declared(AVBPrint) is not supported) 5 | WARNING: Skipping AVBuffer (type Declared(AVBuffer) is not supported) 6 | WARNING: Skipping AVBufferPool (type Declared(AVBufferPool) is not supported) 7 | WARNING: Skipping AVDictionary (type Declared(AVDictionary) is not supported) 8 | WARNING: Skipping AVIODirContext (type Declared(AVIODirContext) is not supported) 9 | WARNING: Skipping AVBPrint (type Declared(AVBPrint) is not supported) 10 | WARNING: Skipping AVCodecTag (type Declared(AVCodecTag) is not supported) 11 | WARNING: Skipping AVIndexEntry.flags (bitfields are not supported) 12 | WARNING: Skipping AVIndexEntry.size (bitfields are not supported) 13 | WARNING: Skipping AVIAMFAudioElement (type Declared(AVIAMFAudioElement) is not supported) 14 | WARNING: Skipping AVIAMFMixPresentation (type Declared(AVIAMFMixPresentation) is not supported) 15 | WARNING: Skipping AVFilterPad (type Declared(AVFilterPad) is not supported) 16 | WARNING: Skipping AVFilterFormats (type Declared(AVFilterFormats) is not supported) 17 | WARNING: Skipping AVFilterChannelLayouts (type Declared(AVFilterChannelLayouts) is not supported) 18 | WARNING: Skipping SwsContext (type Declared(SwsContext) is not supported) 19 | WARNING: Skipping SwrContext (type Declared(SwrContext) is not supported) 20 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.nextbreakpoint 6 | com.nextbreakpoint.ffmpeg4java 7 | 7.0.1-1.2 8 | 9 | com.nextbreakpoint.ffmpeg4java.linux 10 | jar 11 | FFmpeg4Java Linux 12 | FFmpeg4Java provides a Java wrapper of FFmpeg library 13 | 14 | 15 | 16 | org.apache.maven.plugins 17 | maven-source-plugin 18 | 19 | 20 | attach-sources 21 | 22 | jar 23 | 24 | 25 | 26 | 27 | 28 | org.apache.maven.plugins 29 | maven-javadoc-plugin 30 | 31 | 32 | attach-javadocs 33 | 34 | jar 35 | 36 | 37 | 38 | 39 | 40 | org.apache.maven.plugins 41 | maven-jar-plugin 42 | 43 | 44 | native 45 | package 46 | 47 | jar 48 | 49 | 50 | x86_64 51 | 52 | **/*.so 53 | **/*.txt 54 | 55 | 56 | **/*.class 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/source: -------------------------------------------------------------------------------- 1 | export JAVA_HOME='/home/parallels/Documents/jdk-22.0.1+8' 2 | export JEXTRACT_HOME='/home/parallels/Documents/jextract-22' 3 | export PATH=$PATH:$JAVA_HOME/bin:$JEXTRACT_HOME/bin 4 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/AVFilterPadParams.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * struct AVFilterPadParams { 18 | * char *label; 19 | * } 20 | * } 21 | */ 22 | public class AVFilterPadParams { 23 | 24 | AVFilterPadParams() { 25 | // Should not be called directly 26 | } 27 | 28 | private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( 29 | Libffmpeg.C_POINTER.withName("label") 30 | ).withName("AVFilterPadParams"); 31 | 32 | /** 33 | * The layout of this struct 34 | */ 35 | public static final GroupLayout layout() { 36 | return $LAYOUT; 37 | } 38 | 39 | private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); 40 | 41 | /** 42 | * Layout for field: 43 | * {@snippet lang=c : 44 | * char *label 45 | * } 46 | */ 47 | public static final AddressLayout label$layout() { 48 | return label$LAYOUT; 49 | } 50 | 51 | private static final long label$OFFSET = 0; 52 | 53 | /** 54 | * Offset for field: 55 | * {@snippet lang=c : 56 | * char *label 57 | * } 58 | */ 59 | public static final long label$offset() { 60 | return label$OFFSET; 61 | } 62 | 63 | /** 64 | * Getter for field: 65 | * {@snippet lang=c : 66 | * char *label 67 | * } 68 | */ 69 | public static MemorySegment label(MemorySegment struct) { 70 | return struct.get(label$LAYOUT, label$OFFSET); 71 | } 72 | 73 | /** 74 | * Setter for field: 75 | * {@snippet lang=c : 76 | * char *label 77 | * } 78 | */ 79 | public static void label(MemorySegment struct, MemorySegment fieldValue) { 80 | struct.set(label$LAYOUT, label$OFFSET, fieldValue); 81 | } 82 | 83 | /** 84 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 85 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 86 | */ 87 | public static MemorySegment asSlice(MemorySegment array, long index) { 88 | return array.asSlice(layout().byteSize() * index); 89 | } 90 | 91 | /** 92 | * The size (in bytes) of this struct 93 | */ 94 | public static long sizeof() { return layout().byteSize(); } 95 | 96 | /** 97 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 98 | */ 99 | public static MemorySegment allocate(SegmentAllocator allocator) { 100 | return allocator.allocate(layout()); 101 | } 102 | 103 | /** 104 | * Allocate an array of size {@code elementCount} using {@code allocator}. 105 | * The returned segment has size {@code elementCount * layout().byteSize()}. 106 | */ 107 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 108 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 109 | } 110 | 111 | /** 112 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 113 | * The returned segment has size {@code layout().byteSize()} 114 | */ 115 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 116 | return reinterpret(addr, 1, arena, cleanup); 117 | } 118 | 119 | /** 120 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 121 | * The returned segment has size {@code elementCount * layout().byteSize()} 122 | */ 123 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 124 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 125 | } 126 | } 127 | 128 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/AVRational.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * struct AVRational { 18 | * int num; 19 | * int den; 20 | * } 21 | * } 22 | */ 23 | public class AVRational { 24 | 25 | AVRational() { 26 | // Should not be called directly 27 | } 28 | 29 | private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( 30 | Libffmpeg.C_INT.withName("num"), 31 | Libffmpeg.C_INT.withName("den") 32 | ).withName("AVRational"); 33 | 34 | /** 35 | * The layout of this struct 36 | */ 37 | public static final GroupLayout layout() { 38 | return $LAYOUT; 39 | } 40 | 41 | private static final OfInt num$LAYOUT = (OfInt)$LAYOUT.select(groupElement("num")); 42 | 43 | /** 44 | * Layout for field: 45 | * {@snippet lang=c : 46 | * int num 47 | * } 48 | */ 49 | public static final OfInt num$layout() { 50 | return num$LAYOUT; 51 | } 52 | 53 | private static final long num$OFFSET = 0; 54 | 55 | /** 56 | * Offset for field: 57 | * {@snippet lang=c : 58 | * int num 59 | * } 60 | */ 61 | public static final long num$offset() { 62 | return num$OFFSET; 63 | } 64 | 65 | /** 66 | * Getter for field: 67 | * {@snippet lang=c : 68 | * int num 69 | * } 70 | */ 71 | public static int num(MemorySegment struct) { 72 | return struct.get(num$LAYOUT, num$OFFSET); 73 | } 74 | 75 | /** 76 | * Setter for field: 77 | * {@snippet lang=c : 78 | * int num 79 | * } 80 | */ 81 | public static void num(MemorySegment struct, int fieldValue) { 82 | struct.set(num$LAYOUT, num$OFFSET, fieldValue); 83 | } 84 | 85 | private static final OfInt den$LAYOUT = (OfInt)$LAYOUT.select(groupElement("den")); 86 | 87 | /** 88 | * Layout for field: 89 | * {@snippet lang=c : 90 | * int den 91 | * } 92 | */ 93 | public static final OfInt den$layout() { 94 | return den$LAYOUT; 95 | } 96 | 97 | private static final long den$OFFSET = 4; 98 | 99 | /** 100 | * Offset for field: 101 | * {@snippet lang=c : 102 | * int den 103 | * } 104 | */ 105 | public static final long den$offset() { 106 | return den$OFFSET; 107 | } 108 | 109 | /** 110 | * Getter for field: 111 | * {@snippet lang=c : 112 | * int den 113 | * } 114 | */ 115 | public static int den(MemorySegment struct) { 116 | return struct.get(den$LAYOUT, den$OFFSET); 117 | } 118 | 119 | /** 120 | * Setter for field: 121 | * {@snippet lang=c : 122 | * int den 123 | * } 124 | */ 125 | public static void den(MemorySegment struct, int fieldValue) { 126 | struct.set(den$LAYOUT, den$OFFSET, fieldValue); 127 | } 128 | 129 | /** 130 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 131 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 132 | */ 133 | public static MemorySegment asSlice(MemorySegment array, long index) { 134 | return array.asSlice(layout().byteSize() * index); 135 | } 136 | 137 | /** 138 | * The size (in bytes) of this struct 139 | */ 140 | public static long sizeof() { return layout().byteSize(); } 141 | 142 | /** 143 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 144 | */ 145 | public static MemorySegment allocate(SegmentAllocator allocator) { 146 | return allocator.allocate(layout()); 147 | } 148 | 149 | /** 150 | * Allocate an array of size {@code elementCount} using {@code allocator}. 151 | * The returned segment has size {@code elementCount * layout().byteSize()}. 152 | */ 153 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 154 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 155 | } 156 | 157 | /** 158 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 159 | * The returned segment has size {@code layout().byteSize()} 160 | */ 161 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 162 | return reinterpret(addr, 1, arena, cleanup); 163 | } 164 | 165 | /** 166 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 167 | * The returned segment has size {@code elementCount * layout().byteSize()} 168 | */ 169 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 170 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 171 | } 172 | } 173 | 174 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/av_buffer_create$free.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * void (*free)(void *, uint8_t *) 18 | * } 19 | */ 20 | public class av_buffer_create$free { 21 | 22 | av_buffer_create$free() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment _x0, MemorySegment _x1); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libffmpeg.C_POINTER, 35 | Libffmpeg.C_POINTER 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_buffer_create$free.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(av_buffer_create$free.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static void invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) { 61 | try { 62 | DOWN$MH.invokeExact(funcPtr, _x0, _x1); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/av_buffer_pool_init$alloc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * AVBufferRef *(*alloc)(size_t) 18 | * } 19 | */ 20 | public class av_buffer_pool_init$alloc { 21 | 22 | av_buffer_pool_init$alloc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(long _x0); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_POINTER, 35 | Libffmpeg.C_LONG 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_buffer_pool_init$alloc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(av_buffer_pool_init$alloc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static MemorySegment invoke(MemorySegment funcPtr,long _x0) { 61 | try { 62 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/av_buffer_pool_init2$alloc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * AVBufferRef *(*alloc)(void *, size_t) 18 | * } 19 | */ 20 | public class av_buffer_pool_init2$alloc { 21 | 22 | av_buffer_pool_init2$alloc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(MemorySegment _x0, long _x1); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_POINTER, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_LONG 37 | ); 38 | 39 | /** 40 | * The descriptor of this function pointer 41 | */ 42 | public static FunctionDescriptor descriptor() { 43 | return $DESC; 44 | } 45 | 46 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_buffer_pool_init2$alloc.Function.class, "apply", $DESC); 47 | 48 | /** 49 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 50 | * The lifetime of the returned segment is managed by {@code arena} 51 | */ 52 | public static MemorySegment allocate(av_buffer_pool_init2$alloc.Function fi, Arena arena) { 53 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 54 | } 55 | 56 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 57 | 58 | /** 59 | * Invoke the upcall stub {@code funcPtr}, with given parameters 60 | */ 61 | public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1) { 62 | try { 63 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1); 64 | } catch (Throwable ex$) { 65 | throw new AssertionError("should not reach here", ex$); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/av_buffer_pool_init2$pool_free.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * void (*pool_free)(void *) 18 | * } 19 | */ 20 | public class av_buffer_pool_init2$pool_free { 21 | 22 | av_buffer_pool_init2$pool_free() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment _x0); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libffmpeg.C_POINTER 35 | ); 36 | 37 | /** 38 | * The descriptor of this function pointer 39 | */ 40 | public static FunctionDescriptor descriptor() { 41 | return $DESC; 42 | } 43 | 44 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_buffer_pool_init2$pool_free.Function.class, "apply", $DESC); 45 | 46 | /** 47 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 48 | * The lifetime of the returned segment is managed by {@code arena} 49 | */ 50 | public static MemorySegment allocate(av_buffer_pool_init2$pool_free.Function fi, Arena arena) { 51 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 52 | } 53 | 54 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 55 | 56 | /** 57 | * Invoke the upcall stub {@code funcPtr}, with given parameters 58 | */ 59 | public static void invoke(MemorySegment funcPtr,MemorySegment _x0) { 60 | try { 61 | DOWN$MH.invokeExact(funcPtr, _x0); 62 | } catch (Throwable ex$) { 63 | throw new AssertionError("should not reach here", ex$); 64 | } 65 | } 66 | } 67 | 68 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/av_format_control_message.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*av_format_control_message)(struct AVFormatContext { 18 | * const AVClass *av_class; 19 | * const struct AVInputFormat *iformat; 20 | * const struct AVOutputFormat *oformat; 21 | * void *priv_data; 22 | * AVIOContext *pb; 23 | * int ctx_flags; 24 | * unsigned int nb_streams; 25 | * AVStream **streams; 26 | * unsigned int nb_stream_groups; 27 | * AVStreamGroup **stream_groups; 28 | * unsigned int nb_chapters; 29 | * AVChapter **chapters; 30 | * char *url; 31 | * int64_t start_time; 32 | * int64_t duration; 33 | * int64_t bit_rate; 34 | * unsigned int packet_size; 35 | * int max_delay; 36 | * int flags; 37 | * int64_t probesize; 38 | * int64_t max_analyze_duration; 39 | * const uint8_t *key; 40 | * int keylen; 41 | * unsigned int nb_programs; 42 | * AVProgram **programs; 43 | * enum AVCodecID video_codec_id; 44 | * enum AVCodecID audio_codec_id; 45 | * enum AVCodecID subtitle_codec_id; 46 | * enum AVCodecID data_codec_id; 47 | * AVDictionary *metadata; 48 | * int64_t start_time_realtime; 49 | * int fps_probe_size; 50 | * int error_recognition; 51 | * AVIOInterruptCB interrupt_callback; 52 | * int debug; 53 | * int max_streams; 54 | * unsigned int max_index_size; 55 | * unsigned int max_picture_buffer; 56 | * int64_t max_interleave_delta; 57 | * int max_ts_probe; 58 | * int max_chunk_duration; 59 | * int max_chunk_size; 60 | * int max_probe_packets; 61 | * int strict_std_compliance; 62 | * int event_flags; 63 | * int avoid_negative_ts; 64 | * int audio_preload; 65 | * int use_wallclock_as_timestamps; 66 | * int skip_estimate_duration_from_pts; 67 | * int avio_flags; 68 | * enum AVDurationEstimationMethod duration_estimation_method; 69 | * int64_t skip_initial_bytes; 70 | * unsigned int correct_ts_overflow; 71 | * int seek2any; 72 | * int flush_packets; 73 | * int probe_score; 74 | * int format_probesize; 75 | * char *codec_whitelist; 76 | * char *format_whitelist; 77 | * char *protocol_whitelist; 78 | * char *protocol_blacklist; 79 | * int io_repositioned; 80 | * const struct AVCodec *video_codec; 81 | * const struct AVCodec *audio_codec; 82 | * const struct AVCodec *subtitle_codec; 83 | * const struct AVCodec *data_codec; 84 | * int metadata_header_padding; 85 | * void *opaque; 86 | * av_format_control_message control_message_cb; 87 | * int64_t output_ts_offset; 88 | * uint8_t *dump_separator; 89 | * int (*io_open)(struct AVFormatContext *, AVIOContext **, const char *, int, AVDictionary **); 90 | * int (*io_close2)(struct AVFormatContext *, AVIOContext *); 91 | * } *, int, void *, size_t) 92 | * } 93 | */ 94 | public class av_format_control_message { 95 | 96 | av_format_control_message() { 97 | // Should not be called directly 98 | } 99 | 100 | /** 101 | * The function pointer signature, expressed as a functional interface 102 | */ 103 | public interface Function { 104 | int apply(MemorySegment s, int type, MemorySegment data, long data_size); 105 | } 106 | 107 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 108 | Libffmpeg.C_INT, 109 | Libffmpeg.C_POINTER, 110 | Libffmpeg.C_INT, 111 | Libffmpeg.C_POINTER, 112 | Libffmpeg.C_LONG 113 | ); 114 | 115 | /** 116 | * The descriptor of this function pointer 117 | */ 118 | public static FunctionDescriptor descriptor() { 119 | return $DESC; 120 | } 121 | 122 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_format_control_message.Function.class, "apply", $DESC); 123 | 124 | /** 125 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 126 | * The lifetime of the returned segment is managed by {@code arena} 127 | */ 128 | public static MemorySegment allocate(av_format_control_message.Function fi, Arena arena) { 129 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 130 | } 131 | 132 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 133 | 134 | /** 135 | * Invoke the upcall stub {@code funcPtr}, with given parameters 136 | */ 137 | public static int invoke(MemorySegment funcPtr,MemorySegment s, int type, MemorySegment data, long data_size) { 138 | try { 139 | return (int) DOWN$MH.invokeExact(funcPtr, s, type, data, data_size); 140 | } catch (Throwable ex$) { 141 | throw new AssertionError("should not reach here", ex$); 142 | } 143 | } 144 | } 145 | 146 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/av_intfloat32.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * union av_intfloat32 { 18 | * uint32_t i; 19 | * float f; 20 | * } 21 | * } 22 | */ 23 | public class av_intfloat32 { 24 | 25 | av_intfloat32() { 26 | // Should not be called directly 27 | } 28 | 29 | private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout( 30 | Libffmpeg.C_INT.withName("i"), 31 | Libffmpeg.C_FLOAT.withName("f") 32 | ).withName("av_intfloat32"); 33 | 34 | /** 35 | * The layout of this union 36 | */ 37 | public static final GroupLayout layout() { 38 | return $LAYOUT; 39 | } 40 | 41 | private static final OfInt i$LAYOUT = (OfInt)$LAYOUT.select(groupElement("i")); 42 | 43 | /** 44 | * Layout for field: 45 | * {@snippet lang=c : 46 | * uint32_t i 47 | * } 48 | */ 49 | public static final OfInt i$layout() { 50 | return i$LAYOUT; 51 | } 52 | 53 | private static final long i$OFFSET = 0; 54 | 55 | /** 56 | * Offset for field: 57 | * {@snippet lang=c : 58 | * uint32_t i 59 | * } 60 | */ 61 | public static final long i$offset() { 62 | return i$OFFSET; 63 | } 64 | 65 | /** 66 | * Getter for field: 67 | * {@snippet lang=c : 68 | * uint32_t i 69 | * } 70 | */ 71 | public static int i(MemorySegment union) { 72 | return union.get(i$LAYOUT, i$OFFSET); 73 | } 74 | 75 | /** 76 | * Setter for field: 77 | * {@snippet lang=c : 78 | * uint32_t i 79 | * } 80 | */ 81 | public static void i(MemorySegment union, int fieldValue) { 82 | union.set(i$LAYOUT, i$OFFSET, fieldValue); 83 | } 84 | 85 | private static final OfFloat f$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("f")); 86 | 87 | /** 88 | * Layout for field: 89 | * {@snippet lang=c : 90 | * float f 91 | * } 92 | */ 93 | public static final OfFloat f$layout() { 94 | return f$LAYOUT; 95 | } 96 | 97 | private static final long f$OFFSET = 0; 98 | 99 | /** 100 | * Offset for field: 101 | * {@snippet lang=c : 102 | * float f 103 | * } 104 | */ 105 | public static final long f$offset() { 106 | return f$OFFSET; 107 | } 108 | 109 | /** 110 | * Getter for field: 111 | * {@snippet lang=c : 112 | * float f 113 | * } 114 | */ 115 | public static float f(MemorySegment union) { 116 | return union.get(f$LAYOUT, f$OFFSET); 117 | } 118 | 119 | /** 120 | * Setter for field: 121 | * {@snippet lang=c : 122 | * float f 123 | * } 124 | */ 125 | public static void f(MemorySegment union, float fieldValue) { 126 | union.set(f$LAYOUT, f$OFFSET, fieldValue); 127 | } 128 | 129 | /** 130 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 131 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 132 | */ 133 | public static MemorySegment asSlice(MemorySegment array, long index) { 134 | return array.asSlice(layout().byteSize() * index); 135 | } 136 | 137 | /** 138 | * The size (in bytes) of this union 139 | */ 140 | public static long sizeof() { return layout().byteSize(); } 141 | 142 | /** 143 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 144 | */ 145 | public static MemorySegment allocate(SegmentAllocator allocator) { 146 | return allocator.allocate(layout()); 147 | } 148 | 149 | /** 150 | * Allocate an array of size {@code elementCount} using {@code allocator}. 151 | * The returned segment has size {@code elementCount * layout().byteSize()}. 152 | */ 153 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 154 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 155 | } 156 | 157 | /** 158 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 159 | * The returned segment has size {@code layout().byteSize()} 160 | */ 161 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 162 | return reinterpret(addr, 1, arena, cleanup); 163 | } 164 | 165 | /** 166 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 167 | * The returned segment has size {@code elementCount * layout().byteSize()} 168 | */ 169 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 170 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 171 | } 172 | } 173 | 174 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/av_intfloat64.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * union av_intfloat64 { 18 | * uint64_t i; 19 | * double f; 20 | * } 21 | * } 22 | */ 23 | public class av_intfloat64 { 24 | 25 | av_intfloat64() { 26 | // Should not be called directly 27 | } 28 | 29 | private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout( 30 | Libffmpeg.C_LONG.withName("i"), 31 | Libffmpeg.C_DOUBLE.withName("f") 32 | ).withName("av_intfloat64"); 33 | 34 | /** 35 | * The layout of this union 36 | */ 37 | public static final GroupLayout layout() { 38 | return $LAYOUT; 39 | } 40 | 41 | private static final OfLong i$LAYOUT = (OfLong)$LAYOUT.select(groupElement("i")); 42 | 43 | /** 44 | * Layout for field: 45 | * {@snippet lang=c : 46 | * uint64_t i 47 | * } 48 | */ 49 | public static final OfLong i$layout() { 50 | return i$LAYOUT; 51 | } 52 | 53 | private static final long i$OFFSET = 0; 54 | 55 | /** 56 | * Offset for field: 57 | * {@snippet lang=c : 58 | * uint64_t i 59 | * } 60 | */ 61 | public static final long i$offset() { 62 | return i$OFFSET; 63 | } 64 | 65 | /** 66 | * Getter for field: 67 | * {@snippet lang=c : 68 | * uint64_t i 69 | * } 70 | */ 71 | public static long i(MemorySegment union) { 72 | return union.get(i$LAYOUT, i$OFFSET); 73 | } 74 | 75 | /** 76 | * Setter for field: 77 | * {@snippet lang=c : 78 | * uint64_t i 79 | * } 80 | */ 81 | public static void i(MemorySegment union, long fieldValue) { 82 | union.set(i$LAYOUT, i$OFFSET, fieldValue); 83 | } 84 | 85 | private static final OfDouble f$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("f")); 86 | 87 | /** 88 | * Layout for field: 89 | * {@snippet lang=c : 90 | * double f 91 | * } 92 | */ 93 | public static final OfDouble f$layout() { 94 | return f$LAYOUT; 95 | } 96 | 97 | private static final long f$OFFSET = 0; 98 | 99 | /** 100 | * Offset for field: 101 | * {@snippet lang=c : 102 | * double f 103 | * } 104 | */ 105 | public static final long f$offset() { 106 | return f$OFFSET; 107 | } 108 | 109 | /** 110 | * Getter for field: 111 | * {@snippet lang=c : 112 | * double f 113 | * } 114 | */ 115 | public static double f(MemorySegment union) { 116 | return union.get(f$LAYOUT, f$OFFSET); 117 | } 118 | 119 | /** 120 | * Setter for field: 121 | * {@snippet lang=c : 122 | * double f 123 | * } 124 | */ 125 | public static void f(MemorySegment union, double fieldValue) { 126 | union.set(f$LAYOUT, f$OFFSET, fieldValue); 127 | } 128 | 129 | /** 130 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 131 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 132 | */ 133 | public static MemorySegment asSlice(MemorySegment array, long index) { 134 | return array.asSlice(layout().byteSize() * index); 135 | } 136 | 137 | /** 138 | * The size (in bytes) of this union 139 | */ 140 | public static long sizeof() { return layout().byteSize(); } 141 | 142 | /** 143 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 144 | */ 145 | public static MemorySegment allocate(SegmentAllocator allocator) { 146 | return allocator.allocate(layout()); 147 | } 148 | 149 | /** 150 | * Allocate an array of size {@code elementCount} using {@code allocator}. 151 | * The returned segment has size {@code elementCount * layout().byteSize()}. 152 | */ 153 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 154 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 155 | } 156 | 157 | /** 158 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 159 | * The returned segment has size {@code layout().byteSize()} 160 | */ 161 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 162 | return reinterpret(addr, 1, arena, cleanup); 163 | } 164 | 165 | /** 166 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 167 | * The returned segment has size {@code elementCount * layout().byteSize()} 168 | */ 169 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 170 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 171 | } 172 | } 173 | 174 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/av_log_set_callback$callback.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * void (*callback)(void *, int, const char *, struct __va_list_tag *) 18 | * } 19 | */ 20 | public class av_log_set_callback$callback { 21 | 22 | av_log_set_callback$callback() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libffmpeg.C_POINTER, 35 | Libffmpeg.C_INT, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_POINTER 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_log_set_callback$callback.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(av_log_set_callback$callback.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static void invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3) { 63 | try { 64 | DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/avcodec_default_execute$func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int (*func)(AVCodecContext *, void *) 18 | * } 19 | */ 20 | public class avcodec_default_execute$func { 21 | 22 | avcodec_default_execute$func() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment _x0, MemorySegment _x1); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER 37 | ); 38 | 39 | /** 40 | * The descriptor of this function pointer 41 | */ 42 | public static FunctionDescriptor descriptor() { 43 | return $DESC; 44 | } 45 | 46 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avcodec_default_execute$func.Function.class, "apply", $DESC); 47 | 48 | /** 49 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 50 | * The lifetime of the returned segment is managed by {@code arena} 51 | */ 52 | public static MemorySegment allocate(avcodec_default_execute$func.Function fi, Arena arena) { 53 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 54 | } 55 | 56 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 57 | 58 | /** 59 | * Invoke the upcall stub {@code funcPtr}, with given parameters 60 | */ 61 | public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) { 62 | try { 63 | return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1); 64 | } catch (Throwable ex$) { 65 | throw new AssertionError("should not reach here", ex$); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/avcodec_default_execute2$func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int (*func)(AVCodecContext *, void *, int, int) 18 | * } 19 | */ 20 | public class avcodec_default_execute2$func { 21 | 22 | avcodec_default_execute2$func() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment _x0, MemorySegment _x1, int _x2, int _x3); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_INT, 38 | Libffmpeg.C_INT 39 | ); 40 | 41 | /** 42 | * The descriptor of this function pointer 43 | */ 44 | public static FunctionDescriptor descriptor() { 45 | return $DESC; 46 | } 47 | 48 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avcodec_default_execute2$func.Function.class, "apply", $DESC); 49 | 50 | /** 51 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 52 | * The lifetime of the returned segment is managed by {@code arena} 53 | */ 54 | public static MemorySegment allocate(avcodec_default_execute2$func.Function fi, Arena arena) { 55 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 56 | } 57 | 58 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 59 | 60 | /** 61 | * Invoke the upcall stub {@code funcPtr}, with given parameters 62 | */ 63 | public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2, int _x3) { 64 | try { 65 | return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); 66 | } catch (Throwable ex$) { 67 | throw new AssertionError("should not reach here", ex$); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/avfilter_action_func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (avfilter_action_func)(AVFilterContext *, void *, int, int) 18 | * } 19 | */ 20 | public class avfilter_action_func { 21 | 22 | avfilter_action_func() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment ctx, MemorySegment arg, int jobnr, int nb_jobs); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_INT, 38 | Libffmpeg.C_INT 39 | ); 40 | 41 | /** 42 | * The descriptor of this function pointer 43 | */ 44 | public static FunctionDescriptor descriptor() { 45 | return $DESC; 46 | } 47 | 48 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avfilter_action_func.Function.class, "apply", $DESC); 49 | 50 | /** 51 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 52 | * The lifetime of the returned segment is managed by {@code arena} 53 | */ 54 | public static MemorySegment allocate(avfilter_action_func.Function fi, Arena arena) { 55 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 56 | } 57 | 58 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 59 | 60 | /** 61 | * Invoke the upcall stub {@code funcPtr}, with given parameters 62 | */ 63 | public static int invoke(MemorySegment funcPtr,MemorySegment ctx, MemorySegment arg, int jobnr, int nb_jobs) { 64 | try { 65 | return (int) DOWN$MH.invokeExact(funcPtr, ctx, arg, jobnr, nb_jobs); 66 | } catch (Throwable ex$) { 67 | throw new AssertionError("should not reach here", ex$); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/avfilter_execute_func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (avfilter_execute_func)(AVFilterContext *, avfilter_action_func *, void *, int *, int) 18 | * } 19 | */ 20 | public class avfilter_execute_func { 21 | 22 | avfilter_execute_func() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment ctx, MemorySegment func, MemorySegment arg, MemorySegment ret, int nb_jobs); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_POINTER, 38 | Libffmpeg.C_POINTER, 39 | Libffmpeg.C_INT 40 | ); 41 | 42 | /** 43 | * The descriptor of this function pointer 44 | */ 45 | public static FunctionDescriptor descriptor() { 46 | return $DESC; 47 | } 48 | 49 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avfilter_execute_func.Function.class, "apply", $DESC); 50 | 51 | /** 52 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 53 | * The lifetime of the returned segment is managed by {@code arena} 54 | */ 55 | public static MemorySegment allocate(avfilter_execute_func.Function fi, Arena arena) { 56 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 57 | } 58 | 59 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 60 | 61 | /** 62 | * Invoke the upcall stub {@code funcPtr}, with given parameters 63 | */ 64 | public static int invoke(MemorySegment funcPtr,MemorySegment ctx, MemorySegment func, MemorySegment arg, MemorySegment ret, int nb_jobs) { 65 | try { 66 | return (int) DOWN$MH.invokeExact(funcPtr, ctx, func, arg, ret, nb_jobs); 67 | } catch (Throwable ex$) { 68 | throw new AssertionError("should not reach here", ex$); 69 | } 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/avio_alloc_context$read_packet.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int (*read_packet)(void *, uint8_t *, int) 18 | * } 19 | */ 20 | public class avio_alloc_context$read_packet { 21 | 22 | avio_alloc_context$read_packet() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment _x0, MemorySegment _x1, int _x2); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avio_alloc_context$read_packet.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(avio_alloc_context$read_packet.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/avio_alloc_context$seek.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int64_t (*seek)(void *, int64_t, int) 18 | * } 19 | */ 20 | public class avio_alloc_context$seek { 21 | 22 | avio_alloc_context$seek() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | long apply(MemorySegment _x0, long _x1, int _x2); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_LONG, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_LONG, 37 | Libffmpeg.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avio_alloc_context$seek.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(avio_alloc_context$seek.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static long invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1, int _x2) { 63 | try { 64 | return (long) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/avio_alloc_context$write_packet.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int (*write_packet)(void *, const uint8_t *, int) 18 | * } 19 | */ 20 | public class avio_alloc_context$write_packet { 21 | 22 | avio_alloc_context$write_packet() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment _x0, MemorySegment _x1, int _x2); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avio_alloc_context$write_packet.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(avio_alloc_context$write_packet.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/com/nextbreakpoint/ffmpeg4java/max_align_t.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * struct { 18 | * long long __clang_max_align_nonce1; 19 | * long double __clang_max_align_nonce2; 20 | * } 21 | * } 22 | */ 23 | public class max_align_t { 24 | 25 | max_align_t() { 26 | // Should not be called directly 27 | } 28 | 29 | private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( 30 | Libffmpeg.C_LONG_LONG.withName("__clang_max_align_nonce1"), 31 | MemoryLayout.paddingLayout(24) 32 | ).withName("$anon$19:9"); 33 | 34 | /** 35 | * The layout of this struct 36 | */ 37 | public static final GroupLayout layout() { 38 | return $LAYOUT; 39 | } 40 | 41 | private static final OfLong __clang_max_align_nonce1$LAYOUT = (OfLong)$LAYOUT.select(groupElement("__clang_max_align_nonce1")); 42 | 43 | /** 44 | * Layout for field: 45 | * {@snippet lang=c : 46 | * long long __clang_max_align_nonce1 47 | * } 48 | */ 49 | public static final OfLong __clang_max_align_nonce1$layout() { 50 | return __clang_max_align_nonce1$LAYOUT; 51 | } 52 | 53 | private static final long __clang_max_align_nonce1$OFFSET = 0; 54 | 55 | /** 56 | * Offset for field: 57 | * {@snippet lang=c : 58 | * long long __clang_max_align_nonce1 59 | * } 60 | */ 61 | public static final long __clang_max_align_nonce1$offset() { 62 | return __clang_max_align_nonce1$OFFSET; 63 | } 64 | 65 | /** 66 | * Getter for field: 67 | * {@snippet lang=c : 68 | * long long __clang_max_align_nonce1 69 | * } 70 | */ 71 | public static long __clang_max_align_nonce1(MemorySegment struct) { 72 | return struct.get(__clang_max_align_nonce1$LAYOUT, __clang_max_align_nonce1$OFFSET); 73 | } 74 | 75 | /** 76 | * Setter for field: 77 | * {@snippet lang=c : 78 | * long long __clang_max_align_nonce1 79 | * } 80 | */ 81 | public static void __clang_max_align_nonce1(MemorySegment struct, long fieldValue) { 82 | struct.set(__clang_max_align_nonce1$LAYOUT, __clang_max_align_nonce1$OFFSET, fieldValue); 83 | } 84 | 85 | /** 86 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 87 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 88 | */ 89 | public static MemorySegment asSlice(MemorySegment array, long index) { 90 | return array.asSlice(layout().byteSize() * index); 91 | } 92 | 93 | /** 94 | * The size (in bytes) of this struct 95 | */ 96 | public static long sizeof() { return layout().byteSize(); } 97 | 98 | /** 99 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 100 | */ 101 | public static MemorySegment allocate(SegmentAllocator allocator) { 102 | return allocator.allocate(layout()); 103 | } 104 | 105 | /** 106 | * Allocate an array of size {@code elementCount} using {@code allocator}. 107 | * The returned segment has size {@code elementCount * layout().byteSize()}. 108 | */ 109 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 110 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 111 | } 112 | 113 | /** 114 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 115 | * The returned segment has size {@code layout().byteSize()} 116 | */ 117 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 118 | return reinterpret(addr, 1, arena, cleanup); 119 | } 120 | 121 | /** 122 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 123 | * The returned segment has size {@code elementCount * layout().byteSize()} 124 | */ 125 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 126 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 127 | } 128 | } 129 | 130 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module com.nextbreakpoint.ffmpeg4java { 2 | exports com.nextbreakpoint.ffmpeg4java; 3 | } -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/resources/META-INF/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2024, Andrea Medeghini 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of FFmpeg4Java nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /ffmpeg4java-linux/src/main/resources/META-INF/NOTICE.txt: -------------------------------------------------------------------------------- 1 | FFmpeg4Java is distributed as independent JAR files, one for each supported operating system. 2 | Each JAR file contains a native library which must be installed in the library path of the Java runtime. 3 | 4 | Please note that the native library is statically liked with FFmpeg library under the terms of GNU Lesser General Public License, version 2.1. 5 | You should have received a copy of the LGPL v2.1 license with FFmpeg4Java. See http://ffmpeg.org for more information about FFmpeg. 6 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/dump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FFMPEG_HOME=$(pwd)/native/ffmpeg 4 | 5 | export PATH=$PATH:${JEXTRACT_HOME}/bin 6 | 7 | jextract --dump-includes includes.txt \ 8 | --include-dir "${FFMPEG_HOME}" \ 9 | libffmpeg.h -------------------------------------------------------------------------------- /ffmpeg4java-macos/extract.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FFMPEG_HOME=$(pwd)/native/ffmpeg 4 | 5 | export PATH=$PATH:${JEXTRACT_HOME}/bin 6 | 7 | jextract @includes.txt \ 8 | --output src/main/java \ 9 | --target-package com.nextbreakpoint.ffmpeg4java \ 10 | --include-dir "${FFMPEG_HOME}" \ 11 | --use-system-load-library \ 12 | --library ffmpeg4java \ 13 | --header-class-name Libffmpeg \ 14 | libffmpeg.h -------------------------------------------------------------------------------- /ffmpeg4java-macos/libffmpeg.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/native/Makefile: -------------------------------------------------------------------------------- 1 | INSTALL_PATH := $(CURDIR)/../src/main/resources 2 | 3 | .PHONY: checkout 4 | checkout: 5 | ./scripts/checkout.sh 6 | 7 | .PHONY: configure 8 | configure: 9 | ./scripts/configure.sh 10 | 11 | .PHONY: compile 12 | compile: 13 | ./scripts/compile.sh 14 | 15 | .PHONY: clean 16 | clean: 17 | ./scripts/clean.sh 18 | 19 | .PHONY: install 20 | install: 21 | ./scripts/copy.sh $(INSTALL_PATH) 22 | 23 | .PHONY: all 24 | all: build-lib install 25 | 26 | .PHONY: build-lib 27 | build-lib: checkout configure compile 28 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/native/ffmpeg.patch: -------------------------------------------------------------------------------- 1 | diff --git a/libswscale/Makefile b/libswscale/Makefile 2 | index 757997b401..4c950e6c43 100644 3 | --- a/libswscale/Makefile 4 | +++ b/libswscale/Makefile 5 | @@ -9,7 +9,6 @@ OBJS = alphablend.o \ 6 | hscale.o \ 7 | hscale_fast_bilinear.o \ 8 | gamma.o \ 9 | - half2float.o \ 10 | input.o \ 11 | options.o \ 12 | output.o \ 13 | diff --git a/libswscale/half2float.c b/libswscale/half2float.c 14 | deleted file mode 100644 15 | index 1b023f96a5..0000000000 16 | --- a/libswscale/half2float.c 17 | +++ /dev/null 18 | @@ -1,19 +0,0 @@ 19 | -/* 20 | - * This file is part of FFmpeg. 21 | - * 22 | - * FFmpeg is free software; you can redistribute it and/or 23 | - * modify it under the terms of the GNU Lesser General Public 24 | - * License as published by the Free Software Foundation; either 25 | - * version 2.1 of the License, or (at your option) any later version. 26 | - * 27 | - * FFmpeg is distributed in the hope that it will be useful, 28 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | - * Lesser General Public License for more details. 31 | - * 32 | - * You should have received a copy of the GNU Lesser General Public 33 | - * License along with FFmpeg; if not, write to the Free Software 34 | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 35 | - */ 36 | - 37 | -#include "libavutil/half2float.c" 38 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/native/scripts/checkout.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | FFMPEG_HOME=$(pwd)/ffmpeg 6 | 7 | if [ ! -d "$FFMPEG_HOME" ]; then 8 | git clone https://git.ffmpeg.org/ffmpeg.git "$FFMPEG_HOME" 9 | else 10 | pushd "$FFMPEG_HOME" 11 | git fetch 12 | popd 13 | fi 14 | 15 | pushd "$FFMPEG_HOME" 16 | git checkout af25a4bfd2503caf3ee485b27b99b620302f5718 17 | popd 18 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/native/scripts/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FFMPEG_HOME=$(pwd)/ffmpeg 6 | 7 | cd "$FFMPEG_HOME" || exit 8 | 9 | make clean 10 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/native/scripts/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FFMPEG_HOME=$(pwd)/ffmpeg 6 | 7 | LIB_TYPE=64 8 | 9 | cd "$FFMPEG_HOME" || exit 10 | 11 | git reset --hard 12 | patch -p1 -N < ../ffmpeg.patch 13 | 14 | make 15 | 16 | gcc --verbose \ 17 | -o libffmpeg4java.dylib \ 18 | -dynamiclib \ 19 | -m${LIB_TYPE} \ 20 | -Wall \ 21 | -fpic \ 22 | -Wl,-force_load \ 23 | libavformat/libavformat.a \ 24 | -Wl,-force_load \ 25 | libavdevice/libavdevice.a \ 26 | -Wl,-force_load \ 27 | libavfilter/libavfilter.a \ 28 | -Wl,-force_load \ 29 | libavcodec/libavcodec.a \ 30 | -Wl,-force_load \ 31 | libavutil/libavutil.a \ 32 | -Wl,-force_load \ 33 | libswscale/libswscale.a \ 34 | -Wl,-force_load \ 35 | libswresample/libswresample.a \ 36 | -lm \ 37 | -lz \ 38 | -lbz2 \ 39 | -liconv \ 40 | -framework VideoToolbox \ 41 | -framework AudioToolbox \ 42 | -framework AVFoundation \ 43 | -framework Foundation \ 44 | -framework CoreImage \ 45 | -framework CoreGraphics \ 46 | -framework CoreMedia \ 47 | -framework QuartzCore \ 48 | -framework OpenGL \ 49 | -framework OpenAL \ 50 | -framework VideoDecodeAcceleration \ 51 | -framework QTKit \ 52 | -framework AppKit \ 53 | -framework Security -------------------------------------------------------------------------------- /ffmpeg4java-macos/native/scripts/configure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FFMPEG_HOME=$(pwd)/ffmpeg 6 | 7 | LIB_TYPE=64 8 | LIB_ARCH=x86_$LIB_TYPE 9 | 10 | cd "$FFMPEG_HOME" || exit 11 | 12 | ./configure \ 13 | --extra-cflags="-m${LIB_TYPE}" \ 14 | --extra-ldflags="-m${LIB_TYPE}" \ 15 | --arch=${LIB_ARCH} \ 16 | --enable-static \ 17 | --disable-shared \ 18 | --enable-pic \ 19 | --disable-programs \ 20 | --disable-debug \ 21 | --disable-mmx \ 22 | --disable-sdl2 \ 23 | --disable-libxcb \ 24 | --disable-audiotoolbox \ 25 | --disable-videotoolbox 26 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/native/scripts/copy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | mkdir -p "$1" && cp ffmpeg/libffmpeg4java.dylib "$1" 6 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/output.txt: -------------------------------------------------------------------------------- 1 | WARNING: Skipping va_list (type is not supported) 2 | WARNING: Skipping max_align_t (type LongDouble is not supported) 3 | WARNING: Skipping __gnuc_va_list (type is not supported) 4 | WARNING: Skipping AVBPrint (type Declared(AVBPrint) is not supported) 5 | WARNING: Skipping AVBuffer (type Declared(AVBuffer) is not supported) 6 | WARNING: Skipping AVBufferPool (type Declared(AVBufferPool) is not supported) 7 | WARNING: Skipping AVDictionary (type Declared(AVDictionary) is not supported) 8 | WARNING: Skipping AVIODirContext (type Declared(AVIODirContext) is not supported) 9 | WARNING: Skipping AVBPrint (type Declared(AVBPrint) is not supported) 10 | WARNING: Skipping AVCodecTag (type Declared(AVCodecTag) is not supported) 11 | WARNING: Skipping AVIndexEntry.flags (bitfields are not supported) 12 | WARNING: Skipping AVIndexEntry.size (bitfields are not supported) 13 | WARNING: Skipping AVIAMFAudioElement (type Declared(AVIAMFAudioElement) is not supported) 14 | WARNING: Skipping AVIAMFMixPresentation (type Declared(AVIAMFMixPresentation) is not supported) 15 | WARNING: Skipping AVFilterPad (type Declared(AVFilterPad) is not supported) 16 | WARNING: Skipping AVFilterFormats (type Declared(AVFilterFormats) is not supported) 17 | WARNING: Skipping AVFilterChannelLayouts (type Declared(AVFilterChannelLayouts) is not supported) 18 | WARNING: Skipping SwsContext (type Declared(SwsContext) is not supported) 19 | WARNING: Skipping SwrContext (type Declared(SwrContext) is not supported) 20 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.nextbreakpoint 6 | com.nextbreakpoint.ffmpeg4java 7 | 7.0.1-1.2 8 | 9 | com.nextbreakpoint.ffmpeg4java.macos 10 | jar 11 | FFmpeg4Java MacOS 12 | FFmpeg4Java provides a Java wrapper of FFmpeg library 13 | 14 | 15 | 16 | org.apache.maven.plugins 17 | maven-source-plugin 18 | 19 | 20 | attach-sources 21 | 22 | jar 23 | 24 | 25 | 26 | 27 | 28 | org.apache.maven.plugins 29 | maven-javadoc-plugin 30 | 31 | 32 | attach-javadocs 33 | 34 | jar 35 | 36 | 37 | 38 | 39 | 40 | org.apache.maven.plugins 41 | maven-jar-plugin 42 | 43 | 44 | native 45 | package 46 | 47 | jar 48 | 49 | 50 | x86_64 51 | 52 | **/*.dylib 53 | **/*.txt 54 | 55 | 56 | **/*.class 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/source: -------------------------------------------------------------------------------- 1 | export JAVA_HOME='/Library/Java/JavaVirtualMachines/temurin-22.jdk/Contents/Home' 2 | export JEXTRACT_HOME='/Users/andrea/Documents/tools/jextract-22' 3 | export PATH=$PATH:$JAVA_HOME/bin:$JEXTRACT_HOME/bin 4 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/AVFilterPadParams.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * struct AVFilterPadParams { 18 | * char *label; 19 | * } 20 | * } 21 | */ 22 | public class AVFilterPadParams { 23 | 24 | AVFilterPadParams() { 25 | // Should not be called directly 26 | } 27 | 28 | private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( 29 | Libffmpeg.C_POINTER.withName("label") 30 | ).withName("AVFilterPadParams"); 31 | 32 | /** 33 | * The layout of this struct 34 | */ 35 | public static final GroupLayout layout() { 36 | return $LAYOUT; 37 | } 38 | 39 | private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); 40 | 41 | /** 42 | * Layout for field: 43 | * {@snippet lang=c : 44 | * char *label 45 | * } 46 | */ 47 | public static final AddressLayout label$layout() { 48 | return label$LAYOUT; 49 | } 50 | 51 | private static final long label$OFFSET = 0; 52 | 53 | /** 54 | * Offset for field: 55 | * {@snippet lang=c : 56 | * char *label 57 | * } 58 | */ 59 | public static final long label$offset() { 60 | return label$OFFSET; 61 | } 62 | 63 | /** 64 | * Getter for field: 65 | * {@snippet lang=c : 66 | * char *label 67 | * } 68 | */ 69 | public static MemorySegment label(MemorySegment struct) { 70 | return struct.get(label$LAYOUT, label$OFFSET); 71 | } 72 | 73 | /** 74 | * Setter for field: 75 | * {@snippet lang=c : 76 | * char *label 77 | * } 78 | */ 79 | public static void label(MemorySegment struct, MemorySegment fieldValue) { 80 | struct.set(label$LAYOUT, label$OFFSET, fieldValue); 81 | } 82 | 83 | /** 84 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 85 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 86 | */ 87 | public static MemorySegment asSlice(MemorySegment array, long index) { 88 | return array.asSlice(layout().byteSize() * index); 89 | } 90 | 91 | /** 92 | * The size (in bytes) of this struct 93 | */ 94 | public static long sizeof() { return layout().byteSize(); } 95 | 96 | /** 97 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 98 | */ 99 | public static MemorySegment allocate(SegmentAllocator allocator) { 100 | return allocator.allocate(layout()); 101 | } 102 | 103 | /** 104 | * Allocate an array of size {@code elementCount} using {@code allocator}. 105 | * The returned segment has size {@code elementCount * layout().byteSize()}. 106 | */ 107 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 108 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 109 | } 110 | 111 | /** 112 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 113 | * The returned segment has size {@code layout().byteSize()} 114 | */ 115 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 116 | return reinterpret(addr, 1, arena, cleanup); 117 | } 118 | 119 | /** 120 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 121 | * The returned segment has size {@code elementCount * layout().byteSize()} 122 | */ 123 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 124 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 125 | } 126 | } 127 | 128 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/AVRational.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * struct AVRational { 18 | * int num; 19 | * int den; 20 | * } 21 | * } 22 | */ 23 | public class AVRational { 24 | 25 | AVRational() { 26 | // Should not be called directly 27 | } 28 | 29 | private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( 30 | Libffmpeg.C_INT.withName("num"), 31 | Libffmpeg.C_INT.withName("den") 32 | ).withName("AVRational"); 33 | 34 | /** 35 | * The layout of this struct 36 | */ 37 | public static final GroupLayout layout() { 38 | return $LAYOUT; 39 | } 40 | 41 | private static final OfInt num$LAYOUT = (OfInt)$LAYOUT.select(groupElement("num")); 42 | 43 | /** 44 | * Layout for field: 45 | * {@snippet lang=c : 46 | * int num 47 | * } 48 | */ 49 | public static final OfInt num$layout() { 50 | return num$LAYOUT; 51 | } 52 | 53 | private static final long num$OFFSET = 0; 54 | 55 | /** 56 | * Offset for field: 57 | * {@snippet lang=c : 58 | * int num 59 | * } 60 | */ 61 | public static final long num$offset() { 62 | return num$OFFSET; 63 | } 64 | 65 | /** 66 | * Getter for field: 67 | * {@snippet lang=c : 68 | * int num 69 | * } 70 | */ 71 | public static int num(MemorySegment struct) { 72 | return struct.get(num$LAYOUT, num$OFFSET); 73 | } 74 | 75 | /** 76 | * Setter for field: 77 | * {@snippet lang=c : 78 | * int num 79 | * } 80 | */ 81 | public static void num(MemorySegment struct, int fieldValue) { 82 | struct.set(num$LAYOUT, num$OFFSET, fieldValue); 83 | } 84 | 85 | private static final OfInt den$LAYOUT = (OfInt)$LAYOUT.select(groupElement("den")); 86 | 87 | /** 88 | * Layout for field: 89 | * {@snippet lang=c : 90 | * int den 91 | * } 92 | */ 93 | public static final OfInt den$layout() { 94 | return den$LAYOUT; 95 | } 96 | 97 | private static final long den$OFFSET = 4; 98 | 99 | /** 100 | * Offset for field: 101 | * {@snippet lang=c : 102 | * int den 103 | * } 104 | */ 105 | public static final long den$offset() { 106 | return den$OFFSET; 107 | } 108 | 109 | /** 110 | * Getter for field: 111 | * {@snippet lang=c : 112 | * int den 113 | * } 114 | */ 115 | public static int den(MemorySegment struct) { 116 | return struct.get(den$LAYOUT, den$OFFSET); 117 | } 118 | 119 | /** 120 | * Setter for field: 121 | * {@snippet lang=c : 122 | * int den 123 | * } 124 | */ 125 | public static void den(MemorySegment struct, int fieldValue) { 126 | struct.set(den$LAYOUT, den$OFFSET, fieldValue); 127 | } 128 | 129 | /** 130 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 131 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 132 | */ 133 | public static MemorySegment asSlice(MemorySegment array, long index) { 134 | return array.asSlice(layout().byteSize() * index); 135 | } 136 | 137 | /** 138 | * The size (in bytes) of this struct 139 | */ 140 | public static long sizeof() { return layout().byteSize(); } 141 | 142 | /** 143 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 144 | */ 145 | public static MemorySegment allocate(SegmentAllocator allocator) { 146 | return allocator.allocate(layout()); 147 | } 148 | 149 | /** 150 | * Allocate an array of size {@code elementCount} using {@code allocator}. 151 | * The returned segment has size {@code elementCount * layout().byteSize()}. 152 | */ 153 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 154 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 155 | } 156 | 157 | /** 158 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 159 | * The returned segment has size {@code layout().byteSize()} 160 | */ 161 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 162 | return reinterpret(addr, 1, arena, cleanup); 163 | } 164 | 165 | /** 166 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 167 | * The returned segment has size {@code elementCount * layout().byteSize()} 168 | */ 169 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 170 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 171 | } 172 | } 173 | 174 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/av_buffer_create$free.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * void (*free)(void *, uint8_t *) 18 | * } 19 | */ 20 | public class av_buffer_create$free { 21 | 22 | av_buffer_create$free() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment _x0, MemorySegment _x1); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libffmpeg.C_POINTER, 35 | Libffmpeg.C_POINTER 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_buffer_create$free.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(av_buffer_create$free.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static void invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) { 61 | try { 62 | DOWN$MH.invokeExact(funcPtr, _x0, _x1); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/av_buffer_pool_init$alloc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * AVBufferRef *(*alloc)(size_t) 18 | * } 19 | */ 20 | public class av_buffer_pool_init$alloc { 21 | 22 | av_buffer_pool_init$alloc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(long _x0); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_POINTER, 35 | Libffmpeg.C_LONG 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_buffer_pool_init$alloc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(av_buffer_pool_init$alloc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static MemorySegment invoke(MemorySegment funcPtr,long _x0) { 61 | try { 62 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/av_buffer_pool_init2$alloc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * AVBufferRef *(*alloc)(void *, size_t) 18 | * } 19 | */ 20 | public class av_buffer_pool_init2$alloc { 21 | 22 | av_buffer_pool_init2$alloc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(MemorySegment _x0, long _x1); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_POINTER, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_LONG 37 | ); 38 | 39 | /** 40 | * The descriptor of this function pointer 41 | */ 42 | public static FunctionDescriptor descriptor() { 43 | return $DESC; 44 | } 45 | 46 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_buffer_pool_init2$alloc.Function.class, "apply", $DESC); 47 | 48 | /** 49 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 50 | * The lifetime of the returned segment is managed by {@code arena} 51 | */ 52 | public static MemorySegment allocate(av_buffer_pool_init2$alloc.Function fi, Arena arena) { 53 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 54 | } 55 | 56 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 57 | 58 | /** 59 | * Invoke the upcall stub {@code funcPtr}, with given parameters 60 | */ 61 | public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1) { 62 | try { 63 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1); 64 | } catch (Throwable ex$) { 65 | throw new AssertionError("should not reach here", ex$); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/av_buffer_pool_init2$pool_free.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * void (*pool_free)(void *) 18 | * } 19 | */ 20 | public class av_buffer_pool_init2$pool_free { 21 | 22 | av_buffer_pool_init2$pool_free() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment _x0); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libffmpeg.C_POINTER 35 | ); 36 | 37 | /** 38 | * The descriptor of this function pointer 39 | */ 40 | public static FunctionDescriptor descriptor() { 41 | return $DESC; 42 | } 43 | 44 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_buffer_pool_init2$pool_free.Function.class, "apply", $DESC); 45 | 46 | /** 47 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 48 | * The lifetime of the returned segment is managed by {@code arena} 49 | */ 50 | public static MemorySegment allocate(av_buffer_pool_init2$pool_free.Function fi, Arena arena) { 51 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 52 | } 53 | 54 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 55 | 56 | /** 57 | * Invoke the upcall stub {@code funcPtr}, with given parameters 58 | */ 59 | public static void invoke(MemorySegment funcPtr,MemorySegment _x0) { 60 | try { 61 | DOWN$MH.invokeExact(funcPtr, _x0); 62 | } catch (Throwable ex$) { 63 | throw new AssertionError("should not reach here", ex$); 64 | } 65 | } 66 | } 67 | 68 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/av_format_control_message.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*av_format_control_message)(struct AVFormatContext { 18 | * const AVClass *av_class; 19 | * const struct AVInputFormat *iformat; 20 | * const struct AVOutputFormat *oformat; 21 | * void *priv_data; 22 | * AVIOContext *pb; 23 | * int ctx_flags; 24 | * unsigned int nb_streams; 25 | * AVStream **streams; 26 | * unsigned int nb_stream_groups; 27 | * AVStreamGroup **stream_groups; 28 | * unsigned int nb_chapters; 29 | * AVChapter **chapters; 30 | * char *url; 31 | * int64_t start_time; 32 | * int64_t duration; 33 | * int64_t bit_rate; 34 | * unsigned int packet_size; 35 | * int max_delay; 36 | * int flags; 37 | * int64_t probesize; 38 | * int64_t max_analyze_duration; 39 | * const uint8_t *key; 40 | * int keylen; 41 | * unsigned int nb_programs; 42 | * AVProgram **programs; 43 | * enum AVCodecID video_codec_id; 44 | * enum AVCodecID audio_codec_id; 45 | * enum AVCodecID subtitle_codec_id; 46 | * enum AVCodecID data_codec_id; 47 | * AVDictionary *metadata; 48 | * int64_t start_time_realtime; 49 | * int fps_probe_size; 50 | * int error_recognition; 51 | * AVIOInterruptCB interrupt_callback; 52 | * int debug; 53 | * int max_streams; 54 | * unsigned int max_index_size; 55 | * unsigned int max_picture_buffer; 56 | * int64_t max_interleave_delta; 57 | * int max_ts_probe; 58 | * int max_chunk_duration; 59 | * int max_chunk_size; 60 | * int max_probe_packets; 61 | * int strict_std_compliance; 62 | * int event_flags; 63 | * int avoid_negative_ts; 64 | * int audio_preload; 65 | * int use_wallclock_as_timestamps; 66 | * int skip_estimate_duration_from_pts; 67 | * int avio_flags; 68 | * enum AVDurationEstimationMethod duration_estimation_method; 69 | * int64_t skip_initial_bytes; 70 | * unsigned int correct_ts_overflow; 71 | * int seek2any; 72 | * int flush_packets; 73 | * int probe_score; 74 | * int format_probesize; 75 | * char *codec_whitelist; 76 | * char *format_whitelist; 77 | * char *protocol_whitelist; 78 | * char *protocol_blacklist; 79 | * int io_repositioned; 80 | * const struct AVCodec *video_codec; 81 | * const struct AVCodec *audio_codec; 82 | * const struct AVCodec *subtitle_codec; 83 | * const struct AVCodec *data_codec; 84 | * int metadata_header_padding; 85 | * void *opaque; 86 | * av_format_control_message control_message_cb; 87 | * int64_t output_ts_offset; 88 | * uint8_t *dump_separator; 89 | * int (*io_open)(struct AVFormatContext *, AVIOContext **, const char *, int, AVDictionary **); 90 | * int (*io_close2)(struct AVFormatContext *, AVIOContext *); 91 | * } *, int, void *, size_t) 92 | * } 93 | */ 94 | public class av_format_control_message { 95 | 96 | av_format_control_message() { 97 | // Should not be called directly 98 | } 99 | 100 | /** 101 | * The function pointer signature, expressed as a functional interface 102 | */ 103 | public interface Function { 104 | int apply(MemorySegment s, int type, MemorySegment data, long data_size); 105 | } 106 | 107 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 108 | Libffmpeg.C_INT, 109 | Libffmpeg.C_POINTER, 110 | Libffmpeg.C_INT, 111 | Libffmpeg.C_POINTER, 112 | Libffmpeg.C_LONG 113 | ); 114 | 115 | /** 116 | * The descriptor of this function pointer 117 | */ 118 | public static FunctionDescriptor descriptor() { 119 | return $DESC; 120 | } 121 | 122 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_format_control_message.Function.class, "apply", $DESC); 123 | 124 | /** 125 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 126 | * The lifetime of the returned segment is managed by {@code arena} 127 | */ 128 | public static MemorySegment allocate(av_format_control_message.Function fi, Arena arena) { 129 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 130 | } 131 | 132 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 133 | 134 | /** 135 | * Invoke the upcall stub {@code funcPtr}, with given parameters 136 | */ 137 | public static int invoke(MemorySegment funcPtr,MemorySegment s, int type, MemorySegment data, long data_size) { 138 | try { 139 | return (int) DOWN$MH.invokeExact(funcPtr, s, type, data, data_size); 140 | } catch (Throwable ex$) { 141 | throw new AssertionError("should not reach here", ex$); 142 | } 143 | } 144 | } 145 | 146 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/av_intfloat32.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * union av_intfloat32 { 18 | * uint32_t i; 19 | * float f; 20 | * } 21 | * } 22 | */ 23 | public class av_intfloat32 { 24 | 25 | av_intfloat32() { 26 | // Should not be called directly 27 | } 28 | 29 | private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout( 30 | Libffmpeg.C_INT.withName("i"), 31 | Libffmpeg.C_FLOAT.withName("f") 32 | ).withName("av_intfloat32"); 33 | 34 | /** 35 | * The layout of this union 36 | */ 37 | public static final GroupLayout layout() { 38 | return $LAYOUT; 39 | } 40 | 41 | private static final OfInt i$LAYOUT = (OfInt)$LAYOUT.select(groupElement("i")); 42 | 43 | /** 44 | * Layout for field: 45 | * {@snippet lang=c : 46 | * uint32_t i 47 | * } 48 | */ 49 | public static final OfInt i$layout() { 50 | return i$LAYOUT; 51 | } 52 | 53 | private static final long i$OFFSET = 0; 54 | 55 | /** 56 | * Offset for field: 57 | * {@snippet lang=c : 58 | * uint32_t i 59 | * } 60 | */ 61 | public static final long i$offset() { 62 | return i$OFFSET; 63 | } 64 | 65 | /** 66 | * Getter for field: 67 | * {@snippet lang=c : 68 | * uint32_t i 69 | * } 70 | */ 71 | public static int i(MemorySegment union) { 72 | return union.get(i$LAYOUT, i$OFFSET); 73 | } 74 | 75 | /** 76 | * Setter for field: 77 | * {@snippet lang=c : 78 | * uint32_t i 79 | * } 80 | */ 81 | public static void i(MemorySegment union, int fieldValue) { 82 | union.set(i$LAYOUT, i$OFFSET, fieldValue); 83 | } 84 | 85 | private static final OfFloat f$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("f")); 86 | 87 | /** 88 | * Layout for field: 89 | * {@snippet lang=c : 90 | * float f 91 | * } 92 | */ 93 | public static final OfFloat f$layout() { 94 | return f$LAYOUT; 95 | } 96 | 97 | private static final long f$OFFSET = 0; 98 | 99 | /** 100 | * Offset for field: 101 | * {@snippet lang=c : 102 | * float f 103 | * } 104 | */ 105 | public static final long f$offset() { 106 | return f$OFFSET; 107 | } 108 | 109 | /** 110 | * Getter for field: 111 | * {@snippet lang=c : 112 | * float f 113 | * } 114 | */ 115 | public static float f(MemorySegment union) { 116 | return union.get(f$LAYOUT, f$OFFSET); 117 | } 118 | 119 | /** 120 | * Setter for field: 121 | * {@snippet lang=c : 122 | * float f 123 | * } 124 | */ 125 | public static void f(MemorySegment union, float fieldValue) { 126 | union.set(f$LAYOUT, f$OFFSET, fieldValue); 127 | } 128 | 129 | /** 130 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 131 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 132 | */ 133 | public static MemorySegment asSlice(MemorySegment array, long index) { 134 | return array.asSlice(layout().byteSize() * index); 135 | } 136 | 137 | /** 138 | * The size (in bytes) of this union 139 | */ 140 | public static long sizeof() { return layout().byteSize(); } 141 | 142 | /** 143 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 144 | */ 145 | public static MemorySegment allocate(SegmentAllocator allocator) { 146 | return allocator.allocate(layout()); 147 | } 148 | 149 | /** 150 | * Allocate an array of size {@code elementCount} using {@code allocator}. 151 | * The returned segment has size {@code elementCount * layout().byteSize()}. 152 | */ 153 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 154 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 155 | } 156 | 157 | /** 158 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 159 | * The returned segment has size {@code layout().byteSize()} 160 | */ 161 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 162 | return reinterpret(addr, 1, arena, cleanup); 163 | } 164 | 165 | /** 166 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 167 | * The returned segment has size {@code elementCount * layout().byteSize()} 168 | */ 169 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 170 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 171 | } 172 | } 173 | 174 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/av_intfloat64.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * union av_intfloat64 { 18 | * uint64_t i; 19 | * double f; 20 | * } 21 | * } 22 | */ 23 | public class av_intfloat64 { 24 | 25 | av_intfloat64() { 26 | // Should not be called directly 27 | } 28 | 29 | private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout( 30 | Libffmpeg.C_LONG_LONG.withName("i"), 31 | Libffmpeg.C_DOUBLE.withName("f") 32 | ).withName("av_intfloat64"); 33 | 34 | /** 35 | * The layout of this union 36 | */ 37 | public static final GroupLayout layout() { 38 | return $LAYOUT; 39 | } 40 | 41 | private static final OfLong i$LAYOUT = (OfLong)$LAYOUT.select(groupElement("i")); 42 | 43 | /** 44 | * Layout for field: 45 | * {@snippet lang=c : 46 | * uint64_t i 47 | * } 48 | */ 49 | public static final OfLong i$layout() { 50 | return i$LAYOUT; 51 | } 52 | 53 | private static final long i$OFFSET = 0; 54 | 55 | /** 56 | * Offset for field: 57 | * {@snippet lang=c : 58 | * uint64_t i 59 | * } 60 | */ 61 | public static final long i$offset() { 62 | return i$OFFSET; 63 | } 64 | 65 | /** 66 | * Getter for field: 67 | * {@snippet lang=c : 68 | * uint64_t i 69 | * } 70 | */ 71 | public static long i(MemorySegment union) { 72 | return union.get(i$LAYOUT, i$OFFSET); 73 | } 74 | 75 | /** 76 | * Setter for field: 77 | * {@snippet lang=c : 78 | * uint64_t i 79 | * } 80 | */ 81 | public static void i(MemorySegment union, long fieldValue) { 82 | union.set(i$LAYOUT, i$OFFSET, fieldValue); 83 | } 84 | 85 | private static final OfDouble f$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("f")); 86 | 87 | /** 88 | * Layout for field: 89 | * {@snippet lang=c : 90 | * double f 91 | * } 92 | */ 93 | public static final OfDouble f$layout() { 94 | return f$LAYOUT; 95 | } 96 | 97 | private static final long f$OFFSET = 0; 98 | 99 | /** 100 | * Offset for field: 101 | * {@snippet lang=c : 102 | * double f 103 | * } 104 | */ 105 | public static final long f$offset() { 106 | return f$OFFSET; 107 | } 108 | 109 | /** 110 | * Getter for field: 111 | * {@snippet lang=c : 112 | * double f 113 | * } 114 | */ 115 | public static double f(MemorySegment union) { 116 | return union.get(f$LAYOUT, f$OFFSET); 117 | } 118 | 119 | /** 120 | * Setter for field: 121 | * {@snippet lang=c : 122 | * double f 123 | * } 124 | */ 125 | public static void f(MemorySegment union, double fieldValue) { 126 | union.set(f$LAYOUT, f$OFFSET, fieldValue); 127 | } 128 | 129 | /** 130 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 131 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 132 | */ 133 | public static MemorySegment asSlice(MemorySegment array, long index) { 134 | return array.asSlice(layout().byteSize() * index); 135 | } 136 | 137 | /** 138 | * The size (in bytes) of this union 139 | */ 140 | public static long sizeof() { return layout().byteSize(); } 141 | 142 | /** 143 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 144 | */ 145 | public static MemorySegment allocate(SegmentAllocator allocator) { 146 | return allocator.allocate(layout()); 147 | } 148 | 149 | /** 150 | * Allocate an array of size {@code elementCount} using {@code allocator}. 151 | * The returned segment has size {@code elementCount * layout().byteSize()}. 152 | */ 153 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 154 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 155 | } 156 | 157 | /** 158 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 159 | * The returned segment has size {@code layout().byteSize()} 160 | */ 161 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 162 | return reinterpret(addr, 1, arena, cleanup); 163 | } 164 | 165 | /** 166 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 167 | * The returned segment has size {@code elementCount * layout().byteSize()} 168 | */ 169 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 170 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 171 | } 172 | } 173 | 174 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/av_log_set_callback$callback.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * void (*callback)(void *, int, const char *, struct __va_list_tag *) 18 | * } 19 | */ 20 | public class av_log_set_callback$callback { 21 | 22 | av_log_set_callback$callback() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libffmpeg.C_POINTER, 35 | Libffmpeg.C_INT, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_POINTER 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_log_set_callback$callback.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(av_log_set_callback$callback.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static void invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3) { 63 | try { 64 | DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/avcodec_default_execute$func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int (*func)(AVCodecContext *, void *) 18 | * } 19 | */ 20 | public class avcodec_default_execute$func { 21 | 22 | avcodec_default_execute$func() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment _x0, MemorySegment _x1); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER 37 | ); 38 | 39 | /** 40 | * The descriptor of this function pointer 41 | */ 42 | public static FunctionDescriptor descriptor() { 43 | return $DESC; 44 | } 45 | 46 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avcodec_default_execute$func.Function.class, "apply", $DESC); 47 | 48 | /** 49 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 50 | * The lifetime of the returned segment is managed by {@code arena} 51 | */ 52 | public static MemorySegment allocate(avcodec_default_execute$func.Function fi, Arena arena) { 53 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 54 | } 55 | 56 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 57 | 58 | /** 59 | * Invoke the upcall stub {@code funcPtr}, with given parameters 60 | */ 61 | public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) { 62 | try { 63 | return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1); 64 | } catch (Throwable ex$) { 65 | throw new AssertionError("should not reach here", ex$); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/avcodec_default_execute2$func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int (*func)(AVCodecContext *, void *, int, int) 18 | * } 19 | */ 20 | public class avcodec_default_execute2$func { 21 | 22 | avcodec_default_execute2$func() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment _x0, MemorySegment _x1, int _x2, int _x3); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_INT, 38 | Libffmpeg.C_INT 39 | ); 40 | 41 | /** 42 | * The descriptor of this function pointer 43 | */ 44 | public static FunctionDescriptor descriptor() { 45 | return $DESC; 46 | } 47 | 48 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avcodec_default_execute2$func.Function.class, "apply", $DESC); 49 | 50 | /** 51 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 52 | * The lifetime of the returned segment is managed by {@code arena} 53 | */ 54 | public static MemorySegment allocate(avcodec_default_execute2$func.Function fi, Arena arena) { 55 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 56 | } 57 | 58 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 59 | 60 | /** 61 | * Invoke the upcall stub {@code funcPtr}, with given parameters 62 | */ 63 | public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2, int _x3) { 64 | try { 65 | return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); 66 | } catch (Throwable ex$) { 67 | throw new AssertionError("should not reach here", ex$); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/avfilter_action_func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (avfilter_action_func)(AVFilterContext *, void *, int, int) 18 | * } 19 | */ 20 | public class avfilter_action_func { 21 | 22 | avfilter_action_func() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment ctx, MemorySegment arg, int jobnr, int nb_jobs); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_INT, 38 | Libffmpeg.C_INT 39 | ); 40 | 41 | /** 42 | * The descriptor of this function pointer 43 | */ 44 | public static FunctionDescriptor descriptor() { 45 | return $DESC; 46 | } 47 | 48 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avfilter_action_func.Function.class, "apply", $DESC); 49 | 50 | /** 51 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 52 | * The lifetime of the returned segment is managed by {@code arena} 53 | */ 54 | public static MemorySegment allocate(avfilter_action_func.Function fi, Arena arena) { 55 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 56 | } 57 | 58 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 59 | 60 | /** 61 | * Invoke the upcall stub {@code funcPtr}, with given parameters 62 | */ 63 | public static int invoke(MemorySegment funcPtr,MemorySegment ctx, MemorySegment arg, int jobnr, int nb_jobs) { 64 | try { 65 | return (int) DOWN$MH.invokeExact(funcPtr, ctx, arg, jobnr, nb_jobs); 66 | } catch (Throwable ex$) { 67 | throw new AssertionError("should not reach here", ex$); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/avfilter_execute_func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (avfilter_execute_func)(AVFilterContext *, avfilter_action_func *, void *, int *, int) 18 | * } 19 | */ 20 | public class avfilter_execute_func { 21 | 22 | avfilter_execute_func() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment ctx, MemorySegment func, MemorySegment arg, MemorySegment ret, int nb_jobs); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_POINTER, 38 | Libffmpeg.C_POINTER, 39 | Libffmpeg.C_INT 40 | ); 41 | 42 | /** 43 | * The descriptor of this function pointer 44 | */ 45 | public static FunctionDescriptor descriptor() { 46 | return $DESC; 47 | } 48 | 49 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avfilter_execute_func.Function.class, "apply", $DESC); 50 | 51 | /** 52 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 53 | * The lifetime of the returned segment is managed by {@code arena} 54 | */ 55 | public static MemorySegment allocate(avfilter_execute_func.Function fi, Arena arena) { 56 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 57 | } 58 | 59 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 60 | 61 | /** 62 | * Invoke the upcall stub {@code funcPtr}, with given parameters 63 | */ 64 | public static int invoke(MemorySegment funcPtr,MemorySegment ctx, MemorySegment func, MemorySegment arg, MemorySegment ret, int nb_jobs) { 65 | try { 66 | return (int) DOWN$MH.invokeExact(funcPtr, ctx, func, arg, ret, nb_jobs); 67 | } catch (Throwable ex$) { 68 | throw new AssertionError("should not reach here", ex$); 69 | } 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/avio_alloc_context$read_packet.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int (*read_packet)(void *, uint8_t *, int) 18 | * } 19 | */ 20 | public class avio_alloc_context$read_packet { 21 | 22 | avio_alloc_context$read_packet() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment _x0, MemorySegment _x1, int _x2); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avio_alloc_context$read_packet.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(avio_alloc_context$read_packet.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/avio_alloc_context$seek.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int64_t (*seek)(void *, int64_t, int) 18 | * } 19 | */ 20 | public class avio_alloc_context$seek { 21 | 22 | avio_alloc_context$seek() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | long apply(MemorySegment _x0, long _x1, int _x2); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_LONG_LONG, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_LONG_LONG, 37 | Libffmpeg.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avio_alloc_context$seek.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(avio_alloc_context$seek.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static long invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1, int _x2) { 63 | try { 64 | return (long) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/com/nextbreakpoint/ffmpeg4java/avio_alloc_context$write_packet.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int (*write_packet)(void *, const uint8_t *, int) 18 | * } 19 | */ 20 | public class avio_alloc_context$write_packet { 21 | 22 | avio_alloc_context$write_packet() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment _x0, MemorySegment _x1, int _x2); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avio_alloc_context$write_packet.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(avio_alloc_context$write_packet.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module com.nextbreakpoint.ffmpeg4java { 2 | exports com.nextbreakpoint.ffmpeg4java; 3 | } -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/resources/META-INF/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2024, Andrea Medeghini 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of FFmpeg4Java nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /ffmpeg4java-macos/src/main/resources/META-INF/NOTICE.txt: -------------------------------------------------------------------------------- 1 | FFmpeg4Java is distributed as independent JAR files, one for each supported operating system. 2 | Each JAR file contains a native library which must be installed in the library path of the Java runtime. 3 | 4 | Please note that the native library is statically liked with FFmpeg library under the terms of GNU Lesser General Public License, version 2.1. 5 | You should have received a copy of the LGPL v2.1 license with FFmpeg4Java. See http://ffmpeg.org for more information about FFmpeg. 6 | -------------------------------------------------------------------------------- /ffmpeg4java-tests/fixture-frame-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbreakpoint/ffmpeg4java/b132cbcdc2aa9a46feeea39f580b48dd0a982e5e/ffmpeg4java-tests/fixture-frame-10.png -------------------------------------------------------------------------------- /ffmpeg4java-tests/fixture-frame-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbreakpoint/ffmpeg4java/b132cbcdc2aa9a46feeea39f580b48dd0a982e5e/ffmpeg4java-tests/fixture-frame-20.png -------------------------------------------------------------------------------- /ffmpeg4java-tests/fixture-frame-30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbreakpoint/ffmpeg4java/b132cbcdc2aa9a46feeea39f580b48dd0a982e5e/ffmpeg4java-tests/fixture-frame-30.png -------------------------------------------------------------------------------- /ffmpeg4java-tests/fixture-frame-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbreakpoint/ffmpeg4java/b132cbcdc2aa9a46feeea39f580b48dd0a982e5e/ffmpeg4java-tests/fixture-frame-40.png -------------------------------------------------------------------------------- /ffmpeg4java-tests/fixture-video-48.mpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextbreakpoint/ffmpeg4java/b132cbcdc2aa9a46feeea39f580b48dd0a982e5e/ffmpeg4java-tests/fixture-video-48.mpg -------------------------------------------------------------------------------- /ffmpeg4java-windows/dump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FFMPEG_HOME="$(cygpath -w $(pwd)/native/ffmpeg)" 4 | INCLUDE_PATH="$(cygpath -w $CYGWIN_HOME/usr/include)" 5 | 6 | export PATH=$PATH:${JEXTRACT_HOME}/bin 7 | 8 | jextract --dump-includes includes.txt \ 9 | --include-dir "${FFMPEG_HOME}" \ 10 | --include-dir "${INCLUDE_PATH}" \ 11 | libffmpeg.h -------------------------------------------------------------------------------- /ffmpeg4java-windows/extract.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FFMPEG_HOME="$(cygpath -w $(pwd)/native/ffmpeg)" 4 | INCLUDE_PATH="$(cygpath -w $CYGWIN_HOME/usr/include)" 5 | 6 | export PATH=$PATH:${JEXTRACT_HOME}/bin 7 | 8 | jextract @includes.txt \ 9 | --output src/main/java \ 10 | --target-package com.nextbreakpoint.ffmpeg4java \ 11 | --include-dir "${FFMPEG_HOME}" \ 12 | --include-dir "${INCLUDE_PATH}" \ 13 | --use-system-load-library \ 14 | --library ffmpeg4java \ 15 | --header-class-name Libffmpeg \ 16 | libffmpeg.h -------------------------------------------------------------------------------- /ffmpeg4java-windows/libffmpeg.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/native/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | RUN apt-get update -y && apt-get -y install git make gcc=4:11.2.0-1ubuntu1 g++=4:11.2.0-1ubuntu1 mingw-w64=8.0.0-1 4 | 5 | WORKDIR /var/native 6 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/native/Makefile: -------------------------------------------------------------------------------- 1 | INSTALL_PATH := $(CURDIR)/../src/main/resources 2 | 3 | .PHONY: checkout 4 | checkout: 5 | ./scripts/checkout.sh 6 | 7 | .PHONY: configure 8 | configure: 9 | ./scripts/configure.sh 10 | 11 | .PHONY: compile 12 | compile: 13 | ./scripts/compile.sh 14 | 15 | .PHONY: clean 16 | clean: 17 | ./scripts/clean.sh 18 | 19 | .PHONY: install 20 | install: 21 | ./scripts/copy.sh $(INSTALL_PATH) 22 | 23 | .PHONY: all 24 | all: build-lib install 25 | 26 | .PHONY: build-image 27 | build-image: 28 | docker build -t ffmpeg4java-windows . 29 | 30 | .PHONY: build-lib 31 | build-lib: build-image 32 | docker run --rm -i -v $(CURDIR):/var/native ffmpeg4java-windows make checkout configure compile 33 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/native/ffmpeg.patch: -------------------------------------------------------------------------------- 1 | diff --git a/libswscale/Makefile b/libswscale/Makefile 2 | index 757997b401..4c950e6c43 100644 3 | --- a/libswscale/Makefile 4 | +++ b/libswscale/Makefile 5 | @@ -9,7 +9,6 @@ OBJS = alphablend.o \ 6 | hscale.o \ 7 | hscale_fast_bilinear.o \ 8 | gamma.o \ 9 | - half2float.o \ 10 | input.o \ 11 | options.o \ 12 | output.o \ 13 | diff --git a/libswscale/half2float.c b/libswscale/half2float.c 14 | deleted file mode 100644 15 | index 1b023f96a5..0000000000 16 | --- a/libswscale/half2float.c 17 | +++ /dev/null 18 | @@ -1,19 +0,0 @@ 19 | -/* 20 | - * This file is part of FFmpeg. 21 | - * 22 | - * FFmpeg is free software; you can redistribute it and/or 23 | - * modify it under the terms of the GNU Lesser General Public 24 | - * License as published by the Free Software Foundation; either 25 | - * version 2.1 of the License, or (at your option) any later version. 26 | - * 27 | - * FFmpeg is distributed in the hope that it will be useful, 28 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | - * Lesser General Public License for more details. 31 | - * 32 | - * You should have received a copy of the GNU Lesser General Public 33 | - * License along with FFmpeg; if not, write to the Free Software 34 | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 35 | - */ 36 | - 37 | -#include "libavutil/half2float.c" 38 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/native/scripts/checkout.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | FFMPEG_HOME=$(pwd)/ffmpeg 6 | 7 | if [ ! -d "$FFMPEG_HOME" ]; then 8 | git clone https://git.ffmpeg.org/ffmpeg.git "$FFMPEG_HOME" 9 | else 10 | pushd "$FFMPEG_HOME" 11 | git fetch 12 | popd 13 | fi 14 | 15 | pushd "$FFMPEG_HOME" 16 | git checkout af25a4bfd2503caf3ee485b27b99b620302f5718 17 | popd 18 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/native/scripts/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FFMPEG_HOME=$(pwd)/ffmpeg 6 | 7 | cd "$FFMPEG_HOME" || exit 8 | 9 | make clean 10 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/native/scripts/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FFMPEG_HOME=$(pwd)/ffmpeg 6 | 7 | LIB_TYPE=64 8 | 9 | cd "$FFMPEG_HOME" || exit 10 | 11 | git reset --hard 12 | patch -p1 -N < ../ffmpeg.patch 13 | 14 | make 15 | 16 | x86_64-w64-mingw32-gcc --verbose \ 17 | -o ffmpeg4java.dll \ 18 | -shared \ 19 | -m${LIB_TYPE} \ 20 | -Wall \ 21 | -fpic \ 22 | -Wl,--out-implib=ffmpeg4java.dll.a \ 23 | -Wl,-add-stdcall-alias \ 24 | -Wl,--no-undefined \ 25 | -Wl,-Bsymbolic \ 26 | -Wl,--whole-archive \ 27 | libavformat/libavformat.a \ 28 | libavdevice/libavdevice.a \ 29 | libavfilter/libavfilter.a \ 30 | libavcodec/libavcodec.a \ 31 | libavutil/libavutil.a \ 32 | libswscale/libswscale.a \ 33 | libswresample/libswresample.a \ 34 | -Wl,--no-whole-archive \ 35 | -Wl,-Bstatic \ 36 | -lm \ 37 | -lpthread \ 38 | -Wl,-Bdynamic \ 39 | -lws2_32 \ 40 | -lbcrypt \ 41 | -luuid \ 42 | -lsecur32 \ 43 | -lshlwapi \ 44 | -lgdi32 \ 45 | -lstrmiids \ 46 | -lole32 \ 47 | -loleaut32 \ 48 | -lavicap32 -------------------------------------------------------------------------------- /ffmpeg4java-windows/native/scripts/configure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FFMPEG_HOME=$(pwd)/ffmpeg 6 | 7 | LIB_TYPE=64 8 | LIB_ARCH=x86_$LIB_TYPE 9 | 10 | cd "$FFMPEG_HOME" || exit 11 | 12 | ./configure \ 13 | --cross-prefix=${LIB_ARCH}-w64-mingw32- \ 14 | --enable-cross-compile \ 15 | --target-os=mingw32 \ 16 | --extra-cflags="-m${LIB_TYPE}" \ 17 | --extra-ldflags="-m${LIB_TYPE}" \ 18 | --arch=${LIB_ARCH} \ 19 | --enable-static \ 20 | --disable-shared \ 21 | --enable-pic \ 22 | --disable-programs \ 23 | --disable-debug \ 24 | --disable-mmx -------------------------------------------------------------------------------- /ffmpeg4java-windows/native/scripts/copy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | mkdir -p "$1" && cp ffmpeg/ffmpeg4java.dll "$1" 6 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/output.txt: -------------------------------------------------------------------------------- 1 | WARNING: Skipping AVBPrint (type Declared(AVBPrint) is not supported) 2 | WARNING: Skipping AVBuffer (type Declared(AVBuffer) is not supported) 3 | WARNING: Skipping AVBufferPool (type Declared(AVBufferPool) is not supported) 4 | WARNING: Skipping AVDictionary (type Declared(AVDictionary) is not supported) 5 | WARNING: Skipping AVIODirContext (type Declared(AVIODirContext) is not supported) 6 | WARNING: Skipping AVBPrint (type Declared(AVBPrint) is not supported) 7 | WARNING: Skipping AVCodecTag (type Declared(AVCodecTag) is not supported) 8 | WARNING: Skipping AVIndexEntry.flags (bitfields are not supported) 9 | WARNING: Skipping AVIndexEntry.size (bitfields are not supported) 10 | WARNING: Skipping AVIAMFAudioElement (type Declared(AVIAMFAudioElement) is not supported) 11 | WARNING: Skipping AVIAMFMixPresentation (type Declared(AVIAMFMixPresentation) is not supported) 12 | WARNING: Skipping AVFilterPad (type Declared(AVFilterPad) is not supported) 13 | WARNING: Skipping AVFilterFormats (type Declared(AVFilterFormats) is not supported) 14 | WARNING: Skipping AVFilterChannelLayouts (type Declared(AVFilterChannelLayouts) is not supported) 15 | WARNING: Skipping SwsContext (type Declared(SwsContext) is not supported) 16 | WARNING: Skipping SwrContext (type Declared(SwrContext) is not supported) 17 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.nextbreakpoint 6 | com.nextbreakpoint.ffmpeg4java 7 | 7.0.1-1.2 8 | 9 | com.nextbreakpoint.ffmpeg4java.windows 10 | jar 11 | FFmpeg4Java Windows 12 | FFmpeg4Java provides a Java wrapper of FFmpeg library 13 | 14 | 15 | 16 | org.apache.maven.plugins 17 | maven-source-plugin 18 | 19 | 20 | attach-sources 21 | 22 | jar 23 | 24 | 25 | 26 | 27 | 28 | org.apache.maven.plugins 29 | maven-javadoc-plugin 30 | 31 | 32 | attach-javadocs 33 | 34 | jar 35 | 36 | 37 | 38 | 39 | 40 | org.apache.maven.plugins 41 | maven-jar-plugin 42 | 43 | 44 | native 45 | package 46 | 47 | jar 48 | 49 | 50 | x86_64 51 | 52 | **/*.dll 53 | **/*.txt 54 | 55 | 56 | **/*.class 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/source: -------------------------------------------------------------------------------- 1 | export CYGWIN_HOME="/cygdrive/c/Users/andrea/Documents/cygwin" 2 | export JAVA_HOME=/cygdrive/c/Users/andrea/Documents/jdk-22.0.1+8 3 | export JEXTRACT_HOME=/cygdrive/c/Users/andrea/Documents/jextract-22 4 | export PATH=$PATH:$JAVA_HOME/bin:$JEXTRACT_HOME/bin 5 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/AVFilterPadParams.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * struct AVFilterPadParams { 18 | * char *label; 19 | * } 20 | * } 21 | */ 22 | public class AVFilterPadParams { 23 | 24 | AVFilterPadParams() { 25 | // Should not be called directly 26 | } 27 | 28 | private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( 29 | Libffmpeg.C_POINTER.withName("label") 30 | ).withName("AVFilterPadParams"); 31 | 32 | /** 33 | * The layout of this struct 34 | */ 35 | public static final GroupLayout layout() { 36 | return $LAYOUT; 37 | } 38 | 39 | private static final AddressLayout label$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("label")); 40 | 41 | /** 42 | * Layout for field: 43 | * {@snippet lang=c : 44 | * char *label 45 | * } 46 | */ 47 | public static final AddressLayout label$layout() { 48 | return label$LAYOUT; 49 | } 50 | 51 | private static final long label$OFFSET = 0; 52 | 53 | /** 54 | * Offset for field: 55 | * {@snippet lang=c : 56 | * char *label 57 | * } 58 | */ 59 | public static final long label$offset() { 60 | return label$OFFSET; 61 | } 62 | 63 | /** 64 | * Getter for field: 65 | * {@snippet lang=c : 66 | * char *label 67 | * } 68 | */ 69 | public static MemorySegment label(MemorySegment struct) { 70 | return struct.get(label$LAYOUT, label$OFFSET); 71 | } 72 | 73 | /** 74 | * Setter for field: 75 | * {@snippet lang=c : 76 | * char *label 77 | * } 78 | */ 79 | public static void label(MemorySegment struct, MemorySegment fieldValue) { 80 | struct.set(label$LAYOUT, label$OFFSET, fieldValue); 81 | } 82 | 83 | /** 84 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 85 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 86 | */ 87 | public static MemorySegment asSlice(MemorySegment array, long index) { 88 | return array.asSlice(layout().byteSize() * index); 89 | } 90 | 91 | /** 92 | * The size (in bytes) of this struct 93 | */ 94 | public static long sizeof() { return layout().byteSize(); } 95 | 96 | /** 97 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 98 | */ 99 | public static MemorySegment allocate(SegmentAllocator allocator) { 100 | return allocator.allocate(layout()); 101 | } 102 | 103 | /** 104 | * Allocate an array of size {@code elementCount} using {@code allocator}. 105 | * The returned segment has size {@code elementCount * layout().byteSize()}. 106 | */ 107 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 108 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 109 | } 110 | 111 | /** 112 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 113 | * The returned segment has size {@code layout().byteSize()} 114 | */ 115 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 116 | return reinterpret(addr, 1, arena, cleanup); 117 | } 118 | 119 | /** 120 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 121 | * The returned segment has size {@code elementCount * layout().byteSize()} 122 | */ 123 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 124 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 125 | } 126 | } 127 | 128 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/AVOpenCallback.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*AVOpenCallback)(struct AVFormatContext { 18 | * AVClass *av_class; 19 | * struct AVInputFormat *iformat; 20 | * struct AVOutputFormat *oformat; 21 | * void *priv_data; 22 | * AVIOContext *pb; 23 | * int ctx_flags; 24 | * unsigned int nb_streams; 25 | * AVStream **streams; 26 | * unsigned int nb_stream_groups; 27 | * AVStreamGroup **stream_groups; 28 | * unsigned int nb_chapters; 29 | * AVChapter **chapters; 30 | * char *url; 31 | * int64_t start_time; 32 | * int64_t duration; 33 | * int64_t bit_rate; 34 | * unsigned int packet_size; 35 | * int max_delay; 36 | * int flags; 37 | * int64_t probesize; 38 | * int64_t max_analyze_duration; 39 | * uint8_t *key; 40 | * int keylen; 41 | * unsigned int nb_programs; 42 | * AVProgram **programs; 43 | * enum AVCodecID video_codec_id; 44 | * enum AVCodecID audio_codec_id; 45 | * enum AVCodecID subtitle_codec_id; 46 | * enum AVCodecID data_codec_id; 47 | * AVDictionary *metadata; 48 | * int64_t start_time_realtime; 49 | * int fps_probe_size; 50 | * int error_recognition; 51 | * AVIOInterruptCB interrupt_callback; 52 | * int debug; 53 | * int max_streams; 54 | * unsigned int max_index_size; 55 | * unsigned int max_picture_buffer; 56 | * int64_t max_interleave_delta; 57 | * int max_ts_probe; 58 | * int max_chunk_duration; 59 | * int max_chunk_size; 60 | * int max_probe_packets; 61 | * int strict_std_compliance; 62 | * int event_flags; 63 | * int avoid_negative_ts; 64 | * int audio_preload; 65 | * int use_wallclock_as_timestamps; 66 | * int skip_estimate_duration_from_pts; 67 | * int avio_flags; 68 | * enum AVDurationEstimationMethod duration_estimation_method; 69 | * int64_t skip_initial_bytes; 70 | * unsigned int correct_ts_overflow; 71 | * int seek2any; 72 | * int flush_packets; 73 | * int probe_score; 74 | * int format_probesize; 75 | * char *codec_whitelist; 76 | * char *format_whitelist; 77 | * char *protocol_whitelist; 78 | * char *protocol_blacklist; 79 | * int io_repositioned; 80 | * struct AVCodec *video_codec; 81 | * struct AVCodec *audio_codec; 82 | * struct AVCodec *subtitle_codec; 83 | * struct AVCodec *data_codec; 84 | * int metadata_header_padding; 85 | * void *opaque; 86 | * av_format_control_message control_message_cb; 87 | * int64_t output_ts_offset; 88 | * uint8_t *dump_separator; 89 | * int (*io_open)(struct AVFormatContext *, AVIOContext **, char *, int, AVDictionary **); 90 | * int (*io_close2)(struct AVFormatContext *, AVIOContext *); 91 | * } *, AVIOContext **, char *, int, AVIOInterruptCB *, AVDictionary **) 92 | * } 93 | */ 94 | public class AVOpenCallback { 95 | 96 | AVOpenCallback() { 97 | // Should not be called directly 98 | } 99 | 100 | /** 101 | * The function pointer signature, expressed as a functional interface 102 | */ 103 | public interface Function { 104 | int apply(MemorySegment s, MemorySegment pb, MemorySegment url, int flags, MemorySegment int_cb, MemorySegment options); 105 | } 106 | 107 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 108 | Libffmpeg.C_INT, 109 | Libffmpeg.C_POINTER, 110 | Libffmpeg.C_POINTER, 111 | Libffmpeg.C_POINTER, 112 | Libffmpeg.C_INT, 113 | Libffmpeg.C_POINTER, 114 | Libffmpeg.C_POINTER 115 | ); 116 | 117 | /** 118 | * The descriptor of this function pointer 119 | */ 120 | public static FunctionDescriptor descriptor() { 121 | return $DESC; 122 | } 123 | 124 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(AVOpenCallback.Function.class, "apply", $DESC); 125 | 126 | /** 127 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 128 | * The lifetime of the returned segment is managed by {@code arena} 129 | */ 130 | public static MemorySegment allocate(AVOpenCallback.Function fi, Arena arena) { 131 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 132 | } 133 | 134 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 135 | 136 | /** 137 | * Invoke the upcall stub {@code funcPtr}, with given parameters 138 | */ 139 | public static int invoke(MemorySegment funcPtr,MemorySegment s, MemorySegment pb, MemorySegment url, int flags, MemorySegment int_cb, MemorySegment options) { 140 | try { 141 | return (int) DOWN$MH.invokeExact(funcPtr, s, pb, url, flags, int_cb, options); 142 | } catch (Throwable ex$) { 143 | throw new AssertionError("should not reach here", ex$); 144 | } 145 | } 146 | } 147 | 148 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/AVRational.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * struct AVRational { 18 | * int num; 19 | * int den; 20 | * } 21 | * } 22 | */ 23 | public class AVRational { 24 | 25 | AVRational() { 26 | // Should not be called directly 27 | } 28 | 29 | private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( 30 | Libffmpeg.C_INT.withName("num"), 31 | Libffmpeg.C_INT.withName("den") 32 | ).withName("AVRational"); 33 | 34 | /** 35 | * The layout of this struct 36 | */ 37 | public static final GroupLayout layout() { 38 | return $LAYOUT; 39 | } 40 | 41 | private static final OfInt num$LAYOUT = (OfInt)$LAYOUT.select(groupElement("num")); 42 | 43 | /** 44 | * Layout for field: 45 | * {@snippet lang=c : 46 | * int num 47 | * } 48 | */ 49 | public static final OfInt num$layout() { 50 | return num$LAYOUT; 51 | } 52 | 53 | private static final long num$OFFSET = 0; 54 | 55 | /** 56 | * Offset for field: 57 | * {@snippet lang=c : 58 | * int num 59 | * } 60 | */ 61 | public static final long num$offset() { 62 | return num$OFFSET; 63 | } 64 | 65 | /** 66 | * Getter for field: 67 | * {@snippet lang=c : 68 | * int num 69 | * } 70 | */ 71 | public static int num(MemorySegment struct) { 72 | return struct.get(num$LAYOUT, num$OFFSET); 73 | } 74 | 75 | /** 76 | * Setter for field: 77 | * {@snippet lang=c : 78 | * int num 79 | * } 80 | */ 81 | public static void num(MemorySegment struct, int fieldValue) { 82 | struct.set(num$LAYOUT, num$OFFSET, fieldValue); 83 | } 84 | 85 | private static final OfInt den$LAYOUT = (OfInt)$LAYOUT.select(groupElement("den")); 86 | 87 | /** 88 | * Layout for field: 89 | * {@snippet lang=c : 90 | * int den 91 | * } 92 | */ 93 | public static final OfInt den$layout() { 94 | return den$LAYOUT; 95 | } 96 | 97 | private static final long den$OFFSET = 4; 98 | 99 | /** 100 | * Offset for field: 101 | * {@snippet lang=c : 102 | * int den 103 | * } 104 | */ 105 | public static final long den$offset() { 106 | return den$OFFSET; 107 | } 108 | 109 | /** 110 | * Getter for field: 111 | * {@snippet lang=c : 112 | * int den 113 | * } 114 | */ 115 | public static int den(MemorySegment struct) { 116 | return struct.get(den$LAYOUT, den$OFFSET); 117 | } 118 | 119 | /** 120 | * Setter for field: 121 | * {@snippet lang=c : 122 | * int den 123 | * } 124 | */ 125 | public static void den(MemorySegment struct, int fieldValue) { 126 | struct.set(den$LAYOUT, den$OFFSET, fieldValue); 127 | } 128 | 129 | /** 130 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 131 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 132 | */ 133 | public static MemorySegment asSlice(MemorySegment array, long index) { 134 | return array.asSlice(layout().byteSize() * index); 135 | } 136 | 137 | /** 138 | * The size (in bytes) of this struct 139 | */ 140 | public static long sizeof() { return layout().byteSize(); } 141 | 142 | /** 143 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 144 | */ 145 | public static MemorySegment allocate(SegmentAllocator allocator) { 146 | return allocator.allocate(layout()); 147 | } 148 | 149 | /** 150 | * Allocate an array of size {@code elementCount} using {@code allocator}. 151 | * The returned segment has size {@code elementCount * layout().byteSize()}. 152 | */ 153 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 154 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 155 | } 156 | 157 | /** 158 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 159 | * The returned segment has size {@code layout().byteSize()} 160 | */ 161 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 162 | return reinterpret(addr, 1, arena, cleanup); 163 | } 164 | 165 | /** 166 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 167 | * The returned segment has size {@code elementCount * layout().byteSize()} 168 | */ 169 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 170 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 171 | } 172 | } 173 | 174 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/av_buffer_create$free.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * void (*free)(void *, uint8_t *) 18 | * } 19 | */ 20 | public class av_buffer_create$free { 21 | 22 | av_buffer_create$free() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment _x0, MemorySegment _x1); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libffmpeg.C_POINTER, 35 | Libffmpeg.C_POINTER 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_buffer_create$free.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(av_buffer_create$free.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static void invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) { 61 | try { 62 | DOWN$MH.invokeExact(funcPtr, _x0, _x1); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/av_buffer_pool_init$alloc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * AVBufferRef *(*alloc)(size_t) 18 | * } 19 | */ 20 | public class av_buffer_pool_init$alloc { 21 | 22 | av_buffer_pool_init$alloc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(long _x0); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_POINTER, 35 | Libffmpeg.C_LONG_LONG 36 | ); 37 | 38 | /** 39 | * The descriptor of this function pointer 40 | */ 41 | public static FunctionDescriptor descriptor() { 42 | return $DESC; 43 | } 44 | 45 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_buffer_pool_init$alloc.Function.class, "apply", $DESC); 46 | 47 | /** 48 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 49 | * The lifetime of the returned segment is managed by {@code arena} 50 | */ 51 | public static MemorySegment allocate(av_buffer_pool_init$alloc.Function fi, Arena arena) { 52 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 53 | } 54 | 55 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 56 | 57 | /** 58 | * Invoke the upcall stub {@code funcPtr}, with given parameters 59 | */ 60 | public static MemorySegment invoke(MemorySegment funcPtr,long _x0) { 61 | try { 62 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0); 63 | } catch (Throwable ex$) { 64 | throw new AssertionError("should not reach here", ex$); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/av_buffer_pool_init2$alloc.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * AVBufferRef *(*alloc)(void *, size_t) 18 | * } 19 | */ 20 | public class av_buffer_pool_init2$alloc { 21 | 22 | av_buffer_pool_init2$alloc() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | MemorySegment apply(MemorySegment _x0, long _x1); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_POINTER, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_LONG_LONG 37 | ); 38 | 39 | /** 40 | * The descriptor of this function pointer 41 | */ 42 | public static FunctionDescriptor descriptor() { 43 | return $DESC; 44 | } 45 | 46 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_buffer_pool_init2$alloc.Function.class, "apply", $DESC); 47 | 48 | /** 49 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 50 | * The lifetime of the returned segment is managed by {@code arena} 51 | */ 52 | public static MemorySegment allocate(av_buffer_pool_init2$alloc.Function fi, Arena arena) { 53 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 54 | } 55 | 56 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 57 | 58 | /** 59 | * Invoke the upcall stub {@code funcPtr}, with given parameters 60 | */ 61 | public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1) { 62 | try { 63 | return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1); 64 | } catch (Throwable ex$) { 65 | throw new AssertionError("should not reach here", ex$); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/av_buffer_pool_init2$pool_free.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * void (*pool_free)(void *) 18 | * } 19 | */ 20 | public class av_buffer_pool_init2$pool_free { 21 | 22 | av_buffer_pool_init2$pool_free() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment _x0); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libffmpeg.C_POINTER 35 | ); 36 | 37 | /** 38 | * The descriptor of this function pointer 39 | */ 40 | public static FunctionDescriptor descriptor() { 41 | return $DESC; 42 | } 43 | 44 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_buffer_pool_init2$pool_free.Function.class, "apply", $DESC); 45 | 46 | /** 47 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 48 | * The lifetime of the returned segment is managed by {@code arena} 49 | */ 50 | public static MemorySegment allocate(av_buffer_pool_init2$pool_free.Function fi, Arena arena) { 51 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 52 | } 53 | 54 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 55 | 56 | /** 57 | * Invoke the upcall stub {@code funcPtr}, with given parameters 58 | */ 59 | public static void invoke(MemorySegment funcPtr,MemorySegment _x0) { 60 | try { 61 | DOWN$MH.invokeExact(funcPtr, _x0); 62 | } catch (Throwable ex$) { 63 | throw new AssertionError("should not reach here", ex$); 64 | } 65 | } 66 | } 67 | 68 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/av_format_control_message.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (*av_format_control_message)(struct AVFormatContext { 18 | * AVClass *av_class; 19 | * struct AVInputFormat *iformat; 20 | * struct AVOutputFormat *oformat; 21 | * void *priv_data; 22 | * AVIOContext *pb; 23 | * int ctx_flags; 24 | * unsigned int nb_streams; 25 | * AVStream **streams; 26 | * unsigned int nb_stream_groups; 27 | * AVStreamGroup **stream_groups; 28 | * unsigned int nb_chapters; 29 | * AVChapter **chapters; 30 | * char *url; 31 | * int64_t start_time; 32 | * int64_t duration; 33 | * int64_t bit_rate; 34 | * unsigned int packet_size; 35 | * int max_delay; 36 | * int flags; 37 | * int64_t probesize; 38 | * int64_t max_analyze_duration; 39 | * uint8_t *key; 40 | * int keylen; 41 | * unsigned int nb_programs; 42 | * AVProgram **programs; 43 | * enum AVCodecID video_codec_id; 44 | * enum AVCodecID audio_codec_id; 45 | * enum AVCodecID subtitle_codec_id; 46 | * enum AVCodecID data_codec_id; 47 | * AVDictionary *metadata; 48 | * int64_t start_time_realtime; 49 | * int fps_probe_size; 50 | * int error_recognition; 51 | * AVIOInterruptCB interrupt_callback; 52 | * int debug; 53 | * int max_streams; 54 | * unsigned int max_index_size; 55 | * unsigned int max_picture_buffer; 56 | * int64_t max_interleave_delta; 57 | * int max_ts_probe; 58 | * int max_chunk_duration; 59 | * int max_chunk_size; 60 | * int max_probe_packets; 61 | * int strict_std_compliance; 62 | * int event_flags; 63 | * int avoid_negative_ts; 64 | * int audio_preload; 65 | * int use_wallclock_as_timestamps; 66 | * int skip_estimate_duration_from_pts; 67 | * int avio_flags; 68 | * enum AVDurationEstimationMethod duration_estimation_method; 69 | * int64_t skip_initial_bytes; 70 | * unsigned int correct_ts_overflow; 71 | * int seek2any; 72 | * int flush_packets; 73 | * int probe_score; 74 | * int format_probesize; 75 | * char *codec_whitelist; 76 | * char *format_whitelist; 77 | * char *protocol_whitelist; 78 | * char *protocol_blacklist; 79 | * int io_repositioned; 80 | * struct AVCodec *video_codec; 81 | * struct AVCodec *audio_codec; 82 | * struct AVCodec *subtitle_codec; 83 | * struct AVCodec *data_codec; 84 | * int metadata_header_padding; 85 | * void *opaque; 86 | * av_format_control_message control_message_cb; 87 | * int64_t output_ts_offset; 88 | * uint8_t *dump_separator; 89 | * int (*io_open)(struct AVFormatContext *, AVIOContext **, char *, int, AVDictionary **); 90 | * int (*io_close2)(struct AVFormatContext *, AVIOContext *); 91 | * } *, int, void *, size_t) 92 | * } 93 | */ 94 | public class av_format_control_message { 95 | 96 | av_format_control_message() { 97 | // Should not be called directly 98 | } 99 | 100 | /** 101 | * The function pointer signature, expressed as a functional interface 102 | */ 103 | public interface Function { 104 | int apply(MemorySegment s, int type, MemorySegment data, long data_size); 105 | } 106 | 107 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 108 | Libffmpeg.C_INT, 109 | Libffmpeg.C_POINTER, 110 | Libffmpeg.C_INT, 111 | Libffmpeg.C_POINTER, 112 | Libffmpeg.C_LONG_LONG 113 | ); 114 | 115 | /** 116 | * The descriptor of this function pointer 117 | */ 118 | public static FunctionDescriptor descriptor() { 119 | return $DESC; 120 | } 121 | 122 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_format_control_message.Function.class, "apply", $DESC); 123 | 124 | /** 125 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 126 | * The lifetime of the returned segment is managed by {@code arena} 127 | */ 128 | public static MemorySegment allocate(av_format_control_message.Function fi, Arena arena) { 129 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 130 | } 131 | 132 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 133 | 134 | /** 135 | * Invoke the upcall stub {@code funcPtr}, with given parameters 136 | */ 137 | public static int invoke(MemorySegment funcPtr,MemorySegment s, int type, MemorySegment data, long data_size) { 138 | try { 139 | return (int) DOWN$MH.invokeExact(funcPtr, s, type, data, data_size); 140 | } catch (Throwable ex$) { 141 | throw new AssertionError("should not reach here", ex$); 142 | } 143 | } 144 | } 145 | 146 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/av_intfloat32.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * union av_intfloat32 { 18 | * uint32_t i; 19 | * float f; 20 | * } 21 | * } 22 | */ 23 | public class av_intfloat32 { 24 | 25 | av_intfloat32() { 26 | // Should not be called directly 27 | } 28 | 29 | private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout( 30 | Libffmpeg.C_INT.withName("i"), 31 | Libffmpeg.C_FLOAT.withName("f") 32 | ).withName("av_intfloat32"); 33 | 34 | /** 35 | * The layout of this union 36 | */ 37 | public static final GroupLayout layout() { 38 | return $LAYOUT; 39 | } 40 | 41 | private static final OfInt i$LAYOUT = (OfInt)$LAYOUT.select(groupElement("i")); 42 | 43 | /** 44 | * Layout for field: 45 | * {@snippet lang=c : 46 | * uint32_t i 47 | * } 48 | */ 49 | public static final OfInt i$layout() { 50 | return i$LAYOUT; 51 | } 52 | 53 | private static final long i$OFFSET = 0; 54 | 55 | /** 56 | * Offset for field: 57 | * {@snippet lang=c : 58 | * uint32_t i 59 | * } 60 | */ 61 | public static final long i$offset() { 62 | return i$OFFSET; 63 | } 64 | 65 | /** 66 | * Getter for field: 67 | * {@snippet lang=c : 68 | * uint32_t i 69 | * } 70 | */ 71 | public static int i(MemorySegment union) { 72 | return union.get(i$LAYOUT, i$OFFSET); 73 | } 74 | 75 | /** 76 | * Setter for field: 77 | * {@snippet lang=c : 78 | * uint32_t i 79 | * } 80 | */ 81 | public static void i(MemorySegment union, int fieldValue) { 82 | union.set(i$LAYOUT, i$OFFSET, fieldValue); 83 | } 84 | 85 | private static final OfFloat f$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("f")); 86 | 87 | /** 88 | * Layout for field: 89 | * {@snippet lang=c : 90 | * float f 91 | * } 92 | */ 93 | public static final OfFloat f$layout() { 94 | return f$LAYOUT; 95 | } 96 | 97 | private static final long f$OFFSET = 0; 98 | 99 | /** 100 | * Offset for field: 101 | * {@snippet lang=c : 102 | * float f 103 | * } 104 | */ 105 | public static final long f$offset() { 106 | return f$OFFSET; 107 | } 108 | 109 | /** 110 | * Getter for field: 111 | * {@snippet lang=c : 112 | * float f 113 | * } 114 | */ 115 | public static float f(MemorySegment union) { 116 | return union.get(f$LAYOUT, f$OFFSET); 117 | } 118 | 119 | /** 120 | * Setter for field: 121 | * {@snippet lang=c : 122 | * float f 123 | * } 124 | */ 125 | public static void f(MemorySegment union, float fieldValue) { 126 | union.set(f$LAYOUT, f$OFFSET, fieldValue); 127 | } 128 | 129 | /** 130 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 131 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 132 | */ 133 | public static MemorySegment asSlice(MemorySegment array, long index) { 134 | return array.asSlice(layout().byteSize() * index); 135 | } 136 | 137 | /** 138 | * The size (in bytes) of this union 139 | */ 140 | public static long sizeof() { return layout().byteSize(); } 141 | 142 | /** 143 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 144 | */ 145 | public static MemorySegment allocate(SegmentAllocator allocator) { 146 | return allocator.allocate(layout()); 147 | } 148 | 149 | /** 150 | * Allocate an array of size {@code elementCount} using {@code allocator}. 151 | * The returned segment has size {@code elementCount * layout().byteSize()}. 152 | */ 153 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 154 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 155 | } 156 | 157 | /** 158 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 159 | * The returned segment has size {@code layout().byteSize()} 160 | */ 161 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 162 | return reinterpret(addr, 1, arena, cleanup); 163 | } 164 | 165 | /** 166 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 167 | * The returned segment has size {@code elementCount * layout().byteSize()} 168 | */ 169 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 170 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 171 | } 172 | } 173 | 174 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/av_intfloat64.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * union av_intfloat64 { 18 | * uint64_t i; 19 | * double f; 20 | * } 21 | * } 22 | */ 23 | public class av_intfloat64 { 24 | 25 | av_intfloat64() { 26 | // Should not be called directly 27 | } 28 | 29 | private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout( 30 | Libffmpeg.C_LONG_LONG.withName("i"), 31 | Libffmpeg.C_DOUBLE.withName("f") 32 | ).withName("av_intfloat64"); 33 | 34 | /** 35 | * The layout of this union 36 | */ 37 | public static final GroupLayout layout() { 38 | return $LAYOUT; 39 | } 40 | 41 | private static final OfLong i$LAYOUT = (OfLong)$LAYOUT.select(groupElement("i")); 42 | 43 | /** 44 | * Layout for field: 45 | * {@snippet lang=c : 46 | * uint64_t i 47 | * } 48 | */ 49 | public static final OfLong i$layout() { 50 | return i$LAYOUT; 51 | } 52 | 53 | private static final long i$OFFSET = 0; 54 | 55 | /** 56 | * Offset for field: 57 | * {@snippet lang=c : 58 | * uint64_t i 59 | * } 60 | */ 61 | public static final long i$offset() { 62 | return i$OFFSET; 63 | } 64 | 65 | /** 66 | * Getter for field: 67 | * {@snippet lang=c : 68 | * uint64_t i 69 | * } 70 | */ 71 | public static long i(MemorySegment union) { 72 | return union.get(i$LAYOUT, i$OFFSET); 73 | } 74 | 75 | /** 76 | * Setter for field: 77 | * {@snippet lang=c : 78 | * uint64_t i 79 | * } 80 | */ 81 | public static void i(MemorySegment union, long fieldValue) { 82 | union.set(i$LAYOUT, i$OFFSET, fieldValue); 83 | } 84 | 85 | private static final OfDouble f$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("f")); 86 | 87 | /** 88 | * Layout for field: 89 | * {@snippet lang=c : 90 | * double f 91 | * } 92 | */ 93 | public static final OfDouble f$layout() { 94 | return f$LAYOUT; 95 | } 96 | 97 | private static final long f$OFFSET = 0; 98 | 99 | /** 100 | * Offset for field: 101 | * {@snippet lang=c : 102 | * double f 103 | * } 104 | */ 105 | public static final long f$offset() { 106 | return f$OFFSET; 107 | } 108 | 109 | /** 110 | * Getter for field: 111 | * {@snippet lang=c : 112 | * double f 113 | * } 114 | */ 115 | public static double f(MemorySegment union) { 116 | return union.get(f$LAYOUT, f$OFFSET); 117 | } 118 | 119 | /** 120 | * Setter for field: 121 | * {@snippet lang=c : 122 | * double f 123 | * } 124 | */ 125 | public static void f(MemorySegment union, double fieldValue) { 126 | union.set(f$LAYOUT, f$OFFSET, fieldValue); 127 | } 128 | 129 | /** 130 | * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. 131 | * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} 132 | */ 133 | public static MemorySegment asSlice(MemorySegment array, long index) { 134 | return array.asSlice(layout().byteSize() * index); 135 | } 136 | 137 | /** 138 | * The size (in bytes) of this union 139 | */ 140 | public static long sizeof() { return layout().byteSize(); } 141 | 142 | /** 143 | * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} 144 | */ 145 | public static MemorySegment allocate(SegmentAllocator allocator) { 146 | return allocator.allocate(layout()); 147 | } 148 | 149 | /** 150 | * Allocate an array of size {@code elementCount} using {@code allocator}. 151 | * The returned segment has size {@code elementCount * layout().byteSize()}. 152 | */ 153 | public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { 154 | return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); 155 | } 156 | 157 | /** 158 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 159 | * The returned segment has size {@code layout().byteSize()} 160 | */ 161 | public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { 162 | return reinterpret(addr, 1, arena, cleanup); 163 | } 164 | 165 | /** 166 | * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). 167 | * The returned segment has size {@code elementCount * layout().byteSize()} 168 | */ 169 | public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { 170 | return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); 171 | } 172 | } 173 | 174 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/av_log_set_callback$callback.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * void (*callback)(void *, int, char *, va_list) 18 | * } 19 | */ 20 | public class av_log_set_callback$callback { 21 | 22 | av_log_set_callback$callback() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | void apply(MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( 34 | Libffmpeg.C_POINTER, 35 | Libffmpeg.C_INT, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_POINTER 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(av_log_set_callback$callback.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(av_log_set_callback$callback.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static void invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3) { 63 | try { 64 | DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/avcodec_default_execute$func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int (*func)(AVCodecContext *, void *) 18 | * } 19 | */ 20 | public class avcodec_default_execute$func { 21 | 22 | avcodec_default_execute$func() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment _x0, MemorySegment _x1); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER 37 | ); 38 | 39 | /** 40 | * The descriptor of this function pointer 41 | */ 42 | public static FunctionDescriptor descriptor() { 43 | return $DESC; 44 | } 45 | 46 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avcodec_default_execute$func.Function.class, "apply", $DESC); 47 | 48 | /** 49 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 50 | * The lifetime of the returned segment is managed by {@code arena} 51 | */ 52 | public static MemorySegment allocate(avcodec_default_execute$func.Function fi, Arena arena) { 53 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 54 | } 55 | 56 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 57 | 58 | /** 59 | * Invoke the upcall stub {@code funcPtr}, with given parameters 60 | */ 61 | public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) { 62 | try { 63 | return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1); 64 | } catch (Throwable ex$) { 65 | throw new AssertionError("should not reach here", ex$); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/avcodec_default_execute2$func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int (*func)(AVCodecContext *, void *, int, int) 18 | * } 19 | */ 20 | public class avcodec_default_execute2$func { 21 | 22 | avcodec_default_execute2$func() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment _x0, MemorySegment _x1, int _x2, int _x3); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_INT, 38 | Libffmpeg.C_INT 39 | ); 40 | 41 | /** 42 | * The descriptor of this function pointer 43 | */ 44 | public static FunctionDescriptor descriptor() { 45 | return $DESC; 46 | } 47 | 48 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avcodec_default_execute2$func.Function.class, "apply", $DESC); 49 | 50 | /** 51 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 52 | * The lifetime of the returned segment is managed by {@code arena} 53 | */ 54 | public static MemorySegment allocate(avcodec_default_execute2$func.Function fi, Arena arena) { 55 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 56 | } 57 | 58 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 59 | 60 | /** 61 | * Invoke the upcall stub {@code funcPtr}, with given parameters 62 | */ 63 | public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2, int _x3) { 64 | try { 65 | return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); 66 | } catch (Throwable ex$) { 67 | throw new AssertionError("should not reach here", ex$); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/avfilter_action_func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (avfilter_action_func)(AVFilterContext *, void *, int, int) 18 | * } 19 | */ 20 | public class avfilter_action_func { 21 | 22 | avfilter_action_func() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment ctx, MemorySegment arg, int jobnr, int nb_jobs); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_INT, 38 | Libffmpeg.C_INT 39 | ); 40 | 41 | /** 42 | * The descriptor of this function pointer 43 | */ 44 | public static FunctionDescriptor descriptor() { 45 | return $DESC; 46 | } 47 | 48 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avfilter_action_func.Function.class, "apply", $DESC); 49 | 50 | /** 51 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 52 | * The lifetime of the returned segment is managed by {@code arena} 53 | */ 54 | public static MemorySegment allocate(avfilter_action_func.Function fi, Arena arena) { 55 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 56 | } 57 | 58 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 59 | 60 | /** 61 | * Invoke the upcall stub {@code funcPtr}, with given parameters 62 | */ 63 | public static int invoke(MemorySegment funcPtr,MemorySegment ctx, MemorySegment arg, int jobnr, int nb_jobs) { 64 | try { 65 | return (int) DOWN$MH.invokeExact(funcPtr, ctx, arg, jobnr, nb_jobs); 66 | } catch (Throwable ex$) { 67 | throw new AssertionError("should not reach here", ex$); 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/avfilter_execute_func.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * typedef int (avfilter_execute_func)(AVFilterContext *, avfilter_action_func *, void *, int *, int) 18 | * } 19 | */ 20 | public class avfilter_execute_func { 21 | 22 | avfilter_execute_func() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment ctx, MemorySegment func, MemorySegment arg, MemorySegment ret, int nb_jobs); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_POINTER, 38 | Libffmpeg.C_POINTER, 39 | Libffmpeg.C_INT 40 | ); 41 | 42 | /** 43 | * The descriptor of this function pointer 44 | */ 45 | public static FunctionDescriptor descriptor() { 46 | return $DESC; 47 | } 48 | 49 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avfilter_execute_func.Function.class, "apply", $DESC); 50 | 51 | /** 52 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 53 | * The lifetime of the returned segment is managed by {@code arena} 54 | */ 55 | public static MemorySegment allocate(avfilter_execute_func.Function fi, Arena arena) { 56 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 57 | } 58 | 59 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 60 | 61 | /** 62 | * Invoke the upcall stub {@code funcPtr}, with given parameters 63 | */ 64 | public static int invoke(MemorySegment funcPtr,MemorySegment ctx, MemorySegment func, MemorySegment arg, MemorySegment ret, int nb_jobs) { 65 | try { 66 | return (int) DOWN$MH.invokeExact(funcPtr, ctx, func, arg, ret, nb_jobs); 67 | } catch (Throwable ex$) { 68 | throw new AssertionError("should not reach here", ex$); 69 | } 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/avio_alloc_context$read_packet.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int (*read_packet)(void *, uint8_t *, int) 18 | * } 19 | */ 20 | public class avio_alloc_context$read_packet { 21 | 22 | avio_alloc_context$read_packet() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment _x0, MemorySegment _x1, int _x2); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avio_alloc_context$read_packet.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(avio_alloc_context$read_packet.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/avio_alloc_context$seek.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int64_t (*seek)(void *, int64_t, int) 18 | * } 19 | */ 20 | public class avio_alloc_context$seek { 21 | 22 | avio_alloc_context$seek() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | long apply(MemorySegment _x0, long _x1, int _x2); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_LONG_LONG, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_LONG_LONG, 37 | Libffmpeg.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avio_alloc_context$seek.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(avio_alloc_context$seek.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static long invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1, int _x2) { 63 | try { 64 | return (long) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/com/nextbreakpoint/ffmpeg4java/avio_alloc_context$write_packet.java: -------------------------------------------------------------------------------- 1 | // Generated by jextract 2 | 3 | package com.nextbreakpoint.ffmpeg4java; 4 | 5 | import java.lang.invoke.*; 6 | import java.lang.foreign.*; 7 | import java.nio.ByteOrder; 8 | import java.util.*; 9 | import java.util.function.*; 10 | import java.util.stream.*; 11 | 12 | import static java.lang.foreign.ValueLayout.*; 13 | import static java.lang.foreign.MemoryLayout.PathElement.*; 14 | 15 | /** 16 | * {@snippet lang=c : 17 | * int (*write_packet)(void *, uint8_t *, int) 18 | * } 19 | */ 20 | public class avio_alloc_context$write_packet { 21 | 22 | avio_alloc_context$write_packet() { 23 | // Should not be called directly 24 | } 25 | 26 | /** 27 | * The function pointer signature, expressed as a functional interface 28 | */ 29 | public interface Function { 30 | int apply(MemorySegment _x0, MemorySegment _x1, int _x2); 31 | } 32 | 33 | private static final FunctionDescriptor $DESC = FunctionDescriptor.of( 34 | Libffmpeg.C_INT, 35 | Libffmpeg.C_POINTER, 36 | Libffmpeg.C_POINTER, 37 | Libffmpeg.C_INT 38 | ); 39 | 40 | /** 41 | * The descriptor of this function pointer 42 | */ 43 | public static FunctionDescriptor descriptor() { 44 | return $DESC; 45 | } 46 | 47 | private static final MethodHandle UP$MH = Libffmpeg.upcallHandle(avio_alloc_context$write_packet.Function.class, "apply", $DESC); 48 | 49 | /** 50 | * Allocates a new upcall stub, whose implementation is defined by {@code fi}. 51 | * The lifetime of the returned segment is managed by {@code arena} 52 | */ 53 | public static MemorySegment allocate(avio_alloc_context$write_packet.Function fi, Arena arena) { 54 | return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); 55 | } 56 | 57 | private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); 58 | 59 | /** 60 | * Invoke the upcall stub {@code funcPtr}, with given parameters 61 | */ 62 | public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { 63 | try { 64 | return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); 65 | } catch (Throwable ex$) { 66 | throw new AssertionError("should not reach here", ex$); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module com.nextbreakpoint.ffmpeg4java { 2 | exports com.nextbreakpoint.ffmpeg4java; 3 | } -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/resources/META-INF/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2024, Andrea Medeghini 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of FFmpeg4Java nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /ffmpeg4java-windows/src/main/resources/META-INF/NOTICE.txt: -------------------------------------------------------------------------------- 1 | FFmpeg4Java is distributed as independent JAR files, one for each supported operating system. 2 | Each JAR file contains a native library which must be installed in the library path of the Java runtime. 3 | 4 | Please note that the native library is statically liked with FFmpeg library under the terms of GNU Lesser General Public License, version 2.1. 5 | You should have received a copy of the LGPL v2.1 license with FFmpeg4Java. See http://ffmpeg.org for more information about FFmpeg. 6 | -------------------------------------------------------------------------------- /legal/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2024, Andrea Medeghini 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of FFmpeg4Java nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /legal/NOTICE.txt: -------------------------------------------------------------------------------- 1 | FFmpeg4Java is distributed as independent JAR files, one for each supported operating system. 2 | Each JAR file contains a native library which must be installed in the library path of the Java runtime. 3 | 4 | Please note that the native library is statically liked with FFmpeg library under the terms of GNU Lesser General Public License, version 2.1. 5 | You should have received a copy of the LGPL v2.1 license with FFmpeg4Java. See http://ffmpeg.org for more information about FFmpeg. 6 | -------------------------------------------------------------------------------- /maven-version-rules.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | .*-alpha.* 8 | .*-beta.* 9 | .*-Beta.* 10 | .*-ea.* 11 | .*-RC.* 12 | .*-M.* 13 | 14 | --------------------------------------------------------------------------------