react-native-alpha-video 0.0.0-stage → 1.0.1
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/LICENSE +21 -0
- package/README.md +908 -2
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/android/av1/build.gradle +67 -0
- package/android/av1/consumer-rules.pro +4 -0
- package/android/av1/src/main/cpp/Av1Codec_jni.cpp +8 -0
- package/android/av1/src/main/cpp/CMakeLists.txt +34 -0
- package/android/av1/src/main/java/dev/mediacache/alphavideo/av1/Av1Codec.java +21 -0
- package/android/build.gradle +90 -0
- package/android/consumer-rules.pro +2 -0
- package/android/gradle.properties +1 -0
- package/android/publish.gradle +82 -0
- package/android/settings.gradle +5 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/cpp/CMakeLists.txt +59 -0
- package/android/src/main/java/dev/mediacache/alphavideo/AlphaVideoCodecs.java +73 -0
- package/android/src/main/java/dev/mediacache/alphavideo/AlphaVideoView.java +1982 -0
- package/android/src/main/java/dev/mediacache/alphavideo/BufferedDualStreamPlayer.java +978 -0
- package/android/src/main/java/dev/mediacache/alphavideo/Fetcher.java +37 -0
- package/android/src/main/java/dev/mediacache/alphavideo/HttpFetcher.java +156 -0
- package/android/src/main/java/dev/mediacache/alphavideo/MediaCodecColor.java +47 -0
- package/android/src/main/java/dev/mediacache/alphavideo/MediaCodecDecoders.java +135 -0
- package/android/src/main/java/dev/mediacache/alphavideo/RangeSourceLink.java +54 -0
- package/android/src/main/java/dev/mediacache/alphavideo/SourceReader.java +174 -0
- package/android/src/main/java/dev/mediacache/alphavideo/SurfaceTextureVideoDecoder.java +802 -0
- package/android/src/main/java/dev/mediacache/alphavideo/WebMAlphaPlayerNative.java +95 -0
- package/android/src/main/java/dev/mediacache/alphavideo/WebMFrame.java +54 -0
- package/android/src/main/java/dev/mediacache/alphavideo/WebMSource.java +160 -0
- package/android/src/rangesource/java/dev/mediacache/alphavideo/AppDataSource.java +50 -0
- package/android/vpx/build.gradle +67 -0
- package/android/vpx/consumer-rules.pro +4 -0
- package/android/vpx/src/main/cpp/CMakeLists.txt +34 -0
- package/android/vpx/src/main/cpp/VpxCodec_jni.cpp +8 -0
- package/android/vpx/src/main/java/dev/mediacache/alphavideo/vpx/VpxCodec.java +21 -0
- package/codecs/av1/Dav1dDecoderPlugin.cpp +157 -0
- package/codecs/av1/Dav1dDecoderPlugin.h +17 -0
- package/codecs/vpx/VpxDecoderPlugin.cpp +103 -0
- package/codecs/vpx/VpxDecoderPlugin.h +17 -0
- package/cpp/AlphaDemuxer.cpp +984 -0
- package/cpp/AlphaDemuxer.h +123 -0
- package/cpp/AlphaVideoDecoderPlugin.h +84 -0
- package/cpp/Av1SequenceHeader.cpp +175 -0
- package/cpp/Av1SequenceHeader.h +25 -0
- package/cpp/ByteSource.cpp +116 -0
- package/cpp/ByteSource.h +59 -0
- package/cpp/RangeSourceClient.h +40 -0
- package/cpp/VideoDecoder.cpp +157 -0
- package/cpp/VideoDecoder.h +83 -0
- package/cpp/WebMAlphaPlayer.cpp +1666 -0
- package/cpp/WebMAlphaPlayer.h +389 -0
- package/cpp/WebMAlphaPlayer_jni.cpp +1380 -0
- package/cpp/YuvToRgb.cpp +39 -0
- package/cpp/YuvToRgb.h +40 -0
- package/ios/Sources/AlphaVideo/AlphaVideoCodecs.mm +63 -0
- package/ios/Sources/AlphaVideo/AlphaVideoInternal.h +70 -0
- package/ios/Sources/AlphaVideo/AlphaVideoPlayer.mm +994 -0
- package/ios/Sources/AlphaVideo/AlphaVideoSource.mm +476 -0
- package/ios/Sources/AlphaVideo/AlphaVideoView.mm +374 -0
- package/ios/Sources/AlphaVideo/include/AlphaVideo.h +303 -0
- package/ios/Sources/AlphaVideoAV1/AlphaVideoAV1Codec.mm +16 -0
- package/ios/Sources/AlphaVideoAV1/include/AlphaVideoAV1.h +18 -0
- package/ios/Sources/AlphaVideoVPX/AlphaVideoVPXCodec.mm +16 -0
- package/ios/Sources/AlphaVideoVPX/include/AlphaVideoVPX.h +17 -0
- package/lib/commonjs/AlphaVideoView.js +187 -0
- package/lib/commonjs/AlphaVideoView.js.map +1 -0
- package/lib/commonjs/AlphaVideoViewNativeComponent.js +47 -0
- package/lib/commonjs/AlphaVideoViewNativeComponent.js.map +1 -0
- package/lib/commonjs/AlphaVideoViewNativeComponent.web.js +11 -0
- package/lib/commonjs/AlphaVideoViewNativeComponent.web.js.map +1 -0
- package/lib/commonjs/NativeAlphaVideoModule.js +10 -0
- package/lib/commonjs/NativeAlphaVideoModule.js.map +1 -0
- package/lib/commonjs/NativeAlphaVideoModule.web.js +9 -0
- package/lib/commonjs/NativeAlphaVideoModule.web.js.map +1 -0
- package/lib/commonjs/WebPlayer.js +12 -0
- package/lib/commonjs/WebPlayer.js.map +1 -0
- package/lib/commonjs/WebPlayer.web.js +115 -0
- package/lib/commonjs/WebPlayer.web.js.map +1 -0
- package/lib/commonjs/index.js +124 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/AlphaVideoView.js +187 -0
- package/lib/module/AlphaVideoView.js.map +1 -0
- package/lib/module/AlphaVideoViewNativeComponent.js +47 -0
- package/lib/module/AlphaVideoViewNativeComponent.js.map +1 -0
- package/lib/module/AlphaVideoViewNativeComponent.web.js +11 -0
- package/lib/module/AlphaVideoViewNativeComponent.web.js.map +1 -0
- package/lib/module/NativeAlphaVideoModule.js +10 -0
- package/lib/module/NativeAlphaVideoModule.js.map +1 -0
- package/lib/module/NativeAlphaVideoModule.web.js +9 -0
- package/lib/module/NativeAlphaVideoModule.web.js.map +1 -0
- package/lib/module/WebPlayer.js +12 -0
- package/lib/module/WebPlayer.js.map +1 -0
- package/lib/module/WebPlayer.web.js +115 -0
- package/lib/module/WebPlayer.web.js.map +1 -0
- package/lib/module/index.js +124 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/react-native/src/AlphaVideoView.d.ts +189 -0
- package/lib/typescript/react-native/src/AlphaVideoView.d.ts.map +1 -0
- package/lib/typescript/react-native/src/AlphaVideoViewNativeComponent.d.ts +109 -0
- package/lib/typescript/react-native/src/AlphaVideoViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/react-native/src/AlphaVideoViewNativeComponent.web.d.ts +5 -0
- package/lib/typescript/react-native/src/AlphaVideoViewNativeComponent.web.d.ts.map +1 -0
- package/lib/typescript/react-native/src/NativeAlphaVideoModule.d.ts +21 -0
- package/lib/typescript/react-native/src/NativeAlphaVideoModule.d.ts.map +1 -0
- package/lib/typescript/react-native/src/NativeAlphaVideoModule.web.d.ts +3 -0
- package/lib/typescript/react-native/src/NativeAlphaVideoModule.web.d.ts.map +1 -0
- package/lib/typescript/react-native/src/WebPlayer.d.ts +3 -0
- package/lib/typescript/react-native/src/WebPlayer.d.ts.map +1 -0
- package/lib/typescript/react-native/src/WebPlayer.web.d.ts +9 -0
- package/lib/typescript/react-native/src/WebPlayer.web.d.ts.map +1 -0
- package/lib/typescript/react-native/src/index.d.ts +77 -0
- package/lib/typescript/react-native/src/index.d.ts.map +1 -0
- package/licenses/dav1d-COPYING.txt +23 -0
- package/licenses/libvpx-LICENSE.txt +31 -0
- package/licenses/libvpx-PATENTS.txt +23 -0
- package/licenses/libwebm-LICENSE.txt +30 -0
- package/licenses/libwebm-PATENTS.txt +23 -0
- package/package.json +152 -4
- package/prebuilt/android/arm64-v8a/lib/libdav1d.a +0 -0
- package/prebuilt/android/arm64-v8a/lib/libvpx.a +0 -0
- package/prebuilt/android/armeabi-v7a/lib/libdav1d.a +0 -0
- package/prebuilt/android/armeabi-v7a/lib/libvpx.a +0 -0
- package/prebuilt/android/x86_64/lib/libdav1d.a +0 -0
- package/prebuilt/android/x86_64/lib/libvpx.a +0 -0
- package/prebuilt/include/dav1d/common.h +94 -0
- package/prebuilt/include/dav1d/data.h +117 -0
- package/prebuilt/include/dav1d/dav1d.h +329 -0
- package/prebuilt/include/dav1d/headers.h +440 -0
- package/prebuilt/include/dav1d/picture.h +157 -0
- package/prebuilt/include/dav1d/version.h +50 -0
- package/prebuilt/include/vpx/vp8.h +136 -0
- package/prebuilt/include/vpx/vp8dx.h +228 -0
- package/prebuilt/include/vpx/vpx_codec.h +475 -0
- package/prebuilt/include/vpx/vpx_decoder.h +365 -0
- package/prebuilt/include/vpx/vpx_frame_buffer.h +83 -0
- package/prebuilt/include/vpx/vpx_image.h +209 -0
- package/prebuilt/include/vpx/vpx_integer.h +40 -0
- package/prebuilt/ios/lib/libdav1d.a +0 -0
- package/prebuilt/ios/lib/libvpx.a +0 -0
- package/prebuilt/ios-simulator/include/dav1d/common.h +94 -0
- package/prebuilt/ios-simulator/include/dav1d/data.h +117 -0
- package/prebuilt/ios-simulator/include/dav1d/dav1d.h +329 -0
- package/prebuilt/ios-simulator/include/dav1d/headers.h +440 -0
- package/prebuilt/ios-simulator/include/dav1d/picture.h +157 -0
- package/prebuilt/ios-simulator/include/dav1d/version.h +50 -0
- package/prebuilt/ios-simulator/include/vpx/vp8.h +136 -0
- package/prebuilt/ios-simulator/include/vpx/vp8dx.h +228 -0
- package/prebuilt/ios-simulator/include/vpx/vpx_codec.h +475 -0
- package/prebuilt/ios-simulator/include/vpx/vpx_decoder.h +365 -0
- package/prebuilt/ios-simulator/include/vpx/vpx_frame_buffer.h +83 -0
- package/prebuilt/ios-simulator/include/vpx/vpx_image.h +209 -0
- package/prebuilt/ios-simulator/include/vpx/vpx_integer.h +40 -0
- package/prebuilt/ios-simulator/lib/libdav1d.a +0 -0
- package/prebuilt/ios-simulator/lib/libvpx.a +0 -0
- package/react-native/android/CMakeLists.txt +14 -0
- package/react-native/android/build.gradle +113 -0
- package/react-native/android/src/main/AndroidManifest.xml +1 -0
- package/react-native/android/src/main/java/dev/mediacache/alphavideo/reactnative/AlphaVideoModule.java +102 -0
- package/react-native/android/src/main/java/dev/mediacache/alphavideo/reactnative/AlphaVideoPackage.java +50 -0
- package/react-native/android/src/main/java/dev/mediacache/alphavideo/reactnative/AlphaVideoViewManager.java +317 -0
- package/react-native/android/src/newarch/java/dev/mediacache/alphavideo/reactnative/AlphaVideoModuleSpec.java +10 -0
- package/react-native/android/src/newarch/java/dev/mediacache/alphavideo/reactnative/AlphaVideoViewManagerSpec.java +23 -0
- package/react-native/android/src/norangesource/java/dev/mediacache/alphavideo/AppDataSource.java +15 -0
- package/react-native/android/src/oldarch/java/dev/mediacache/alphavideo/reactnative/AlphaVideoModuleSpec.java +30 -0
- package/react-native/android/src/oldarch/java/dev/mediacache/alphavideo/reactnative/AlphaVideoViewManagerSpec.java +61 -0
- package/react-native/ios/RNAlphaVideoViewComponentView.mm +173 -0
- package/react-native/ios/RNAlphaVideoViewManager.mm +147 -0
- package/react-native/src/AlphaVideoView.tsx +329 -0
- package/react-native/src/AlphaVideoViewNativeComponent.ts +132 -0
- package/react-native/src/AlphaVideoViewNativeComponent.web.ts +5 -0
- package/react-native/src/NativeAlphaVideoModule.ts +22 -0
- package/react-native/src/NativeAlphaVideoModule.web.ts +2 -0
- package/react-native/src/WebPlayer.tsx +7 -0
- package/react-native/src/WebPlayer.web.tsx +87 -0
- package/react-native/src/index.tsx +144 -0
- package/react-native-alpha-video.podspec +99 -0
- package/react-native.config.js +12 -0
- package/scripts/build_codecs_android.sh +246 -0
- package/scripts/build_codecs_ios.sh +31 -0
- package/scripts/build_codecs_ios_device.sh +210 -0
- package/scripts/build_codecs_ios_simulator.sh +256 -0
- package/scripts/build_wasm.sh +230 -0
- package/scripts/build_xcframework.sh +49 -0
- package/scripts/fetch-prebuilt.sh +48 -0
- package/scripts/package_release.sh +107 -0
- package/scripts/publish-android.sh +85 -0
- package/scripts/vendor_range_source.sh +47 -0
- package/third_party/libwebm/AUTHORS.TXT +5 -0
- package/third_party/libwebm/LICENSE.TXT +30 -0
- package/third_party/libwebm/PATENTS.TXT +23 -0
- package/third_party/libwebm/README.md +7 -0
- package/third_party/libwebm/webm_parser/include/webm/buffer_reader.h +138 -0
- package/third_party/libwebm/webm_parser/include/webm/callback.h +363 -0
- package/third_party/libwebm/webm_parser/include/webm/dom_types.h +1781 -0
- package/third_party/libwebm/webm_parser/include/webm/element.h +208 -0
- package/third_party/libwebm/webm_parser/include/webm/file_reader.h +103 -0
- package/third_party/libwebm/webm_parser/include/webm/id.h +1085 -0
- package/third_party/libwebm/webm_parser/include/webm/istream_reader.h +99 -0
- package/third_party/libwebm/webm_parser/include/webm/reader.h +94 -0
- package/third_party/libwebm/webm_parser/include/webm/status.h +166 -0
- package/third_party/libwebm/webm_parser/include/webm/webm_parser.h +133 -0
- package/third_party/libwebm/webm_parser/src/ancestory.cc +334 -0
- package/third_party/libwebm/webm_parser/src/ancestory.h +83 -0
- package/third_party/libwebm/webm_parser/src/audio_parser.h +84 -0
- package/third_party/libwebm/webm_parser/src/bit_utils.cc +26 -0
- package/third_party/libwebm/webm_parser/src/bit_utils.h +24 -0
- package/third_party/libwebm/webm_parser/src/block_additions_parser.h +30 -0
- package/third_party/libwebm/webm_parser/src/block_group_parser.h +71 -0
- package/third_party/libwebm/webm_parser/src/block_header_parser.cc +76 -0
- package/third_party/libwebm/webm_parser/src/block_header_parser.h +65 -0
- package/third_party/libwebm/webm_parser/src/block_more_parser.h +32 -0
- package/third_party/libwebm/webm_parser/src/block_parser.cc +285 -0
- package/third_party/libwebm/webm_parser/src/block_parser.h +126 -0
- package/third_party/libwebm/webm_parser/src/bool_parser.h +95 -0
- package/third_party/libwebm/webm_parser/src/buffer_reader.cc +110 -0
- package/third_party/libwebm/webm_parser/src/byte_parser.h +144 -0
- package/third_party/libwebm/webm_parser/src/callback.cc +155 -0
- package/third_party/libwebm/webm_parser/src/chapter_atom_parser.h +42 -0
- package/third_party/libwebm/webm_parser/src/chapter_display_parser.h +34 -0
- package/third_party/libwebm/webm_parser/src/chapters_parser.h +28 -0
- package/third_party/libwebm/webm_parser/src/cluster_parser.h +48 -0
- package/third_party/libwebm/webm_parser/src/colour_parser.h +55 -0
- package/third_party/libwebm/webm_parser/src/content_enc_aes_settings_parser.h +32 -0
- package/third_party/libwebm/webm_parser/src/content_encoding_parser.h +38 -0
- package/third_party/libwebm/webm_parser/src/content_encodings_parser.h +30 -0
- package/third_party/libwebm/webm_parser/src/content_encryption_parser.h +37 -0
- package/third_party/libwebm/webm_parser/src/cue_point_parser.h +38 -0
- package/third_party/libwebm/webm_parser/src/cue_track_positions_parser.h +39 -0
- package/third_party/libwebm/webm_parser/src/cues_parser.h +27 -0
- package/third_party/libwebm/webm_parser/src/date_parser.cc +72 -0
- package/third_party/libwebm/webm_parser/src/date_parser.h +64 -0
- package/third_party/libwebm/webm_parser/src/ebml_parser.h +48 -0
- package/third_party/libwebm/webm_parser/src/edition_entry_parser.h +35 -0
- package/third_party/libwebm/webm_parser/src/element_parser.h +102 -0
- package/third_party/libwebm/webm_parser/src/file_reader.cc +142 -0
- package/third_party/libwebm/webm_parser/src/float_parser.cc +77 -0
- package/third_party/libwebm/webm_parser/src/float_parser.h +65 -0
- package/third_party/libwebm/webm_parser/src/id_element_parser.cc +49 -0
- package/third_party/libwebm/webm_parser/src/id_element_parser.h +56 -0
- package/third_party/libwebm/webm_parser/src/id_parser.cc +75 -0
- package/third_party/libwebm/webm_parser/src/id_parser.h +45 -0
- package/third_party/libwebm/webm_parser/src/info_parser.h +44 -0
- package/third_party/libwebm/webm_parser/src/int_parser.h +121 -0
- package/third_party/libwebm/webm_parser/src/istream_reader.cc +133 -0
- package/third_party/libwebm/webm_parser/src/master_parser.cc +298 -0
- package/third_party/libwebm/webm_parser/src/master_parser.h +230 -0
- package/third_party/libwebm/webm_parser/src/master_value_parser.h +533 -0
- package/third_party/libwebm/webm_parser/src/mastering_metadata_parser.h +57 -0
- package/third_party/libwebm/webm_parser/src/parser.h +34 -0
- package/third_party/libwebm/webm_parser/src/parser_utils.cc +34 -0
- package/third_party/libwebm/webm_parser/src/parser_utils.h +64 -0
- package/third_party/libwebm/webm_parser/src/projection_parser.h +40 -0
- package/third_party/libwebm/webm_parser/src/recursive_parser.h +93 -0
- package/third_party/libwebm/webm_parser/src/seek_head_parser.h +27 -0
- package/third_party/libwebm/webm_parser/src/seek_parser.h +37 -0
- package/third_party/libwebm/webm_parser/src/segment_parser.cc +86 -0
- package/third_party/libwebm/webm_parser/src/segment_parser.h +53 -0
- package/third_party/libwebm/webm_parser/src/simple_tag_parser.h +37 -0
- package/third_party/libwebm/webm_parser/src/size_parser.cc +56 -0
- package/third_party/libwebm/webm_parser/src/size_parser.h +43 -0
- package/third_party/libwebm/webm_parser/src/skip_callback.h +63 -0
- package/third_party/libwebm/webm_parser/src/skip_parser.cc +59 -0
- package/third_party/libwebm/webm_parser/src/skip_parser.h +35 -0
- package/third_party/libwebm/webm_parser/src/slices_parser.h +30 -0
- package/third_party/libwebm/webm_parser/src/tag_parser.h +37 -0
- package/third_party/libwebm/webm_parser/src/tags_parser.h +27 -0
- package/third_party/libwebm/webm_parser/src/targets_parser.h +35 -0
- package/third_party/libwebm/webm_parser/src/time_slice_parser.h +30 -0
- package/third_party/libwebm/webm_parser/src/track_entry_parser.h +65 -0
- package/third_party/libwebm/webm_parser/src/tracks_parser.h +27 -0
- package/third_party/libwebm/webm_parser/src/unknown_parser.cc +49 -0
- package/third_party/libwebm/webm_parser/src/unknown_parser.h +38 -0
- package/third_party/libwebm/webm_parser/src/var_int_parser.cc +71 -0
- package/third_party/libwebm/webm_parser/src/var_int_parser.h +56 -0
- package/third_party/libwebm/webm_parser/src/video_parser.h +122 -0
- package/third_party/libwebm/webm_parser/src/virtual_block_parser.cc +72 -0
- package/third_party/libwebm/webm_parser/src/virtual_block_parser.h +69 -0
- package/third_party/libwebm/webm_parser/src/void_parser.cc +49 -0
- package/third_party/libwebm/webm_parser/src/void_parser.h +41 -0
- package/third_party/libwebm/webm_parser/src/webm_parser.cc +282 -0
- package/third_party/range-source/LICENSE +21 -0
- package/third_party/range-source/README.md +8 -0
- package/third_party/range-source/include/range_source.h +395 -0
- package/third_party/range-source/include/range_source_download.h +309 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package entry point.
|
|
3
|
+
*
|
|
4
|
+
* The player view itself lives in `AlphaVideoView.tsx`; this file holds the native-module
|
|
5
|
+
* utilities and re-exports the rest.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Platform } from 'react-native';
|
|
9
|
+
import NativeAlphaVideoModule from './NativeAlphaVideoModule';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Decoder status information (Android only)
|
|
13
|
+
*/
|
|
14
|
+
export interface DecoderStatus {
|
|
15
|
+
/** Maximum VP9 decoder instances supported by the device */
|
|
16
|
+
maxVp9Instances: number;
|
|
17
|
+
/** Maximum AV1 decoder instances supported by the device */
|
|
18
|
+
maxAv1Instances: number;
|
|
19
|
+
/** Whether VP9 hardware decoder is available */
|
|
20
|
+
vp9HardwareAvailable: boolean;
|
|
21
|
+
/** Whether AV1 hardware decoder is available */
|
|
22
|
+
av1HardwareAvailable: boolean;
|
|
23
|
+
/** Currently active decoder instances */
|
|
24
|
+
activeDecoders: number;
|
|
25
|
+
/** Remaining available VP9 decoder slots */
|
|
26
|
+
availableVp9Slots: number;
|
|
27
|
+
/** Maximum dual-stream players possible */
|
|
28
|
+
maxDualStreamPlayers: number;
|
|
29
|
+
/** Whether we can create more dual-stream players */
|
|
30
|
+
canCreateMore: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The C++ core's software decoders, from the codecs built in (`"react-native-alpha-video":
|
|
33
|
+
* { "codecs": [...] }` in the app's package.json), e.g. `['libvpx v1.14.0', 'dav1d 1.5.1']`
|
|
34
|
+
*/
|
|
35
|
+
softwareDecoders: string[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Native module for AlphaVideo utilities (Android only)
|
|
40
|
+
*/
|
|
41
|
+
const AlphaVideoModule = Platform.OS === 'android' ? NativeAlphaVideoModule : null;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get detailed decoder information for all supported codecs (VP9, AV1).
|
|
45
|
+
* Returns a string with all decoder capabilities including max instances,
|
|
46
|
+
* hardware acceleration status, supported resolutions, etc.
|
|
47
|
+
*
|
|
48
|
+
* @returns Promise<string> - Detailed decoder information
|
|
49
|
+
* @platform android
|
|
50
|
+
*/
|
|
51
|
+
export async function getDecoderInfo(): Promise<string> {
|
|
52
|
+
if (Platform.OS !== 'android') {
|
|
53
|
+
return 'Decoder info only available on Android';
|
|
54
|
+
}
|
|
55
|
+
if (!AlphaVideoModule) {
|
|
56
|
+
throw new Error('RNAlphaVideo native module not available');
|
|
57
|
+
}
|
|
58
|
+
return AlphaVideoModule.getDecoderInfo();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get the maximum number of concurrent decoder instances for a codec.
|
|
63
|
+
* Dual-stream videos require 2 instances per player.
|
|
64
|
+
*
|
|
65
|
+
* @param mimeType - MIME type (e.g. 'video/x-vnd.on2.vp9' or 'video/av01')
|
|
66
|
+
* @returns Promise<number> - Max instances (-1 if unable to determine)
|
|
67
|
+
* @platform android
|
|
68
|
+
*/
|
|
69
|
+
export async function getMaxDecoderInstances(mimeType: string): Promise<number> {
|
|
70
|
+
if (Platform.OS !== 'android') {
|
|
71
|
+
return -1;
|
|
72
|
+
}
|
|
73
|
+
if (!AlphaVideoModule) {
|
|
74
|
+
throw new Error('RNAlphaVideo native module not available');
|
|
75
|
+
}
|
|
76
|
+
return AlphaVideoModule.getMaxDecoderInstances(mimeType);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get the current number of active VP9 decoder instances.
|
|
81
|
+
*
|
|
82
|
+
* @returns Promise<number> - Active decoder count
|
|
83
|
+
* @platform android
|
|
84
|
+
*/
|
|
85
|
+
export async function getActiveDecoderCount(): Promise<number> {
|
|
86
|
+
if (Platform.OS !== 'android') {
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
if (!AlphaVideoModule) {
|
|
90
|
+
throw new Error('RNAlphaVideo native module not available');
|
|
91
|
+
}
|
|
92
|
+
return AlphaVideoModule.getActiveDecoderCount();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get comprehensive decoder status as a structured object.
|
|
97
|
+
* Useful for determining if more dual-stream players can be created.
|
|
98
|
+
*
|
|
99
|
+
* @returns Promise<DecoderStatus> - Decoder status information
|
|
100
|
+
* @platform android
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* const status = await getDecoderStatus();
|
|
105
|
+
* console.log(`Can create ${status.maxDualStreamPlayers} dual-stream players`);
|
|
106
|
+
* console.log(`Currently using ${status.activeDualStreamPlayers}`);
|
|
107
|
+
* if (!status.canCreateMore) {
|
|
108
|
+
* console.warn('At decoder limit!');
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export async function getDecoderStatus(): Promise<DecoderStatus> {
|
|
113
|
+
if (Platform.OS !== 'android') {
|
|
114
|
+
return {
|
|
115
|
+
maxVp9Instances: -1,
|
|
116
|
+
maxAv1Instances: -1,
|
|
117
|
+
vp9HardwareAvailable: false,
|
|
118
|
+
av1HardwareAvailable: false,
|
|
119
|
+
activeDecoders: 0,
|
|
120
|
+
availableVp9Slots: -1,
|
|
121
|
+
maxDualStreamPlayers: -1,
|
|
122
|
+
canCreateMore: true,
|
|
123
|
+
softwareDecoders: [],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (!AlphaVideoModule) {
|
|
127
|
+
throw new Error('RNAlphaVideo native module not available');
|
|
128
|
+
}
|
|
129
|
+
return AlphaVideoModule.getDecoderStatus();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
AlphaVideoView,
|
|
134
|
+
type AlphaVideoViewProps,
|
|
135
|
+
type AlphaVideoViewRef,
|
|
136
|
+
type AlphaVideoSource,
|
|
137
|
+
type AlphaVideoWebSource,
|
|
138
|
+
type ByteSource,
|
|
139
|
+
type AlphaVideoStorage,
|
|
140
|
+
type PlaybackMode,
|
|
141
|
+
type Decoder,
|
|
142
|
+
type WebDecoder,
|
|
143
|
+
type AlphaVideoLoadEvent,
|
|
144
|
+
} from './AlphaVideoView';
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'pathname'
|
|
3
|
+
|
|
4
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
5
|
+
pod_dir = Pathname.new(__dir__).relative_path_from(Pathname.new(Pod::Config.instance.installation_root)).to_s
|
|
6
|
+
|
|
7
|
+
# The codec modules to build in, from the app's package.json as android/build.gradle reads them:
|
|
8
|
+
# "react-native-alpha-video": { "codecs": ["vpx"] }. Both without the setting.
|
|
9
|
+
codec_targets = { 'vpx' => 'AlphaVideoVPX', 'av1' => 'AlphaVideoAV1' }
|
|
10
|
+
app_package_json = File.join(Pod::Config.instance.installation_root, '..', 'package.json')
|
|
11
|
+
codecs_setting = File.exist?(app_package_json) &&
|
|
12
|
+
JSON.parse(File.read(app_package_json)).dig('react-native-alpha-video', 'codecs')
|
|
13
|
+
codecs = codec_targets.keys
|
|
14
|
+
if codecs_setting
|
|
15
|
+
unless codecs_setting.is_a?(Array) && (codecs_setting - codec_targets.keys).empty?
|
|
16
|
+
raise "react-native-alpha-video: \"codecs\" in #{app_package_json} must list some of #{codec_targets.keys}, not #{codecs_setting}"
|
|
17
|
+
end
|
|
18
|
+
codecs = codec_targets.keys & codecs_setting
|
|
19
|
+
end
|
|
20
|
+
# Once: CocoaPods evaluates a podspec several times per install
|
|
21
|
+
unless $react_native_alpha_video_codecs_reported
|
|
22
|
+
$react_native_alpha_video_codecs_reported = true
|
|
23
|
+
if codecs.empty?
|
|
24
|
+
Pod::UI.warn 'react-native-alpha-video: no codecs, and iOS has no platform decoder for these files: every video reports NO_DECODER'
|
|
25
|
+
else
|
|
26
|
+
Pod::UI.puts "react-native-alpha-video: codecs #{codecs.join(', ')}"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
Pod::Spec.new do |s|
|
|
31
|
+
s.name = 'react-native-alpha-video'
|
|
32
|
+
s.version = package['version']
|
|
33
|
+
s.summary = package['description']
|
|
34
|
+
s.homepage = package['homepage']
|
|
35
|
+
s.license = package['license']
|
|
36
|
+
s.authors = package['author']
|
|
37
|
+
|
|
38
|
+
s.platforms = { :ios => '13.0' }
|
|
39
|
+
s.source = { :git => package['repository']['url'], :tag => "v#{s.version}" }
|
|
40
|
+
|
|
41
|
+
# The iOS library (ios/Sources/AlphaVideo, also the Swift package), the React Native view, and
|
|
42
|
+
# each codec module's plugin adapter and the class the core finds it by
|
|
43
|
+
s.source_files = [
|
|
44
|
+
'ios/Sources/AlphaVideo/**/*.{h,mm}',
|
|
45
|
+
'react-native/ios/**/*.{h,mm}',
|
|
46
|
+
'cpp/**/*.{h,cpp}',
|
|
47
|
+
'third_party/libwebm/webm_parser/**/*.{h,cc}',
|
|
48
|
+
'third_party/range-source/include/*.h'
|
|
49
|
+
] + codecs.flat_map { |codec| ["codecs/#{codec}/*.{h,cpp}", "ios/Sources/#{codec_targets[codec]}/**/*.{h,mm}"] }
|
|
50
|
+
s.exclude_files = [
|
|
51
|
+
'cpp/*_jni.cpp'
|
|
52
|
+
]
|
|
53
|
+
s.public_header_files = 'ios/Sources/AlphaVideo/include/AlphaVideo.h'
|
|
54
|
+
|
|
55
|
+
# Prebuilt libvpx and dav1d, linked by the app (see user_target_xcconfig)
|
|
56
|
+
s.preserve_paths = [
|
|
57
|
+
'prebuilt/ios/**/*',
|
|
58
|
+
'prebuilt/ios-simulator/**/*',
|
|
59
|
+
'prebuilt/include/**/*'
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
header_paths = ['prebuilt/include', 'ios/Sources/AlphaVideo/include', 'cpp'] +
|
|
63
|
+
codecs.map { |codec| "codecs/#{codec}" } +
|
|
64
|
+
['third_party/range-source/include', 'third_party/libwebm/webm_parser', 'third_party/libwebm/webm_parser/include']
|
|
65
|
+
s.pod_target_xcconfig = {
|
|
66
|
+
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
|
|
67
|
+
'CLANG_CXX_LIBRARY' => 'libc++',
|
|
68
|
+
'HEADER_SEARCH_PATHS' => header_paths.map { |path| "\"$(PODS_TARGET_SRCROOT)/#{path}\"" }.join(' '),
|
|
69
|
+
'LIBRARY_SEARCH_PATHS[sdk=iphoneos*]' => '"$(PODS_TARGET_SRCROOT)/prebuilt/ios/lib"',
|
|
70
|
+
'LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]' => '"$(PODS_TARGET_SRCROOT)/prebuilt/ios-simulator/lib"'
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# Propagate linker flags to the user target (app). The prebuilt libs differ per SDK, so they
|
|
74
|
+
# can't be vendored; the app links them by path, relative to the Podfile's directory.
|
|
75
|
+
# dav1d is force-loaded: an app that also links another dav1d (libavif's pod) would otherwise
|
|
76
|
+
# bind the core's calls to whichever comes first on the link line, maybe one without 10-bit AV1.
|
|
77
|
+
user_target_xcconfig = {}
|
|
78
|
+
{ 'iphoneos' => 'ios', 'iphonesimulator' => 'ios-simulator' }.each do |sdk, dir|
|
|
79
|
+
lib_dir = "$(PODS_ROOT)/../#{pod_dir}/prebuilt/#{dir}/lib"
|
|
80
|
+
flags = []
|
|
81
|
+
flags << "-force_load \"#{lib_dir}/libdav1d.a\"" if codecs.include?('av1')
|
|
82
|
+
flags << '-lvpx' if codecs.include?('vpx')
|
|
83
|
+
next if flags.empty?
|
|
84
|
+
user_target_xcconfig["LIBRARY_SEARCH_PATHS[sdk=#{sdk}*]"] = "$(inherited) \"#{lib_dir}\""
|
|
85
|
+
user_target_xcconfig["OTHER_LDFLAGS[sdk=#{sdk}*]"] = "$(inherited) #{flags.join(' ')}"
|
|
86
|
+
end
|
|
87
|
+
s.user_target_xcconfig = user_target_xcconfig
|
|
88
|
+
|
|
89
|
+
s.frameworks = ['Metal', 'MetalKit']
|
|
90
|
+
s.libraries = ['c++']
|
|
91
|
+
|
|
92
|
+
# React Native's helper: the Fabric and codegen dependencies, and RCT_NEW_ARCH_ENABLED on the
|
|
93
|
+
# new architecture. It reads pod_target_xcconfig, so it comes after it.
|
|
94
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
95
|
+
install_modules_dependencies(s)
|
|
96
|
+
else
|
|
97
|
+
s.dependency 'React-Core'
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
dependency: {
|
|
3
|
+
platforms: {
|
|
4
|
+
ios: {},
|
|
5
|
+
android: {
|
|
6
|
+
sourceDir: './react-native/android',
|
|
7
|
+
packageImportPath: 'import dev.mediacache.alphavideo.reactnative.AlphaVideoPackage;',
|
|
8
|
+
packageInstance: 'new AlphaVideoPackage()',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# build_codecs_android.sh
|
|
4
|
+
# Downloads and builds the decoders for Android (arm64-v8a, armeabi-v7a, x86_64): libvpx for VP9
|
|
5
|
+
# and dav1d for AV1 (8- and 10/12-bit), as static libraries in prebuilt/android/<abi>/lib.
|
|
6
|
+
# Needs meson and ninja for dav1d (brew install meson ninja), and nasm for x86_64
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
set -e
|
|
10
|
+
|
|
11
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
12
|
+
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
13
|
+
LIBVPX_VERSION="1.14.0"
|
|
14
|
+
DAV1D_VERSION="1.5.1"
|
|
15
|
+
BUILD_DIR="$SCRIPT_DIR/build/android"
|
|
16
|
+
OUTPUT_DIR="$PROJECT_DIR/prebuilt/android"
|
|
17
|
+
|
|
18
|
+
# Android settings
|
|
19
|
+
ANDROID_API=24
|
|
20
|
+
NDK_PATH="${ANDROID_NDK_HOME:-$ANDROID_HOME/ndk/27.1.12297006}"
|
|
21
|
+
|
|
22
|
+
if [ ! -d "$NDK_PATH" ]; then
|
|
23
|
+
echo "❌ Android NDK not found at $NDK_PATH"
|
|
24
|
+
echo " Set ANDROID_NDK_HOME or install NDK via Android Studio"
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
TOOLCHAIN="$NDK_PATH/toolchains/llvm/prebuilt/$(uname -s | tr '[:upper:]' '[:lower:]')-x86_64"
|
|
29
|
+
# Tools are called by name and installs are staged with DESTDIR, because libvpx embeds its
|
|
30
|
+
# configure line in the library; that way no local paths end up in it.
|
|
31
|
+
export PATH="$TOOLCHAIN/bin:$PATH"
|
|
32
|
+
INSTALL_PREFIX="/usr/local"
|
|
33
|
+
|
|
34
|
+
echo "🔧 Building libvpx $LIBVPX_VERSION and dav1d $DAV1D_VERSION for Android"
|
|
35
|
+
echo " NDK: $NDK_PATH"
|
|
36
|
+
echo " Build dir: $BUILD_DIR"
|
|
37
|
+
echo " Output dir: $OUTPUT_DIR"
|
|
38
|
+
|
|
39
|
+
mkdir -p "$BUILD_DIR"
|
|
40
|
+
mkdir -p "$OUTPUT_DIR"
|
|
41
|
+
|
|
42
|
+
# Download libvpx source
|
|
43
|
+
download_libvpx() {
|
|
44
|
+
if [ ! -d "$BUILD_DIR/libvpx-$LIBVPX_VERSION" ]; then
|
|
45
|
+
echo "📥 Downloading libvpx $LIBVPX_VERSION..."
|
|
46
|
+
cd "$BUILD_DIR"
|
|
47
|
+
curl -L "https://github.com/webmproject/libvpx/archive/refs/tags/v$LIBVPX_VERSION.tar.gz" -o libvpx.tar.gz
|
|
48
|
+
tar xf libvpx.tar.gz
|
|
49
|
+
rm libvpx.tar.gz
|
|
50
|
+
fi
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Download dav1d source
|
|
54
|
+
download_dav1d() {
|
|
55
|
+
if [ ! -d "$BUILD_DIR/dav1d-$DAV1D_VERSION" ]; then
|
|
56
|
+
echo "📥 Downloading dav1d $DAV1D_VERSION..."
|
|
57
|
+
cd "$BUILD_DIR"
|
|
58
|
+
curl -L "https://github.com/videolan/dav1d/archive/refs/tags/$DAV1D_VERSION.tar.gz" -o dav1d.tar.gz
|
|
59
|
+
tar xf dav1d.tar.gz
|
|
60
|
+
rm dav1d.tar.gz
|
|
61
|
+
fi
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# libvpx and dav1d install into one staging root per ABI
|
|
65
|
+
deps_stage() {
|
|
66
|
+
echo "$BUILD_DIR/deps-$1"
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# Build libvpx for Android
|
|
70
|
+
build_libvpx_android() {
|
|
71
|
+
local ABI=$1
|
|
72
|
+
local ARCH=$2
|
|
73
|
+
local TARGET=$3
|
|
74
|
+
|
|
75
|
+
echo "🔨 Building libvpx for $ABI..."
|
|
76
|
+
|
|
77
|
+
cd "$BUILD_DIR/libvpx-$LIBVPX_VERSION"
|
|
78
|
+
|
|
79
|
+
local STAGE="$(deps_stage "$ABI")"
|
|
80
|
+
|
|
81
|
+
make clean 2>/dev/null || true
|
|
82
|
+
|
|
83
|
+
export CC="${TARGET}${ANDROID_API}-clang"
|
|
84
|
+
export CXX="${TARGET}${ANDROID_API}-clang++"
|
|
85
|
+
export AR="llvm-ar"
|
|
86
|
+
export RANLIB="llvm-ranlib"
|
|
87
|
+
export STRIP="llvm-strip"
|
|
88
|
+
|
|
89
|
+
if [ "$ABI" = "arm64-v8a" ] || [ "$ABI" = "armeabi-v7a" ]; then
|
|
90
|
+
export AS="${TARGET}${ANDROID_API}-clang"
|
|
91
|
+
export ASFLAGS="-c"
|
|
92
|
+
else
|
|
93
|
+
unset AS
|
|
94
|
+
unset ASFLAGS
|
|
95
|
+
|
|
96
|
+
if command -v nasm >/dev/null 2>&1; then
|
|
97
|
+
export NASM="$(command -v nasm)"
|
|
98
|
+
elif command -v yasm >/dev/null 2>&1; then
|
|
99
|
+
export YASM="$(command -v yasm)"
|
|
100
|
+
else
|
|
101
|
+
echo "⚠️ NASM/YASM not found on PATH; x86 builds may fail."
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
if command -v readelf >/dev/null 2>&1; then
|
|
105
|
+
export READELF="$(command -v readelf)"
|
|
106
|
+
elif command -v greadelf >/dev/null 2>&1; then
|
|
107
|
+
export READELF="$(command -v greadelf)"
|
|
108
|
+
else
|
|
109
|
+
export READELF="llvm-readelf"
|
|
110
|
+
fi
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
local VPX_TARGET=""
|
|
114
|
+
case $ABI in
|
|
115
|
+
arm64-v8a)
|
|
116
|
+
VPX_TARGET="arm64-android-gcc"
|
|
117
|
+
;;
|
|
118
|
+
armeabi-v7a)
|
|
119
|
+
VPX_TARGET="armv7-android-gcc"
|
|
120
|
+
;;
|
|
121
|
+
x86_64)
|
|
122
|
+
VPX_TARGET="x86_64-android-gcc"
|
|
123
|
+
;;
|
|
124
|
+
esac
|
|
125
|
+
|
|
126
|
+
./configure \
|
|
127
|
+
--prefix="$INSTALL_PREFIX" \
|
|
128
|
+
--target="$VPX_TARGET" \
|
|
129
|
+
--disable-examples \
|
|
130
|
+
--disable-tools \
|
|
131
|
+
--disable-docs \
|
|
132
|
+
--disable-unit-tests \
|
|
133
|
+
--enable-vp8-decoder \
|
|
134
|
+
--enable-vp9-decoder \
|
|
135
|
+
--disable-vp8-encoder \
|
|
136
|
+
--disable-vp9-encoder \
|
|
137
|
+
--enable-pic \
|
|
138
|
+
--enable-static \
|
|
139
|
+
--disable-shared \
|
|
140
|
+
--extra-cflags="-fPIC"
|
|
141
|
+
|
|
142
|
+
make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)
|
|
143
|
+
make install DESTDIR="$STAGE"
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
# Build dav1d for Android: the AV1 decoder, 8-bit and 10/12-bit (16bpc)
|
|
147
|
+
build_dav1d_android() {
|
|
148
|
+
local ABI=$1
|
|
149
|
+
local TARGET=$2
|
|
150
|
+
local CPU_FAMILY=$3
|
|
151
|
+
|
|
152
|
+
echo "🔨 Building dav1d for $ABI..."
|
|
153
|
+
|
|
154
|
+
local BUILD="$BUILD_DIR/dav1d-build-$ABI"
|
|
155
|
+
local CROSS_FILE="$BUILD_DIR/dav1d-$ABI.meson"
|
|
156
|
+
rm -rf "$BUILD"
|
|
157
|
+
|
|
158
|
+
cat > "$CROSS_FILE" <<EOF
|
|
159
|
+
[binaries]
|
|
160
|
+
c = '${TARGET}${ANDROID_API}-clang'
|
|
161
|
+
ar = 'llvm-ar'
|
|
162
|
+
strip = 'llvm-strip'
|
|
163
|
+
|
|
164
|
+
[properties]
|
|
165
|
+
needs_exe_wrapper = true
|
|
166
|
+
|
|
167
|
+
[host_machine]
|
|
168
|
+
system = 'android'
|
|
169
|
+
cpu_family = '$CPU_FAMILY'
|
|
170
|
+
cpu = '$CPU_FAMILY'
|
|
171
|
+
endian = 'little'
|
|
172
|
+
EOF
|
|
173
|
+
|
|
174
|
+
meson setup "$BUILD" "$BUILD_DIR/dav1d-$DAV1D_VERSION" \
|
|
175
|
+
--cross-file "$CROSS_FILE" \
|
|
176
|
+
--prefix="$INSTALL_PREFIX" \
|
|
177
|
+
--libdir=lib \
|
|
178
|
+
--buildtype=release \
|
|
179
|
+
--default-library=static \
|
|
180
|
+
-Db_pie=true \
|
|
181
|
+
-Dbitdepths=8,16 \
|
|
182
|
+
-Denable_tools=false \
|
|
183
|
+
-Denable_tests=false
|
|
184
|
+
ninja -C "$BUILD"
|
|
185
|
+
DESTDIR="$(deps_stage "$ABI")" meson install -C "$BUILD" --no-rebuild
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
# Copy outputs for each ABI
|
|
189
|
+
package_output() {
|
|
190
|
+
local ABI=$1
|
|
191
|
+
|
|
192
|
+
echo "📦 Packaging $ABI..."
|
|
193
|
+
|
|
194
|
+
local OUT="$OUTPUT_DIR/$ABI"
|
|
195
|
+
local DEPS_DIR="$(deps_stage "$ABI")$INSTALL_PREFIX"
|
|
196
|
+
rm -rf "$OUT/lib"
|
|
197
|
+
mkdir -p "$OUT/lib"
|
|
198
|
+
|
|
199
|
+
# Copy static archives (.a)
|
|
200
|
+
cp "$DEPS_DIR/lib/"*.a "$OUT/lib/"
|
|
201
|
+
|
|
202
|
+
# Copy headers to common prebuilt/include (same for all platforms)
|
|
203
|
+
local COMMON_INCLUDE="$PROJECT_DIR/prebuilt/include"
|
|
204
|
+
mkdir -p "$COMMON_INCLUDE"
|
|
205
|
+
rm -rf "$COMMON_INCLUDE/vpx" "$COMMON_INCLUDE/dav1d"
|
|
206
|
+
cp -R "$DEPS_DIR/include/"* "$COMMON_INCLUDE/"
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
# Main build process
|
|
210
|
+
main() {
|
|
211
|
+
echo "🚀 Starting Android libvpx + dav1d build..."
|
|
212
|
+
|
|
213
|
+
for tool in meson ninja; do
|
|
214
|
+
if ! command -v "$tool" >/dev/null 2>&1; then
|
|
215
|
+
echo "❌ $tool not found on PATH; dav1d needs it (brew install meson ninja)"
|
|
216
|
+
exit 1
|
|
217
|
+
fi
|
|
218
|
+
done
|
|
219
|
+
|
|
220
|
+
download_libvpx
|
|
221
|
+
download_dav1d
|
|
222
|
+
|
|
223
|
+
# Build for arm64-v8a (most common)
|
|
224
|
+
rm -rf "$(deps_stage arm64-v8a)"
|
|
225
|
+
build_libvpx_android "arm64-v8a" "aarch64" "aarch64-linux-android"
|
|
226
|
+
build_dav1d_android "arm64-v8a" "aarch64-linux-android" "aarch64"
|
|
227
|
+
package_output "arm64-v8a"
|
|
228
|
+
|
|
229
|
+
# Build for armeabi-v7a (older devices)
|
|
230
|
+
rm -rf "$(deps_stage armeabi-v7a)"
|
|
231
|
+
build_libvpx_android "armeabi-v7a" "arm" "armv7a-linux-androideabi"
|
|
232
|
+
build_dav1d_android "armeabi-v7a" "armv7a-linux-androideabi" "arm"
|
|
233
|
+
package_output "armeabi-v7a"
|
|
234
|
+
|
|
235
|
+
# Build for x86_64 (emulator)
|
|
236
|
+
rm -rf "$(deps_stage x86_64)"
|
|
237
|
+
build_libvpx_android "x86_64" "x86_64" "x86_64-linux-android"
|
|
238
|
+
build_dav1d_android "x86_64" "x86_64-linux-android" "x86_64"
|
|
239
|
+
package_output "x86_64"
|
|
240
|
+
|
|
241
|
+
echo "✅ Android libvpx + dav1d build complete!"
|
|
242
|
+
echo " Output: $OUTPUT_DIR"
|
|
243
|
+
ls -la "$OUTPUT_DIR"
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
main "$@"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# build_codecs_ios.sh
|
|
4
|
+
# Convenience script to build libvpx and dav1d for both iOS Device and Simulator
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
10
|
+
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
11
|
+
|
|
12
|
+
echo "🚀 Building libvpx + dav1d for iOS (Device + Simulator)"
|
|
13
|
+
echo ""
|
|
14
|
+
|
|
15
|
+
# Build for device first
|
|
16
|
+
"$SCRIPT_DIR/build_codecs_ios_device.sh"
|
|
17
|
+
|
|
18
|
+
echo ""
|
|
19
|
+
echo "================================================"
|
|
20
|
+
echo ""
|
|
21
|
+
|
|
22
|
+
# Build for simulator
|
|
23
|
+
"$SCRIPT_DIR/build_codecs_ios_simulator.sh"
|
|
24
|
+
|
|
25
|
+
echo ""
|
|
26
|
+
echo "================================================"
|
|
27
|
+
echo "✅ All iOS builds complete!"
|
|
28
|
+
echo ""
|
|
29
|
+
echo "📁 Output directories:"
|
|
30
|
+
echo " Device: $PROJECT_DIR/prebuilt/ios/"
|
|
31
|
+
echo " Simulator: $PROJECT_DIR/prebuilt/ios-simulator/"
|