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,44 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>AvailableLibraries</key>
|
|
6
|
+
<array>
|
|
7
|
+
<dict>
|
|
8
|
+
<key>BinaryPath</key>
|
|
9
|
+
<string>libavcodec.framework/libavcodec</string>
|
|
10
|
+
<key>LibraryIdentifier</key>
|
|
11
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
12
|
+
<key>LibraryPath</key>
|
|
13
|
+
<string>libavcodec.framework</string>
|
|
14
|
+
<key>SupportedArchitectures</key>
|
|
15
|
+
<array>
|
|
16
|
+
<string>arm64</string>
|
|
17
|
+
<string>x86_64</string>
|
|
18
|
+
</array>
|
|
19
|
+
<key>SupportedPlatform</key>
|
|
20
|
+
<string>ios</string>
|
|
21
|
+
<key>SupportedPlatformVariant</key>
|
|
22
|
+
<string>simulator</string>
|
|
23
|
+
</dict>
|
|
24
|
+
<dict>
|
|
25
|
+
<key>BinaryPath</key>
|
|
26
|
+
<string>libavcodec.framework/libavcodec</string>
|
|
27
|
+
<key>LibraryIdentifier</key>
|
|
28
|
+
<string>ios-arm64</string>
|
|
29
|
+
<key>LibraryPath</key>
|
|
30
|
+
<string>libavcodec.framework</string>
|
|
31
|
+
<key>SupportedArchitectures</key>
|
|
32
|
+
<array>
|
|
33
|
+
<string>arm64</string>
|
|
34
|
+
</array>
|
|
35
|
+
<key>SupportedPlatform</key>
|
|
36
|
+
<string>ios</string>
|
|
37
|
+
</dict>
|
|
38
|
+
</array>
|
|
39
|
+
<key>CFBundlePackageType</key>
|
|
40
|
+
<string>XFWK</string>
|
|
41
|
+
<key>XCFrameworkFormatVersion</key>
|
|
42
|
+
<string>1.0</string>
|
|
43
|
+
</dict>
|
|
44
|
+
</plist>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>libavcodec</string> <key>CFBundleIdentifier</key> <string>io.qt.ffmpegkit.libavcodec</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>libavcodec</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>7.0.2</string> <key>CFBundleVersion</key> <string>7.0.2</string> <key>CFBundleSignature</key> <string>????</string> <key>MinimumOSVersion</key> <string>16.0</string> <key>CFBundleSupportedPlatforms</key> <array> <string>iPhoneOS</string> </array> <key>NSPrincipalClass</key> <string></string> </dict> </plist>
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>libavcodec</string> <key>CFBundleIdentifier</key> <string>io.qt.ffmpegkit.libavcodec</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>libavcodec</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>7.0.2</string> <key>CFBundleVersion</key> <string>7.0.2</string> <key>CFBundleSignature</key> <string>????</string> <key>MinimumOSVersion</key> <string>16.0</string> <key>CFBundleSupportedPlatforms</key> <array> <string>iPhoneOS</string> </array> <key>NSPrincipalClass</key> <string></string> </dict> </plist>
|
|
Binary file
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>AvailableLibraries</key>
|
|
6
|
+
<array>
|
|
7
|
+
<dict>
|
|
8
|
+
<key>BinaryPath</key>
|
|
9
|
+
<string>libavformat.framework/libavformat</string>
|
|
10
|
+
<key>LibraryIdentifier</key>
|
|
11
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
12
|
+
<key>LibraryPath</key>
|
|
13
|
+
<string>libavformat.framework</string>
|
|
14
|
+
<key>SupportedArchitectures</key>
|
|
15
|
+
<array>
|
|
16
|
+
<string>arm64</string>
|
|
17
|
+
<string>x86_64</string>
|
|
18
|
+
</array>
|
|
19
|
+
<key>SupportedPlatform</key>
|
|
20
|
+
<string>ios</string>
|
|
21
|
+
<key>SupportedPlatformVariant</key>
|
|
22
|
+
<string>simulator</string>
|
|
23
|
+
</dict>
|
|
24
|
+
<dict>
|
|
25
|
+
<key>BinaryPath</key>
|
|
26
|
+
<string>libavformat.framework/libavformat</string>
|
|
27
|
+
<key>LibraryIdentifier</key>
|
|
28
|
+
<string>ios-arm64</string>
|
|
29
|
+
<key>LibraryPath</key>
|
|
30
|
+
<string>libavformat.framework</string>
|
|
31
|
+
<key>SupportedArchitectures</key>
|
|
32
|
+
<array>
|
|
33
|
+
<string>arm64</string>
|
|
34
|
+
</array>
|
|
35
|
+
<key>SupportedPlatform</key>
|
|
36
|
+
<string>ios</string>
|
|
37
|
+
</dict>
|
|
38
|
+
</array>
|
|
39
|
+
<key>CFBundlePackageType</key>
|
|
40
|
+
<string>XFWK</string>
|
|
41
|
+
<key>XCFrameworkFormatVersion</key>
|
|
42
|
+
<string>1.0</string>
|
|
43
|
+
</dict>
|
|
44
|
+
</plist>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>libavformat</string> <key>CFBundleIdentifier</key> <string>io.qt.ffmpegkit.libavformat</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>libavformat</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>7.0.2</string> <key>CFBundleVersion</key> <string>7.0.2</string> <key>CFBundleSignature</key> <string>????</string> <key>MinimumOSVersion</key> <string>16.0</string> <key>CFBundleSupportedPlatforms</key> <array> <string>iPhoneOS</string> </array> <key>NSPrincipalClass</key> <string></string> </dict> </plist>
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>libavformat</string> <key>CFBundleIdentifier</key> <string>io.qt.ffmpegkit.libavformat</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>libavformat</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>7.0.2</string> <key>CFBundleVersion</key> <string>7.0.2</string> <key>CFBundleSignature</key> <string>????</string> <key>MinimumOSVersion</key> <string>16.0</string> <key>CFBundleSupportedPlatforms</key> <array> <string>iPhoneOS</string> </array> <key>NSPrincipalClass</key> <string></string> </dict> </plist>
|
|
Binary file
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>AvailableLibraries</key>
|
|
6
|
+
<array>
|
|
7
|
+
<dict>
|
|
8
|
+
<key>BinaryPath</key>
|
|
9
|
+
<string>libavutil.framework/libavutil</string>
|
|
10
|
+
<key>LibraryIdentifier</key>
|
|
11
|
+
<string>ios-arm64</string>
|
|
12
|
+
<key>LibraryPath</key>
|
|
13
|
+
<string>libavutil.framework</string>
|
|
14
|
+
<key>SupportedArchitectures</key>
|
|
15
|
+
<array>
|
|
16
|
+
<string>arm64</string>
|
|
17
|
+
</array>
|
|
18
|
+
<key>SupportedPlatform</key>
|
|
19
|
+
<string>ios</string>
|
|
20
|
+
</dict>
|
|
21
|
+
<dict>
|
|
22
|
+
<key>BinaryPath</key>
|
|
23
|
+
<string>libavutil.framework/libavutil</string>
|
|
24
|
+
<key>LibraryIdentifier</key>
|
|
25
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
26
|
+
<key>LibraryPath</key>
|
|
27
|
+
<string>libavutil.framework</string>
|
|
28
|
+
<key>SupportedArchitectures</key>
|
|
29
|
+
<array>
|
|
30
|
+
<string>arm64</string>
|
|
31
|
+
<string>x86_64</string>
|
|
32
|
+
</array>
|
|
33
|
+
<key>SupportedPlatform</key>
|
|
34
|
+
<string>ios</string>
|
|
35
|
+
<key>SupportedPlatformVariant</key>
|
|
36
|
+
<string>simulator</string>
|
|
37
|
+
</dict>
|
|
38
|
+
</array>
|
|
39
|
+
<key>CFBundlePackageType</key>
|
|
40
|
+
<string>XFWK</string>
|
|
41
|
+
<key>XCFrameworkFormatVersion</key>
|
|
42
|
+
<string>1.0</string>
|
|
43
|
+
</dict>
|
|
44
|
+
</plist>
|
package/common/cpp/audioapi/external/libavutil.xcframework/ios-arm64/libavutil.framework/Info.plist
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>libavutil</string> <key>CFBundleIdentifier</key> <string>io.qt.ffmpegkit.libavutil</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>libavutil</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>7.0.2</string> <key>CFBundleVersion</key> <string>7.0.2</string> <key>CFBundleSignature</key> <string>????</string> <key>MinimumOSVersion</key> <string>16.0</string> <key>CFBundleSupportedPlatforms</key> <array> <string>iPhoneOS</string> </array> <key>NSPrincipalClass</key> <string></string> </dict> </plist>
|
package/common/cpp/audioapi/external/libavutil.xcframework/ios-arm64/libavutil.framework/libavutil
ADDED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>libavutil</string> <key>CFBundleIdentifier</key> <string>io.qt.ffmpegkit.libavutil</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>libavutil</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>7.0.2</string> <key>CFBundleVersion</key> <string>7.0.2</string> <key>CFBundleSignature</key> <string>????</string> <key>MinimumOSVersion</key> <string>16.0</string> <key>CFBundleSupportedPlatforms</key> <array> <string>iPhoneOS</string> </array> <key>NSPrincipalClass</key> <string></string> </dict> </plist>
|
|
Binary file
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>AvailableLibraries</key>
|
|
6
|
+
<array>
|
|
7
|
+
<dict>
|
|
8
|
+
<key>BinaryPath</key>
|
|
9
|
+
<string>libswresample.framework/libswresample</string>
|
|
10
|
+
<key>LibraryIdentifier</key>
|
|
11
|
+
<string>ios-arm64</string>
|
|
12
|
+
<key>LibraryPath</key>
|
|
13
|
+
<string>libswresample.framework</string>
|
|
14
|
+
<key>SupportedArchitectures</key>
|
|
15
|
+
<array>
|
|
16
|
+
<string>arm64</string>
|
|
17
|
+
</array>
|
|
18
|
+
<key>SupportedPlatform</key>
|
|
19
|
+
<string>ios</string>
|
|
20
|
+
</dict>
|
|
21
|
+
<dict>
|
|
22
|
+
<key>BinaryPath</key>
|
|
23
|
+
<string>libswresample.framework/libswresample</string>
|
|
24
|
+
<key>LibraryIdentifier</key>
|
|
25
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
26
|
+
<key>LibraryPath</key>
|
|
27
|
+
<string>libswresample.framework</string>
|
|
28
|
+
<key>SupportedArchitectures</key>
|
|
29
|
+
<array>
|
|
30
|
+
<string>arm64</string>
|
|
31
|
+
<string>x86_64</string>
|
|
32
|
+
</array>
|
|
33
|
+
<key>SupportedPlatform</key>
|
|
34
|
+
<string>ios</string>
|
|
35
|
+
<key>SupportedPlatformVariant</key>
|
|
36
|
+
<string>simulator</string>
|
|
37
|
+
</dict>
|
|
38
|
+
</array>
|
|
39
|
+
<key>CFBundlePackageType</key>
|
|
40
|
+
<string>XFWK</string>
|
|
41
|
+
<key>XCFrameworkFormatVersion</key>
|
|
42
|
+
<string>1.0</string>
|
|
43
|
+
</dict>
|
|
44
|
+
</plist>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>libswresample</string> <key>CFBundleIdentifier</key> <string>io.qt.ffmpegkit.libswresample</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>libswresample</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>7.0.2</string> <key>CFBundleVersion</key> <string>7.0.2</string> <key>CFBundleSignature</key> <string>????</string> <key>MinimumOSVersion</key> <string>16.0</string> <key>CFBundleSupportedPlatforms</key> <array> <string>iPhoneOS</string> </array> <key>NSPrincipalClass</key> <string></string> </dict> </plist>
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>libswresample</string> <key>CFBundleIdentifier</key> <string>io.qt.ffmpegkit.libswresample</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>libswresample</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>7.0.2</string> <key>CFBundleVersion</key> <string>7.0.2</string> <key>CFBundleSignature</key> <string>????</string> <key>MinimumOSVersion</key> <string>16.0</string> <key>CFBundleSupportedPlatforms</key> <array> <string>iPhoneOS</string> </array> <key>NSPrincipalClass</key> <string></string> </dict> </plist>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
#include "FFmpegDecoding.h"
|
|
2
|
+
|
|
3
|
+
namespace audioapi::ffmpegdecoding {
|
|
4
|
+
|
|
5
|
+
int read_packet(void *opaque, uint8_t *buf, int buf_size) {
|
|
6
|
+
MemoryIOContext *ctx = static_cast<MemoryIOContext *>(opaque);
|
|
7
|
+
|
|
8
|
+
if (ctx->pos >= ctx->size) {
|
|
9
|
+
return AVERROR_EOF;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
int bytes_to_read =
|
|
13
|
+
std::min(buf_size, static_cast<int>(ctx->size - ctx->pos));
|
|
14
|
+
memcpy(buf, ctx->data + ctx->pos, bytes_to_read);
|
|
15
|
+
ctx->pos += bytes_to_read;
|
|
16
|
+
|
|
17
|
+
return bytes_to_read;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
int64_t seek_packet(void *opaque, int64_t offset, int whence) {
|
|
21
|
+
MemoryIOContext *ctx = static_cast<MemoryIOContext *>(opaque);
|
|
22
|
+
|
|
23
|
+
switch (whence) {
|
|
24
|
+
case SEEK_SET:
|
|
25
|
+
ctx->pos = offset;
|
|
26
|
+
break;
|
|
27
|
+
case SEEK_CUR:
|
|
28
|
+
ctx->pos += offset;
|
|
29
|
+
break;
|
|
30
|
+
case SEEK_END:
|
|
31
|
+
ctx->pos = ctx->size + offset;
|
|
32
|
+
break;
|
|
33
|
+
case AVSEEK_SIZE:
|
|
34
|
+
return ctx->size;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (ctx->pos > ctx->size) {
|
|
38
|
+
ctx->pos = ctx->size;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return ctx->pos;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
std::vector<int16_t> readAllPcmFrames(
|
|
45
|
+
AVFormatContext *fmt_ctx,
|
|
46
|
+
AVCodecContext *codec_ctx,
|
|
47
|
+
int out_sample_rate,
|
|
48
|
+
int audio_stream_index,
|
|
49
|
+
int channels,
|
|
50
|
+
size_t &framesRead) {
|
|
51
|
+
std::vector<int16_t> buffer;
|
|
52
|
+
SwrContext *swr_ctx = swr_alloc();
|
|
53
|
+
if (swr_ctx == nullptr) {
|
|
54
|
+
return buffer;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
av_opt_set_chlayout(swr_ctx, "in_chlayout", &codec_ctx->ch_layout, 0);
|
|
58
|
+
av_opt_set_int(swr_ctx, "in_sample_rate", codec_ctx->sample_rate, 0);
|
|
59
|
+
av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", codec_ctx->sample_fmt, 0);
|
|
60
|
+
|
|
61
|
+
AVChannelLayout out_ch_layout;
|
|
62
|
+
av_channel_layout_default(&out_ch_layout, channels);
|
|
63
|
+
av_opt_set_chlayout(swr_ctx, "out_chlayout", &out_ch_layout, 0);
|
|
64
|
+
av_opt_set_int(swr_ctx, "out_sample_rate", out_sample_rate, 0);
|
|
65
|
+
av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
|
|
66
|
+
|
|
67
|
+
if (swr_init(swr_ctx) < 0) {
|
|
68
|
+
swr_free(&swr_ctx);
|
|
69
|
+
av_channel_layout_uninit(&out_ch_layout);
|
|
70
|
+
return buffer;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
AVPacket *packet = av_packet_alloc();
|
|
74
|
+
AVFrame *frame = av_frame_alloc();
|
|
75
|
+
|
|
76
|
+
if (packet == nullptr || frame == nullptr) {
|
|
77
|
+
if (packet != nullptr) av_packet_free(&packet);
|
|
78
|
+
if (frame != nullptr) av_frame_free(&frame);
|
|
79
|
+
swr_free(&swr_ctx);
|
|
80
|
+
av_channel_layout_uninit(&out_ch_layout);
|
|
81
|
+
return buffer;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Allocate buffer for resampled data
|
|
85
|
+
uint8_t **resampled_data = nullptr;
|
|
86
|
+
int max_resampled_samples = 4096; // Initial size
|
|
87
|
+
int ret = av_samples_alloc_array_and_samples(
|
|
88
|
+
&resampled_data,
|
|
89
|
+
nullptr,
|
|
90
|
+
channels,
|
|
91
|
+
max_resampled_samples,
|
|
92
|
+
AV_SAMPLE_FMT_S16,
|
|
93
|
+
0);
|
|
94
|
+
|
|
95
|
+
if (ret < 0) {
|
|
96
|
+
av_frame_free(&frame);
|
|
97
|
+
av_packet_free(&packet);
|
|
98
|
+
swr_free(&swr_ctx);
|
|
99
|
+
av_channel_layout_uninit(&out_ch_layout);
|
|
100
|
+
return buffer;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
framesRead = 0;
|
|
104
|
+
|
|
105
|
+
while (av_read_frame(fmt_ctx, packet) >= 0) {
|
|
106
|
+
if (packet->stream_index == audio_stream_index) {
|
|
107
|
+
if (avcodec_send_packet(codec_ctx, packet) == 0) {
|
|
108
|
+
while (avcodec_receive_frame(codec_ctx, frame) == 0) {
|
|
109
|
+
// Check if we need more buffer space
|
|
110
|
+
int out_samples = swr_get_out_samples(swr_ctx, frame->nb_samples);
|
|
111
|
+
if (out_samples > max_resampled_samples) {
|
|
112
|
+
if (resampled_data != nullptr) {
|
|
113
|
+
av_freep(&resampled_data[0]);
|
|
114
|
+
av_freep(&resampled_data);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
max_resampled_samples = out_samples;
|
|
118
|
+
ret = av_samples_alloc_array_and_samples(
|
|
119
|
+
&resampled_data,
|
|
120
|
+
nullptr,
|
|
121
|
+
channels,
|
|
122
|
+
max_resampled_samples,
|
|
123
|
+
AV_SAMPLE_FMT_S16,
|
|
124
|
+
0);
|
|
125
|
+
|
|
126
|
+
if (ret < 0) {
|
|
127
|
+
break; // Exit on allocation failure
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
int converted_samples = swr_convert(
|
|
132
|
+
swr_ctx,
|
|
133
|
+
resampled_data,
|
|
134
|
+
max_resampled_samples,
|
|
135
|
+
(const uint8_t **)frame->data,
|
|
136
|
+
frame->nb_samples);
|
|
137
|
+
|
|
138
|
+
if (converted_samples > 0) {
|
|
139
|
+
size_t current_size = buffer.size();
|
|
140
|
+
size_t new_samples = converted_samples * channels;
|
|
141
|
+
buffer.resize(current_size + new_samples);
|
|
142
|
+
memcpy(
|
|
143
|
+
buffer.data() + current_size,
|
|
144
|
+
resampled_data[0],
|
|
145
|
+
new_samples * sizeof(int16_t));
|
|
146
|
+
|
|
147
|
+
framesRead += converted_samples;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
av_packet_unref(packet);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Flush decoder
|
|
156
|
+
avcodec_send_packet(codec_ctx, nullptr);
|
|
157
|
+
while (avcodec_receive_frame(codec_ctx, frame) == 0) {
|
|
158
|
+
int out_samples = swr_get_out_samples(swr_ctx, frame->nb_samples);
|
|
159
|
+
if (out_samples > max_resampled_samples) {
|
|
160
|
+
if (resampled_data != nullptr) {
|
|
161
|
+
av_freep(&resampled_data[0]);
|
|
162
|
+
av_freep(&resampled_data);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
max_resampled_samples = out_samples;
|
|
166
|
+
ret = av_samples_alloc_array_and_samples(
|
|
167
|
+
&resampled_data,
|
|
168
|
+
nullptr,
|
|
169
|
+
channels,
|
|
170
|
+
max_resampled_samples,
|
|
171
|
+
AV_SAMPLE_FMT_S16,
|
|
172
|
+
0);
|
|
173
|
+
|
|
174
|
+
if (ret < 0) {
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
int converted_samples = swr_convert(
|
|
180
|
+
swr_ctx,
|
|
181
|
+
resampled_data,
|
|
182
|
+
max_resampled_samples,
|
|
183
|
+
(const uint8_t **)frame->data,
|
|
184
|
+
frame->nb_samples);
|
|
185
|
+
|
|
186
|
+
if (converted_samples > 0) {
|
|
187
|
+
size_t current_size = buffer.size();
|
|
188
|
+
size_t new_samples = converted_samples * channels;
|
|
189
|
+
buffer.resize(current_size + new_samples);
|
|
190
|
+
memcpy(
|
|
191
|
+
buffer.data() + current_size,
|
|
192
|
+
resampled_data[0],
|
|
193
|
+
new_samples * sizeof(int16_t));
|
|
194
|
+
|
|
195
|
+
framesRead += converted_samples;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (resampled_data != nullptr) {
|
|
200
|
+
av_freep(&resampled_data[0]);
|
|
201
|
+
av_freep(&resampled_data);
|
|
202
|
+
}
|
|
203
|
+
swr_free(&swr_ctx);
|
|
204
|
+
av_channel_layout_uninit(&out_ch_layout);
|
|
205
|
+
av_frame_free(&frame);
|
|
206
|
+
av_packet_free(&packet);
|
|
207
|
+
|
|
208
|
+
return buffer;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
std::vector<int16_t> decodeWithMemoryBlock(const void *data, size_t size, int sample_rate) {
|
|
212
|
+
if (data == nullptr || size == 0) {
|
|
213
|
+
return {};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
MemoryIOContext io_ctx;
|
|
217
|
+
io_ctx.data = static_cast<const uint8_t *>(data);
|
|
218
|
+
io_ctx.size = size;
|
|
219
|
+
io_ctx.pos = 0;
|
|
220
|
+
|
|
221
|
+
constexpr size_t buffer_size = 4096;
|
|
222
|
+
uint8_t *io_buffer = static_cast<uint8_t *>(av_malloc(buffer_size));
|
|
223
|
+
if (io_buffer == nullptr) {
|
|
224
|
+
return {};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
AVIOContext *avio_ctx = avio_alloc_context(
|
|
228
|
+
io_buffer, buffer_size, 0, &io_ctx, read_packet, nullptr, seek_packet);
|
|
229
|
+
|
|
230
|
+
if (avio_ctx == nullptr) {
|
|
231
|
+
av_free(io_buffer);
|
|
232
|
+
return {};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Create format context and set custom IO
|
|
236
|
+
AVFormatContext *fmt_ctx = avformat_alloc_context();
|
|
237
|
+
if (fmt_ctx == nullptr) {
|
|
238
|
+
avio_context_free(&avio_ctx);
|
|
239
|
+
return {};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
fmt_ctx->pb = avio_ctx;
|
|
243
|
+
|
|
244
|
+
// Open input from memory
|
|
245
|
+
if (avformat_open_input(&fmt_ctx, nullptr, nullptr, nullptr) < 0) {
|
|
246
|
+
avformat_free_context(fmt_ctx);
|
|
247
|
+
avio_context_free(&avio_ctx);
|
|
248
|
+
return {};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Find stream info
|
|
252
|
+
if (avformat_find_stream_info(fmt_ctx, nullptr) < 0) {
|
|
253
|
+
avformat_close_input(&fmt_ctx);
|
|
254
|
+
avio_context_free(&avio_ctx);
|
|
255
|
+
return {};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
int audio_stream_index = -1;
|
|
259
|
+
for (int i = 0; i < fmt_ctx->nb_streams; i++) {
|
|
260
|
+
if (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
|
261
|
+
audio_stream_index = i;
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (audio_stream_index == -1) {
|
|
267
|
+
avformat_close_input(&fmt_ctx);
|
|
268
|
+
avio_context_free(&avio_ctx);
|
|
269
|
+
return {};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
AVCodecParameters *codecpar = fmt_ctx->streams[audio_stream_index]->codecpar;
|
|
273
|
+
|
|
274
|
+
// Find decoder
|
|
275
|
+
const AVCodec *codec = avcodec_find_decoder(codecpar->codec_id);
|
|
276
|
+
if (codec == nullptr) {
|
|
277
|
+
avformat_close_input(&fmt_ctx);
|
|
278
|
+
avio_context_free(&avio_ctx);
|
|
279
|
+
return {};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Allocate and setup codec context
|
|
283
|
+
AVCodecContext *codec_ctx = avcodec_alloc_context3(codec);
|
|
284
|
+
if (codec_ctx == nullptr) {
|
|
285
|
+
avformat_close_input(&fmt_ctx);
|
|
286
|
+
avio_context_free(&avio_ctx);
|
|
287
|
+
return {};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (avcodec_parameters_to_context(codec_ctx, codecpar) < 0) {
|
|
291
|
+
avcodec_free_context(&codec_ctx);
|
|
292
|
+
avformat_close_input(&fmt_ctx);
|
|
293
|
+
avio_context_free(&avio_ctx);
|
|
294
|
+
return {};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (avcodec_open2(codec_ctx, codec, nullptr) < 0) {
|
|
298
|
+
avcodec_free_context(&codec_ctx);
|
|
299
|
+
avformat_close_input(&fmt_ctx);
|
|
300
|
+
avio_context_free(&avio_ctx);
|
|
301
|
+
return {};
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Get actual channel count from the decoded stream
|
|
305
|
+
int actual_channels = codec_ctx->ch_layout.nb_channels;
|
|
306
|
+
|
|
307
|
+
// Validate channel count
|
|
308
|
+
if (actual_channels <= 0 || actual_channels > 8) {
|
|
309
|
+
avcodec_free_context(&codec_ctx);
|
|
310
|
+
avformat_close_input(&fmt_ctx);
|
|
311
|
+
avio_context_free(&avio_ctx);
|
|
312
|
+
return {};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Decode all frames
|
|
316
|
+
size_t framesRead = 0;
|
|
317
|
+
std::vector<int16_t> decoded_buffer = readAllPcmFrames(
|
|
318
|
+
fmt_ctx, codec_ctx, sample_rate, audio_stream_index, actual_channels, framesRead);
|
|
319
|
+
|
|
320
|
+
// Cleanup - Note: avio_context_free will free the io_buffer
|
|
321
|
+
avcodec_free_context(&codec_ctx);
|
|
322
|
+
avformat_close_input(&fmt_ctx);
|
|
323
|
+
avio_context_free(&avio_ctx);
|
|
324
|
+
|
|
325
|
+
if (framesRead == 0 || decoded_buffer.empty()) {
|
|
326
|
+
return {};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return decoded_buffer;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
std::vector<int16_t> decodeWithFilePath(const std::string &path, int sample_rate) {
|
|
333
|
+
if (path.empty()) {
|
|
334
|
+
return {};
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
AVFormatContext *fmt_ctx = nullptr;
|
|
338
|
+
if (avformat_open_input(&fmt_ctx, path.c_str(), nullptr, nullptr) < 0) {
|
|
339
|
+
return {};
|
|
340
|
+
}
|
|
341
|
+
if (avformat_find_stream_info(fmt_ctx, nullptr) < 0) {
|
|
342
|
+
avformat_close_input(&fmt_ctx);
|
|
343
|
+
return {};
|
|
344
|
+
}
|
|
345
|
+
int audio_stream_index = -1;
|
|
346
|
+
for (int i = 0; i < fmt_ctx->nb_streams; i++) {
|
|
347
|
+
if (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
|
348
|
+
audio_stream_index = i;
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
if (audio_stream_index == -1) {
|
|
353
|
+
avformat_close_input(&fmt_ctx);
|
|
354
|
+
return {};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
AVCodecParameters *codecpar = fmt_ctx->streams[audio_stream_index]->codecpar;
|
|
358
|
+
const AVCodec *codec = avcodec_find_decoder(codecpar->codec_id);
|
|
359
|
+
if (codec == nullptr) {
|
|
360
|
+
avformat_close_input(&fmt_ctx);
|
|
361
|
+
return {};
|
|
362
|
+
}
|
|
363
|
+
AVCodecContext *codec_ctx = avcodec_alloc_context3(codec);
|
|
364
|
+
if (codec_ctx == nullptr) {
|
|
365
|
+
avformat_close_input(&fmt_ctx);
|
|
366
|
+
return {};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (avcodec_parameters_to_context(codec_ctx, codecpar) < 0) {
|
|
370
|
+
avcodec_free_context(&codec_ctx);
|
|
371
|
+
avformat_close_input(&fmt_ctx);
|
|
372
|
+
return {};
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (avcodec_open2(codec_ctx, codec, nullptr) < 0) {
|
|
376
|
+
avcodec_free_context(&codec_ctx);
|
|
377
|
+
avformat_close_input(&fmt_ctx);
|
|
378
|
+
return {};
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
int actual_channels = codec_ctx->ch_layout.nb_channels;
|
|
382
|
+
if (actual_channels <= 0 || actual_channels > 8) {
|
|
383
|
+
avcodec_free_context(&codec_ctx);
|
|
384
|
+
avformat_close_input(&fmt_ctx);
|
|
385
|
+
return {};
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
size_t framesRead = 0;
|
|
389
|
+
std::vector<int16_t> decoded_buffer = readAllPcmFrames(
|
|
390
|
+
fmt_ctx, codec_ctx, sample_rate, audio_stream_index, actual_channels, framesRead);
|
|
391
|
+
|
|
392
|
+
avcodec_free_context(&codec_ctx);
|
|
393
|
+
avformat_close_input(&fmt_ctx);
|
|
394
|
+
|
|
395
|
+
if (framesRead == 0 || decoded_buffer.empty()) {
|
|
396
|
+
return {};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return decoded_buffer;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
} // namespace audioapi::ffmpegdecoder
|