Skip to content

Commit

Permalink
update to 11.4.2 (5469)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaraush committed Nov 20, 2024
1 parent 9b78d43 commit fb2e545
Show file tree
Hide file tree
Showing 295 changed files with 18,934 additions and 3,822 deletions.
2 changes: 1 addition & 1 deletion TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ apply plugin: 'com.google.gms.google-services'
task checkVisibility {
doFirst {
def isPrivateBuild = project.gradle.startParameter.taskNames.find {
it.contains("HA_private") || it.contains("Debug") || it.contains("Release")
it.contains("HA_private") || it.contains("HA_hardcore") || it.contains("Debug") || it.contains("Release")
}
def isPublicAllowed = !project.hasProperty("IS_PRIVATE") || !project.property("IS_PRIVATE").toBoolean()
if (!isPrivateBuild && !isPublicAllowed) {
Expand Down
4 changes: 4 additions & 0 deletions TMessagesProj/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ${CMAKE_HOME_DIRECTORY}/ffmpeg/${ANDROID_ABI}/libavresample.a,
${CMAKE_HOME_DIRECTORY}/ffmpeg/${ANDROID_ABI}/libavutil.a,
${CMAKE_HOME_DIRECTORY}/ffmpeg/${ANDROID_ABI}/libswresample.a,
${CMAKE_HOME_DIRECTORY}/ffmpeg/${ANDROID_ABI}/libvpx.a,
${CMAKE_HOME_DIRECTORY}/ffmpeg/${ANDROID_ABI}/libdav1d.a,
${CMAKE_HOME_DIRECTORY}/boringssl/lib/libssl_${ANDROID_ABI}.a,
${CMAKE_HOME_DIRECTORY}/boringssl/lib/libcrypto_${ANDROID_ABI}.a")

Expand Down Expand Up @@ -49,6 +50,8 @@ set_target_properties(ssl PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/b
add_library(libvpx STATIC IMPORTED)
set_target_properties(libvpx PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/ffmpeg/${ANDROID_ABI}/libvpx.a)

add_library(libdav1d STATIC IMPORTED)
set_target_properties(libdav1d PROPERTIES IMPORTED_LOCATION ${CMAKE_HOME_DIRECTORY}/ffmpeg/${ANDROID_ABI}/libdav1d.a)

#tgnet
#add_library(mozjpeg STATIC
Expand Down Expand Up @@ -641,6 +644,7 @@ target_link_libraries(${NATIVE_LIB}
avresample
swresample
libvpx
libdav1d
avutil
ssl
crypto
Expand Down
5 changes: 5 additions & 0 deletions TMessagesProj/jni/TgNetWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ jint getCurrentTime(JNIEnv *env, jclass c, jint instanceNum) {
return ConnectionsManager::getInstance(instanceNum).getCurrentTime();
}

jint getCurrentPingTime(JNIEnv *env, jclass c, jint instanceNum) {
return ConnectionsManager::getInstance(instanceNum).getCurrentPingTime();
}

jint getCurrentDatacenterId(JNIEnv *env, jclass c, jint instanceNum) {
return ConnectionsManager::getInstance(instanceNum).getCurrentDatacenterId();
}
Expand Down Expand Up @@ -486,6 +490,7 @@ static const char *ConnectionsManagerClassPathName = "org/telegram/tgnet/Connect
static JNINativeMethod ConnectionsManagerMethods[] = {
{"native_getCurrentTimeMillis", "(I)J", (void *) getCurrentTimeMillis},
{"native_getCurrentTime", "(I)I", (void *) getCurrentTime},
{"native_getCurrentPingTime", "(I)I", (void *) getCurrentPingTime},
{"native_getCurrentDatacenterId", "(I)I", (void *) getCurrentDatacenterId},
{"native_isTestBackend", "(I)I", (void *) isTestBackend},
{"native_getTimeDifference", "(I)I", (void *) getTimeDifference},
Expand Down
Binary file modified TMessagesProj/jni/ffmpeg/arm64-v8a/libavcodec.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/arm64-v8a/libavformat.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/arm64-v8a/libavresample.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/arm64-v8a/libavutil.a
Binary file not shown.
Binary file added TMessagesProj/jni/ffmpeg/arm64-v8a/libdav1d.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/arm64-v8a/libswresample.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/arm64-v8a/libswscale.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/arm64-v8a/libvpx.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/armeabi-v7a/libavcodec.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/armeabi-v7a/libavformat.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/armeabi-v7a/libavresample.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/armeabi-v7a/libavutil.a
Binary file not shown.
Binary file added TMessagesProj/jni/ffmpeg/armeabi-v7a/libdav1d.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/armeabi-v7a/libswresample.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/armeabi-v7a/libswscale.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/armeabi-v7a/libvpx.a
Binary file not shown.
28 changes: 24 additions & 4 deletions TMessagesProj/jni/ffmpeg/build_ffmpeg/build_ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,26 @@
# ffmpeg 4.4.3
# lib vpx 1.10.9
# NDK for compile libvpx. Last successful build with 21.1.6352462
# and dav1d. Last successful build with
# NDK r10e for compile ffmpeg
#
# 1) download ffmpeg
# 2) set NDK_r10e and NDK variables
# 3) download lib vpx
# 4) copy libvpx to vpx-android folder and rename as libvpx
# 5) copy build_ffmpeg foleder in ffmepg directory
# 6) run build_ffmpeg.sh
# 7) see compiled library in build_ffmpeg/adnroid folder
# 6) download dav1d into android-dav1d/dav1d folder
# 7.1) in ffmpeg fix typos in 3 files, replacing 'int B0' into 'int b0'
# 7.2) install python3.9 and replace python in vpx-android/_settings.sh
# 7.3) (macos) replace HOST_NUM_CORES with $(sysctl -n hw.physicalcpu)
# 7.4) (macos) press allow and open for each executable in system preferences
# 8) patch ffmpeg/configure to take dav1d as an external lib from folder:
# enabled libdav1d && {
# require_pkg_config libdav1d "libdav1d >= 0.5.0" "dav1d/dav1d.h" dav1d_version ||
# check_lib libdav1d "dav1d/dav1d.h" "DAV1D_VERSION" "-ldav1d $libm_extralibs $pthreads_extralibs"
# }
# 9) run build_ffmpeg.sh
# 10) see compiled library in build_ffmpeg/android folder

NDK="/opt/android/ndk/android-ndk-r21e"
NDK_r10e="/opt/android/ndk/android-ndk-r10e"
Expand All @@ -24,6 +35,11 @@ export ANDROID_NDK=$NDK
sh build-vpx.sh
cd ..

#build dav1d
cd ./dav1d-android
export ANDROID_NDK=$NDK
./build_dav1d.sh
cd ..

NDK=$NDK_r10e

Expand All @@ -37,7 +53,7 @@ echo "Configuring..."

INCLUDES=" -I${PREFIX}/include"
LIBS=" -L${PREFIX}/lib"

./configure \
--cc=$CC \
--nm=$NM \
Expand Down Expand Up @@ -80,6 +96,10 @@ LIBS=" -L${PREFIX}/lib"
--enable-muxer=matroska \
--enable-bsf=vp9_superframe \
--enable-bsf=vp9_raw_reorder \
\
--enable-libdav1d \
--enable-decoder=libdav1d \
--enable-decoder=av1 \
--enable-runtime-cpudetect \
--enable-pthreads \
--enable-avresample \
Expand All @@ -106,7 +126,7 @@ $ADDITIONAL_CONFIGURE_FLAG

#echo "continue?"
#read
make -j8 install
make -j${HOST_NUM_CORES} install

}

Expand Down
87 changes: 87 additions & 0 deletions TMessagesProj/jni/ffmpeg/build_ffmpeg/dav1d-android/build_dav1d.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash

PREFIX="$(pwd)/../android"
mkdir -p "$PREFIX"
echo "Building dav1d into $PREFIX"

pushd dav1d

meson setup builddir-arm64 \
--prefix "$PREFIX/arm64-v8a" \
--libdir="lib" \
--includedir="include" \
--buildtype=release -Denable_tests=false -Denable_tools=false -Ddefault_library=static \
--cross-file <(echo "
[binaries]
c = '${ANDROID_NDK}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang'
ar = '${ANDROID_NDK}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar'
[host_machine]
system = 'android'
cpu_family = 'aarch64'
cpu = 'arm64'
endian = 'little'
")
ninja -C builddir-arm64
ninja -C builddir-arm64 install

meson setup builddir-armv7 \
--prefix "$PREFIX/armeabi-v7a" \
--libdir="lib" \
--includedir="include" \
--buildtype=release -Denable_tests=false -Denable_tools=false -Ddefault_library=static \
--cross-file <(echo "
[binaries]
c = '${ANDROID_NDK}/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi21-clang'
ar = '${ANDROID_NDK}/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar'
[host_machine]
system = 'android'
cpu_family = 'arm'
cpu = 'armv7'
endian = 'little'
") \
-Dc_args="-DDAV1D_NO_GETAUXVAL"
ninja -C builddir-armv7
ninja -C builddir-armv7 install

meson setup builddir-x86 \
--prefix "$PREFIX/x86" \
--libdir="lib" \
--includedir="include" \
--buildtype=release -Denable_tests=false -Denable_tools=false -Ddefault_library=static \
--cross-file <(echo "
[binaries]
c = '${ANDROID_NDK}/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android21-clang'
ar = '${ANDROID_NDK}/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android-ar'
[host_machine]
system = 'android'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'
")
ninja -C builddir-x86
ninja -C builddir-x86 install

meson setup builddir-x86_64 \
--prefix "$PREFIX/x86_64" \
--libdir="lib" \
--includedir="include" \
--buildtype=release -Denable_tests=false -Denable_tools=false -Ddefault_library=static \
--cross-file <(echo "
[binaries]
c = '${ANDROID_NDK}/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android21-clang'
ar = '${ANDROID_NDK}/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android-ar'
[host_machine]
system = 'android'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
")
ninja -C builddir-x86_64
ninja -C builddir-x86_64 install

popd

94 changes: 94 additions & 0 deletions TMessagesProj/jni/ffmpeg/include/dav1d/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* Copyright © 2018, VideoLAN and dav1d authors
* Copyright © 2018, Two Orioles, LLC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef DAV1D_COMMON_H
#define DAV1D_COMMON_H

#include <errno.h>
#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef DAV1D_API
#if defined _WIN32
#if defined DAV1D_BUILDING_DLL
#define DAV1D_API __declspec(dllexport)
#else
#define DAV1D_API
#endif
#else
#if __GNUC__ >= 4
#define DAV1D_API __attribute__ ((visibility ("default")))
#else
#define DAV1D_API
#endif
#endif
#endif

#if EPERM > 0
#define DAV1D_ERR(e) (-(e)) ///< Negate POSIX error code.
#else
#define DAV1D_ERR(e) (e)
#endif

/**
* A reference-counted object wrapper for a user-configurable pointer.
*/
typedef struct Dav1dUserData {
const uint8_t *data; ///< data pointer
struct Dav1dRef *ref; ///< allocation origin
} Dav1dUserData;

/**
* Input packet metadata which are copied from the input data used to
* decode each image into the matching structure of the output image
* returned back to the user. Since these are metadata fields, they
* can be used for other purposes than the documented ones, they will
* still be passed from input data to output picture without being
* used internally.
*/
typedef struct Dav1dDataProps {
int64_t timestamp; ///< container timestamp of input data, INT64_MIN if unknown (default)
int64_t duration; ///< container duration of input data, 0 if unknown (default)
int64_t offset; ///< stream offset of input data, -1 if unknown (default)
size_t size; ///< packet size, default Dav1dData.sz
struct Dav1dUserData user_data; ///< user-configurable data, default NULL members
} Dav1dDataProps;

/**
* Release reference to a Dav1dDataProps.
*/
DAV1D_API void dav1d_data_props_unref(Dav1dDataProps *props);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* DAV1D_COMMON_H */
Loading

0 comments on commit fb2e545

Please sign in to comment.