react-native-audio-api 0.8.0-nightly-5a12f24-20250901 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RNAudioAPI.podspec +15 -6
- package/android/build.gradle +11 -2
- package/android/src/main/cpp/audioapi/CMakeLists.txt +24 -17
- package/android/src/main/cpp/audioapi/android/core/AudioDecoder.cpp +51 -21
- package/android/src/main/jniLibs/arm64-v8a/libavcodec.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libavformat.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libavutil.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libswresample.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libavcodec.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libavformat.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libavutil.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libswresample.so +0 -0
- package/android/src/main/jniLibs/x86/libavcodec.so +0 -0
- package/android/src/main/jniLibs/x86/libavformat.so +0 -0
- package/android/src/main/jniLibs/x86/libavutil.so +0 -0
- package/android/src/main/jniLibs/x86/libswresample.so +0 -0
- package/android/src/main/jniLibs/x86_64/libavcodec.so +0 -0
- package/android/src/main/jniLibs/x86_64/libavformat.so +0 -0
- package/android/src/main/jniLibs/x86_64/libavutil.so +0 -0
- package/android/src/main/jniLibs/x86_64/libswresample.so +0 -0
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.h +11 -0
- package/common/cpp/audioapi/HostObjects/StreamerNodeHostObject.h +30 -0
- package/common/cpp/audioapi/core/BaseAudioContext.cpp +9 -0
- package/common/cpp/audioapi/core/BaseAudioContext.h +2 -0
- package/common/cpp/audioapi/core/sources/StreamerNode.cpp +299 -0
- package/common/cpp/audioapi/core/sources/StreamerNode.h +123 -0
- package/common/cpp/audioapi/core/utils/AudioDecoder.h +61 -0
- package/common/cpp/audioapi/core/utils/AudioNodeManager.cpp +14 -2
- package/common/cpp/audioapi/core/utils/AudioNodeManager.h +3 -0
- package/common/cpp/audioapi/external/arm64-v8a/libcrypto.a +0 -0
- package/common/cpp/audioapi/external/arm64-v8a/libssl.a +0 -0
- package/common/cpp/audioapi/external/armeabi-v7a/libcrypto.a +0 -0
- package/common/cpp/audioapi/external/armeabi-v7a/libssl.a +0 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/ac3_parser.h +36 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/adts_parser.h +37 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/avcodec.h +2947 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/avdct.h +88 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/bsf.h +332 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/codec.h +367 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/codec_desc.h +134 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/codec_id.h +681 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/codec_par.h +248 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/d3d11va.h +109 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/defs.h +359 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/dirac.h +135 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/dv_profile.h +82 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/dxva2.h +90 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/jni.h +67 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/mediacodec.h +103 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/packet.h +907 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/qsv.h +109 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/vdpau.h +138 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/version.h +45 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/version_major.h +55 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/videotoolbox.h +85 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/vorbis_parser.h +74 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavformat/avformat.h +3004 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavformat/avio.h +831 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavformat/version.h +47 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavformat/version_major.h +50 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/adler32.h +63 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/aes.h +69 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/aes_ctr.h +99 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/ambient_viewing_environment.h +72 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/attributes.h +175 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/audio_fifo.h +187 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/avassert.h +120 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/avconfig.h +6 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/avstring.h +428 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/avutil.h +364 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/base64.h +72 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/blowfish.h +82 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/bprint.h +254 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/bswap.h +105 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/buffer.h +322 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/camellia.h +70 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/cast5.h +80 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/channel_layout.h +762 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/common.h +589 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/container_fifo.h +130 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/cpu.h +150 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/crc.h +102 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/csp.h +192 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/des.h +81 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/detection_bbox.h +108 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/dict.h +242 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/display.h +109 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/dovi_meta.h +396 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/downmix_info.h +115 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/encryption_info.h +205 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/error.h +129 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/eval.h +140 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/executor.h +67 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/ffversion.h +5 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/fifo.h +242 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/file.h +62 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/film_grain_params.h +282 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/frame.h +1163 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hash.h +264 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hdr_dynamic_metadata.h +376 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hdr_dynamic_vivid_metadata.h +292 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hmac.h +99 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext.h +601 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_amf.h +46 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_cuda.h +74 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_d3d11va.h +178 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_d3d12va.h +142 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_drm.h +169 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_dxva2.h +75 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_mediacodec.h +61 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_oh.h +34 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_opencl.h +100 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_qsv.h +87 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_vaapi.h +117 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_vdpau.h +44 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_videotoolbox.h +106 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_vulkan.h +377 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/iamf.h +694 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/imgutils.h +377 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/intfloat.h +77 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/intreadwrite.h +677 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/lfg.h +81 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/log.h +427 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/lzo.h +66 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/macros.h +80 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/mastering_display_metadata.h +137 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/mathematics.h +300 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/md5.h +89 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/mem.h +607 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/motion_vector.h +57 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/murmur3.h +115 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/opt.h +1194 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/parseutils.h +197 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/pixdesc.h +440 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/pixelutils.h +51 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/pixfmt.h +797 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/random_seed.h +57 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/rational.h +225 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/rc4.h +69 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/refstruct.h +297 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/replaygain.h +50 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/ripemd.h +83 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/samplefmt.h +269 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/sha.h +90 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/sha512.h +92 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/spherical.h +243 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/stereo3d.h +325 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/tdrdi.h +164 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/tea.h +71 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/threadmessage.h +115 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/timecode.h +199 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/timestamp.h +85 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/tree.h +137 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/twofish.h +70 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/tx.h +210 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/uuid.h +146 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/version.h +119 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/video_enc_params.h +171 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/video_hint.h +107 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/xtea.h +94 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libswresample/swresample.h +587 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libswresample/version.h +46 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libswresample/version_major.h +31 -0
- package/common/cpp/audioapi/external/libavcodec.xcframework/Info.plist +44 -0
- package/common/cpp/audioapi/external/libavcodec.xcframework/ios-arm64/libavcodec.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libavcodec.xcframework/ios-arm64/libavcodec.framework/libavcodec +0 -0
- package/common/cpp/audioapi/external/libavcodec.xcframework/ios-arm64_x86_64-simulator/libavcodec.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libavcodec.xcframework/ios-arm64_x86_64-simulator/libavcodec.framework/libavcodec +0 -0
- package/common/cpp/audioapi/external/libavformat.xcframework/Info.plist +44 -0
- package/common/cpp/audioapi/external/libavformat.xcframework/ios-arm64/libavformat.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libavformat.xcframework/ios-arm64/libavformat.framework/libavformat +0 -0
- package/common/cpp/audioapi/external/libavformat.xcframework/ios-arm64_x86_64-simulator/libavformat.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libavformat.xcframework/ios-arm64_x86_64-simulator/libavformat.framework/libavformat +0 -0
- package/common/cpp/audioapi/external/libavutil.xcframework/Info.plist +44 -0
- package/common/cpp/audioapi/external/libavutil.xcframework/ios-arm64/libavutil.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libavutil.xcframework/ios-arm64/libavutil.framework/libavutil +0 -0
- package/common/cpp/audioapi/external/libavutil.xcframework/ios-arm64_x86_64-simulator/libavutil.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libavutil.xcframework/ios-arm64_x86_64-simulator/libavutil.framework/libavutil +0 -0
- package/common/cpp/audioapi/external/libswresample.xcframework/Info.plist +44 -0
- package/common/cpp/audioapi/external/libswresample.xcframework/ios-arm64/libswresample.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libswresample.xcframework/ios-arm64/libswresample.framework/libswresample +0 -0
- package/common/cpp/audioapi/external/libswresample.xcframework/ios-arm64_x86_64-simulator/libswresample.framework/Info.plist +1 -0
- package/common/cpp/audioapi/external/libswresample.xcframework/ios-arm64_x86_64-simulator/libswresample.framework/libswresample +0 -0
- package/common/cpp/audioapi/external/x86/libcrypto.a +0 -0
- package/common/cpp/audioapi/external/x86/libssl.a +0 -0
- package/common/cpp/audioapi/external/x86_64/libcrypto.a +0 -0
- package/common/cpp/audioapi/external/x86_64/libssl.a +0 -0
- package/common/cpp/audioapi/libs/ffmpeg/FFmpegDecoding.cpp +402 -0
- package/common/cpp/audioapi/libs/ffmpeg/FFmpegDecoding.h +27 -0
- package/common/cpp/audioapi/libs/ffmpeg/INSTRUCTIONS.md +26 -0
- package/common/cpp/audioapi/libs/ffmpeg/create_xcframework.sh +111 -0
- package/common/cpp/audioapi/libs/ffmpeg/ffmpeg_setup.sh +361 -0
- package/common/cpp/audioapi/utils/SpscChannel.hpp +47 -38
- package/common/cpp/test/CMakeLists.txt +7 -1
- package/ios/audioapi/ios/core/AudioDecoder.mm +22 -2
- package/lib/commonjs/api.js +7 -0
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/core/AudioContext.js.map +1 -1
- package/lib/commonjs/core/BaseAudioContext.js +4 -0
- package/lib/commonjs/core/BaseAudioContext.js.map +1 -1
- package/lib/commonjs/core/StreamerNode.js +15 -0
- package/lib/commonjs/core/StreamerNode.js.map +1 -0
- package/lib/module/api.js +1 -0
- package/lib/module/api.js.map +1 -1
- package/lib/module/core/AudioContext.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +4 -0
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/module/core/StreamerNode.js +9 -0
- package/lib/module/core/StreamerNode.js.map +1 -0
- package/lib/typescript/api.d.ts +1 -0
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/core/AudioContext.d.ts +1 -1
- package/lib/typescript/core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/core/BaseAudioContext.d.ts +2 -0
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/core/StreamerNode.d.ts +5 -0
- package/lib/typescript/core/StreamerNode.d.ts.map +1 -0
- package/lib/typescript/interfaces.d.ts +5 -1
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +1 -0
- package/src/core/AudioContext.ts +1 -1
- package/src/core/BaseAudioContext.ts +5 -0
- package/src/core/StreamerNode.ts +8 -0
- package/src/interfaces.ts +6 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#include <audioapi/utils/AudioBus.h>
|
|
2
|
+
#include <iostream>
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <vector>
|
|
5
|
+
|
|
6
|
+
extern "C" {
|
|
7
|
+
#include <libavcodec/avcodec.h>
|
|
8
|
+
#include <libavformat/avformat.h>
|
|
9
|
+
#include <libavutil/opt.h>
|
|
10
|
+
#include <libswresample/swresample.h>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
namespace audioapi::ffmpegdecoding {
|
|
14
|
+
// Custom IO context for reading from memory
|
|
15
|
+
struct MemoryIOContext {
|
|
16
|
+
const uint8_t *data;
|
|
17
|
+
size_t size;
|
|
18
|
+
size_t pos;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
int read_packet(void *opaque, uint8_t *buf, int buf_size);
|
|
22
|
+
int64_t seek_packet(void *opaque, int64_t offset, int whence);
|
|
23
|
+
std::vector<int16_t> readAllPcmFrames(AVFormatContext *fmt_ctx, AVCodecContext *codec_ctx, int out_sample_rate, int audio_stream_index, int channels, size_t &framesRead);
|
|
24
|
+
std::vector<int16_t> decodeWithMemoryBlock(const void *data, size_t size, int sample_rate);
|
|
25
|
+
std::vector<int16_t> decodeWithFilePath(const std::string &path, int sample_rate);
|
|
26
|
+
|
|
27
|
+
} // namespace audioapi::ffmpegdecoder
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Instruction on how to compile your own version of the ffmpeg and to replace binary files with yours.
|
|
2
|
+
|
|
3
|
+
If you would like to change ffmpeg binaries f.e. to include some of its functionalities. There are possible solutions to do that.
|
|
4
|
+
|
|
5
|
+
Basically, there are two options to achieve it:
|
|
6
|
+
|
|
7
|
+
- Utilize `ffmpeg_setup.sh` script, which provides set of instructions to cross-compile FFmpeg library on all desired mobile architectures.
|
|
8
|
+
- Cross-compile it dynamically fully on your own.
|
|
9
|
+
|
|
10
|
+
Last part in both of the cases is to replace files in corresponding places.
|
|
11
|
+
|
|
12
|
+
## Where to put compiled files?
|
|
13
|
+
|
|
14
|
+
### Includes
|
|
15
|
+
|
|
16
|
+
All includes should go to packages/react-native-audio-api/common/cpp/audioapi/external/ffmpeg_include
|
|
17
|
+
|
|
18
|
+
### Android
|
|
19
|
+
|
|
20
|
+
Put your corresponding .so files for each architecture (TARGET_ABI) to packages/react-native-audio-api/android/src/main/jniLibs/TARGET_ABI
|
|
21
|
+
|
|
22
|
+
### iOS
|
|
23
|
+
|
|
24
|
+
Put corresponding .xcframework files in packages/react-native-audio-api/common/cpp/audioapi/external
|
|
25
|
+
|
|
26
|
+
## Warning: due to how xcode build an app, it is recommended to delete output directory after moving prebuilt
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Creates an Info.plist file for a given framework:
|
|
4
|
+
build_info_plist() {
|
|
5
|
+
local file_path="$1"
|
|
6
|
+
local framework_name="$2"
|
|
7
|
+
local framework_id="$3"
|
|
8
|
+
|
|
9
|
+
# Minimum version must be the same we used when building FFmpeg.
|
|
10
|
+
local minimum_version_key="MinimumOSVersion"
|
|
11
|
+
local minimum_os_version="16.0"
|
|
12
|
+
|
|
13
|
+
local supported_platforms="iPhoneOS"
|
|
14
|
+
|
|
15
|
+
info_plist="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
|
16
|
+
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
|
|
17
|
+
<plist version=\"1.0\">
|
|
18
|
+
<dict>
|
|
19
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
20
|
+
<string>en</string>
|
|
21
|
+
<key>CFBundleExecutable</key>
|
|
22
|
+
<string>${framework_name}</string>
|
|
23
|
+
<key>CFBundleIdentifier</key>
|
|
24
|
+
<string>${framework_id}</string>
|
|
25
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
26
|
+
<string>6.0</string>
|
|
27
|
+
<key>CFBundleName</key>
|
|
28
|
+
<string>${framework_name}</string>
|
|
29
|
+
<key>CFBundlePackageType</key>
|
|
30
|
+
<string>FMWK</string>
|
|
31
|
+
<key>CFBundleShortVersionString</key>
|
|
32
|
+
<string>7.0.2</string>
|
|
33
|
+
<key>CFBundleVersion</key>
|
|
34
|
+
<string>7.0.2</string>
|
|
35
|
+
<key>CFBundleSignature</key>
|
|
36
|
+
<string>????</string>
|
|
37
|
+
<key>${minimum_version_key}</key>
|
|
38
|
+
<string>${minimum_os_version}</string>
|
|
39
|
+
<key>CFBundleSupportedPlatforms</key>
|
|
40
|
+
<array>
|
|
41
|
+
<string>${supported_platforms}</string>
|
|
42
|
+
</array>
|
|
43
|
+
<key>NSPrincipalClass</key>
|
|
44
|
+
<string></string>
|
|
45
|
+
</dict>
|
|
46
|
+
</plist>"
|
|
47
|
+
echo $info_plist | tee ${file_path} 1>/dev/null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
dylib_regex="^@rpath/.*\.dylib$"
|
|
51
|
+
|
|
52
|
+
# Creates framework from a dylib file:
|
|
53
|
+
create_framework() {
|
|
54
|
+
local framework_name="$1"
|
|
55
|
+
local ffmpeg_library_path="$2"
|
|
56
|
+
local framework_complete_path="${ffmpeg_library_path}/framework/${framework_name}.framework/${framework_name}"
|
|
57
|
+
|
|
58
|
+
# Create framework directory and copy dylib file to this directory:
|
|
59
|
+
mkdir -p "${ffmpeg_library_path}/framework/${framework_name}.framework"
|
|
60
|
+
cp "${ffmpeg_library_path}/lib/${framework_name}.dylib" "${ffmpeg_library_path}/framework/${framework_name}.framework/${framework_name}"
|
|
61
|
+
|
|
62
|
+
# Change the shared library identification name, removing version number and 'dylib' extension;
|
|
63
|
+
# \c Frameworks part of the name is needed since this is where frameworks will be installed in
|
|
64
|
+
# an application bundle:
|
|
65
|
+
install_name_tool -id @rpath/Frameworks/${framework_name}.framework/${framework_name} "${framework_complete_path}"
|
|
66
|
+
|
|
67
|
+
# Add Info.plist file into the framework directory:
|
|
68
|
+
build_info_plist "${ffmpeg_library_path}/framework/${framework_name}.framework/Info.plist" "${framework_name}" "io.qt.ffmpegkit."${framework_name}
|
|
69
|
+
otool -L "$framework_complete_path" | awk '/\t/ {print $1}' | egrep "$dylib_regex" | while read -r dependency_path; do
|
|
70
|
+
found_name=$(tmp=${dependency_path/*\/}; echo ${tmp/\.*})
|
|
71
|
+
if [ "$found_name" != "$framework_name" ]
|
|
72
|
+
then
|
|
73
|
+
# Change the dependent shared library install name to remove version number and 'dylib' extension:
|
|
74
|
+
install_name_tool -change "$dependency_path" @rpath/Frameworks/${found_name}.framework/${found_name} "${framework_complete_path}"
|
|
75
|
+
fi
|
|
76
|
+
done
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
ffmpeg_libs="libavcodec libavformat libavutil libswresample"
|
|
80
|
+
|
|
81
|
+
for name in $ffmpeg_libs; do
|
|
82
|
+
create_framework $name output/ios/iphoneos
|
|
83
|
+
create_framework $name output/ios/iphonesimulator
|
|
84
|
+
done
|
|
85
|
+
|
|
86
|
+
# Create XCFramework:
|
|
87
|
+
OUTPUT_DIR="output/ios"
|
|
88
|
+
|
|
89
|
+
xcodebuild -create-xcframework \
|
|
90
|
+
-framework "${OUTPUT_DIR}/iphoneos/framework/libavcodec.framework" \
|
|
91
|
+
-framework "${OUTPUT_DIR}/iphonesimulator/framework/libavcodec.framework" \
|
|
92
|
+
-output "${OUTPUT_DIR}/libavcodec.xcframework"
|
|
93
|
+
|
|
94
|
+
xcodebuild -create-xcframework \
|
|
95
|
+
-framework "${OUTPUT_DIR}/iphoneos/framework/libavformat.framework" \
|
|
96
|
+
-framework "${OUTPUT_DIR}/iphonesimulator/framework/libavformat.framework" \
|
|
97
|
+
-output "${OUTPUT_DIR}/libavformat.xcframework"
|
|
98
|
+
|
|
99
|
+
xcodebuild -create-xcframework \
|
|
100
|
+
-framework "${OUTPUT_DIR}/iphoneos/framework/libavutil.framework" \
|
|
101
|
+
-framework "${OUTPUT_DIR}/iphonesimulator/framework/libavutil.framework" \
|
|
102
|
+
-output "${OUTPUT_DIR}/libavutil.xcframework"
|
|
103
|
+
|
|
104
|
+
xcodebuild -create-xcframework \
|
|
105
|
+
-framework "${OUTPUT_DIR}/iphoneos/framework/libswresample.framework" \
|
|
106
|
+
-framework "${OUTPUT_DIR}/iphonesimulator/framework/libswresample.framework" \
|
|
107
|
+
-output "${OUTPUT_DIR}/libswresample.xcframework"
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# FFmpeg Mobile Architecture Build Script
|
|
4
|
+
# Builds static libraries (.a files) for iOS and Android architectures
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
SOURCE_DIR="/path/to/your/ffmpeg" # Change this to your FFmpeg source directory
|
|
8
|
+
if [ ! -d "${SOURCE_DIR}" ]; then
|
|
9
|
+
echo "FFmpeg source directory does not exist: ${SOURCE_DIR}"
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
BUILD_DIR="$(pwd)/build"
|
|
14
|
+
OUTPUT_DIR="$(pwd)/output"
|
|
15
|
+
mkdir -p "${BUILD_DIR}"
|
|
16
|
+
mkdir -p "${OUTPUT_DIR}"
|
|
17
|
+
|
|
18
|
+
AVUTIL_VERSION="60.6.100"
|
|
19
|
+
AVCODEC_VERSION="62.8.100"
|
|
20
|
+
AVFORMAT_VERSION="62.1.103"
|
|
21
|
+
SWRRESAMPLE_VERSION="6.0.100"
|
|
22
|
+
|
|
23
|
+
COMMON_CONFIG="
|
|
24
|
+
--disable-programs
|
|
25
|
+
--disable-doc
|
|
26
|
+
--disable-htmlpages
|
|
27
|
+
--disable-manpages
|
|
28
|
+
--disable-podpages
|
|
29
|
+
--disable-txtpages
|
|
30
|
+
--disable-avdevice
|
|
31
|
+
--disable-swscale
|
|
32
|
+
--disable-avfilter
|
|
33
|
+
--disable-protocols
|
|
34
|
+
--disable-devices
|
|
35
|
+
--disable-filters
|
|
36
|
+
--disable-static
|
|
37
|
+
--enable-shared
|
|
38
|
+
--enable-small
|
|
39
|
+
--disable-debug
|
|
40
|
+
--disable-optimizations
|
|
41
|
+
--disable-everything
|
|
42
|
+
--disable-audiotoolbox
|
|
43
|
+
--disable-videotoolbox
|
|
44
|
+
--disable-hwaccels
|
|
45
|
+
--enable-protocol=https,tls,tcp
|
|
46
|
+
--enable-demuxer=hls
|
|
47
|
+
--enable-demuxer=mov
|
|
48
|
+
--enable-demuxer=mp3
|
|
49
|
+
--enable-parser=aac
|
|
50
|
+
--enable-decoder=aac
|
|
51
|
+
--enable-decoder=mp3
|
|
52
|
+
--enable-decoder=flac
|
|
53
|
+
--enable-protocol=udp
|
|
54
|
+
--enable-protocol=file
|
|
55
|
+
--enable-pic
|
|
56
|
+
--disable-x86asm
|
|
57
|
+
"
|
|
58
|
+
|
|
59
|
+
build_arch() {
|
|
60
|
+
local ARCH=$1
|
|
61
|
+
local PLATFORM=$2
|
|
62
|
+
local CC=$3
|
|
63
|
+
local CXX=$4
|
|
64
|
+
local CFLAGS=$5
|
|
65
|
+
local LDFLAGS=$6
|
|
66
|
+
local EXTRA_CONFIG=$7
|
|
67
|
+
|
|
68
|
+
if [[ ${PLATFORM} == "android" ]]; then
|
|
69
|
+
PLATFORM_NAME="android"
|
|
70
|
+
if [[ ${ARCH} == "aarch64" ]]; then
|
|
71
|
+
ARCH_NAME="arm64-v8a"
|
|
72
|
+
elif [[ ${ARCH} == "armv7a" ]]; then
|
|
73
|
+
ARCH_NAME="armeabi-v7a"
|
|
74
|
+
else
|
|
75
|
+
ARCH_NAME=${ARCH}
|
|
76
|
+
fi
|
|
77
|
+
elif [[ ${PLATFORM} == "darwin" ]]; then
|
|
78
|
+
PLATFORM_NAME="ios"
|
|
79
|
+
ARCH_NAME="iphoneos"
|
|
80
|
+
elif [[ ${PLATFORM} == "darwinsim" ]]; then
|
|
81
|
+
PLATFORM_NAME="ios"
|
|
82
|
+
if [[ ${ARCH} == "x86_64" ]]; then
|
|
83
|
+
ARCH_NAME="iphonesimulator_x86_64"
|
|
84
|
+
else
|
|
85
|
+
ARCH_NAME="iphonesimulator_arm64"
|
|
86
|
+
fi
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
echo "Building FFmpeg for ${PLATFORM_NAME} ${ARCH_NAME}..."
|
|
90
|
+
|
|
91
|
+
SOURCE_PATH="${BUILD_DIR}/ffmpeg-${PLATFORM_NAME}-${ARCH_NAME}"
|
|
92
|
+
OUTPUT_PATH="${OUTPUT_DIR}/${PLATFORM_NAME}/${ARCH_NAME}"
|
|
93
|
+
|
|
94
|
+
mkdir -p "${OUTPUT_PATH}"
|
|
95
|
+
|
|
96
|
+
echo "Copying source for ${PLATFORM_NAME} ${ARCH_NAME}..."
|
|
97
|
+
rm -rf "${SOURCE_PATH}"
|
|
98
|
+
cp -r "${SOURCE_DIR}" "${SOURCE_PATH}"
|
|
99
|
+
|
|
100
|
+
cd "${SOURCE_PATH}"
|
|
101
|
+
|
|
102
|
+
make distclean 2>/dev/null || true
|
|
103
|
+
|
|
104
|
+
if [[ ${PLATFORM} == "darwinsim" ]]; then
|
|
105
|
+
PLATFORM="darwin"
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
echo --enable-cross-compile --arch=${ARCH} --target-os=${PLATFORM} --cc="${CC}" --cxx="${CXX}" --extra-cflags="${CFLAGS}" --extra-ldflags="${LDFLAGS}" --prefix="${OUTPUT_PATH}" ${COMMON_CONFIG} ${EXTRA_CONFIG}
|
|
109
|
+
|
|
110
|
+
# Configure
|
|
111
|
+
./configure \
|
|
112
|
+
--enable-cross-compile \
|
|
113
|
+
--arch=${ARCH} \
|
|
114
|
+
--target-os=${PLATFORM} \
|
|
115
|
+
--cc="${CC}" \
|
|
116
|
+
--cxx="${CXX}" \
|
|
117
|
+
--extra-cflags="${CFLAGS}" \
|
|
118
|
+
--extra-ldflags="${LDFLAGS}" \
|
|
119
|
+
--prefix="${OUTPUT_PATH}" \
|
|
120
|
+
${COMMON_CONFIG} \
|
|
121
|
+
${EXTRA_CONFIG}
|
|
122
|
+
|
|
123
|
+
# Build
|
|
124
|
+
make -j10
|
|
125
|
+
make install
|
|
126
|
+
|
|
127
|
+
echo "Completed ${PLATFORM} ${ARCH}"
|
|
128
|
+
cd - > /dev/null
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
fix_dynamic_ios_linkage() {
|
|
132
|
+
local LIB_PATH=$1
|
|
133
|
+
|
|
134
|
+
# Get all dependencies that are not system libraries (including the library itself)
|
|
135
|
+
otool -L "${LIB_PATH}" | grep -v "/usr/lib/" | grep -v "/System/" | awk 'NR>1 {print $1}' | while read -r dep; do
|
|
136
|
+
if [[ -n "$dep" ]]; then
|
|
137
|
+
# Extract library name without any version numbers and extension for framework path
|
|
138
|
+
local lib_name=$(basename "$dep" | sed 's/\.dylib$//' | sed 's/\.[0-9][0-9.]*$//')
|
|
139
|
+
local framework_path="@rpath/Frameworks/${lib_name}.framework/${lib_name}"
|
|
140
|
+
echo "Changing dependency: $dep -> $framework_path"
|
|
141
|
+
install_name_tool -change "$dep" "$framework_path" "${LIB_PATH}"
|
|
142
|
+
fi
|
|
143
|
+
done
|
|
144
|
+
|
|
145
|
+
# Also update the library's own install name to use @rpath with framework structure
|
|
146
|
+
local lib_name=$(basename "${LIB_PATH}" | sed 's/\.dylib$//' | sed 's/\.[0-9][0-9.]*$//')
|
|
147
|
+
local framework_path="@rpath/Frameworks/${lib_name}.framework/${lib_name}"
|
|
148
|
+
echo "Updating install name for $(basename "${LIB_PATH}") -> $framework_path"
|
|
149
|
+
install_name_tool -id "$framework_path" "${LIB_PATH}"
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
# Check if source exists
|
|
153
|
+
if [ ! -d "${SOURCE_DIR}" ]; then
|
|
154
|
+
echo "FFmpeg source not found."
|
|
155
|
+
exit 1
|
|
156
|
+
fi
|
|
157
|
+
|
|
158
|
+
# Clean the source directory of any previous builds
|
|
159
|
+
echo "Cleaning source directory..."
|
|
160
|
+
cd "${SOURCE_DIR}"
|
|
161
|
+
make distclean 2>/dev/null || true
|
|
162
|
+
cd - > /dev/null
|
|
163
|
+
|
|
164
|
+
# iOS Architectures
|
|
165
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
166
|
+
echo "Building for iOS architectures..."
|
|
167
|
+
|
|
168
|
+
# iOS SDK paths
|
|
169
|
+
IOS_SDK_PATH=$(xcrun --sdk iphoneos --show-sdk-path)
|
|
170
|
+
IOS_SIM_SDK_PATH=$(xcrun --sdk iphonesimulator --show-sdk-path)
|
|
171
|
+
|
|
172
|
+
# iOS Device architectures
|
|
173
|
+
build_arch "arm64" "darwin" \
|
|
174
|
+
"$(xcrun --sdk iphoneos --find clang)" \
|
|
175
|
+
"$(xcrun --sdk iphoneos --find clang++)" \
|
|
176
|
+
"-arch arm64 -mios-version-min=11.0 -isysroot ${IOS_SDK_PATH}" \
|
|
177
|
+
"-arch arm64 -mios-version-min=11.0 -isysroot ${IOS_SDK_PATH}" \
|
|
178
|
+
"--disable-iconv --disable-zlib"
|
|
179
|
+
|
|
180
|
+
fix_dynamic_ios_linkage "${OUTPUT_DIR}/ios/iphoneos/lib/libavcodec.${AVCODEC_VERSION}.dylib"
|
|
181
|
+
fix_dynamic_ios_linkage "${OUTPUT_DIR}/ios/iphoneos/lib/libavformat.${AVFORMAT_VERSION}.dylib"
|
|
182
|
+
fix_dynamic_ios_linkage "${OUTPUT_DIR}/ios/iphoneos/lib/libavutil.${AVUTIL_VERSION}.dylib"
|
|
183
|
+
fix_dynamic_ios_linkage "${OUTPUT_DIR}/ios/iphoneos/lib/libswresample.${SWRRESAMPLE_VERSION}.dylib"
|
|
184
|
+
|
|
185
|
+
rm -rf "${OUTPUT_DIR}/ios/iphoneos/share"
|
|
186
|
+
|
|
187
|
+
build_arch "arm64" "darwinsim" \
|
|
188
|
+
"$(xcrun --sdk iphonesimulator --find clang)" \
|
|
189
|
+
"$(xcrun --sdk iphonesimulator --find clang++)" \
|
|
190
|
+
"-arch arm64 -mios-simulator-version-min=11.0 -isysroot ${IOS_SIM_SDK_PATH}" \
|
|
191
|
+
"-arch arm64 -mios-simulator-version-min=11.0 -isysroot ${IOS_SIM_SDK_PATH}" \
|
|
192
|
+
"--disable-iconv --disable-zlib"
|
|
193
|
+
|
|
194
|
+
fix_dynamic_ios_linkage "${OUTPUT_DIR}/ios/iphonesimulator_arm64/lib/libavcodec.${AVCODEC_VERSION}.dylib"
|
|
195
|
+
fix_dynamic_ios_linkage "${OUTPUT_DIR}/ios/iphonesimulator_arm64/lib/libavformat.${AVFORMAT_VERSION}.dylib"
|
|
196
|
+
fix_dynamic_ios_linkage "${OUTPUT_DIR}/ios/iphonesimulator_arm64/lib/libavutil.${AVUTIL_VERSION}.dylib"
|
|
197
|
+
fix_dynamic_ios_linkage "${OUTPUT_DIR}/ios/iphonesimulator_arm64/lib/libswresample.${SWRRESAMPLE_VERSION}.dylib"
|
|
198
|
+
|
|
199
|
+
rm -rf "${OUTPUT_DIR}/ios/iphonesimulator_arm64/share"
|
|
200
|
+
|
|
201
|
+
# iOS Simulator x86_64 (Intel Macs)
|
|
202
|
+
build_arch "x86_64" "darwinsim" \
|
|
203
|
+
"$(xcrun --sdk iphonesimulator --find clang)" \
|
|
204
|
+
"$(xcrun --sdk iphonesimulator --find clang++)" \
|
|
205
|
+
"-arch x86_64 -mios-simulator-version-min=11.0 -isysroot ${IOS_SIM_SDK_PATH}" \
|
|
206
|
+
"-arch x86_64 -mios-simulator-version-min=11.0 -isysroot ${IOS_SIM_SDK_PATH}" \
|
|
207
|
+
"--disable-iconv --disable-zlib"
|
|
208
|
+
|
|
209
|
+
fix_dynamic_ios_linkage "${OUTPUT_DIR}/ios/iphonesimulator_x86_64/lib/libavcodec.${AVCODEC_VERSION}.dylib"
|
|
210
|
+
fix_dynamic_ios_linkage "${OUTPUT_DIR}/ios/iphonesimulator_x86_64/lib/libavformat.${AVFORMAT_VERSION}.dylib"
|
|
211
|
+
fix_dynamic_ios_linkage "${OUTPUT_DIR}/ios/iphonesimulator_x86_64/lib/libavutil.${AVUTIL_VERSION}.dylib"
|
|
212
|
+
fix_dynamic_ios_linkage "${OUTPUT_DIR}/ios/iphonesimulator_x86_64/lib/libswresample.${SWRRESAMPLE_VERSION}.dylib"
|
|
213
|
+
|
|
214
|
+
rm -rf "${OUTPUT_DIR}/ios/iphonesimulator_x86_64/share"
|
|
215
|
+
|
|
216
|
+
mkdir -p "${OUTPUT_DIR}/ios/iphonesimulator/lib"
|
|
217
|
+
lipo -create \
|
|
218
|
+
"${OUTPUT_DIR}/ios/iphonesimulator_arm64/lib/libavcodec.${AVCODEC_VERSION}.dylib" \
|
|
219
|
+
"${OUTPUT_DIR}/ios/iphonesimulator_x86_64/lib/libavcodec.${AVCODEC_VERSION}.dylib" \
|
|
220
|
+
-output "${OUTPUT_DIR}/ios/iphonesimulator/lib/libavcodec.${AVCODEC_VERSION}.dylib"
|
|
221
|
+
lipo -create \
|
|
222
|
+
"${OUTPUT_DIR}/ios/iphonesimulator_arm64/lib/libavformat.${AVFORMAT_VERSION}.dylib" \
|
|
223
|
+
"${OUTPUT_DIR}/ios/iphonesimulator_x86_64/lib/libavformat.${AVFORMAT_VERSION}.dylib" \
|
|
224
|
+
-output "${OUTPUT_DIR}/ios/iphonesimulator/lib/libavformat.${AVFORMAT_VERSION}.dylib"
|
|
225
|
+
|
|
226
|
+
lipo -create \
|
|
227
|
+
"${OUTPUT_DIR}/ios/iphonesimulator_arm64/lib/libavutil.${AVUTIL_VERSION}.dylib" \
|
|
228
|
+
"${OUTPUT_DIR}/ios/iphonesimulator_x86_64/lib/libavutil.${AVUTIL_VERSION}.dylib" \
|
|
229
|
+
-output "${OUTPUT_DIR}/ios/iphonesimulator/lib/libavutil.${AVUTIL_VERSION}.dylib"
|
|
230
|
+
|
|
231
|
+
lipo -create \
|
|
232
|
+
"${OUTPUT_DIR}/ios/iphonesimulator_arm64/lib/libswresample.${SWRRESAMPLE_VERSION}.dylib" \
|
|
233
|
+
"${OUTPUT_DIR}/ios/iphonesimulator_x86_64/lib/libswresample.${SWRRESAMPLE_VERSION}.dylib" \
|
|
234
|
+
-output "${OUTPUT_DIR}/ios/iphonesimulator/lib/libswresample.${SWRRESAMPLE_VERSION}.dylib"
|
|
235
|
+
|
|
236
|
+
mv "${OUTPUT_DIR}/ios/iphonesimulator/lib/libswresample.${SWRRESAMPLE_VERSION}.dylib" "${OUTPUT_DIR}/ios/iphonesimulator/lib/libswresample.dylib"
|
|
237
|
+
mv "${OUTPUT_DIR}/ios/iphonesimulator/lib/libavutil.${AVUTIL_VERSION}.dylib" "${OUTPUT_DIR}/ios/iphonesimulator/lib/libavutil.dylib"
|
|
238
|
+
mv "${OUTPUT_DIR}/ios/iphonesimulator/lib/libavformat.${AVFORMAT_VERSION}.dylib" "${OUTPUT_DIR}/ios/iphonesimulator/lib/libavformat.dylib"
|
|
239
|
+
mv "${OUTPUT_DIR}/ios/iphonesimulator/lib/libavcodec.${AVCODEC_VERSION}.dylib" "${OUTPUT_DIR}/ios/iphonesimulator/lib/libavcodec.dylib"
|
|
240
|
+
|
|
241
|
+
bash ./create_xcframework.sh
|
|
242
|
+
|
|
243
|
+
echo "iOS builds completed!"
|
|
244
|
+
else
|
|
245
|
+
echo "Skipping iOS builds (requires macOS)"
|
|
246
|
+
fi
|
|
247
|
+
|
|
248
|
+
# Android Architectures
|
|
249
|
+
if [ -n "$ANDROID_NDK_ROOT" ] || [ -n "$NDK_ROOT" ]; then
|
|
250
|
+
echo "Building for Android architectures..."
|
|
251
|
+
|
|
252
|
+
# Use NDK_ROOT if ANDROID_NDK_ROOT is not set
|
|
253
|
+
NDK_PATH="${ANDROID_NDK_ROOT:-$NDK_ROOT}"
|
|
254
|
+
|
|
255
|
+
if [ ! -d "$NDK_PATH" ]; then
|
|
256
|
+
echo "Android NDK not found. Please set ANDROID_NDK_ROOT or NDK_ROOT environment variable"
|
|
257
|
+
else
|
|
258
|
+
API_LEVEL=21
|
|
259
|
+
TOOLCHAIN_PATH="${NDK_PATH}/toolchains/llvm/prebuilt"
|
|
260
|
+
|
|
261
|
+
# Detect host OS for toolchain
|
|
262
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
263
|
+
HOST_TAG="darwin-x86_64"
|
|
264
|
+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
265
|
+
HOST_TAG="linux-x86_64"
|
|
266
|
+
else
|
|
267
|
+
echo "Unsupported host OS for Android NDK"
|
|
268
|
+
exit 1
|
|
269
|
+
fi
|
|
270
|
+
|
|
271
|
+
TOOLCHAIN="${TOOLCHAIN_PATH}/${HOST_TAG}"
|
|
272
|
+
|
|
273
|
+
OPENSSL_PREBUILT_FOLDER="$(pwd)/openssl-prebuilt"
|
|
274
|
+
if [ ! -d "$OPENSSL_PREBUILT_FOLDER" ]; then
|
|
275
|
+
echo "Cloning and building OpenSSL for Android..."
|
|
276
|
+
if [ ! -d "openssl" ]; then
|
|
277
|
+
git clone https://github.com/openssl/openssl.git
|
|
278
|
+
fi
|
|
279
|
+
cd openssl
|
|
280
|
+
export ANDROID_NDK_ROOT=${NDK_PATH}
|
|
281
|
+
PATH=$TOOLCHAIN/bin:$PATH
|
|
282
|
+
mkdir -p "${OPENSSL_PREBUILT_FOLDER}/include"
|
|
283
|
+
|
|
284
|
+
# arm64-v8a
|
|
285
|
+
./Configure android-arm64 no-shared no-asm -D__ANDROID_API__=${API_LEVEL}
|
|
286
|
+
make -j10
|
|
287
|
+
mkdir -p ${OPENSSL_PREBUILT_FOLDER}/arm64-v8a && cp libcrypto.a libssl.a "${OPENSSL_PREBUILT_FOLDER}/arm64-v8a"
|
|
288
|
+
cp -r include/crypto include/openssl "${OPENSSL_PREBUILT_FOLDER}/include"
|
|
289
|
+
make clean
|
|
290
|
+
|
|
291
|
+
# armeabi-v7a
|
|
292
|
+
./Configure android-arm no-shared no-asm -D__ANDROID_API__=${API_LEVEL}
|
|
293
|
+
make -j10
|
|
294
|
+
mkdir -p ${OPENSSL_PREBUILT_FOLDER}/armeabi-v7a && cp libcrypto.a libssl.a "${OPENSSL_PREBUILT_FOLDER}/armeabi-v7a"
|
|
295
|
+
make clean
|
|
296
|
+
|
|
297
|
+
./Configure android-x86 no-shared no-asm -D__ANDROID_API__=${API_LEVEL}
|
|
298
|
+
make -j10
|
|
299
|
+
mkdir -p ${OPENSSL_PREBUILT_FOLDER}/x86 && cp libcrypto.a libssl.a "${OPENSSL_PREBUILT_FOLDER}/x86"
|
|
300
|
+
make clean
|
|
301
|
+
|
|
302
|
+
./Configure android-x86_64 no-shared no-asm -D__ANDROID_API__=${API_LEVEL}
|
|
303
|
+
make -j10
|
|
304
|
+
mkdir -p ${OPENSSL_PREBUILT_FOLDER}/x86_64 && cp libcrypto.a libssl.a "${OPENSSL_PREBUILT_FOLDER}/x86_64"
|
|
305
|
+
make clean
|
|
306
|
+
|
|
307
|
+
cd .. && rm -rf openssl
|
|
308
|
+
fi
|
|
309
|
+
|
|
310
|
+
# ARM64-v8a
|
|
311
|
+
build_arch "aarch64" "android" \
|
|
312
|
+
"${TOOLCHAIN}/bin/aarch64-linux-android${API_LEVEL}-clang" \
|
|
313
|
+
"${TOOLCHAIN}/bin/aarch64-linux-android${API_LEVEL}-clang++" \
|
|
314
|
+
"-I${OPENSSL_PREBUILT_FOLDER}/include -I${TOOLCHAIN}/sysroot/usr/include -fPIC -Wl,-Bsymbolic -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384" \
|
|
315
|
+
"-L${OPENSSL_PREBUILT_FOLDER}/arm64-v8a -L${TOOLCHAIN}/sysroot/usr/lib/aarch64-linux-android/${API_LEVEL} -fPIC -Wl,-Bsymbolic -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384" \
|
|
316
|
+
"--enable-openssl --extra-libs=-lz"
|
|
317
|
+
|
|
318
|
+
rm -rf ${OUTPUT_DIR}/android/arm64-v8a/share
|
|
319
|
+
|
|
320
|
+
# ARMv7a
|
|
321
|
+
build_arch "armv7a" "android" \
|
|
322
|
+
"${TOOLCHAIN}/bin/armv7a-linux-androideabi${API_LEVEL}-clang" \
|
|
323
|
+
"${TOOLCHAIN}/bin/armv7a-linux-androideabi${API_LEVEL}-clang++" \
|
|
324
|
+
"-I${OPENSSL_PREBUILT_FOLDER}/include -I${TOOLCHAIN}/sysroot/usr/include -fPIC -Wl,-Bsymbolic -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384" \
|
|
325
|
+
"-L${OPENSSL_PREBUILT_FOLDER}/armeabi-v7a -L${TOOLCHAIN}/sysroot/usr/lib/arm-linux-android/${API_LEVEL} -fPIC -Wl,-Bsymbolic -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384" \
|
|
326
|
+
"--enable-openssl --extra-libs=-lz"
|
|
327
|
+
|
|
328
|
+
rm -rf ${OUTPUT_DIR}/android/armeabi-v7a/share
|
|
329
|
+
|
|
330
|
+
# x86
|
|
331
|
+
build_arch "x86" "android" \
|
|
332
|
+
"${TOOLCHAIN}/bin/i686-linux-android${API_LEVEL}-clang" \
|
|
333
|
+
"${TOOLCHAIN}/bin/i686-linux-android${API_LEVEL}-clang++" \
|
|
334
|
+
"-I${OPENSSL_PREBUILT_FOLDER}/include -I${TOOLCHAIN}/darwin-x86_64/sysroot/usr/include -fPIC -Wl,-Bsymbolic -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384" \
|
|
335
|
+
"-L${OPENSSL_PREBUILT_FOLDER}/x86 -L${TOOLCHAIN}/darwin-x86_64/sysroot/usr/lib/i686-linux-android/${API_LEVEL} -fPIC -Wl,-Bsymbolic -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384" \
|
|
336
|
+
"--enable-openssl --extra-libs=-lz"
|
|
337
|
+
|
|
338
|
+
rm -rf ${OUTPUT_DIR}/android/x86/share
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
# x86_64
|
|
342
|
+
build_arch "x86_64" "android" \
|
|
343
|
+
"${TOOLCHAIN}/bin/x86_64-linux-android${API_LEVEL}-clang" \
|
|
344
|
+
"${TOOLCHAIN}/bin/x86_64-linux-android${API_LEVEL}-clang++" \
|
|
345
|
+
"-I${OPENSSL_PREBUILT_FOLDER}/include -I${TOOLCHAIN}/darwin-x86_64/sysroot/usr/include -fPIC -Wl,-Bsymbolic -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384" \
|
|
346
|
+
"-L${OPENSSL_PREBUILT_FOLDER}/x86_64 -L${TOOLCHAIN}/darwin-x86_64/sysroot/usr/lib/x86_64-linux-android/${API_LEVEL} -fPIC -Wl,-Bsymbolic -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384" \
|
|
347
|
+
"--enable-openssl --extra-libs=-lz"
|
|
348
|
+
|
|
349
|
+
rm -rf ${OUTPUT_DIR}/android/x86_64/share
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
echo "Android builds completed!"
|
|
353
|
+
fi
|
|
354
|
+
else
|
|
355
|
+
echo "Skipping Android builds (ANDROID_NDK_ROOT or NDK_ROOT not set)"
|
|
356
|
+
fi
|
|
357
|
+
|
|
358
|
+
rm -rf "${BUILD_DIR}"
|
|
359
|
+
|
|
360
|
+
echo ""
|
|
361
|
+
echo "All FFmpeg builds completed!"
|