diff --git a/.circleci/scripts/binary_populate_env.sh b/.circleci/scripts/binary_populate_env.sh deleted file mode 100755 index 0a95c1424..000000000 --- a/.circleci/scripts/binary_populate_env.sh +++ /dev/null @@ -1,167 +0,0 @@ -#!/bin/bash -# Derived from https://github.com/pytorch/pytorch/blob/2c7df1360aa17d4a6d6726998eede3671bcb36ee/.circleci/scripts/binary_populate_env.sh -set -eux -o pipefail -export TZ=UTC - -tagged_version() { - # Grabs version from either the env variable CIRCLE_TAG - # or the pytorch git described version - if [[ "$OSTYPE" == "msys" ]]; then - GIT_DESCRIBE="git --git-dir ${WORK_DIR}/p/.git describe" - else - GIT_DESCRIBE="git --git-dir ${WORK_DIR}/pytorch/.git describe" - fi - if [[ -n "${CIRCLE_TAG:-}" ]]; then - echo "${CIRCLE_TAG}" - elif ${GIT_DESCRIBE} --exact --tags >/dev/null; then - ${GIT_DESCRIBE} --tags - else - return 1 - fi -} - -envfile="$WORK_DIR/env" -touch "$envfile" -chmod +x "$envfile" - -# Parse the BUILD_ENVIRONMENT to package type, python, and cuda -configs=($BUILD_ENVIRONMENT) -PACKAGE_TYPE="${configs[0]}" -DESIRED_PYTHON="${configs[1]}" -DESIRED_CUDA="${configs[2]}" -if [[ "${BUILD_FOR_SYSTEM:-}" == "windows" ]]; then - export DESIRED_DEVTOOLSET="" - export LIBTORCH_CONFIG="${configs[3]:-}" - if [[ "$LIBTORCH_CONFIG" == 'debug' ]]; then - export DEBUG=1 - fi -else - export DESIRED_DEVTOOLSET="${configs[3]:-}" -fi -if [[ "$PACKAGE_TYPE" == 'libtorch' ]]; then - export BUILD_PYTHONLESS=1 -fi - -# Pick docker image -DOCKER_IMAGE=${DOCKER_IMAGE:-} -if [[ -z "$DOCKER_IMAGE" ]]; then - if [[ "$PACKAGE_TYPE" == conda ]]; then - export DOCKER_IMAGE="pytorch/conda-cuda" - elif [[ "$DESIRED_CUDA" == cpu ]]; then - export DOCKER_IMAGE="pytorch/manylinux-builder:cpu" - else - export DOCKER_IMAGE="pytorch/manylinux-builder:${DESIRED_CUDA:2}" - fi -fi - -USE_GOLD_LINKER="OFF" -# GOLD linker can not be used if CUPTI is statically linked into PyTorch, see https://github.com/pytorch/pytorch/issues/57744 -if [[ ${DESIRED_CUDA} == "cpu" ]]; then - USE_GOLD_LINKER="ON" -fi - -# Default to nightly, since that's where this normally uploads to -PIP_UPLOAD_FOLDER='nightly/' -# We put this here so that OVERRIDE_PACKAGE_VERSION below can read from it -export DATE="$(date -u +%Y%m%d)" -#TODO: We should be pulling semver version from the base version.txt -BASE_BUILD_VERSION="1.11.0.dev$DATE" -# Change BASE_BUILD_VERSION to git tag when on a git tag -# Use 'git -C' to make doubly sure we're in the correct directory for checking -# the git tag -if tagged_version >/dev/null; then - # Switch upload folder to 'test/' if we are on a tag - PIP_UPLOAD_FOLDER='test/' - # Grab git tag, remove prefixed v and remove everything after - - # Used to clean up tags that are for release candidates like v1.6.0-rc1 - # Turns tag v1.6.0-rc1 -> v1.6.0 - BASE_BUILD_VERSION="$(tagged_version | sed -e 's/^v//' -e 's/-.*$//')" -fi -if [[ "$(uname)" == 'Darwin' ]] || [[ "$PACKAGE_TYPE" == conda ]]; then - export PYTORCH_BUILD_VERSION="${BASE_BUILD_VERSION}" -else - export PYTORCH_BUILD_VERSION="${BASE_BUILD_VERSION}+$DESIRED_CUDA" -fi -export PYTORCH_BUILD_NUMBER=1 - - -JAVA_HOME= -BUILD_JNI=OFF -if [[ "$PACKAGE_TYPE" == libtorch ]]; then - POSSIBLE_JAVA_HOMES=() - POSSIBLE_JAVA_HOMES+=(/usr/local) - POSSIBLE_JAVA_HOMES+=(/usr/lib/jvm/java-8-openjdk-amd64) - POSSIBLE_JAVA_HOMES+=(/Library/Java/JavaVirtualMachines/*.jdk/Contents/Home) - # Add the Windows-specific JNI path - POSSIBLE_JAVA_HOMES+=("$PWD/.circleci/windows-jni/") - for JH in "${POSSIBLE_JAVA_HOMES[@]}" ; do - if [[ -e "$JH/include/jni.h" ]] ; then - # Skip if we're not on Windows but haven't found a JAVA_HOME - if [[ "$JH" == "$PWD/.circleci/windows-jni/" && "$OSTYPE" != "msys" ]] ; then - break - fi - echo "Found jni.h under $JH" - JAVA_HOME="$JH" - BUILD_JNI=ON - break - fi - done - if [ -z "$JAVA_HOME" ]; then - echo "Did not find jni.h" - fi -fi - -cat >>"$envfile" <> "$envfile" -echo ' $* || (sleep 1 && $*) || (sleep 2 && $*) || (sleep 4 && $*) || (sleep 8 && $*)' >> "$envfile" -echo '}' >> "$envfile" -echo 'export -f retry' >> "$envfile" - -cat "$envfile" diff --git a/conda/install_conda.bat b/conda/install_conda.bat deleted file mode 100755 index 6052ad08b..000000000 --- a/conda/install_conda.bat +++ /dev/null @@ -1 +0,0 @@ -start /wait "" "%miniconda_exe%" /S /InstallationType=JustMe /RegisterPython=0 /AddToPath=0 /D=%tmp_conda% diff --git a/ffmpeg/README.md b/ffmpeg/README.md deleted file mode 100644 index 4267863b2..000000000 --- a/ffmpeg/README.md +++ /dev/null @@ -1,99 +0,0 @@ -# FFmpeg - -## Building - -To build just run: - -``` -./build.sh -``` - -This should give you a docker image with `devtoolset3` installed in order to keep binary size down. -Outputted binaries should be in the `output` folder - -## Pushing - -Once you have built the binaries push them with: - -``` -anaconda upload -u pytorch --force output/*/ffmpeg*.bz2 -``` - -If you do not have upload permissions, please ping @seemethere or @soumith to gain access - -## Licensing -FFmpeg was compiled without the GPL components enabled, thus being LGPL-licensed. The LICENSE notice is included as part of this repository and the compilation flags are described as follows: - -### Linux and Mac -Linux binaries were compiled using the [official FFmpeg source files](http://ffmpeg.org/releases/), and compiled with the following flags: - -``` ---disable-doc ---disable-openssl ---enable-avresample ---enable-gnutls ---enable-hardcoded-tables ---enable-libfreetype ---enable-libopenh264 ---enable-pic ---enable-pthreads ---enable-shared ---disable-static ---enable-version3 ---enable-zlib ---enable-libmp3lame -``` - -### Windows -Windows binaries are redistributed from the LGPL [Zeranoe FFmpeg Builds](http://ffmpeg.zeranoe.com/builds/), which define the following flags: - -``` ---disable-static - --enable-shared - --enable-version3 - --enable-sdl2 - --enable-fontconfig - --enable-gnutls - --enable-iconv - --enable-libass - --enable-libdav1d - --enable-libbluray - --enable-libfreetype - --enable-libmp3lame - --enable-libopencore-amrnb - --enable-libopencore-amrwb - --enable-libopenjpeg - --enable-libopus - --enable-libshine - --enable-libsnappy - --enable-libsoxr - --enable-libsrt - --enable-libtheora - --enable-libtwolame - --enable-libvpx - --enable-libwavpack - --enable-libwebp - --enable-libxml2 - --enable-libzimg - --enable-lzma - --enable-zlib - --enable-gmp - --enable-libvmaf - --enable-libvorbis - --enable-libvo-amrwbenc - --enable-libmysofa - --enable-libspeex - --enable-libaom - --enable-libgsm - --disable-w32threads - --enable-libmfx - --enable-ffnvcodec - --enable-cuda-llvm - --enable-cuvid - --enable-d3d11va - --enable-nvenc - --enable-nvdec - --enable-dxva2 - --enable-libopenmpt - --enable-amf -``` diff --git a/ffmpeg/build.sh b/ffmpeg/build.sh deleted file mode 100755 index 27bf422ac..000000000 --- a/ffmpeg/build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -eou pipefail - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -docker run --rm -i \ - -v $(git rev-parse --show-toplevel):/builder \ - -w /builder \ - "pytorch/conda-cuda:latest" \ - ffmpeg/build_ffmpeg.sh diff --git a/ffmpeg/build_ci.sh b/ffmpeg/build_ci.sh deleted file mode 100755 index a7d29f482..000000000 --- a/ffmpeg/build_ci.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -set e+x -echo "Getting git refs" - -git show-ref | while IFS=' ' read -r hash name; -do - echo "ref $name hash $hash" - test ! -e "${GIT_DIR:-.git}/$name" && echo $hash > "${GIT_DIR:-.git}/$name"; -done - -set -xou pipefail - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -git remote -v -git branch -git fetch origin - -FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff $DIR) -BASE_COMMIT=$(git show-ref refs/remotes/origin/master | awk '{print $1}') - -git merge-base --is-ancestor "${FOLDER_COMMIT}" "${BASE_COMMIT}" -COMMIT_SAME=$? - -set -exou pipefail - -mkdir -p "${DIR}/output/" -# This is so that circle's persist_to_workspace doesn't fail when builds don't run -touch "${DIR}/output/hello" - -if [ $COMMIT_SAME -eq 1 ]; then - echo "FFMpeg has changed" - if [[ "$(uname)" == Darwin ]]; then - echo $(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs - ls $(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs - export CONDA_BUILD_SYSROOT=$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk - fi - "${DIR}/build_ffmpeg.sh" -else - echo "No changes in FFmpeg" - exit 0; -fi diff --git a/ffmpeg/build_ffmpeg.sh b/ffmpeg/build_ffmpeg.sh deleted file mode 100755 index a33a66add..000000000 --- a/ffmpeg/build_ffmpeg.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -set -eou pipefail - -if [[ "$OSTYPE" == "msys" ]]; then - export FFMPEG_SHA="" - for FFMPEG_TARBALL in tmp/*.tar.gz; do - echo $FFMPEG_TARBALL - export FFMPEG_SHA=$(sha256sum $FFMPEG_TARBALL | awk '{print $1}') - echo $FFMPEG_SHA - done - -fi - -conda install -yq conda-build conda-verify -( - set -x - conda build --output-folder ffmpeg/output "ffmpeg/recipe" -) diff --git a/ffmpeg/recipe/LICENSE b/ffmpeg/recipe/LICENSE deleted file mode 100644 index 153d416dc..000000000 --- a/ffmpeg/recipe/LICENSE +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. \ No newline at end of file diff --git a/ffmpeg/recipe/bld.bat b/ffmpeg/recipe/bld.bat deleted file mode 100644 index ab11f2659..000000000 --- a/ffmpeg/recipe/bld.bat +++ /dev/null @@ -1,19 +0,0 @@ -@echo ON - -rem Copy over the bin, include and lib dirs -robocopy %SRC_DIR%\bin\ %LIBRARY_BIN%\ *.* /E /XC /XN /XO -if %ERRORLEVEL% GEQ 8 exit 1 - - -robocopy %SRC_DIR%\include\ %LIBRARY_INC%\ *.* /E -if %ERRORLEVEL% GEQ 8 exit 1 - -robocopy %SRC_DIR%\lib\ %LIBRARY_LIB%\ *.* /E -if %ERRORLEVEL% GEQ 8 exit 1 - -rem Add the licences to the recipe directory -copy "%SRC_DIR%\README.txt" "%RECIPE_DIR%" -mkdir "%RECIPE_DIR%\licenses" -copy "%SRC_DIR%\licenses" "%RECIPE_DIR%\licenses" - -exit 0 diff --git a/ffmpeg/recipe/build.sh b/ffmpeg/recipe/build.sh deleted file mode 100644 index 9b82c6553..000000000 --- a/ffmpeg/recipe/build.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# unset the SUBDIR variable since it changes the behavior of make here -unset SUBDIR - -if [[ "$(uname)" == Darwin ]]; then - export CONDA_BUILD_SYSROOT=$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -fi - -./configure \ - --prefix="${PREFIX}" \ - --cc=${CC} \ - --disable-doc \ - --disable-openssl \ - --enable-avresample \ - --enable-gnutls \ - --enable-hardcoded-tables \ - --enable-libfreetype \ - --enable-libopenh264 \ - --enable-pic \ - --enable-pthreads \ - --enable-shared \ - --disable-static \ - --enable-version3 \ - --enable-zlib \ - --enable-libmp3lame - -make -j${CPU_COUNT} -make install -j${CPU_COUNT} diff --git a/ffmpeg/recipe/meta.yaml b/ffmpeg/recipe/meta.yaml deleted file mode 100644 index 496ebb92e..000000000 --- a/ffmpeg/recipe/meta.yaml +++ /dev/null @@ -1,84 +0,0 @@ -{% set version = "4.2" %} - -package: - name: ffmpeg - version: {{ version }} - -source: - - url: https://ffmpeg.org/releases/ffmpeg-{{ version }}.tar.gz # [not win] - sha256: 9353228c2a397d1c62df7ca16033ec8a0cd2b12296de83a1c74948fe7395bb87 # [not win] - - - url: file:///c:/Users/circleci/project/tmp/ffmpeg-{{ version }}-win64-shared-dev-lgpl.tar.gz # [win] - sha256: "{{ environ.get('FFMPEG_SHA') }}" # [win] - -build: - number: 1 - run_exports: - # seems to be minor version compatibility - # https://abi-laboratory.pro/tracker/timeline/ffmpeg/ - - {{ pin_subpackage('ffmpeg', max_pin='x.x') }} - -requirements: - build: - - {{ compiler("c") }} - - {{ compiler("cxx") }} - - pkg-config # [not win] - - libtool # [not win] - - nasm # [not win] - - lame # [not win] - - make # [not win] - host: - - bzip2 - - libpng - - freetype - - gnutls # [not win] - - libiconv - - zlib - - openh264 # [not win] - - lame # [not win] - - gmp # [unix] - - nettle # [not win] - run: - - bzip2 - - libpng - - freetype - - gnutls # [not win] - - libiconv - - zlib - - openh264 # [not win] - - lame # [not win] - - gmp # [unix] - - nettle # [not win] - -test: - commands: - - ffmpeg --help - - ffmpeg -loglevel panic -protocols | grep "https" # [not win] - - ffmpeg -loglevel panic -codecs | grep "libmp3lame" # [not win] - - ffmpeg -loglevel panic -codecs | grep "DEVI.S zlib" # [unix] - - ffmpeg -loglevel panic -codecs | grep "DEV.LS h264" # [unix] - - ffmpeg -loglevel panic -codecs | grep "libopenh264" # [unix] - # Verify dynamic libraries on all systems - {% set ffmpeg_libs = [ - "avcodec", - "avdevice", - "swresample", - "avfilter", - "swresample", - "avcodec", - "avformat", - "swscale", - "avresample" - ] %} - {% for each_ffmpeg_lib in ffmpeg_libs %} - - test -f $PREFIX/lib/lib{{ each_ffmpeg_lib }}.dylib # [osx] - - test -f $PREFIX/lib/lib{{ each_ffmpeg_lib }}.so # [linux] - {% endfor %} - - conda inspect linkages -p $PREFIX $PKG_NAME # [not win] - - conda inspect objects -p $PREFIX $PKG_NAME # [osx] - -about: - home: http://www.ffmpeg.org/ - license: LGPL - license_file: COPYING.LGPLv2.1 # [unix] - summary: Cross-platform solution to record, convert and stream audio and video. diff --git a/ffmpeg/win/Dockerfile b/ffmpeg/win/Dockerfile deleted file mode 100644 index d9ab1f127..000000000 --- a/ffmpeg/win/Dockerfile +++ /dev/null @@ -1,46 +0,0 @@ -# Base docker image for cross-compilling FFmpeg (LGPL) for Windows -FROM pytorch/manylinux-builder:cuda101 -COPY . /ffmpeg-build-src -WORKDIR /ffmpeg-build-src - -# Install required system libraries -RUN yum install epel-release -RUN yum install -y \ - autoconf \ - automake \ - bash \ - bison \ - bzip2 \ - flex \ - gcc-c++ \ - gdk-pixbuf2-devel \ - gettext \ - git \ - gperf \ - intltool \ - libtool \ - lzip \ - make \ - openssl \ - openssl-devel \ - p7zip \ - patch \ - perl \ - python \ - ruby \ - sed \ - unzip \ - wget \ - xz \ - nano - -# Update automake to 1.15 -RUN wget https://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz -RUN tar -xzvf automake-1.15.tar.gz -RUN cd automake-1.15.tar.gz && ./configure && make && make install - -# Create MXE environment and install packages -RUN bash build_mxe.sh - -# Compile and install OpenH264 -RUN bash build_openh264.sh diff --git a/ffmpeg/win/LICENSE b/ffmpeg/win/LICENSE deleted file mode 100644 index d41351094..000000000 --- a/ffmpeg/win/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Edgar Andrés Margffoy Tuay - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/ffmpeg/win/README.md b/ffmpeg/win/README.md deleted file mode 100644 index 51bf7e04b..000000000 --- a/ffmpeg/win/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# ffmpeg-win-lgpl -MXE-based cross-compilation workflow for producing FFMpeg LGPL binaries for Windows on Linux. - -## Overview -This repository provides LGPL binary distributions of FFMpeg for Windows. The compilation is based on the [M cross environment](https://github.com/mxe/mxe) (MXE) to compile the binaries from Linux. The compilation is performed on a CentOS 7 Docker image to ensure manylinux compatibility on Python. - -## Docker image -We provide a Docker image with all the MXE packages already compiled at `andfoy/ffmpeg-win-lgpl`, however it is possible to build the image from scratch: - -```bash -docker build --tag ffmpeg-win-lgpl . -``` - -**Note:** Because MXE compiles all the binary dependencies required to build FFmpeg from scratch, this process may take more than two hours depending on your machine. - -## Compilling FFmpeg -To compile FFmpeg, it is possible to execute the ``build_ffmpeg.sh`` script found at the root of this repository using the corresponding Docker image: - -```bash -mkdir ffmpeg_output -docker run --rm -i \ --v $(pwd)/ffmpeg_output:ffmpeg-build-src/ffmpeg_output \ -"andfoy/ffmpeg-win-lgpl" \ -build_ffmpeg.sh -``` - -### Compilation flags -This distribution of FFmpeg is LGPL-compliant and it is compiled with the following flags: - -``` ---disable-doc ---disable-openssl ---enable-avresample ---enable-gnutls ---enable-hardcoded-tables ---enable-libfreetype ---enable-libopenh264 ---enable-pic ---disable-w32threads ---enable-shared ---disable-static ---enable-version3 ---enable-zlib ---enable-libmp3lame -``` diff --git a/ffmpeg/win/build_ffmpeg.sh b/ffmpeg/win/build_ffmpeg.sh deleted file mode 100644 index f5fbe5be7..000000000 --- a/ffmpeg/win/build_ffmpeg.sh +++ /dev/null @@ -1,73 +0,0 @@ -#! /bin/bash -set -exou - -# Create output folder -mkdir -p ffmpeg_output - -# Set MXE environment variables -export PATH=$(pwd)/mxe/usr/bin:$(pwd)/mxe/usr/x86_64-pc-linux-gnu/bin:$PATH -MXE_DIR=$(pwd)/mxe/usr/x86_64-w64-mingw32.shared - -# Download FFmpeg -wget https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.gz -tar -xvzf ffmpeg-$FFMPEG_VERSION.tar.gz -pushd ffmpeg-$FFMPEG_VERSION - -# Configure FFmpeg -./configure \ ---arch=x86_64 \ ---target-os=mingw32 \ ---cross-prefix=x86_64-w64-mingw32.shared- \ ---disable-doc \ ---disable-openssl \ ---enable-avresample \ ---enable-gnutls \ ---enable-hardcoded-tables \ ---enable-libfreetype \ ---enable-libopenh264 \ ---enable-pic \ ---disable-w32threads \ ---enable-shared \ ---disable-static \ ---enable-version3 \ ---enable-zlib \ ---enable-libmp3lame - -# Compile FFmpeg -make -j$(nproc) - -# Install FFmpeg to output folder -make DESTDIR=../ffmpeg_output install -cp COPYING.LGPLv3 ../ffmpeg_output/LICENSE -popd - -# Rearrange binary distribution -pushd ffmpeg_output -mv usr/local/* . -rm -rf usr -mv bin/*.lib lib/ - -# Copy all dependent DLLs -copy_dependent_dlls() { - for d in $(peldd $1); do - echo "$f: $d" - if [[ -f "$(pwd)/$d" ]]; then - echo "Library $d is already part of FFmpeg" - else - for l in $(find $MXE_DIR -name $d); do - echo "Library $d found at: $l" - cp $l . - copy_dependent_dlls $l - done - fi - done -} - -pushd bin/ -for f in *.{dll,exe}; do - copy_dependent_dlls $f -done -popd - -# Compress FFMpeg distribution -tar -cvzf ffmpeg-$FFMPEG_VERSION-win64-shared-dev-lgpl.tar.gz * diff --git a/ffmpeg/win/build_mxe.sh b/ffmpeg/win/build_mxe.sh deleted file mode 100644 index f90dd5fb1..000000000 --- a/ffmpeg/win/build_mxe.sh +++ /dev/null @@ -1,52 +0,0 @@ -#! /bin/bash -# ---- Clone MXE ----- -git clone https://github.com/mxe/mxe.git -pushd mxe - -# ---- Install FFmpeg dependencies ----- -# CMake -make MXE_TARGETS="x86_64-w64-mingw32.shared" cmake - -# bzip2 -make MXE_TARGETS="x86_64-w64-mingw32.shared" bzip2 - -# libiconv -make MXE_TARGETS="x86_64-w64-mingw32.shared" libiconv - -# YASM -make MXE_TARGETS="x86_64-w64-mingw32.shared" yasm - -# NASM -make MXE_TARGETS="x86_64-w64-mingw32.shared" nasm - -# OpenSSL -make MXE_TARGETS="x86_64-w64-mingw32.shared" openssl - -# SDL2 -make MXE_TARGETS="x86_64-w64-mingw32.shared" sdl2 - -# ZLib -make MXE_TARGETS="x86_64-w64-mingw32.shared" zlib - -# FreeType -make MXE_TARGETS="x86_64-w64-mingw32.shared" freetype - -# Vorbis -make MXE_TARGETS="x86_64-w64-mingw32.shared" vorbis - -# Theora -make MXE_TARGETS="x86_64-w64-mingw32.shared" theora - -# TurboJPEG -make MXE_TARGETS="x86_64-w64-mingw32.shared" libjpeg-turbo - -# LibPNG -make MXE_TARGETS="x86_64-w64-mingw32.shared" libpng - -# LAME -make MXE_TARGETS="x86_64-w64-mingw32.shared" lame - -# GNU TLS -make MXE_TARGETS="x86_64-w64-mingw32.shared" gnutls - -popd diff --git a/ffmpeg/win/build_openh264.sh b/ffmpeg/win/build_openh264.sh deleted file mode 100644 index 04f736224..000000000 --- a/ffmpeg/win/build_openh264.sh +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/bash - -export PATH=$(pwd)/mxe/usr/bin:$(pwd)/mxe/usr/x86_64-pc-linux-gnu/bin:$PATH - -# Clone OpenH264 -git clone https://github.com/cisco/openh264.git -pushd openh264 - -# Compile OpenH264 -make \ -OS=mingw_nt \ -ARCH=x86_64 \ -CC=x86_64-w64-mingw32.shared-gcc \ -CXX=x86_64-w64-mingw32.shared-g++ \ -AR=x86_64-w64-mingw32.shared-ar - -# Install OpenH264 -make \ -OS=mingw_nt \ -ARCH=x86_64 \ -CC=x86_64-w64-mingw32.shared-gcc \ -MXE_TARGETS="x86_64-w64-mingw32.shared" \ -DESTDIR=../mxe/usr/x86_64-w64-mingw32.shared/ \ -install - -popd - -# Apply pkgconfig patch -pushd mxe/usr/x86_64-w64-mingw32.shared/usr/local/lib/pkgconfig -patch openh264.pc < /ffmpeg-build-src/openh264.pc.patch -popd - -cp \ -mxe/usr/x86_64-w64-mingw32.shared/usr/local/lib/pkgconfig/openh264.pc \ -mxe/usr/x86_64-w64-mingw32.shared/lib/pkgconfig/ diff --git a/ffmpeg/win/openh264.pc.patch b/ffmpeg/win/openh264.pc.patch deleted file mode 100644 index f82f24fa7..000000000 --- a/ffmpeg/win/openh264.pc.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- openh264.pc.bak 2020-10-07 03:05:43.475152908 +0000 -+++ openh264.pc 2020-10-07 03:06:32.871410433 +0000 -@@ -1,5 +1,5 @@ --prefix=/usr/local --libdir=/usr/local/lib -+prefix=/ffmpeg-build-src/mxe/usr/x86_64-w64-mingw32.shared/usr/local -+libdir=/ffmpeg-build-src/mxe/usr/x86_64-w64-mingw32.shared/usr/local/lib - includedir=${prefix}/include - - Name: OpenH264 diff --git a/java/jni.h b/java/jni.h deleted file mode 100644 index 4c343139e..000000000 --- a/java/jni.h +++ /dev/null @@ -1,1143 +0,0 @@ -/* - * Copyright (C) 2006 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * JNI specification, as defined by Sun: - * http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.html - * - * Everything here is expected to be VM-neutral. - */ - -#ifndef JNI_H_ -#define JNI_H_ - -#include -#include - -/* Primitive types that match up with Java equivalents. */ -typedef uint8_t jboolean; /* unsigned 8 bits */ -typedef int8_t jbyte; /* signed 8 bits */ -typedef uint16_t jchar; /* unsigned 16 bits */ -typedef int16_t jshort; /* signed 16 bits */ -typedef int32_t jint; /* signed 32 bits */ -typedef int64_t jlong; /* signed 64 bits */ -typedef float jfloat; /* 32-bit IEEE 754 */ -typedef double jdouble; /* 64-bit IEEE 754 */ - -/* "cardinal indices and sizes" */ -typedef jint jsize; - -#ifdef __cplusplus -/* - * Reference types, in C++ - */ -class _jobject {}; -class _jclass : public _jobject {}; -class _jstring : public _jobject {}; -class _jarray : public _jobject {}; -class _jobjectArray : public _jarray {}; -class _jbooleanArray : public _jarray {}; -class _jbyteArray : public _jarray {}; -class _jcharArray : public _jarray {}; -class _jshortArray : public _jarray {}; -class _jintArray : public _jarray {}; -class _jlongArray : public _jarray {}; -class _jfloatArray : public _jarray {}; -class _jdoubleArray : public _jarray {}; -class _jthrowable : public _jobject {}; - -typedef _jobject* jobject; -typedef _jclass* jclass; -typedef _jstring* jstring; -typedef _jarray* jarray; -typedef _jobjectArray* jobjectArray; -typedef _jbooleanArray* jbooleanArray; -typedef _jbyteArray* jbyteArray; -typedef _jcharArray* jcharArray; -typedef _jshortArray* jshortArray; -typedef _jintArray* jintArray; -typedef _jlongArray* jlongArray; -typedef _jfloatArray* jfloatArray; -typedef _jdoubleArray* jdoubleArray; -typedef _jthrowable* jthrowable; -typedef _jobject* jweak; - - -#else /* not __cplusplus */ - -/* - * Reference types, in C. - */ -typedef void* jobject; -typedef jobject jclass; -typedef jobject jstring; -typedef jobject jarray; -typedef jarray jobjectArray; -typedef jarray jbooleanArray; -typedef jarray jbyteArray; -typedef jarray jcharArray; -typedef jarray jshortArray; -typedef jarray jintArray; -typedef jarray jlongArray; -typedef jarray jfloatArray; -typedef jarray jdoubleArray; -typedef jobject jthrowable; -typedef jobject jweak; - -#endif /* not __cplusplus */ - -struct _jfieldID; /* opaque structure */ -typedef struct _jfieldID* jfieldID; /* field IDs */ - -struct _jmethodID; /* opaque structure */ -typedef struct _jmethodID* jmethodID; /* method IDs */ - -struct JNIInvokeInterface; - -typedef union jvalue { - jboolean z; - jbyte b; - jchar c; - jshort s; - jint i; - jlong j; - jfloat f; - jdouble d; - jobject l; -} jvalue; - -typedef enum jobjectRefType { - JNIInvalidRefType = 0, - JNILocalRefType = 1, - JNIGlobalRefType = 2, - JNIWeakGlobalRefType = 3 -} jobjectRefType; - -typedef struct { - const char* name; - const char* signature; - void* fnPtr; -} JNINativeMethod; - -struct _JNIEnv; -struct _JavaVM; -typedef const struct JNINativeInterface* C_JNIEnv; - -#if defined(__cplusplus) -typedef _JNIEnv JNIEnv; -typedef _JavaVM JavaVM; -#else -typedef const struct JNINativeInterface* JNIEnv; -typedef const struct JNIInvokeInterface* JavaVM; -#endif - -/* - * Table of interface function pointers. - */ -struct JNINativeInterface { - void* reserved0; - void* reserved1; - void* reserved2; - void* reserved3; - - jint (*GetVersion)(JNIEnv *); - - jclass (*DefineClass)(JNIEnv*, const char*, jobject, const jbyte*, - jsize); - jclass (*FindClass)(JNIEnv*, const char*); - - jmethodID (*FromReflectedMethod)(JNIEnv*, jobject); - jfieldID (*FromReflectedField)(JNIEnv*, jobject); - /* spec doesn't show jboolean parameter */ - jobject (*ToReflectedMethod)(JNIEnv*, jclass, jmethodID, jboolean); - - jclass (*GetSuperclass)(JNIEnv*, jclass); - jboolean (*IsAssignableFrom)(JNIEnv*, jclass, jclass); - - /* spec doesn't show jboolean parameter */ - jobject (*ToReflectedField)(JNIEnv*, jclass, jfieldID, jboolean); - - jint (*Throw)(JNIEnv*, jthrowable); - jint (*ThrowNew)(JNIEnv *, jclass, const char *); - jthrowable (*ExceptionOccurred)(JNIEnv*); - void (*ExceptionDescribe)(JNIEnv*); - void (*ExceptionClear)(JNIEnv*); - void (*FatalError)(JNIEnv*, const char*); - - jint (*PushLocalFrame)(JNIEnv*, jint); - jobject (*PopLocalFrame)(JNIEnv*, jobject); - - jobject (*NewGlobalRef)(JNIEnv*, jobject); - void (*DeleteGlobalRef)(JNIEnv*, jobject); - void (*DeleteLocalRef)(JNIEnv*, jobject); - jboolean (*IsSameObject)(JNIEnv*, jobject, jobject); - - jobject (*NewLocalRef)(JNIEnv*, jobject); - jint (*EnsureLocalCapacity)(JNIEnv*, jint); - - jobject (*AllocObject)(JNIEnv*, jclass); - jobject (*NewObject)(JNIEnv*, jclass, jmethodID, ...); - jobject (*NewObjectV)(JNIEnv*, jclass, jmethodID, va_list); - jobject (*NewObjectA)(JNIEnv*, jclass, jmethodID, const jvalue*); - - jclass (*GetObjectClass)(JNIEnv*, jobject); - jboolean (*IsInstanceOf)(JNIEnv*, jobject, jclass); - jmethodID (*GetMethodID)(JNIEnv*, jclass, const char*, const char*); - - jobject (*CallObjectMethod)(JNIEnv*, jobject, jmethodID, ...); - jobject (*CallObjectMethodV)(JNIEnv*, jobject, jmethodID, va_list); - jobject (*CallObjectMethodA)(JNIEnv*, jobject, jmethodID, const jvalue*); - jboolean (*CallBooleanMethod)(JNIEnv*, jobject, jmethodID, ...); - jboolean (*CallBooleanMethodV)(JNIEnv*, jobject, jmethodID, va_list); - jboolean (*CallBooleanMethodA)(JNIEnv*, jobject, jmethodID, const jvalue*); - jbyte (*CallByteMethod)(JNIEnv*, jobject, jmethodID, ...); - jbyte (*CallByteMethodV)(JNIEnv*, jobject, jmethodID, va_list); - jbyte (*CallByteMethodA)(JNIEnv*, jobject, jmethodID, const jvalue*); - jchar (*CallCharMethod)(JNIEnv*, jobject, jmethodID, ...); - jchar (*CallCharMethodV)(JNIEnv*, jobject, jmethodID, va_list); - jchar (*CallCharMethodA)(JNIEnv*, jobject, jmethodID, const jvalue*); - jshort (*CallShortMethod)(JNIEnv*, jobject, jmethodID, ...); - jshort (*CallShortMethodV)(JNIEnv*, jobject, jmethodID, va_list); - jshort (*CallShortMethodA)(JNIEnv*, jobject, jmethodID, const jvalue*); - jint (*CallIntMethod)(JNIEnv*, jobject, jmethodID, ...); - jint (*CallIntMethodV)(JNIEnv*, jobject, jmethodID, va_list); - jint (*CallIntMethodA)(JNIEnv*, jobject, jmethodID, const jvalue*); - jlong (*CallLongMethod)(JNIEnv*, jobject, jmethodID, ...); - jlong (*CallLongMethodV)(JNIEnv*, jobject, jmethodID, va_list); - jlong (*CallLongMethodA)(JNIEnv*, jobject, jmethodID, const jvalue*); - jfloat (*CallFloatMethod)(JNIEnv*, jobject, jmethodID, ...); - jfloat (*CallFloatMethodV)(JNIEnv*, jobject, jmethodID, va_list); - jfloat (*CallFloatMethodA)(JNIEnv*, jobject, jmethodID, const jvalue*); - jdouble (*CallDoubleMethod)(JNIEnv*, jobject, jmethodID, ...); - jdouble (*CallDoubleMethodV)(JNIEnv*, jobject, jmethodID, va_list); - jdouble (*CallDoubleMethodA)(JNIEnv*, jobject, jmethodID, const jvalue*); - void (*CallVoidMethod)(JNIEnv*, jobject, jmethodID, ...); - void (*CallVoidMethodV)(JNIEnv*, jobject, jmethodID, va_list); - void (*CallVoidMethodA)(JNIEnv*, jobject, jmethodID, const jvalue*); - - jobject (*CallNonvirtualObjectMethod)(JNIEnv*, jobject, jclass, - jmethodID, ...); - jobject (*CallNonvirtualObjectMethodV)(JNIEnv*, jobject, jclass, - jmethodID, va_list); - jobject (*CallNonvirtualObjectMethodA)(JNIEnv*, jobject, jclass, - jmethodID, const jvalue*); - jboolean (*CallNonvirtualBooleanMethod)(JNIEnv*, jobject, jclass, - jmethodID, ...); - jboolean (*CallNonvirtualBooleanMethodV)(JNIEnv*, jobject, jclass, - jmethodID, va_list); - jboolean (*CallNonvirtualBooleanMethodA)(JNIEnv*, jobject, jclass, - jmethodID, const jvalue*); - jbyte (*CallNonvirtualByteMethod)(JNIEnv*, jobject, jclass, - jmethodID, ...); - jbyte (*CallNonvirtualByteMethodV)(JNIEnv*, jobject, jclass, - jmethodID, va_list); - jbyte (*CallNonvirtualByteMethodA)(JNIEnv*, jobject, jclass, - jmethodID, const jvalue*); - jchar (*CallNonvirtualCharMethod)(JNIEnv*, jobject, jclass, - jmethodID, ...); - jchar (*CallNonvirtualCharMethodV)(JNIEnv*, jobject, jclass, - jmethodID, va_list); - jchar (*CallNonvirtualCharMethodA)(JNIEnv*, jobject, jclass, - jmethodID, const jvalue*); - jshort (*CallNonvirtualShortMethod)(JNIEnv*, jobject, jclass, - jmethodID, ...); - jshort (*CallNonvirtualShortMethodV)(JNIEnv*, jobject, jclass, - jmethodID, va_list); - jshort (*CallNonvirtualShortMethodA)(JNIEnv*, jobject, jclass, - jmethodID, const jvalue*); - jint (*CallNonvirtualIntMethod)(JNIEnv*, jobject, jclass, - jmethodID, ...); - jint (*CallNonvirtualIntMethodV)(JNIEnv*, jobject, jclass, - jmethodID, va_list); - jint (*CallNonvirtualIntMethodA)(JNIEnv*, jobject, jclass, - jmethodID, const jvalue*); - jlong (*CallNonvirtualLongMethod)(JNIEnv*, jobject, jclass, - jmethodID, ...); - jlong (*CallNonvirtualLongMethodV)(JNIEnv*, jobject, jclass, - jmethodID, va_list); - jlong (*CallNonvirtualLongMethodA)(JNIEnv*, jobject, jclass, - jmethodID, const jvalue*); - jfloat (*CallNonvirtualFloatMethod)(JNIEnv*, jobject, jclass, - jmethodID, ...); - jfloat (*CallNonvirtualFloatMethodV)(JNIEnv*, jobject, jclass, - jmethodID, va_list); - jfloat (*CallNonvirtualFloatMethodA)(JNIEnv*, jobject, jclass, - jmethodID, const jvalue*); - jdouble (*CallNonvirtualDoubleMethod)(JNIEnv*, jobject, jclass, - jmethodID, ...); - jdouble (*CallNonvirtualDoubleMethodV)(JNIEnv*, jobject, jclass, - jmethodID, va_list); - jdouble (*CallNonvirtualDoubleMethodA)(JNIEnv*, jobject, jclass, - jmethodID, const jvalue*); - void (*CallNonvirtualVoidMethod)(JNIEnv*, jobject, jclass, - jmethodID, ...); - void (*CallNonvirtualVoidMethodV)(JNIEnv*, jobject, jclass, - jmethodID, va_list); - void (*CallNonvirtualVoidMethodA)(JNIEnv*, jobject, jclass, - jmethodID, const jvalue*); - - jfieldID (*GetFieldID)(JNIEnv*, jclass, const char*, const char*); - - jobject (*GetObjectField)(JNIEnv*, jobject, jfieldID); - jboolean (*GetBooleanField)(JNIEnv*, jobject, jfieldID); - jbyte (*GetByteField)(JNIEnv*, jobject, jfieldID); - jchar (*GetCharField)(JNIEnv*, jobject, jfieldID); - jshort (*GetShortField)(JNIEnv*, jobject, jfieldID); - jint (*GetIntField)(JNIEnv*, jobject, jfieldID); - jlong (*GetLongField)(JNIEnv*, jobject, jfieldID); - jfloat (*GetFloatField)(JNIEnv*, jobject, jfieldID); - jdouble (*GetDoubleField)(JNIEnv*, jobject, jfieldID); - - void (*SetObjectField)(JNIEnv*, jobject, jfieldID, jobject); - void (*SetBooleanField)(JNIEnv*, jobject, jfieldID, jboolean); - void (*SetByteField)(JNIEnv*, jobject, jfieldID, jbyte); - void (*SetCharField)(JNIEnv*, jobject, jfieldID, jchar); - void (*SetShortField)(JNIEnv*, jobject, jfieldID, jshort); - void (*SetIntField)(JNIEnv*, jobject, jfieldID, jint); - void (*SetLongField)(JNIEnv*, jobject, jfieldID, jlong); - void (*SetFloatField)(JNIEnv*, jobject, jfieldID, jfloat); - void (*SetDoubleField)(JNIEnv*, jobject, jfieldID, jdouble); - - jmethodID (*GetStaticMethodID)(JNIEnv*, jclass, const char*, const char*); - - jobject (*CallStaticObjectMethod)(JNIEnv*, jclass, jmethodID, ...); - jobject (*CallStaticObjectMethodV)(JNIEnv*, jclass, jmethodID, va_list); - jobject (*CallStaticObjectMethodA)(JNIEnv*, jclass, jmethodID, const jvalue*); - jboolean (*CallStaticBooleanMethod)(JNIEnv*, jclass, jmethodID, ...); - jboolean (*CallStaticBooleanMethodV)(JNIEnv*, jclass, jmethodID, - va_list); - jboolean (*CallStaticBooleanMethodA)(JNIEnv*, jclass, jmethodID, const jvalue*); - jbyte (*CallStaticByteMethod)(JNIEnv*, jclass, jmethodID, ...); - jbyte (*CallStaticByteMethodV)(JNIEnv*, jclass, jmethodID, va_list); - jbyte (*CallStaticByteMethodA)(JNIEnv*, jclass, jmethodID, const jvalue*); - jchar (*CallStaticCharMethod)(JNIEnv*, jclass, jmethodID, ...); - jchar (*CallStaticCharMethodV)(JNIEnv*, jclass, jmethodID, va_list); - jchar (*CallStaticCharMethodA)(JNIEnv*, jclass, jmethodID, const jvalue*); - jshort (*CallStaticShortMethod)(JNIEnv*, jclass, jmethodID, ...); - jshort (*CallStaticShortMethodV)(JNIEnv*, jclass, jmethodID, va_list); - jshort (*CallStaticShortMethodA)(JNIEnv*, jclass, jmethodID, const jvalue*); - jint (*CallStaticIntMethod)(JNIEnv*, jclass, jmethodID, ...); - jint (*CallStaticIntMethodV)(JNIEnv*, jclass, jmethodID, va_list); - jint (*CallStaticIntMethodA)(JNIEnv*, jclass, jmethodID, const jvalue*); - jlong (*CallStaticLongMethod)(JNIEnv*, jclass, jmethodID, ...); - jlong (*CallStaticLongMethodV)(JNIEnv*, jclass, jmethodID, va_list); - jlong (*CallStaticLongMethodA)(JNIEnv*, jclass, jmethodID, const jvalue*); - jfloat (*CallStaticFloatMethod)(JNIEnv*, jclass, jmethodID, ...); - jfloat (*CallStaticFloatMethodV)(JNIEnv*, jclass, jmethodID, va_list); - jfloat (*CallStaticFloatMethodA)(JNIEnv*, jclass, jmethodID, const jvalue*); - jdouble (*CallStaticDoubleMethod)(JNIEnv*, jclass, jmethodID, ...); - jdouble (*CallStaticDoubleMethodV)(JNIEnv*, jclass, jmethodID, va_list); - jdouble (*CallStaticDoubleMethodA)(JNIEnv*, jclass, jmethodID, const jvalue*); - void (*CallStaticVoidMethod)(JNIEnv*, jclass, jmethodID, ...); - void (*CallStaticVoidMethodV)(JNIEnv*, jclass, jmethodID, va_list); - void (*CallStaticVoidMethodA)(JNIEnv*, jclass, jmethodID, const jvalue*); - - jfieldID (*GetStaticFieldID)(JNIEnv*, jclass, const char*, - const char*); - - jobject (*GetStaticObjectField)(JNIEnv*, jclass, jfieldID); - jboolean (*GetStaticBooleanField)(JNIEnv*, jclass, jfieldID); - jbyte (*GetStaticByteField)(JNIEnv*, jclass, jfieldID); - jchar (*GetStaticCharField)(JNIEnv*, jclass, jfieldID); - jshort (*GetStaticShortField)(JNIEnv*, jclass, jfieldID); - jint (*GetStaticIntField)(JNIEnv*, jclass, jfieldID); - jlong (*GetStaticLongField)(JNIEnv*, jclass, jfieldID); - jfloat (*GetStaticFloatField)(JNIEnv*, jclass, jfieldID); - jdouble (*GetStaticDoubleField)(JNIEnv*, jclass, jfieldID); - - void (*SetStaticObjectField)(JNIEnv*, jclass, jfieldID, jobject); - void (*SetStaticBooleanField)(JNIEnv*, jclass, jfieldID, jboolean); - void (*SetStaticByteField)(JNIEnv*, jclass, jfieldID, jbyte); - void (*SetStaticCharField)(JNIEnv*, jclass, jfieldID, jchar); - void (*SetStaticShortField)(JNIEnv*, jclass, jfieldID, jshort); - void (*SetStaticIntField)(JNIEnv*, jclass, jfieldID, jint); - void (*SetStaticLongField)(JNIEnv*, jclass, jfieldID, jlong); - void (*SetStaticFloatField)(JNIEnv*, jclass, jfieldID, jfloat); - void (*SetStaticDoubleField)(JNIEnv*, jclass, jfieldID, jdouble); - - jstring (*NewString)(JNIEnv*, const jchar*, jsize); - jsize (*GetStringLength)(JNIEnv*, jstring); - const jchar* (*GetStringChars)(JNIEnv*, jstring, jboolean*); - void (*ReleaseStringChars)(JNIEnv*, jstring, const jchar*); - jstring (*NewStringUTF)(JNIEnv*, const char*); - jsize (*GetStringUTFLength)(JNIEnv*, jstring); - /* JNI spec says this returns const jbyte*, but that's inconsistent */ - const char* (*GetStringUTFChars)(JNIEnv*, jstring, jboolean*); - void (*ReleaseStringUTFChars)(JNIEnv*, jstring, const char*); - jsize (*GetArrayLength)(JNIEnv*, jarray); - jobjectArray (*NewObjectArray)(JNIEnv*, jsize, jclass, jobject); - jobject (*GetObjectArrayElement)(JNIEnv*, jobjectArray, jsize); - void (*SetObjectArrayElement)(JNIEnv*, jobjectArray, jsize, jobject); - - jbooleanArray (*NewBooleanArray)(JNIEnv*, jsize); - jbyteArray (*NewByteArray)(JNIEnv*, jsize); - jcharArray (*NewCharArray)(JNIEnv*, jsize); - jshortArray (*NewShortArray)(JNIEnv*, jsize); - jintArray (*NewIntArray)(JNIEnv*, jsize); - jlongArray (*NewLongArray)(JNIEnv*, jsize); - jfloatArray (*NewFloatArray)(JNIEnv*, jsize); - jdoubleArray (*NewDoubleArray)(JNIEnv*, jsize); - - jboolean* (*GetBooleanArrayElements)(JNIEnv*, jbooleanArray, jboolean*); - jbyte* (*GetByteArrayElements)(JNIEnv*, jbyteArray, jboolean*); - jchar* (*GetCharArrayElements)(JNIEnv*, jcharArray, jboolean*); - jshort* (*GetShortArrayElements)(JNIEnv*, jshortArray, jboolean*); - jint* (*GetIntArrayElements)(JNIEnv*, jintArray, jboolean*); - jlong* (*GetLongArrayElements)(JNIEnv*, jlongArray, jboolean*); - jfloat* (*GetFloatArrayElements)(JNIEnv*, jfloatArray, jboolean*); - jdouble* (*GetDoubleArrayElements)(JNIEnv*, jdoubleArray, jboolean*); - - void (*ReleaseBooleanArrayElements)(JNIEnv*, jbooleanArray, - jboolean*, jint); - void (*ReleaseByteArrayElements)(JNIEnv*, jbyteArray, - jbyte*, jint); - void (*ReleaseCharArrayElements)(JNIEnv*, jcharArray, - jchar*, jint); - void (*ReleaseShortArrayElements)(JNIEnv*, jshortArray, - jshort*, jint); - void (*ReleaseIntArrayElements)(JNIEnv*, jintArray, - jint*, jint); - void (*ReleaseLongArrayElements)(JNIEnv*, jlongArray, - jlong*, jint); - void (*ReleaseFloatArrayElements)(JNIEnv*, jfloatArray, - jfloat*, jint); - void (*ReleaseDoubleArrayElements)(JNIEnv*, jdoubleArray, - jdouble*, jint); - - void (*GetBooleanArrayRegion)(JNIEnv*, jbooleanArray, - jsize, jsize, jboolean*); - void (*GetByteArrayRegion)(JNIEnv*, jbyteArray, - jsize, jsize, jbyte*); - void (*GetCharArrayRegion)(JNIEnv*, jcharArray, - jsize, jsize, jchar*); - void (*GetShortArrayRegion)(JNIEnv*, jshortArray, - jsize, jsize, jshort*); - void (*GetIntArrayRegion)(JNIEnv*, jintArray, - jsize, jsize, jint*); - void (*GetLongArrayRegion)(JNIEnv*, jlongArray, - jsize, jsize, jlong*); - void (*GetFloatArrayRegion)(JNIEnv*, jfloatArray, - jsize, jsize, jfloat*); - void (*GetDoubleArrayRegion)(JNIEnv*, jdoubleArray, - jsize, jsize, jdouble*); - - /* spec shows these without const; some jni.h do, some don't */ - void (*SetBooleanArrayRegion)(JNIEnv*, jbooleanArray, - jsize, jsize, const jboolean*); - void (*SetByteArrayRegion)(JNIEnv*, jbyteArray, - jsize, jsize, const jbyte*); - void (*SetCharArrayRegion)(JNIEnv*, jcharArray, - jsize, jsize, const jchar*); - void (*SetShortArrayRegion)(JNIEnv*, jshortArray, - jsize, jsize, const jshort*); - void (*SetIntArrayRegion)(JNIEnv*, jintArray, - jsize, jsize, const jint*); - void (*SetLongArrayRegion)(JNIEnv*, jlongArray, - jsize, jsize, const jlong*); - void (*SetFloatArrayRegion)(JNIEnv*, jfloatArray, - jsize, jsize, const jfloat*); - void (*SetDoubleArrayRegion)(JNIEnv*, jdoubleArray, - jsize, jsize, const jdouble*); - - jint (*RegisterNatives)(JNIEnv*, jclass, const JNINativeMethod*, - jint); - jint (*UnregisterNatives)(JNIEnv*, jclass); - jint (*MonitorEnter)(JNIEnv*, jobject); - jint (*MonitorExit)(JNIEnv*, jobject); - jint (*GetJavaVM)(JNIEnv*, JavaVM**); - - void (*GetStringRegion)(JNIEnv*, jstring, jsize, jsize, jchar*); - void (*GetStringUTFRegion)(JNIEnv*, jstring, jsize, jsize, char*); - - void* (*GetPrimitiveArrayCritical)(JNIEnv*, jarray, jboolean*); - void (*ReleasePrimitiveArrayCritical)(JNIEnv*, jarray, void*, jint); - - const jchar* (*GetStringCritical)(JNIEnv*, jstring, jboolean*); - void (*ReleaseStringCritical)(JNIEnv*, jstring, const jchar*); - - jweak (*NewWeakGlobalRef)(JNIEnv*, jobject); - void (*DeleteWeakGlobalRef)(JNIEnv*, jweak); - - jboolean (*ExceptionCheck)(JNIEnv*); - - jobject (*NewDirectByteBuffer)(JNIEnv*, void*, jlong); - void* (*GetDirectBufferAddress)(JNIEnv*, jobject); - jlong (*GetDirectBufferCapacity)(JNIEnv*, jobject); - - /* added in JNI 1.6 */ - jobjectRefType (*GetObjectRefType)(JNIEnv*, jobject); -}; - -/* - * C++ object wrapper. - * - * This is usually overlaid on a C struct whose first element is a - * JNINativeInterface*. We rely somewhat on compiler behavior. - */ -struct _JNIEnv { - /* do not rename this; it does not seem to be entirely opaque */ - const struct JNINativeInterface* functions; - -#if defined(__cplusplus) - - jint GetVersion() - { return functions->GetVersion(this); } - - jclass DefineClass(const char *name, jobject loader, const jbyte* buf, - jsize bufLen) - { return functions->DefineClass(this, name, loader, buf, bufLen); } - - jclass FindClass(const char* name) - { return functions->FindClass(this, name); } - - jmethodID FromReflectedMethod(jobject method) - { return functions->FromReflectedMethod(this, method); } - - jfieldID FromReflectedField(jobject field) - { return functions->FromReflectedField(this, field); } - - jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic) - { return functions->ToReflectedMethod(this, cls, methodID, isStatic); } - - jclass GetSuperclass(jclass clazz) - { return functions->GetSuperclass(this, clazz); } - - jboolean IsAssignableFrom(jclass clazz1, jclass clazz2) - { return functions->IsAssignableFrom(this, clazz1, clazz2); } - - jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic) - { return functions->ToReflectedField(this, cls, fieldID, isStatic); } - - jint Throw(jthrowable obj) - { return functions->Throw(this, obj); } - - jint ThrowNew(jclass clazz, const char* message) - { return functions->ThrowNew(this, clazz, message); } - - jthrowable ExceptionOccurred() - { return functions->ExceptionOccurred(this); } - - void ExceptionDescribe() - { functions->ExceptionDescribe(this); } - - void ExceptionClear() - { functions->ExceptionClear(this); } - - void FatalError(const char* msg) - { functions->FatalError(this, msg); } - - jint PushLocalFrame(jint capacity) - { return functions->PushLocalFrame(this, capacity); } - - jobject PopLocalFrame(jobject result) - { return functions->PopLocalFrame(this, result); } - - jobject NewGlobalRef(jobject obj) - { return functions->NewGlobalRef(this, obj); } - - void DeleteGlobalRef(jobject globalRef) - { functions->DeleteGlobalRef(this, globalRef); } - - void DeleteLocalRef(jobject localRef) - { functions->DeleteLocalRef(this, localRef); } - - jboolean IsSameObject(jobject ref1, jobject ref2) - { return functions->IsSameObject(this, ref1, ref2); } - - jobject NewLocalRef(jobject ref) - { return functions->NewLocalRef(this, ref); } - - jint EnsureLocalCapacity(jint capacity) - { return functions->EnsureLocalCapacity(this, capacity); } - - jobject AllocObject(jclass clazz) - { return functions->AllocObject(this, clazz); } - - jobject NewObject(jclass clazz, jmethodID methodID, ...) - { - va_list args; - va_start(args, methodID); - jobject result = functions->NewObjectV(this, clazz, methodID, args); - va_end(args); - return result; - } - - jobject NewObjectV(jclass clazz, jmethodID methodID, va_list args) - { return functions->NewObjectV(this, clazz, methodID, args); } - - jobject NewObjectA(jclass clazz, jmethodID methodID, const jvalue* args) - { return functions->NewObjectA(this, clazz, methodID, args); } - - jclass GetObjectClass(jobject obj) - { return functions->GetObjectClass(this, obj); } - - jboolean IsInstanceOf(jobject obj, jclass clazz) - { return functions->IsInstanceOf(this, obj, clazz); } - - jmethodID GetMethodID(jclass clazz, const char* name, const char* sig) - { return functions->GetMethodID(this, clazz, name, sig); } - -#define CALL_TYPE_METHOD(_jtype, _jname) \ - _jtype Call##_jname##Method(jobject obj, jmethodID methodID, ...) \ - { \ - _jtype result; \ - va_list args; \ - va_start(args, methodID); \ - result = functions->Call##_jname##MethodV(this, obj, methodID, \ - args); \ - va_end(args); \ - return result; \ - } -#define CALL_TYPE_METHODV(_jtype, _jname) \ - _jtype Call##_jname##MethodV(jobject obj, jmethodID methodID, \ - va_list args) \ - { return functions->Call##_jname##MethodV(this, obj, methodID, args); } -#define CALL_TYPE_METHODA(_jtype, _jname) \ - _jtype Call##_jname##MethodA(jobject obj, jmethodID methodID, \ - const jvalue* args) \ - { return functions->Call##_jname##MethodA(this, obj, methodID, args); } - -#define CALL_TYPE(_jtype, _jname) \ - CALL_TYPE_METHOD(_jtype, _jname) \ - CALL_TYPE_METHODV(_jtype, _jname) \ - CALL_TYPE_METHODA(_jtype, _jname) - - CALL_TYPE(jobject, Object) - CALL_TYPE(jboolean, Boolean) - CALL_TYPE(jbyte, Byte) - CALL_TYPE(jchar, Char) - CALL_TYPE(jshort, Short) - CALL_TYPE(jint, Int) - CALL_TYPE(jlong, Long) - CALL_TYPE(jfloat, Float) - CALL_TYPE(jdouble, Double) - - void CallVoidMethod(jobject obj, jmethodID methodID, ...) - { - va_list args; - va_start(args, methodID); - functions->CallVoidMethodV(this, obj, methodID, args); - va_end(args); - } - void CallVoidMethodV(jobject obj, jmethodID methodID, va_list args) - { functions->CallVoidMethodV(this, obj, methodID, args); } - void CallVoidMethodA(jobject obj, jmethodID methodID, const jvalue* args) - { functions->CallVoidMethodA(this, obj, methodID, args); } - -#define CALL_NONVIRT_TYPE_METHOD(_jtype, _jname) \ - _jtype CallNonvirtual##_jname##Method(jobject obj, jclass clazz, \ - jmethodID methodID, ...) \ - { \ - _jtype result; \ - va_list args; \ - va_start(args, methodID); \ - result = functions->CallNonvirtual##_jname##MethodV(this, obj, \ - clazz, methodID, args); \ - va_end(args); \ - return result; \ - } -#define CALL_NONVIRT_TYPE_METHODV(_jtype, _jname) \ - _jtype CallNonvirtual##_jname##MethodV(jobject obj, jclass clazz, \ - jmethodID methodID, va_list args) \ - { return functions->CallNonvirtual##_jname##MethodV(this, obj, clazz, \ - methodID, args); } -#define CALL_NONVIRT_TYPE_METHODA(_jtype, _jname) \ - _jtype CallNonvirtual##_jname##MethodA(jobject obj, jclass clazz, \ - jmethodID methodID, const jvalue* args) \ - { return functions->CallNonvirtual##_jname##MethodA(this, obj, clazz, \ - methodID, args); } - -#define CALL_NONVIRT_TYPE(_jtype, _jname) \ - CALL_NONVIRT_TYPE_METHOD(_jtype, _jname) \ - CALL_NONVIRT_TYPE_METHODV(_jtype, _jname) \ - CALL_NONVIRT_TYPE_METHODA(_jtype, _jname) - - CALL_NONVIRT_TYPE(jobject, Object) - CALL_NONVIRT_TYPE(jboolean, Boolean) - CALL_NONVIRT_TYPE(jbyte, Byte) - CALL_NONVIRT_TYPE(jchar, Char) - CALL_NONVIRT_TYPE(jshort, Short) - CALL_NONVIRT_TYPE(jint, Int) - CALL_NONVIRT_TYPE(jlong, Long) - CALL_NONVIRT_TYPE(jfloat, Float) - CALL_NONVIRT_TYPE(jdouble, Double) - - void CallNonvirtualVoidMethod(jobject obj, jclass clazz, - jmethodID methodID, ...) - { - va_list args; - va_start(args, methodID); - functions->CallNonvirtualVoidMethodV(this, obj, clazz, methodID, args); - va_end(args); - } - void CallNonvirtualVoidMethodV(jobject obj, jclass clazz, - jmethodID methodID, va_list args) - { functions->CallNonvirtualVoidMethodV(this, obj, clazz, methodID, args); } - void CallNonvirtualVoidMethodA(jobject obj, jclass clazz, - jmethodID methodID, const jvalue* args) - { functions->CallNonvirtualVoidMethodA(this, obj, clazz, methodID, args); } - - jfieldID GetFieldID(jclass clazz, const char* name, const char* sig) - { return functions->GetFieldID(this, clazz, name, sig); } - - jobject GetObjectField(jobject obj, jfieldID fieldID) - { return functions->GetObjectField(this, obj, fieldID); } - jboolean GetBooleanField(jobject obj, jfieldID fieldID) - { return functions->GetBooleanField(this, obj, fieldID); } - jbyte GetByteField(jobject obj, jfieldID fieldID) - { return functions->GetByteField(this, obj, fieldID); } - jchar GetCharField(jobject obj, jfieldID fieldID) - { return functions->GetCharField(this, obj, fieldID); } - jshort GetShortField(jobject obj, jfieldID fieldID) - { return functions->GetShortField(this, obj, fieldID); } - jint GetIntField(jobject obj, jfieldID fieldID) - { return functions->GetIntField(this, obj, fieldID); } - jlong GetLongField(jobject obj, jfieldID fieldID) - { return functions->GetLongField(this, obj, fieldID); } - jfloat GetFloatField(jobject obj, jfieldID fieldID) - { return functions->GetFloatField(this, obj, fieldID); } - jdouble GetDoubleField(jobject obj, jfieldID fieldID) - { return functions->GetDoubleField(this, obj, fieldID); } - - void SetObjectField(jobject obj, jfieldID fieldID, jobject value) - { functions->SetObjectField(this, obj, fieldID, value); } - void SetBooleanField(jobject obj, jfieldID fieldID, jboolean value) - { functions->SetBooleanField(this, obj, fieldID, value); } - void SetByteField(jobject obj, jfieldID fieldID, jbyte value) - { functions->SetByteField(this, obj, fieldID, value); } - void SetCharField(jobject obj, jfieldID fieldID, jchar value) - { functions->SetCharField(this, obj, fieldID, value); } - void SetShortField(jobject obj, jfieldID fieldID, jshort value) - { functions->SetShortField(this, obj, fieldID, value); } - void SetIntField(jobject obj, jfieldID fieldID, jint value) - { functions->SetIntField(this, obj, fieldID, value); } - void SetLongField(jobject obj, jfieldID fieldID, jlong value) - { functions->SetLongField(this, obj, fieldID, value); } - void SetFloatField(jobject obj, jfieldID fieldID, jfloat value) - { functions->SetFloatField(this, obj, fieldID, value); } - void SetDoubleField(jobject obj, jfieldID fieldID, jdouble value) - { functions->SetDoubleField(this, obj, fieldID, value); } - - jmethodID GetStaticMethodID(jclass clazz, const char* name, const char* sig) - { return functions->GetStaticMethodID(this, clazz, name, sig); } - -#define CALL_STATIC_TYPE_METHOD(_jtype, _jname) \ - _jtype CallStatic##_jname##Method(jclass clazz, jmethodID methodID, \ - ...) \ - { \ - _jtype result; \ - va_list args; \ - va_start(args, methodID); \ - result = functions->CallStatic##_jname##MethodV(this, clazz, \ - methodID, args); \ - va_end(args); \ - return result; \ - } -#define CALL_STATIC_TYPE_METHODV(_jtype, _jname) \ - _jtype CallStatic##_jname##MethodV(jclass clazz, jmethodID methodID, \ - va_list args) \ - { return functions->CallStatic##_jname##MethodV(this, clazz, methodID, \ - args); } -#define CALL_STATIC_TYPE_METHODA(_jtype, _jname) \ - _jtype CallStatic##_jname##MethodA(jclass clazz, jmethodID methodID, \ - const jvalue* args) \ - { return functions->CallStatic##_jname##MethodA(this, clazz, methodID, \ - args); } - -#define CALL_STATIC_TYPE(_jtype, _jname) \ - CALL_STATIC_TYPE_METHOD(_jtype, _jname) \ - CALL_STATIC_TYPE_METHODV(_jtype, _jname) \ - CALL_STATIC_TYPE_METHODA(_jtype, _jname) - - CALL_STATIC_TYPE(jobject, Object) - CALL_STATIC_TYPE(jboolean, Boolean) - CALL_STATIC_TYPE(jbyte, Byte) - CALL_STATIC_TYPE(jchar, Char) - CALL_STATIC_TYPE(jshort, Short) - CALL_STATIC_TYPE(jint, Int) - CALL_STATIC_TYPE(jlong, Long) - CALL_STATIC_TYPE(jfloat, Float) - CALL_STATIC_TYPE(jdouble, Double) - - void CallStaticVoidMethod(jclass clazz, jmethodID methodID, ...) - { - va_list args; - va_start(args, methodID); - functions->CallStaticVoidMethodV(this, clazz, methodID, args); - va_end(args); - } - void CallStaticVoidMethodV(jclass clazz, jmethodID methodID, va_list args) - { functions->CallStaticVoidMethodV(this, clazz, methodID, args); } - void CallStaticVoidMethodA(jclass clazz, jmethodID methodID, const jvalue* args) - { functions->CallStaticVoidMethodA(this, clazz, methodID, args); } - - jfieldID GetStaticFieldID(jclass clazz, const char* name, const char* sig) - { return functions->GetStaticFieldID(this, clazz, name, sig); } - - jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) - { return functions->GetStaticObjectField(this, clazz, fieldID); } - jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID) - { return functions->GetStaticBooleanField(this, clazz, fieldID); } - jbyte GetStaticByteField(jclass clazz, jfieldID fieldID) - { return functions->GetStaticByteField(this, clazz, fieldID); } - jchar GetStaticCharField(jclass clazz, jfieldID fieldID) - { return functions->GetStaticCharField(this, clazz, fieldID); } - jshort GetStaticShortField(jclass clazz, jfieldID fieldID) - { return functions->GetStaticShortField(this, clazz, fieldID); } - jint GetStaticIntField(jclass clazz, jfieldID fieldID) - { return functions->GetStaticIntField(this, clazz, fieldID); } - jlong GetStaticLongField(jclass clazz, jfieldID fieldID) - { return functions->GetStaticLongField(this, clazz, fieldID); } - jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID) - { return functions->GetStaticFloatField(this, clazz, fieldID); } - jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID) - { return functions->GetStaticDoubleField(this, clazz, fieldID); } - - void SetStaticObjectField(jclass clazz, jfieldID fieldID, jobject value) - { functions->SetStaticObjectField(this, clazz, fieldID, value); } - void SetStaticBooleanField(jclass clazz, jfieldID fieldID, jboolean value) - { functions->SetStaticBooleanField(this, clazz, fieldID, value); } - void SetStaticByteField(jclass clazz, jfieldID fieldID, jbyte value) - { functions->SetStaticByteField(this, clazz, fieldID, value); } - void SetStaticCharField(jclass clazz, jfieldID fieldID, jchar value) - { functions->SetStaticCharField(this, clazz, fieldID, value); } - void SetStaticShortField(jclass clazz, jfieldID fieldID, jshort value) - { functions->SetStaticShortField(this, clazz, fieldID, value); } - void SetStaticIntField(jclass clazz, jfieldID fieldID, jint value) - { functions->SetStaticIntField(this, clazz, fieldID, value); } - void SetStaticLongField(jclass clazz, jfieldID fieldID, jlong value) - { functions->SetStaticLongField(this, clazz, fieldID, value); } - void SetStaticFloatField(jclass clazz, jfieldID fieldID, jfloat value) - { functions->SetStaticFloatField(this, clazz, fieldID, value); } - void SetStaticDoubleField(jclass clazz, jfieldID fieldID, jdouble value) - { functions->SetStaticDoubleField(this, clazz, fieldID, value); } - - jstring NewString(const jchar* unicodeChars, jsize len) - { return functions->NewString(this, unicodeChars, len); } - - jsize GetStringLength(jstring string) - { return functions->GetStringLength(this, string); } - - const jchar* GetStringChars(jstring string, jboolean* isCopy) - { return functions->GetStringChars(this, string, isCopy); } - - void ReleaseStringChars(jstring string, const jchar* chars) - { functions->ReleaseStringChars(this, string, chars); } - - jstring NewStringUTF(const char* bytes) - { return functions->NewStringUTF(this, bytes); } - - jsize GetStringUTFLength(jstring string) - { return functions->GetStringUTFLength(this, string); } - - const char* GetStringUTFChars(jstring string, jboolean* isCopy) - { return functions->GetStringUTFChars(this, string, isCopy); } - - void ReleaseStringUTFChars(jstring string, const char* utf) - { functions->ReleaseStringUTFChars(this, string, utf); } - - jsize GetArrayLength(jarray array) - { return functions->GetArrayLength(this, array); } - - jobjectArray NewObjectArray(jsize length, jclass elementClass, - jobject initialElement) - { return functions->NewObjectArray(this, length, elementClass, - initialElement); } - - jobject GetObjectArrayElement(jobjectArray array, jsize index) - { return functions->GetObjectArrayElement(this, array, index); } - - void SetObjectArrayElement(jobjectArray array, jsize index, jobject value) - { functions->SetObjectArrayElement(this, array, index, value); } - - jbooleanArray NewBooleanArray(jsize length) - { return functions->NewBooleanArray(this, length); } - jbyteArray NewByteArray(jsize length) - { return functions->NewByteArray(this, length); } - jcharArray NewCharArray(jsize length) - { return functions->NewCharArray(this, length); } - jshortArray NewShortArray(jsize length) - { return functions->NewShortArray(this, length); } - jintArray NewIntArray(jsize length) - { return functions->NewIntArray(this, length); } - jlongArray NewLongArray(jsize length) - { return functions->NewLongArray(this, length); } - jfloatArray NewFloatArray(jsize length) - { return functions->NewFloatArray(this, length); } - jdoubleArray NewDoubleArray(jsize length) - { return functions->NewDoubleArray(this, length); } - - jboolean* GetBooleanArrayElements(jbooleanArray array, jboolean* isCopy) - { return functions->GetBooleanArrayElements(this, array, isCopy); } - jbyte* GetByteArrayElements(jbyteArray array, jboolean* isCopy) - { return functions->GetByteArrayElements(this, array, isCopy); } - jchar* GetCharArrayElements(jcharArray array, jboolean* isCopy) - { return functions->GetCharArrayElements(this, array, isCopy); } - jshort* GetShortArrayElements(jshortArray array, jboolean* isCopy) - { return functions->GetShortArrayElements(this, array, isCopy); } - jint* GetIntArrayElements(jintArray array, jboolean* isCopy) - { return functions->GetIntArrayElements(this, array, isCopy); } - jlong* GetLongArrayElements(jlongArray array, jboolean* isCopy) - { return functions->GetLongArrayElements(this, array, isCopy); } - jfloat* GetFloatArrayElements(jfloatArray array, jboolean* isCopy) - { return functions->GetFloatArrayElements(this, array, isCopy); } - jdouble* GetDoubleArrayElements(jdoubleArray array, jboolean* isCopy) - { return functions->GetDoubleArrayElements(this, array, isCopy); } - - void ReleaseBooleanArrayElements(jbooleanArray array, jboolean* elems, - jint mode) - { functions->ReleaseBooleanArrayElements(this, array, elems, mode); } - void ReleaseByteArrayElements(jbyteArray array, jbyte* elems, - jint mode) - { functions->ReleaseByteArrayElements(this, array, elems, mode); } - void ReleaseCharArrayElements(jcharArray array, jchar* elems, - jint mode) - { functions->ReleaseCharArrayElements(this, array, elems, mode); } - void ReleaseShortArrayElements(jshortArray array, jshort* elems, - jint mode) - { functions->ReleaseShortArrayElements(this, array, elems, mode); } - void ReleaseIntArrayElements(jintArray array, jint* elems, - jint mode) - { functions->ReleaseIntArrayElements(this, array, elems, mode); } - void ReleaseLongArrayElements(jlongArray array, jlong* elems, - jint mode) - { functions->ReleaseLongArrayElements(this, array, elems, mode); } - void ReleaseFloatArrayElements(jfloatArray array, jfloat* elems, - jint mode) - { functions->ReleaseFloatArrayElements(this, array, elems, mode); } - void ReleaseDoubleArrayElements(jdoubleArray array, jdouble* elems, - jint mode) - { functions->ReleaseDoubleArrayElements(this, array, elems, mode); } - - void GetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len, - jboolean* buf) - { functions->GetBooleanArrayRegion(this, array, start, len, buf); } - void GetByteArrayRegion(jbyteArray array, jsize start, jsize len, - jbyte* buf) - { functions->GetByteArrayRegion(this, array, start, len, buf); } - void GetCharArrayRegion(jcharArray array, jsize start, jsize len, - jchar* buf) - { functions->GetCharArrayRegion(this, array, start, len, buf); } - void GetShortArrayRegion(jshortArray array, jsize start, jsize len, - jshort* buf) - { functions->GetShortArrayRegion(this, array, start, len, buf); } - void GetIntArrayRegion(jintArray array, jsize start, jsize len, - jint* buf) - { functions->GetIntArrayRegion(this, array, start, len, buf); } - void GetLongArrayRegion(jlongArray array, jsize start, jsize len, - jlong* buf) - { functions->GetLongArrayRegion(this, array, start, len, buf); } - void GetFloatArrayRegion(jfloatArray array, jsize start, jsize len, - jfloat* buf) - { functions->GetFloatArrayRegion(this, array, start, len, buf); } - void GetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len, - jdouble* buf) - { functions->GetDoubleArrayRegion(this, array, start, len, buf); } - - void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len, - const jboolean* buf) - { functions->SetBooleanArrayRegion(this, array, start, len, buf); } - void SetByteArrayRegion(jbyteArray array, jsize start, jsize len, - const jbyte* buf) - { functions->SetByteArrayRegion(this, array, start, len, buf); } - void SetCharArrayRegion(jcharArray array, jsize start, jsize len, - const jchar* buf) - { functions->SetCharArrayRegion(this, array, start, len, buf); } - void SetShortArrayRegion(jshortArray array, jsize start, jsize len, - const jshort* buf) - { functions->SetShortArrayRegion(this, array, start, len, buf); } - void SetIntArrayRegion(jintArray array, jsize start, jsize len, - const jint* buf) - { functions->SetIntArrayRegion(this, array, start, len, buf); } - void SetLongArrayRegion(jlongArray array, jsize start, jsize len, - const jlong* buf) - { functions->SetLongArrayRegion(this, array, start, len, buf); } - void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len, - const jfloat* buf) - { functions->SetFloatArrayRegion(this, array, start, len, buf); } - void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len, - const jdouble* buf) - { functions->SetDoubleArrayRegion(this, array, start, len, buf); } - - jint RegisterNatives(jclass clazz, const JNINativeMethod* methods, - jint nMethods) - { return functions->RegisterNatives(this, clazz, methods, nMethods); } - - jint UnregisterNatives(jclass clazz) - { return functions->UnregisterNatives(this, clazz); } - - jint MonitorEnter(jobject obj) - { return functions->MonitorEnter(this, obj); } - - jint MonitorExit(jobject obj) - { return functions->MonitorExit(this, obj); } - - jint GetJavaVM(JavaVM** vm) - { return functions->GetJavaVM(this, vm); } - - void GetStringRegion(jstring str, jsize start, jsize len, jchar* buf) - { functions->GetStringRegion(this, str, start, len, buf); } - - void GetStringUTFRegion(jstring str, jsize start, jsize len, char* buf) - { return functions->GetStringUTFRegion(this, str, start, len, buf); } - - void* GetPrimitiveArrayCritical(jarray array, jboolean* isCopy) - { return functions->GetPrimitiveArrayCritical(this, array, isCopy); } - - void ReleasePrimitiveArrayCritical(jarray array, void* carray, jint mode) - { functions->ReleasePrimitiveArrayCritical(this, array, carray, mode); } - - const jchar* GetStringCritical(jstring string, jboolean* isCopy) - { return functions->GetStringCritical(this, string, isCopy); } - - void ReleaseStringCritical(jstring string, const jchar* carray) - { functions->ReleaseStringCritical(this, string, carray); } - - jweak NewWeakGlobalRef(jobject obj) - { return functions->NewWeakGlobalRef(this, obj); } - - void DeleteWeakGlobalRef(jweak obj) - { functions->DeleteWeakGlobalRef(this, obj); } - - jboolean ExceptionCheck() - { return functions->ExceptionCheck(this); } - - jobject NewDirectByteBuffer(void* address, jlong capacity) - { return functions->NewDirectByteBuffer(this, address, capacity); } - - void* GetDirectBufferAddress(jobject buf) - { return functions->GetDirectBufferAddress(this, buf); } - - jlong GetDirectBufferCapacity(jobject buf) - { return functions->GetDirectBufferCapacity(this, buf); } - - /* added in JNI 1.6 */ - jobjectRefType GetObjectRefType(jobject obj) - { return functions->GetObjectRefType(this, obj); } -#endif /*__cplusplus*/ -}; - - -/* - * JNI invocation interface. - */ -struct JNIInvokeInterface { - void* reserved0; - void* reserved1; - void* reserved2; - - jint (*DestroyJavaVM)(JavaVM*); - jint (*AttachCurrentThread)(JavaVM*, JNIEnv**, void*); - jint (*DetachCurrentThread)(JavaVM*); - jint (*GetEnv)(JavaVM*, void**, jint); - jint (*AttachCurrentThreadAsDaemon)(JavaVM*, JNIEnv**, void*); -}; - -/* - * C++ version. - */ -struct _JavaVM { - const struct JNIInvokeInterface* functions; - -#if defined(__cplusplus) - jint DestroyJavaVM() - { return functions->DestroyJavaVM(this); } - jint AttachCurrentThread(JNIEnv** p_env, void* thr_args) - { return functions->AttachCurrentThread(this, p_env, thr_args); } - jint DetachCurrentThread() - { return functions->DetachCurrentThread(this); } - jint GetEnv(void** env, jint version) - { return functions->GetEnv(this, env, version); } - jint AttachCurrentThreadAsDaemon(JNIEnv** p_env, void* thr_args) - { return functions->AttachCurrentThreadAsDaemon(this, p_env, thr_args); } -#endif /*__cplusplus*/ -}; - -struct JavaVMAttachArgs { - jint version; /* must be >= JNI_VERSION_1_2 */ - const char* name; /* NULL or name of thread as modified UTF-8 str */ - jobject group; /* global ref of a ThreadGroup object, or NULL */ -}; -typedef struct JavaVMAttachArgs JavaVMAttachArgs; - -/* - * JNI 1.2+ initialization. (As of 1.6, the pre-1.2 structures are no - * longer supported.) - */ -typedef struct JavaVMOption { - const char* optionString; - void* extraInfo; -} JavaVMOption; - -typedef struct JavaVMInitArgs { - jint version; /* use JNI_VERSION_1_2 or later */ - - jint nOptions; - JavaVMOption* options; - jboolean ignoreUnrecognized; -} JavaVMInitArgs; - -#ifdef __cplusplus -extern "C" { -#endif -/* - * VM initialization functions. - * - * Note these are the only symbols exported for JNI by the VM. - */ -jint JNI_GetDefaultJavaVMInitArgs(void*); -jint JNI_CreateJavaVM(JavaVM**, JNIEnv**, void*); -jint JNI_GetCreatedJavaVMs(JavaVM**, jsize, jsize*); - -#define JNIIMPORT -#define JNIEXPORT __attribute__ ((visibility ("default"))) -#define JNICALL - -/* - * Prototypes for functions exported by loadable shared libs. These are - * called by JNI, not provided by JNI. - */ -JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved); -JNIEXPORT void JNI_OnUnload(JavaVM* vm, void* reserved); - -#ifdef __cplusplus -} -#endif - - -/* - * Manifest constants. - */ -#define JNI_FALSE 0 -#define JNI_TRUE 1 - -#define JNI_VERSION_1_1 0x00010001 -#define JNI_VERSION_1_2 0x00010002 -#define JNI_VERSION_1_4 0x00010004 -#define JNI_VERSION_1_6 0x00010006 - -#define JNI_OK (0) /* no error */ -#define JNI_ERR (-1) /* generic error */ -#define JNI_EDETACHED (-2) /* thread detached from the VM */ -#define JNI_EVERSION (-3) /* JNI version error */ -#define JNI_ENOMEM (-4) /* Out of memory */ -#define JNI_EEXIST (-5) /* VM already created */ -#define JNI_EINVAL (-6) /* Invalid argument */ - -#define JNI_COMMIT 1 /* copy content, do not free buffer */ -#define JNI_ABORT 2 /* free buffer w/o copying back */ - -#endif /* JNI_H_ */