react-native-audio-api 0.11.0-alpha.1 → 0.11.0-alpha.3
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/README.md +13 -11
- package/RNAudioAPI.podspec +25 -18
- package/android/build.gradle +41 -5
- package/android/src/main/cpp/audioapi/CMakeLists.txt +6 -3
- package/android/src/main/cpp/audioapi/android/AudioAPIModule.cpp +10 -16
- package/android/src/main/cpp/audioapi/android/OnLoad.cpp +1 -2
- package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.cpp +219 -84
- package/android/src/main/cpp/audioapi/android/core/AndroidAudioRecorder.h +23 -23
- package/android/src/main/cpp/audioapi/android/core/AudioPlayer.cpp +13 -20
- package/android/src/main/cpp/audioapi/android/core/utils/AndroidFileWriterBackend.h +14 -18
- package/android/src/main/cpp/audioapi/android/core/utils/AndroidRecorderCallback.cpp +72 -89
- package/android/src/main/cpp/audioapi/android/core/utils/AndroidRecorderCallback.h +12 -23
- package/android/src/main/cpp/audioapi/android/core/utils/AudioDecoder.cpp +47 -47
- package/android/src/main/cpp/audioapi/android/core/utils/FileOptions.cpp +83 -0
- package/android/src/main/cpp/audioapi/android/core/utils/FileOptions.h +22 -0
- package/android/src/main/cpp/audioapi/android/core/utils/MiniaudioImplementation.cpp +5 -0
- package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegFileWriter.cpp +379 -298
- package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegFileWriter.h +48 -91
- package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/ptrs.hpp +48 -0
- package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/utils.cpp +110 -0
- package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/utils.h +34 -0
- package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileWriter.cpp +132 -104
- package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileWriter.h +8 -16
- package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +28 -1
- package/android/src/main/java/com/swmansion/audioapi/system/LockScreenManager.kt +28 -6
- package/android/src/main/java/com/swmansion/audioapi/system/MediaNotificationManager.kt +11 -0
- 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/android/src/oldarch/NativeAudioAPIModuleSpec.java +4 -0
- package/common/cpp/audioapi/AudioAPIModuleInstaller.h +45 -70
- package/common/cpp/audioapi/HostObjects/AudioContextHostObject.cpp +20 -22
- package/common/cpp/audioapi/HostObjects/AudioNodeHostObject.cpp +3 -4
- package/common/cpp/audioapi/HostObjects/AudioParamHostObject.cpp +6 -8
- package/common/cpp/audioapi/HostObjects/AudioParamHostObject.h +2 -2
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.cpp +102 -63
- package/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.h +4 -1
- package/common/cpp/audioapi/HostObjects/OfflineAudioContextHostObject.cpp +25 -31
- package/common/cpp/audioapi/HostObjects/OfflineAudioContextHostObject.h +3 -3
- package/common/cpp/audioapi/HostObjects/WorkletNodeHostObject.h +1 -2
- package/common/cpp/audioapi/HostObjects/WorkletProcessingNodeHostObject.h +1 -2
- package/common/cpp/audioapi/HostObjects/analysis/AnalyserNodeHostObject.cpp +10 -18
- package/common/cpp/audioapi/HostObjects/destinations/AudioDestinationNodeHostObject.h +2 -3
- package/common/cpp/audioapi/HostObjects/effects/BiquadFilterNodeHostObject.cpp +18 -30
- package/common/cpp/audioapi/HostObjects/effects/BiquadFilterNodeHostObject.h +1 -2
- package/common/cpp/audioapi/HostObjects/effects/ConvolverNodeHostObject.cpp +50 -0
- package/common/cpp/audioapi/HostObjects/effects/ConvolverNodeHostObject.h +20 -0
- package/common/cpp/audioapi/HostObjects/effects/DelayNodeHostObject.cpp +27 -0
- package/common/cpp/audioapi/HostObjects/effects/DelayNodeHostObject.h +21 -0
- package/common/cpp/audioapi/HostObjects/effects/GainNodeHostObject.cpp +2 -2
- package/common/cpp/audioapi/HostObjects/effects/IIRFilterNodeHostObject.cpp +33 -0
- package/common/cpp/audioapi/HostObjects/effects/IIRFilterNodeHostObject.h +20 -0
- package/common/cpp/audioapi/HostObjects/effects/PeriodicWaveHostObject.h +1 -2
- package/common/cpp/audioapi/HostObjects/effects/StereoPannerNodeHostObject.cpp +2 -2
- package/common/cpp/audioapi/HostObjects/effects/StereoPannerNodeHostObject.h +1 -2
- package/common/cpp/audioapi/HostObjects/events/AudioEventHandlerRegistryHostObject.cpp +6 -12
- package/common/cpp/audioapi/HostObjects/events/AudioEventHandlerRegistryHostObject.h +7 -7
- package/common/cpp/audioapi/HostObjects/inputs/AudioRecorderHostObject.cpp +98 -50
- package/common/cpp/audioapi/HostObjects/inputs/AudioRecorderHostObject.h +5 -2
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferBaseSourceNodeHostObject.cpp +27 -22
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferBaseSourceNodeHostObject.h +12 -10
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferHostObject.cpp +17 -22
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferHostObject.h +5 -7
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.cpp +25 -11
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.h +8 -8
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.cpp +19 -30
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.h +2 -4
- package/common/cpp/audioapi/HostObjects/sources/AudioScheduledSourceNodeHostObject.cpp +7 -11
- package/common/cpp/audioapi/HostObjects/sources/ConstantSourceNodeHostObject.cpp +2 -2
- package/common/cpp/audioapi/HostObjects/sources/ConstantSourceNodeHostObject.h +1 -2
- package/common/cpp/audioapi/HostObjects/sources/OscillatorNodeHostObject.cpp +6 -8
- package/common/cpp/audioapi/HostObjects/sources/OscillatorNodeHostObject.h +1 -2
- package/common/cpp/audioapi/HostObjects/sources/RecorderAdapterNodeHostObject.h +4 -5
- package/common/cpp/audioapi/HostObjects/sources/StreamerNodeHostObject.cpp +6 -2
- package/common/cpp/audioapi/HostObjects/sources/StreamerNodeHostObject.h +5 -6
- package/common/cpp/audioapi/HostObjects/sources/WorkletSourceNodeHostObject.h +1 -2
- package/common/cpp/audioapi/HostObjects/utils/AudioDecoderHostObject.cpp +39 -60
- package/common/cpp/audioapi/HostObjects/utils/AudioStretcherHostObject.cpp +15 -30
- package/common/cpp/audioapi/core/AudioContext.cpp +23 -28
- package/common/cpp/audioapi/core/AudioContext.h +6 -3
- package/common/cpp/audioapi/core/AudioNode.cpp +17 -19
- package/common/cpp/audioapi/core/AudioNode.h +19 -8
- package/common/cpp/audioapi/core/AudioParam.cpp +68 -100
- package/common/cpp/audioapi/core/AudioParam.h +20 -12
- package/common/cpp/audioapi/core/BaseAudioContext.cpp +52 -34
- package/common/cpp/audioapi/core/BaseAudioContext.h +26 -14
- package/common/cpp/audioapi/core/OfflineAudioContext.cpp +12 -17
- package/common/cpp/audioapi/core/OfflineAudioContext.h +10 -5
- package/common/cpp/audioapi/core/analysis/AnalyserNode.cpp +13 -21
- package/common/cpp/audioapi/core/analysis/AnalyserNode.h +8 -6
- package/common/cpp/audioapi/core/destinations/AudioDestinationNode.cpp +1 -0
- package/common/cpp/audioapi/core/destinations/AudioDestinationNode.h +5 -3
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.cpp +84 -66
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.h +39 -10
- package/common/cpp/audioapi/core/effects/ConvolverNode.cpp +201 -0
- package/common/cpp/audioapi/core/effects/ConvolverNode.h +64 -0
- package/common/cpp/audioapi/core/effects/DelayNode.cpp +101 -0
- package/common/cpp/audioapi/core/effects/DelayNode.h +39 -0
- package/common/cpp/audioapi/core/effects/GainNode.cpp +1 -0
- package/common/cpp/audioapi/core/effects/GainNode.h +3 -1
- package/common/cpp/audioapi/core/effects/IIRFilterNode.cpp +166 -0
- package/common/cpp/audioapi/core/effects/IIRFilterNode.h +74 -0
- package/common/cpp/audioapi/core/effects/PeriodicWave.cpp +22 -35
- package/common/cpp/audioapi/core/effects/PeriodicWave.h +4 -9
- package/common/cpp/audioapi/core/effects/StereoPannerNode.cpp +4 -5
- package/common/cpp/audioapi/core/effects/StereoPannerNode.h +4 -2
- package/common/cpp/audioapi/core/effects/WorkletNode.cpp +11 -13
- package/common/cpp/audioapi/core/effects/WorkletNode.h +15 -12
- package/common/cpp/audioapi/core/effects/WorkletProcessingNode.cpp +4 -4
- package/common/cpp/audioapi/core/effects/WorkletProcessingNode.h +15 -14
- package/common/cpp/audioapi/core/inputs/AudioRecorder.cpp +58 -36
- package/common/cpp/audioapi/core/inputs/AudioRecorder.h +42 -44
- package/common/cpp/audioapi/core/sources/AudioBuffer.cpp +4 -6
- package/common/cpp/audioapi/core/sources/AudioBuffer.h +4 -7
- package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.cpp +48 -57
- package/common/cpp/audioapi/core/sources/AudioBufferBaseSourceNode.h +37 -34
- package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.cpp +55 -17
- package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.h +35 -28
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp +41 -49
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.h +8 -6
- package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.cpp +29 -24
- package/common/cpp/audioapi/core/sources/AudioScheduledSourceNode.h +6 -6
- package/common/cpp/audioapi/core/sources/ConstantSourceNode.cpp +3 -4
- package/common/cpp/audioapi/core/sources/ConstantSourceNode.h +3 -1
- package/common/cpp/audioapi/core/sources/OscillatorNode.cpp +12 -23
- package/common/cpp/audioapi/core/sources/OscillatorNode.h +6 -4
- package/common/cpp/audioapi/core/sources/RecorderAdapterNode.cpp +43 -16
- package/common/cpp/audioapi/core/sources/RecorderAdapterNode.h +22 -17
- package/common/cpp/audioapi/core/sources/StreamerNode.cpp +104 -87
- package/common/cpp/audioapi/core/sources/StreamerNode.h +69 -33
- package/common/cpp/audioapi/core/sources/WorkletSourceNode.cpp +5 -7
- package/common/cpp/audioapi/core/sources/WorkletSourceNode.h +15 -13
- package/common/cpp/audioapi/core/types/AudioFormat.h +1 -11
- package/common/cpp/audioapi/core/utils/AudioDecoder.h +15 -6
- package/common/cpp/audioapi/core/utils/AudioFileWriter.cpp +41 -0
- package/common/cpp/audioapi/core/utils/AudioFileWriter.h +43 -0
- package/common/cpp/audioapi/core/utils/AudioNodeDestructor.cpp +5 -6
- package/common/cpp/audioapi/core/utils/AudioNodeDestructor.h +7 -10
- package/common/cpp/audioapi/core/utils/AudioNodeManager.cpp +17 -19
- package/common/cpp/audioapi/core/utils/AudioNodeManager.h +8 -11
- package/common/cpp/audioapi/core/utils/AudioParamEventQueue.cpp +3 -3
- package/common/cpp/audioapi/core/utils/AudioParamEventQueue.h +5 -5
- package/common/cpp/audioapi/core/utils/AudioRecorderCallback.cpp +101 -0
- package/common/cpp/audioapi/core/utils/AudioRecorderCallback.h +51 -0
- package/common/cpp/audioapi/core/utils/AudioStretcher.cpp +6 -6
- package/common/cpp/audioapi/core/utils/Constants.h +7 -3
- package/common/cpp/audioapi/core/utils/ParamChangeEvent.cpp +1 -0
- package/common/cpp/audioapi/core/utils/ParamChangeEvent.h +9 -9
- package/common/cpp/audioapi/core/utils/worklets/SafeIncludes.h +33 -34
- package/common/cpp/audioapi/core/utils/worklets/WorkletsRunner.cpp +17 -19
- package/common/cpp/audioapi/core/utils/worklets/WorkletsRunner.h +23 -19
- package/common/cpp/audioapi/dsp/AudioUtils.cpp +4 -10
- package/common/cpp/audioapi/dsp/AudioUtils.h +1 -1
- package/common/cpp/audioapi/dsp/Convolver.cpp +201 -0
- package/common/cpp/audioapi/dsp/Convolver.h +47 -0
- package/common/cpp/audioapi/dsp/FFT.cpp +1 -27
- package/common/cpp/audioapi/dsp/FFT.h +19 -3
- package/common/cpp/audioapi/dsp/VectorMath.cpp +24 -58
- package/common/cpp/audioapi/dsp/VectorMath.h +35 -8
- package/common/cpp/audioapi/dsp/Windows.cpp +4 -9
- package/common/cpp/audioapi/dsp/Windows.h +24 -23
- package/common/cpp/audioapi/events/AudioEventHandlerRegistry.cpp +12 -17
- package/common/cpp/audioapi/events/AudioEventHandlerRegistry.h +45 -40
- package/common/cpp/audioapi/events/IAudioEventHandlerRegistry.h +15 -7
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/avcodec.h +4 -4
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/codec.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/codec_desc.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/codec_id.h +3 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/codec_par.h +2 -2
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/defs.h +3 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/packet.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/smpte_436m.h +254 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavcodec/version.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavformat/avformat.h +6 -6
- package/common/cpp/audioapi/external/ffmpeg_include/libavformat/version.h +2 -2
- package/common/cpp/audioapi/external/ffmpeg_include/libavformat/version_major.h +2 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/avassert.h +5 -2
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/avutil.h +2 -2
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/channel_layout.h +2 -2
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/csp.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/dict.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/ffversion.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/film_grain_params.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/frame.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hdr_dynamic_vivid_metadata.h +3 -3
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_opencl.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_qsv.h +0 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/hwcontext_vulkan.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/iamf.h +2 -2
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/lfg.h +2 -2
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/log.h +2 -2
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/mathematics.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/opt.h +4 -4
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/rational.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/rc4.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/refstruct.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/spherical.h +6 -0
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/tdrdi.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/tx.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/version.h +3 -3
- package/common/cpp/audioapi/external/ffmpeg_include/libavutil/video_hint.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libswresample/swresample.h +1 -1
- package/common/cpp/audioapi/external/ffmpeg_include/libswresample/version.h +1 -1
- package/common/cpp/audioapi/external/{libavcodec.xcframework → ffmpeg_ios/libavcodec.xcframework}/ios-arm64/libavcodec.framework/libavcodec +0 -0
- package/common/cpp/audioapi/external/{libavcodec.xcframework → ffmpeg_ios/libavcodec.xcframework}/ios-arm64_x86_64-simulator/libavcodec.framework/libavcodec +0 -0
- package/common/cpp/audioapi/external/{libavformat.xcframework → ffmpeg_ios/libavformat.xcframework}/ios-arm64/libavformat.framework/libavformat +0 -0
- package/common/cpp/audioapi/external/{libavformat.xcframework → ffmpeg_ios/libavformat.xcframework}/ios-arm64_x86_64-simulator/libavformat.framework/libavformat +0 -0
- package/common/cpp/audioapi/external/{libavutil.xcframework → ffmpeg_ios/libavutil.xcframework}/ios-arm64/libavutil.framework/libavutil +0 -0
- package/common/cpp/audioapi/external/{libavutil.xcframework → ffmpeg_ios/libavutil.xcframework}/ios-arm64_x86_64-simulator/libavutil.framework/libavutil +0 -0
- package/common/cpp/audioapi/external/{libswresample.xcframework → ffmpeg_ios/libswresample.xcframework}/ios-arm64/libswresample.framework/libswresample +0 -0
- package/common/cpp/audioapi/external/{libswresample.xcframework → ffmpeg_ios/libswresample.xcframework}/ios-arm64_x86_64-simulator/libswresample.framework/libswresample +0 -0
- package/common/cpp/audioapi/jsi/AudioArrayBuffer.h +4 -5
- package/common/cpp/audioapi/jsi/JsiHostObject.cpp +11 -13
- package/common/cpp/audioapi/jsi/JsiHostObject.h +26 -33
- package/common/cpp/audioapi/jsi/JsiPromise.cpp +34 -67
- package/common/cpp/audioapi/jsi/JsiPromise.h +65 -26
- package/common/cpp/audioapi/jsi/RuntimeLifecycleMonitor.cpp +7 -10
- package/common/cpp/audioapi/jsi/RuntimeLifecycleMonitor.h +1 -3
- package/common/cpp/audioapi/libs/ffmpeg/FFmpegDecoding.cpp +4 -3
- package/common/cpp/audioapi/libs/ffmpeg/relinking.md +24 -0
- package/common/cpp/audioapi/utils/AlignedAllocator.hpp +50 -0
- package/common/cpp/audioapi/utils/AudioArray.cpp +3 -8
- package/common/cpp/audioapi/utils/AudioArray.h +3 -11
- package/common/cpp/audioapi/utils/AudioBus.cpp +79 -149
- package/common/cpp/audioapi/utils/AudioBus.h +17 -14
- package/common/cpp/audioapi/utils/AudioFileProperties.cpp +92 -0
- package/common/cpp/audioapi/utils/AudioFileProperties.h +76 -0
- package/common/cpp/audioapi/utils/CircularAudioArray.cpp +6 -18
- package/common/cpp/audioapi/utils/CircularOverflowableAudioArray.cpp +6 -10
- package/common/cpp/audioapi/utils/CircularOverflowableAudioArray.h +2 -2
- package/common/cpp/audioapi/utils/Result.hpp +286 -0
- package/common/cpp/audioapi/utils/ThreadPool.hpp +59 -1
- package/common/cpp/audioapi/utils/UnitConversion.h +9 -0
- package/common/cpp/test/CMakeLists.txt +20 -14
- package/common/cpp/test/src/AudioParamTest.cpp +4 -3
- package/common/cpp/test/src/AudioScheduledSourceTest.cpp +113 -0
- package/common/cpp/test/src/ConstantSourceTest.cpp +5 -7
- package/common/cpp/test/src/DelayTest.cpp +108 -0
- package/common/cpp/test/src/GainTest.cpp +4 -5
- package/common/cpp/test/src/IIRFilterTest.cpp +153 -0
- package/common/cpp/test/src/MockAudioEventHandlerRegistry.h +19 -11
- package/common/cpp/test/src/OscillatorTest.cpp +2 -1
- package/common/cpp/test/src/StereoPannerTest.cpp +6 -9
- package/common/cpp/test/src/biquad/BiquadFilterChromium.cpp +372 -0
- package/common/cpp/test/src/biquad/BiquadFilterChromium.h +65 -0
- package/common/cpp/test/src/biquad/BiquadFilterTest.cpp +272 -0
- package/common/cpp/test/src/biquad/BiquadFilterTest.h +47 -0
- package/ios/audioapi/ios/AudioAPIModule.h +2 -1
- package/ios/audioapi/ios/AudioAPIModule.mm +44 -20
- package/ios/audioapi/ios/core/IOSAudioPlayer.h +2 -2
- package/ios/audioapi/ios/core/IOSAudioPlayer.mm +7 -6
- package/ios/audioapi/ios/core/IOSAudioRecorder.h +26 -18
- package/ios/audioapi/ios/core/IOSAudioRecorder.mm +193 -53
- package/ios/audioapi/ios/core/NativeAudioPlayer.m +16 -13
- package/ios/audioapi/ios/core/NativeAudioRecorder.h +4 -0
- package/ios/audioapi/ios/core/NativeAudioRecorder.m +42 -7
- package/ios/audioapi/ios/core/utils/AudioDecoder.mm +21 -4
- package/ios/audioapi/ios/core/utils/FileOptions.h +31 -0
- package/ios/audioapi/ios/core/utils/FileOptions.mm +177 -0
- package/ios/audioapi/ios/core/{IOSAudioFileWriter.h → utils/IOSFileWriter.h} +16 -14
- package/ios/audioapi/ios/core/utils/IOSFileWriter.mm +224 -0
- package/ios/audioapi/ios/core/{IOSRecorderCallback.h → utils/IOSRecorderCallback.h} +7 -17
- package/ios/audioapi/ios/core/utils/IOSRecorderCallback.mm +172 -0
- package/ios/audioapi/ios/system/AudioEngine.h +19 -16
- package/ios/audioapi/ios/system/AudioEngine.mm +101 -134
- package/ios/audioapi/ios/system/AudioSessionManager.h +25 -11
- package/ios/audioapi/ios/system/AudioSessionManager.mm +273 -202
- package/ios/audioapi/ios/system/LockScreenManager.mm +39 -23
- package/ios/audioapi/ios/system/NotificationManager.mm +37 -52
- package/lib/commonjs/AudioAPIModule/AudioAPIModule.js +90 -0
- package/lib/commonjs/AudioAPIModule/AudioAPIModule.js.map +1 -0
- package/lib/commonjs/AudioAPIModule/globals.d.js +6 -0
- package/lib/commonjs/AudioAPIModule/globals.d.js.map +1 -0
- package/lib/commonjs/AudioAPIModule/index.js +14 -0
- package/lib/commonjs/AudioAPIModule/index.js.map +1 -0
- package/lib/commonjs/api.js +18 -12
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/api.web.js +8 -0
- package/lib/commonjs/api.web.js.map +1 -1
- package/lib/commonjs/core/AudioBufferBaseSourceNode.js +3 -0
- package/lib/commonjs/core/AudioBufferBaseSourceNode.js.map +1 -1
- package/lib/commonjs/core/AudioBufferQueueSourceNode.js +5 -2
- package/lib/commonjs/core/AudioBufferQueueSourceNode.js.map +1 -1
- package/lib/commonjs/core/AudioContext.js +5 -8
- package/lib/commonjs/core/AudioContext.js.map +1 -1
- package/lib/commonjs/core/AudioNode.js +1 -1
- package/lib/commonjs/core/AudioNode.js.map +1 -1
- package/lib/commonjs/core/AudioParam.js +18 -11
- package/lib/commonjs/core/AudioParam.js.map +1 -1
- package/lib/commonjs/core/AudioRecorder.js +43 -55
- package/lib/commonjs/core/AudioRecorder.js.map +1 -1
- package/lib/commonjs/core/BaseAudioContext.js +61 -30
- package/lib/commonjs/core/BaseAudioContext.js.map +1 -1
- package/lib/commonjs/core/ConvolverNode.js +37 -0
- package/lib/commonjs/core/ConvolverNode.js.map +1 -0
- package/lib/commonjs/core/DelayNode.js +17 -0
- package/lib/commonjs/core/DelayNode.js.map +1 -0
- package/lib/commonjs/core/IIRFilterNode.js +19 -0
- package/lib/commonjs/core/IIRFilterNode.js.map +1 -0
- package/lib/commonjs/core/OfflineAudioContext.js +3 -6
- package/lib/commonjs/core/OfflineAudioContext.js.map +1 -1
- package/lib/commonjs/plugin/withAudioAPI.js +46 -0
- package/lib/commonjs/plugin/withAudioAPI.js.map +1 -1
- package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/commonjs/system/AudioManager.js +4 -7
- package/lib/commonjs/system/AudioManager.js.map +1 -1
- package/lib/commonjs/types.js +16 -23
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/filePresets.js +43 -0
- package/lib/commonjs/utils/filePresets.js.map +1 -0
- package/lib/commonjs/utils/index.js +12 -27
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/web-core/AudioContext.js +21 -1
- package/lib/commonjs/web-core/AudioContext.js.map +1 -1
- package/lib/commonjs/web-core/ConvolverNode.js +40 -0
- package/lib/commonjs/web-core/ConvolverNode.js.map +1 -0
- package/lib/commonjs/web-core/ConvolverNodeOptions.js +6 -0
- package/lib/commonjs/web-core/ConvolverNodeOptions.js.map +1 -0
- package/lib/commonjs/web-core/DelayNode.js +17 -0
- package/lib/commonjs/web-core/DelayNode.js.map +1 -0
- package/lib/commonjs/web-core/IIRFilterNode.js +19 -0
- package/lib/commonjs/web-core/IIRFilterNode.js.map +1 -0
- package/lib/commonjs/web-core/OfflineAudioContext.js +20 -0
- package/lib/commonjs/web-core/OfflineAudioContext.js.map +1 -1
- package/lib/module/AudioAPIModule/AudioAPIModule.js +87 -0
- package/lib/module/AudioAPIModule/AudioAPIModule.js.map +1 -0
- package/lib/module/AudioAPIModule/globals.d.js +4 -0
- package/lib/module/AudioAPIModule/globals.d.js.map +1 -0
- package/lib/module/AudioAPIModule/index.js +4 -0
- package/lib/module/AudioAPIModule/index.js.map +1 -0
- package/lib/module/api.js +3 -12
- package/lib/module/api.js.map +1 -1
- package/lib/module/api.web.js +1 -0
- package/lib/module/api.web.js.map +1 -1
- package/lib/module/core/AudioBufferBaseSourceNode.js +3 -0
- package/lib/module/core/AudioBufferBaseSourceNode.js.map +1 -1
- package/lib/module/core/AudioBufferQueueSourceNode.js +5 -2
- package/lib/module/core/AudioBufferQueueSourceNode.js.map +1 -1
- package/lib/module/core/AudioContext.js +5 -8
- package/lib/module/core/AudioContext.js.map +1 -1
- package/lib/module/core/AudioNode.js +1 -1
- package/lib/module/core/AudioNode.js.map +1 -1
- package/lib/module/core/AudioParam.js +18 -11
- package/lib/module/core/AudioParam.js.map +1 -1
- package/lib/module/core/AudioRecorder.js +44 -56
- package/lib/module/core/AudioRecorder.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +63 -32
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/module/core/ConvolverNode.js +31 -0
- package/lib/module/core/ConvolverNode.js.map +1 -0
- package/lib/module/core/DelayNode.js +11 -0
- package/lib/module/core/DelayNode.js.map +1 -0
- package/lib/module/core/IIRFilterNode.js +13 -0
- package/lib/module/core/IIRFilterNode.js.map +1 -0
- package/lib/module/core/OfflineAudioContext.js +3 -6
- package/lib/module/core/OfflineAudioContext.js.map +1 -1
- package/lib/module/plugin/withAudioAPI.js +47 -1
- package/lib/module/plugin/withAudioAPI.js.map +1 -1
- package/lib/module/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/module/system/AudioManager.js +4 -7
- package/lib/module/system/AudioManager.js.map +1 -1
- package/lib/module/types.js +15 -22
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/filePresets.js +39 -0
- package/lib/module/utils/filePresets.js.map +1 -0
- package/lib/module/utils/index.js +10 -10
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/web-core/AudioContext.js +21 -1
- package/lib/module/web-core/AudioContext.js.map +1 -1
- package/lib/module/web-core/ConvolverNode.js +34 -0
- package/lib/module/web-core/ConvolverNode.js.map +1 -0
- package/lib/module/web-core/ConvolverNodeOptions.js +4 -0
- package/lib/module/web-core/ConvolverNodeOptions.js.map +1 -0
- package/lib/module/web-core/DelayNode.js +11 -0
- package/lib/module/web-core/DelayNode.js.map +1 -0
- package/lib/module/web-core/IIRFilterNode.js +13 -0
- package/lib/module/web-core/IIRFilterNode.js.map +1 -0
- package/lib/module/web-core/OfflineAudioContext.js +20 -0
- package/lib/module/web-core/OfflineAudioContext.js.map +1 -1
- package/lib/typescript/AudioAPIModule/AudioAPIModule.d.ts +36 -0
- package/lib/typescript/AudioAPIModule/AudioAPIModule.d.ts.map +1 -0
- package/lib/typescript/AudioAPIModule/index.d.ts +2 -0
- package/lib/typescript/AudioAPIModule/index.d.ts.map +1 -0
- package/lib/typescript/api.d.ts +3 -9
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/api.web.d.ts +1 -0
- package/lib/typescript/api.web.d.ts.map +1 -1
- package/lib/typescript/core/AudioBufferBaseSourceNode.d.ts +1 -0
- package/lib/typescript/core/AudioBufferBaseSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioBufferQueueSourceNode.d.ts +1 -1
- package/lib/typescript/core/AudioBufferQueueSourceNode.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/AudioNode.d.ts +2 -1
- package/lib/typescript/core/AudioNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioParam.d.ts.map +1 -1
- package/lib/typescript/core/AudioRecorder.d.ts +13 -6
- package/lib/typescript/core/AudioRecorder.d.ts.map +1 -1
- package/lib/typescript/core/BaseAudioContext.d.ts +9 -3
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/core/ConvolverNode.d.ts +12 -0
- package/lib/typescript/core/ConvolverNode.d.ts.map +1 -0
- package/lib/typescript/core/DelayNode.d.ts +9 -0
- package/lib/typescript/core/DelayNode.d.ts.map +1 -0
- package/lib/typescript/core/IIRFilterNode.d.ts +5 -0
- package/lib/typescript/core/IIRFilterNode.d.ts.map +1 -0
- package/lib/typescript/core/OfflineAudioContext.d.ts +1 -1
- package/lib/typescript/core/OfflineAudioContext.d.ts.map +1 -1
- package/lib/typescript/events/types.d.ts +4 -0
- package/lib/typescript/events/types.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +34 -34
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/plugin/withAudioAPI.d.ts +1 -0
- package/lib/typescript/plugin/withAudioAPI.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts +2 -1
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts.map +1 -1
- package/lib/typescript/system/AudioManager.d.ts +3 -2
- package/lib/typescript/system/AudioManager.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +42 -34
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/filePresets.d.ts +9 -0
- package/lib/typescript/utils/filePresets.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts +1 -8
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioContext.d.ts +9 -2
- package/lib/typescript/web-core/AudioContext.d.ts.map +1 -1
- package/lib/typescript/web-core/BaseAudioContext.d.ts +7 -1
- package/lib/typescript/web-core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/web-core/ConvolverNode.d.ts +11 -0
- package/lib/typescript/web-core/ConvolverNode.d.ts.map +1 -0
- package/lib/typescript/web-core/ConvolverNodeOptions.d.ts +6 -0
- package/lib/typescript/web-core/ConvolverNodeOptions.d.ts.map +1 -0
- package/lib/typescript/web-core/DelayNode.d.ts +8 -0
- package/lib/typescript/web-core/DelayNode.d.ts.map +1 -0
- package/lib/typescript/web-core/IIRFilterNode.d.ts +5 -0
- package/lib/typescript/web-core/IIRFilterNode.d.ts.map +1 -0
- package/lib/typescript/web-core/OfflineAudioContext.d.ts +8 -1
- package/lib/typescript/web-core/OfflineAudioContext.d.ts.map +1 -1
- package/package.json +11 -4
- package/scripts/download-prebuilt-binaries.sh +61 -0
- package/scripts/rnaa_utils.rb +8 -0
- package/scripts/validate-worklets-version.js +27 -0
- package/src/AudioAPIModule/AudioAPIModule.ts +122 -0
- package/src/AudioAPIModule/globals.d.ts +33 -0
- package/src/AudioAPIModule/index.ts +1 -0
- package/src/api.ts +4 -52
- package/src/api.web.ts +1 -0
- package/src/core/AudioBufferBaseSourceNode.ts +8 -0
- package/src/core/AudioBufferQueueSourceNode.ts +8 -2
- package/src/core/AudioContext.ts +5 -8
- package/src/core/AudioNode.ts +4 -3
- package/src/core/AudioParam.ts +18 -11
- package/src/core/AudioRecorder.ts +63 -78
- package/src/core/BaseAudioContext.ts +120 -54
- package/src/core/ConvolverNode.ts +35 -0
- package/src/core/DelayNode.ts +13 -0
- package/src/core/IIRFilterNode.ts +25 -0
- package/src/core/OfflineAudioContext.ts +4 -7
- package/src/events/types.ts +5 -0
- package/src/interfaces.ts +51 -34
- package/src/plugin/withAudioAPI.ts +61 -0
- package/src/specs/NativeAudioAPIModule.ts +3 -2
- package/src/system/AudioManager.ts +13 -19
- package/src/types.ts +45 -36
- package/src/utils/filePresets.ts +47 -0
- package/src/utils/index.ts +13 -19
- package/src/web-core/AudioContext.tsx +40 -1
- package/src/web-core/BaseAudioContext.tsx +11 -1
- package/src/web-core/ConvolverNode.tsx +43 -0
- package/src/web-core/ConvolverNodeOptions.tsx +6 -0
- package/src/web-core/DelayNode.tsx +12 -0
- package/src/web-core/IIRFilterNode.tsx +25 -0
- package/src/web-core/OfflineAudioContext.tsx +39 -0
- package/android/src/main/cpp/audioapi/android/core/utils/FileUtils.h +0 -34
- package/android/src/main/cpp/audioapi/android/core/utils/FileUtilts.cpp +0 -133
- package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegAudioFileOptions.cpp +0 -154
- package/android/src/main/cpp/audioapi/android/core/utils/ffmpegBackend/FFmpegAudioFileOptions.h +0 -41
- package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileOptions.cpp +0 -47
- package/android/src/main/cpp/audioapi/android/core/utils/miniaudioBackend/MiniAudioFileOptions.h +0 -28
- package/common/cpp/audioapi/libs/ffmpeg/INSTRUCTIONS.md +0 -32
- package/common/cpp/audioapi/libs/ffmpeg/create_xcframework.sh +0 -111
- package/common/cpp/audioapi/libs/ffmpeg/ffmpeg_setup.sh +0 -391
- package/ios/audioapi/ios/core/IOSAudioFileOptions.h +0 -36
- package/ios/audioapi/ios/core/IOSAudioFileOptions.mm +0 -140
- package/ios/audioapi/ios/core/IOSAudioFileWriter.mm +0 -223
- package/ios/audioapi/ios/core/IOSRecorderCallback.mm +0 -189
- package/lib/commonjs/utils/bitEnums.js +0 -33
- package/lib/commonjs/utils/bitEnums.js.map +0 -1
- package/lib/module/utils/bitEnums.js +0 -27
- package/lib/module/utils/bitEnums.js.map +0 -1
- package/lib/typescript/utils/bitEnums.d.ts +0 -4
- package/lib/typescript/utils/bitEnums.d.ts.map +0 -1
- package/metro-config/index.d.ts +0 -5
- package/metro-config/index.js +0 -41
- package/metro-config/tsconfig.json +0 -3
- package/src/utils/bitEnums.ts +0 -51
- package/common/cpp/audioapi/external/{libavcodec.xcframework → ffmpeg_ios/libavcodec.xcframework}/Info.plist +5 -5
- package/common/cpp/audioapi/external/{libavcodec.xcframework → ffmpeg_ios/libavcodec.xcframework}/ios-arm64/libavcodec.framework/Info.plist +0 -0
- package/common/cpp/audioapi/external/{libavcodec.xcframework → ffmpeg_ios/libavcodec.xcframework}/ios-arm64_x86_64-simulator/libavcodec.framework/Info.plist +0 -0
- package/common/cpp/audioapi/external/{libavformat.xcframework → ffmpeg_ios/libavformat.xcframework}/Info.plist +0 -0
- package/common/cpp/audioapi/external/{libavformat.xcframework → ffmpeg_ios/libavformat.xcframework}/ios-arm64/libavformat.framework/Info.plist +0 -0
- package/common/cpp/audioapi/external/{libavformat.xcframework → ffmpeg_ios/libavformat.xcframework}/ios-arm64_x86_64-simulator/libavformat.framework/Info.plist +0 -0
- package/common/cpp/audioapi/external/{libavutil.xcframework → ffmpeg_ios/libavutil.xcframework}/Info.plist +5 -5
- package/common/cpp/audioapi/external/{libavutil.xcframework → ffmpeg_ios/libavutil.xcframework}/ios-arm64/libavutil.framework/Info.plist +0 -0
- package/common/cpp/audioapi/external/{libavutil.xcframework → ffmpeg_ios/libavutil.xcframework}/ios-arm64_x86_64-simulator/libavutil.framework/Info.plist +0 -0
- package/common/cpp/audioapi/external/{libswresample.xcframework → ffmpeg_ios/libswresample.xcframework}/Info.plist +5 -5
- /package/common/cpp/audioapi/external/{libswresample.xcframework → ffmpeg_ios/libswresample.xcframework}/ios-arm64/libswresample.framework/Info.plist +0 -0
- /package/common/cpp/audioapi/external/{libswresample.xcframework → ffmpeg_ios/libswresample.xcframework}/ios-arm64_x86_64-simulator/libswresample.framework/Info.plist +0 -0
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#include <audioapi/HostObjects/sources/AudioBufferHostObject.h>
|
|
2
2
|
#include <audioapi/events/AudioEventHandlerRegistry.h>
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <unordered_map>
|
|
3
6
|
|
|
4
7
|
namespace audioapi {
|
|
5
8
|
|
|
@@ -100,12 +103,9 @@ void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
|
|
|
100
103
|
if (eventName.compare("audioReady") == 0) {
|
|
101
104
|
auto bufferIt = body.find("buffer");
|
|
102
105
|
if (bufferIt != body.end()) {
|
|
103
|
-
auto bufferHostObject =
|
|
104
|
-
std::
|
|
105
|
-
|
|
106
|
-
bufferIt->second));
|
|
107
|
-
eventObject =
|
|
108
|
-
createEventObject(body, bufferHostObject->getSizeInBytes());
|
|
106
|
+
auto bufferHostObject = std::static_pointer_cast<AudioBufferHostObject>(
|
|
107
|
+
std::get<std::shared_ptr<jsi::HostObject>>(bufferIt->second));
|
|
108
|
+
eventObject = createEventObject(body, bufferHostObject->getSizeInBytes());
|
|
109
109
|
}
|
|
110
110
|
} else {
|
|
111
111
|
eventObject = createEventObject(body);
|
|
@@ -117,8 +117,7 @@ void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
|
|
|
117
117
|
throw;
|
|
118
118
|
} catch (...) {
|
|
119
119
|
printf(
|
|
120
|
-
"Unknown exception occurred while invoking handler for event: %s\n",
|
|
121
|
-
eventName.c_str());
|
|
120
|
+
"Unknown exception occurred while invoking handler for event: %s\n", eventName.c_str());
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
});
|
|
@@ -168,11 +167,9 @@ void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
|
|
|
168
167
|
if (eventName.compare("audioReady") == 0) {
|
|
169
168
|
auto bufferIt = body.find("buffer");
|
|
170
169
|
if (bufferIt != body.end()) {
|
|
171
|
-
auto bufferHostObject =
|
|
172
|
-
std::
|
|
173
|
-
|
|
174
|
-
eventObject =
|
|
175
|
-
createEventObject(body, bufferHostObject->getSizeInBytes());
|
|
170
|
+
auto bufferHostObject = std::static_pointer_cast<AudioBufferHostObject>(
|
|
171
|
+
std::get<std::shared_ptr<jsi::HostObject>>(bufferIt->second));
|
|
172
|
+
eventObject = createEventObject(body, bufferHostObject->getSizeInBytes());
|
|
176
173
|
}
|
|
177
174
|
} else {
|
|
178
175
|
eventObject = createEventObject(body);
|
|
@@ -184,8 +181,7 @@ void AudioEventHandlerRegistry::invokeHandlerWithEventBody(
|
|
|
184
181
|
throw;
|
|
185
182
|
} catch (...) {
|
|
186
183
|
printf(
|
|
187
|
-
"Unknown exception occurred while invoking handler for event: %s\n",
|
|
188
|
-
eventName.c_str());
|
|
184
|
+
"Unknown exception occurred while invoking handler for event: %s\n", eventName.c_str());
|
|
189
185
|
}
|
|
190
186
|
});
|
|
191
187
|
}
|
|
@@ -208,8 +204,7 @@ jsi::Object AudioEventHandlerRegistry::createEventObject(
|
|
|
208
204
|
eventObject.setProperty(*runtime_, name, std::get<bool>(value));
|
|
209
205
|
} else if (std::holds_alternative<std::string>(value)) {
|
|
210
206
|
eventObject.setProperty(*runtime_, name, std::get<std::string>(value));
|
|
211
|
-
} else if (std::holds_alternative<std::shared_ptr<jsi::HostObject>>(
|
|
212
|
-
value)) {
|
|
207
|
+
} else if (std::holds_alternative<std::shared_ptr<jsi::HostObject>>(value)) {
|
|
213
208
|
auto hostObject = jsi::Object::createFromHostObject(
|
|
214
209
|
*runtime_, std::get<std::shared_ptr<jsi::HostObject>>(value));
|
|
215
210
|
eventObject.setProperty(*runtime_, name, hostObject);
|
|
@@ -1,69 +1,74 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <jsi/jsi.h>
|
|
4
3
|
#include <ReactCommon/CallInvoker.h>
|
|
5
4
|
#include <audioapi/events/IAudioEventHandlerRegistry.h>
|
|
6
|
-
#include <
|
|
7
|
-
#include <unordered_map>
|
|
5
|
+
#include <jsi/jsi.h>
|
|
8
6
|
#include <array>
|
|
7
|
+
#include <atomic>
|
|
8
|
+
#include <memory>
|
|
9
9
|
#include <string>
|
|
10
|
+
#include <unordered_map>
|
|
10
11
|
#include <variant>
|
|
11
|
-
#include <atomic>
|
|
12
12
|
|
|
13
13
|
namespace audioapi {
|
|
14
14
|
using namespace facebook;
|
|
15
15
|
|
|
16
|
-
using EventValue =
|
|
16
|
+
using EventValue =
|
|
17
|
+
std::variant<int, float, double, std::string, bool, std::shared_ptr<jsi::HostObject>>;
|
|
17
18
|
|
|
18
19
|
class AudioEventHandlerRegistry : public IAudioEventHandlerRegistry {
|
|
19
20
|
public:
|
|
20
21
|
explicit AudioEventHandlerRegistry(
|
|
21
22
|
jsi::Runtime *runtime,
|
|
22
23
|
const std::shared_ptr<react::CallInvoker> &callInvoker);
|
|
23
|
-
~AudioEventHandlerRegistry();
|
|
24
|
+
~AudioEventHandlerRegistry() override;
|
|
24
25
|
|
|
25
|
-
uint64_t registerHandler(
|
|
26
|
+
uint64_t registerHandler(
|
|
27
|
+
const std::string &eventName,
|
|
28
|
+
const std::shared_ptr<jsi::Function> &handler) override;
|
|
26
29
|
void unregisterHandler(const std::string &eventName, uint64_t listenerId) override;
|
|
27
30
|
|
|
28
|
-
void invokeHandlerWithEventBody(
|
|
29
|
-
|
|
31
|
+
void invokeHandlerWithEventBody(
|
|
32
|
+
const std::string &eventName,
|
|
33
|
+
const std::unordered_map<std::string, EventValue> &body) override;
|
|
34
|
+
void invokeHandlerWithEventBody(
|
|
35
|
+
const std::string &eventName,
|
|
36
|
+
uint64_t listenerId,
|
|
37
|
+
const std::unordered_map<std::string, EventValue> &body) override;
|
|
30
38
|
|
|
31
39
|
private:
|
|
32
|
-
|
|
40
|
+
std::atomic<uint64_t> listenerIdCounter_{1}; // Atomic counter for listener IDs
|
|
33
41
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
std::shared_ptr<react::CallInvoker> callInvoker_;
|
|
43
|
+
jsi::Runtime *runtime_;
|
|
44
|
+
std::unordered_map<std::string, std::unordered_map<uint64_t, std::shared_ptr<jsi::Function>>>
|
|
45
|
+
eventHandlers_;
|
|
37
46
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
static constexpr std::array<std::string_view, 15> SYSTEM_EVENT_NAMES = {
|
|
48
|
+
"remotePlay",
|
|
49
|
+
"remotePause",
|
|
50
|
+
"remoteStop",
|
|
51
|
+
"remoteTogglePlayPause",
|
|
52
|
+
"remoteChangePlaybackRate",
|
|
53
|
+
"remoteNextTrack",
|
|
54
|
+
"remotePreviousTrack",
|
|
55
|
+
"remoteSkipForward",
|
|
56
|
+
"remoteSkipBackward",
|
|
57
|
+
"remoteSeekForward",
|
|
58
|
+
"remoteSeekBackward",
|
|
59
|
+
"remoteChangePlaybackPosition",
|
|
60
|
+
"routeChange",
|
|
61
|
+
"interruption",
|
|
62
|
+
"volumeChange",
|
|
63
|
+
};
|
|
55
64
|
|
|
56
|
-
|
|
57
|
-
"ended",
|
|
58
|
-
"loopEnded",
|
|
59
|
-
"audioReady",
|
|
60
|
-
"positionChanged",
|
|
61
|
-
"audioError",
|
|
62
|
-
"systemStateChanged"
|
|
63
|
-
};
|
|
65
|
+
static constexpr std::array<std::string_view, 6> AUDIO_API_EVENT_NAMES =
|
|
66
|
+
{"ended", "loopEnded", "audioReady", "positionChanged", "audioError", "systemStateChanged"};
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
jsi::Object createEventObject(const std::unordered_map<std::string, EventValue> &body);
|
|
69
|
+
jsi::Object createEventObject(
|
|
70
|
+
const std::unordered_map<std::string, EventValue> &body,
|
|
71
|
+
size_t memoryPressure);
|
|
67
72
|
};
|
|
68
73
|
|
|
69
74
|
} // namespace audioapi
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
|
-
#include <jsi/jsi.h>
|
|
4
3
|
#include <ReactCommon/CallInvoker.h>
|
|
4
|
+
#include <jsi/jsi.h>
|
|
5
|
+
#include <memory>
|
|
6
|
+
#include <string>
|
|
5
7
|
#include <unordered_map>
|
|
6
8
|
#include <variant>
|
|
7
|
-
#include <string>
|
|
8
|
-
#include <memory>
|
|
9
9
|
|
|
10
10
|
namespace audioapi {
|
|
11
11
|
|
|
12
|
-
using EventValue =
|
|
12
|
+
using EventValue =
|
|
13
|
+
std::variant<int, float, double, std::string, bool, std::shared_ptr<facebook::jsi::HostObject>>;
|
|
13
14
|
|
|
14
15
|
class IAudioEventHandlerRegistry {
|
|
15
16
|
public:
|
|
16
17
|
virtual ~IAudioEventHandlerRegistry() = default;
|
|
17
18
|
|
|
18
|
-
virtual uint64_t registerHandler(
|
|
19
|
+
virtual uint64_t registerHandler(
|
|
20
|
+
const std::string &eventName,
|
|
21
|
+
const std::shared_ptr<facebook::jsi::Function> &handler) = 0;
|
|
19
22
|
virtual void unregisterHandler(const std::string &eventName, uint64_t listenerId) = 0;
|
|
20
23
|
|
|
21
|
-
virtual void invokeHandlerWithEventBody(
|
|
22
|
-
|
|
24
|
+
virtual void invokeHandlerWithEventBody(
|
|
25
|
+
const std::string &eventName,
|
|
26
|
+
const std::unordered_map<std::string, EventValue> &body) = 0;
|
|
27
|
+
virtual void invokeHandlerWithEventBody(
|
|
28
|
+
const std::string &eventName,
|
|
29
|
+
uint64_t listenerId,
|
|
30
|
+
const std::unordered_map<std::string, EventValue> &body) = 0;
|
|
23
31
|
};
|
|
24
32
|
|
|
25
33
|
} // namespace audioapi
|
|
@@ -225,7 +225,7 @@ typedef struct RcOverride{
|
|
|
225
225
|
#define AV_CODEC_FLAG_QPEL (1 << 4)
|
|
226
226
|
/**
|
|
227
227
|
* Request the encoder to output reconstructed frames, i.e.\ frames that would
|
|
228
|
-
* be produced by decoding the encoded
|
|
228
|
+
* be produced by decoding the encoded bitstream. These frames may be retrieved
|
|
229
229
|
* by calling avcodec_receive_frame() immediately after a successful call to
|
|
230
230
|
* avcodec_receive_packet().
|
|
231
231
|
*
|
|
@@ -436,7 +436,7 @@ typedef struct AVCodecContext {
|
|
|
436
436
|
const AVClass *av_class;
|
|
437
437
|
int log_level_offset;
|
|
438
438
|
|
|
439
|
-
enum
|
|
439
|
+
enum AVMediaTypeFFmpeg codec_type; /* see AVMEDIA_TYPE_xxx */
|
|
440
440
|
const struct AVCodec *codec;
|
|
441
441
|
enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
|
|
442
442
|
|
|
@@ -1946,7 +1946,7 @@ typedef struct AVHWAccel {
|
|
|
1946
1946
|
*
|
|
1947
1947
|
* See AVMEDIA_TYPE_xxx
|
|
1948
1948
|
*/
|
|
1949
|
-
enum
|
|
1949
|
+
enum AVMediaTypeFFmpeg type;
|
|
1950
1950
|
|
|
1951
1951
|
/**
|
|
1952
1952
|
* Codec implemented by the hardware accelerator.
|
|
@@ -2900,7 +2900,7 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
|
|
|
2900
2900
|
*
|
|
2901
2901
|
* @note for encoders, this function will only do something if the encoder
|
|
2902
2902
|
* declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder
|
|
2903
|
-
* will drain any remaining packets, and can then be
|
|
2903
|
+
* will drain any remaining packets, and can then be reused for a different
|
|
2904
2904
|
* stream (as opposed to sending a null frame which will leave the encoder
|
|
2905
2905
|
* in a permanent EOF state after draining). This can be desirable if the
|
|
2906
2906
|
* cost of tearing down and replacing the encoder instance is high.
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
*/
|
|
38
38
|
typedef struct AVCodecDescriptor {
|
|
39
39
|
enum AVCodecID id;
|
|
40
|
-
enum
|
|
40
|
+
enum AVMediaTypeFFmpeg type;
|
|
41
41
|
/**
|
|
42
42
|
* Name of the codec described by this descriptor. It is non-empty and
|
|
43
43
|
* unique for each codec descriptor. It should contain alphanumeric
|
|
@@ -330,6 +330,7 @@ enum AVCodecID {
|
|
|
330
330
|
AV_CODEC_ID_RV60,
|
|
331
331
|
AV_CODEC_ID_JPEGXL_ANIM,
|
|
332
332
|
AV_CODEC_ID_APV,
|
|
333
|
+
AV_CODEC_ID_PRORES_RAW,
|
|
333
334
|
|
|
334
335
|
/* various PCM "codecs" */
|
|
335
336
|
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
|
|
@@ -602,6 +603,7 @@ enum AVCodecID {
|
|
|
602
603
|
AV_CODEC_ID_BIN_DATA,
|
|
603
604
|
AV_CODEC_ID_SMPTE_2038,
|
|
604
605
|
AV_CODEC_ID_LCEVC,
|
|
606
|
+
AV_CODEC_ID_SMPTE_436M_ANC,
|
|
605
607
|
|
|
606
608
|
|
|
607
609
|
AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
|
|
@@ -627,7 +629,7 @@ enum AVCodecID {
|
|
|
627
629
|
/**
|
|
628
630
|
* Get the type of the given codec.
|
|
629
631
|
*/
|
|
630
|
-
enum
|
|
632
|
+
enum AVMediaTypeFFmpeg avcodec_get_type(enum AVCodecID codec_id);
|
|
631
633
|
|
|
632
634
|
/**
|
|
633
635
|
* Get the name of a codec.
|
|
@@ -48,7 +48,7 @@ typedef struct AVCodecParameters {
|
|
|
48
48
|
/**
|
|
49
49
|
* General type of the encoded data.
|
|
50
50
|
*/
|
|
51
|
-
enum
|
|
51
|
+
enum AVMediaTypeFFmpeg codec_type;
|
|
52
52
|
/**
|
|
53
53
|
* Specific type of the encoded data (the codec used).
|
|
54
54
|
*/
|
|
@@ -148,7 +148,7 @@ typedef struct AVCodecParameters {
|
|
|
148
148
|
* durations. Should be set to { 0, 1 } when some frames have differing
|
|
149
149
|
* durations or if the value is not known.
|
|
150
150
|
*
|
|
151
|
-
* @note This field
|
|
151
|
+
* @note This field corresponds to values that are stored in codec-level
|
|
152
152
|
* headers and is typically overridden by container/transport-layer
|
|
153
153
|
* timestamps, when available. It should thus be used only as a last resort,
|
|
154
154
|
* when no higher-level timing information is available.
|
|
@@ -142,7 +142,7 @@ enum AVPacketSideDataType {
|
|
|
142
142
|
AV_PKT_DATA_CPB_PROPERTIES,
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
|
-
*
|
|
145
|
+
* Recommends skipping the specified number of samples
|
|
146
146
|
* @code
|
|
147
147
|
* u32le number of samples to skip from start of this packet
|
|
148
148
|
* u32le number of samples to skip from end of this packet
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* MXF SMPTE-436M VBI/ANC parsing functions
|
|
3
|
+
* Copyright (c) 2025 Jacob Lifshay
|
|
4
|
+
*
|
|
5
|
+
* This file is part of FFmpeg.
|
|
6
|
+
*
|
|
7
|
+
* FFmpeg is free software; you can redistribute it and/or
|
|
8
|
+
* modify it under the terms of the GNU Lesser General Public
|
|
9
|
+
* License as published by the Free Software Foundation; either
|
|
10
|
+
* version 2.1 of the License, or (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* FFmpeg is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15
|
+
* Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public
|
|
18
|
+
* License along with FFmpeg; if not, write to the Free Software
|
|
19
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef AVCODEC_SMPTE_436M_H
|
|
23
|
+
#define AVCODEC_SMPTE_436M_H
|
|
24
|
+
|
|
25
|
+
#include <stdint.h>
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Iterator over the ANC packets in a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data
|
|
29
|
+
*/
|
|
30
|
+
typedef struct AVSmpte436mAncIterator {
|
|
31
|
+
uint16_t anc_packets_left;
|
|
32
|
+
int size_left;
|
|
33
|
+
const uint8_t *data_left;
|
|
34
|
+
} AVSmpte436mAncIterator;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Wrapping Type from Table 7 (page 13) of:
|
|
38
|
+
* https://pub.smpte.org/latest/st436/s436m-2006.pdf
|
|
39
|
+
*/
|
|
40
|
+
typedef enum AVSmpte436mWrappingType
|
|
41
|
+
{
|
|
42
|
+
AV_SMPTE_436M_WRAPPING_TYPE_VANC_FRAME = 1,
|
|
43
|
+
AV_SMPTE_436M_WRAPPING_TYPE_VANC_FIELD_1 = 2,
|
|
44
|
+
AV_SMPTE_436M_WRAPPING_TYPE_VANC_FIELD_2 = 3,
|
|
45
|
+
AV_SMPTE_436M_WRAPPING_TYPE_VANC_PROGRESSIVE_FRAME = 4,
|
|
46
|
+
AV_SMPTE_436M_WRAPPING_TYPE_HANC_FRAME = 0x11,
|
|
47
|
+
AV_SMPTE_436M_WRAPPING_TYPE_HANC_FIELD_1 = 0x12,
|
|
48
|
+
AV_SMPTE_436M_WRAPPING_TYPE_HANC_FIELD_2 = 0x13,
|
|
49
|
+
AV_SMPTE_436M_WRAPPING_TYPE_HANC_PROGRESSIVE_FRAME = 0x14,
|
|
50
|
+
/** not a real wrapping type, just here to guarantee the enum is big enough */
|
|
51
|
+
AV_SMPTE_436M_WRAPPING_TYPE_MAX = 0xFF,
|
|
52
|
+
} AVSmpte436mWrappingType;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Payload Sample Coding from Table 4 (page 10) and Table 7 (page 13) of:
|
|
56
|
+
* https://pub.smpte.org/latest/st436/s436m-2006.pdf
|
|
57
|
+
*/
|
|
58
|
+
typedef enum AVSmpte436mPayloadSampleCoding
|
|
59
|
+
{
|
|
60
|
+
/** only used for VBI */
|
|
61
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_1BIT_LUMA = 1,
|
|
62
|
+
/** only used for VBI */
|
|
63
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_1BIT_COLOR_DIFF = 2,
|
|
64
|
+
/** only used for VBI */
|
|
65
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_1BIT_LUMA_AND_COLOR_DIFF = 3,
|
|
66
|
+
/** used for VBI and ANC */
|
|
67
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_LUMA = 4,
|
|
68
|
+
/** used for VBI and ANC */
|
|
69
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_COLOR_DIFF = 5,
|
|
70
|
+
/** used for VBI and ANC */
|
|
71
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_LUMA_AND_COLOR_DIFF = 6,
|
|
72
|
+
/** used for VBI and ANC */
|
|
73
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_10BIT_LUMA = 7,
|
|
74
|
+
/** used for VBI and ANC */
|
|
75
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_10BIT_COLOR_DIFF = 8,
|
|
76
|
+
/** used for VBI and ANC */
|
|
77
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_10BIT_LUMA_AND_COLOR_DIFF = 9,
|
|
78
|
+
/** only used for ANC */
|
|
79
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_LUMA_WITH_PARITY_ERROR = 10,
|
|
80
|
+
/** only used for ANC */
|
|
81
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_COLOR_DIFF_WITH_PARITY_ERROR = 11,
|
|
82
|
+
/** only used for ANC */
|
|
83
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_8BIT_LUMA_AND_COLOR_DIFF_WITH_PARITY_ERROR = 12,
|
|
84
|
+
/** not a real sample coding, just here to guarantee the enum is big enough */
|
|
85
|
+
AV_SMPTE_436M_PAYLOAD_SAMPLE_CODING_MAX = 0xFF,
|
|
86
|
+
} AVSmpte436mPayloadSampleCoding;
|
|
87
|
+
|
|
88
|
+
/** the payload capacity of AVSmpte291mAnc8bit (and of AVSmpte291mAnc10bit when that gets added) */
|
|
89
|
+
#define AV_SMPTE_291M_ANC_PAYLOAD_CAPACITY 0xFF
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* An ANC packet with an 8-bit payload.
|
|
93
|
+
* This can be decoded from AVSmpte436mCodedAnc::payload.
|
|
94
|
+
*
|
|
95
|
+
* Note: Some ANC packets need a 10-bit payload, if stored in this struct,
|
|
96
|
+
* the most-significant 2 bits of each sample are discarded.
|
|
97
|
+
*/
|
|
98
|
+
typedef struct AVSmpte291mAnc8bit {
|
|
99
|
+
uint8_t did;
|
|
100
|
+
uint8_t sdid_or_dbn;
|
|
101
|
+
uint8_t data_count;
|
|
102
|
+
uint8_t payload[AV_SMPTE_291M_ANC_PAYLOAD_CAPACITY];
|
|
103
|
+
uint8_t checksum;
|
|
104
|
+
} AVSmpte291mAnc8bit;
|
|
105
|
+
|
|
106
|
+
/** max number of samples that can be stored in the payload of AVSmpte436mCodedAnc */
|
|
107
|
+
#define AV_SMPTE_436M_CODED_ANC_SAMPLE_CAPACITY \
|
|
108
|
+
(AV_SMPTE_291M_ANC_PAYLOAD_CAPACITY + 4) /* 4 for did, sdid_or_dbn, data_count, and checksum */
|
|
109
|
+
/** max number of bytes that can be stored in the payload of AVSmpte436mCodedAnc */
|
|
110
|
+
#define AV_SMPTE_436M_CODED_ANC_PAYLOAD_CAPACITY (((AV_SMPTE_436M_CODED_ANC_SAMPLE_CAPACITY + 2) / 3) * 4)
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* An encoded ANC packet within a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
|
|
114
|
+
* The repeated section of Table 7 (page 13) of:
|
|
115
|
+
* https://pub.smpte.org/latest/st436/s436m-2006.pdf
|
|
116
|
+
*/
|
|
117
|
+
typedef struct AVSmpte436mCodedAnc {
|
|
118
|
+
uint16_t line_number;
|
|
119
|
+
AVSmpte436mWrappingType wrapping_type;
|
|
120
|
+
AVSmpte436mPayloadSampleCoding payload_sample_coding;
|
|
121
|
+
uint16_t payload_sample_count;
|
|
122
|
+
uint32_t payload_array_length;
|
|
123
|
+
/** the payload, has size payload_array_length.
|
|
124
|
+
* can be decoded into AVSmpte291mAnc8bit
|
|
125
|
+
*/
|
|
126
|
+
uint8_t payload[AV_SMPTE_436M_CODED_ANC_PAYLOAD_CAPACITY];
|
|
127
|
+
} AVSmpte436mCodedAnc;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Validate a AVSmpte436mCodedAnc structure. Doesn't check if the payload is valid.
|
|
131
|
+
* @param[in] anc ANC packet to validate
|
|
132
|
+
* @return 0 on success, AVERROR codes otherwise.
|
|
133
|
+
*/
|
|
134
|
+
int av_smpte_436m_coded_anc_validate(const AVSmpte436mCodedAnc *anc);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Encode ANC packets into a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
|
|
138
|
+
* @param[in] anc_packet_count number of ANC packets to encode
|
|
139
|
+
* @param[in] anc_packets the ANC packets to encode
|
|
140
|
+
* @param[in] size the size of out. ignored if out is NULL.
|
|
141
|
+
* @param[out] out Output bytes. Doesn't write anything if out is NULL.
|
|
142
|
+
* @return the number of bytes written on success, AVERROR codes otherwise.
|
|
143
|
+
* If out is NULL, returns the number of bytes it would have written.
|
|
144
|
+
*/
|
|
145
|
+
int av_smpte_436m_anc_encode(uint8_t *out, int size, int anc_packet_count, const AVSmpte436mCodedAnc *anc_packets);
|
|
146
|
+
|
|
147
|
+
struct AVPacket;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Append more ANC packets to a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
|
|
151
|
+
* @param[in] anc_packet_count number of ANC packets to encode
|
|
152
|
+
* @param[in] anc_packets the ANC packets to encode
|
|
153
|
+
* @param pkt the AVPacket to append to.
|
|
154
|
+
* it must either be size 0 or contain valid SMPTE_436M_ANC data.
|
|
155
|
+
* @return 0 on success, AVERROR codes otherwise.
|
|
156
|
+
*/
|
|
157
|
+
int av_smpte_436m_anc_append(struct AVPacket *pkt, int anc_packet_count, const AVSmpte436mCodedAnc *anc_packets);
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Set up iteration over the ANC packets in a single AV_CODEC_ID_SMPTE_436M_ANC AVPacket's data.
|
|
161
|
+
* @param[in] buf Pointer to the data from a AV_CODEC_ID_SMPTE_436M_ANC AVPacket.
|
|
162
|
+
* @param[in] buf_size Size of the data from a AV_CODEC_ID_SMPTE_436M_ANC AVPacket.
|
|
163
|
+
* @param[out] iter Pointer to the iterator.
|
|
164
|
+
* @return 0 on success, AVERROR codes otherwise.
|
|
165
|
+
*/
|
|
166
|
+
int av_smpte_436m_anc_iter_init(AVSmpte436mAncIterator *iter, const uint8_t *buf, int buf_size);
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get the next ANC packet from the iterator, advancing the iterator.
|
|
170
|
+
* @param[in,out] iter Pointer to the iterator.
|
|
171
|
+
* @param[out] anc The returned ANC packet.
|
|
172
|
+
* @return 0 on success, AVERROR_EOF when the iterator has reached the end, AVERROR codes otherwise.
|
|
173
|
+
*/
|
|
174
|
+
int av_smpte_436m_anc_iter_next(AVSmpte436mAncIterator *iter, AVSmpte436mCodedAnc *anc);
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Get the minimum number of bytes needed to store a AVSmpte436mCodedAnc payload.
|
|
178
|
+
* @param sample_coding the payload sample coding
|
|
179
|
+
* @param sample_count the number of samples stored in the payload
|
|
180
|
+
* @return returns the minimum number of bytes needed, on error returns < 0.
|
|
181
|
+
* always <= SMPTE_436M_CODED_ANC_PAYLOAD_CAPACITY
|
|
182
|
+
*/
|
|
183
|
+
int av_smpte_436m_coded_anc_payload_size(AVSmpte436mPayloadSampleCoding sample_coding, uint16_t sample_count);
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Decode a AVSmpte436mCodedAnc payload into AVSmpte291mAnc8bit
|
|
187
|
+
* @param[in] sample_coding the payload sample coding
|
|
188
|
+
* @param[in] sample_count the number of samples stored in the payload
|
|
189
|
+
* @param[in] payload the bytes storing the payload,
|
|
190
|
+
* the needed size can be obtained from
|
|
191
|
+
avpriv_smpte_436m_coded_anc_payload_size
|
|
192
|
+
* @param[in] log_ctx context pointer for av_log
|
|
193
|
+
* @param[out] out The decoded ANC packet.
|
|
194
|
+
* @return returns 0 on success, otherwise < 0.
|
|
195
|
+
*/
|
|
196
|
+
int av_smpte_291m_anc_8bit_decode(AVSmpte291mAnc8bit *out,
|
|
197
|
+
AVSmpte436mPayloadSampleCoding sample_coding,
|
|
198
|
+
uint16_t sample_count,
|
|
199
|
+
const uint8_t *payload,
|
|
200
|
+
void *log_ctx);
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Fill in the correct checksum for a AVSmpte291mAnc8bit
|
|
204
|
+
* @param[in,out] anc The ANC packet.
|
|
205
|
+
*/
|
|
206
|
+
void av_smpte_291m_anc_8bit_fill_checksum(AVSmpte291mAnc8bit *anc);
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Compute the sample count needed to encode a AVSmpte291mAnc8bit into a AVSmpte436mCodedAnc payload
|
|
210
|
+
* @param[in] anc The ANC packet.
|
|
211
|
+
* @param[in] sample_coding The sample coding.
|
|
212
|
+
* @param[in] log_ctx context pointer for av_log
|
|
213
|
+
* @return returns the sample count on success, otherwise < 0.
|
|
214
|
+
*/
|
|
215
|
+
int av_smpte_291m_anc_8bit_get_sample_count(const AVSmpte291mAnc8bit *anc,
|
|
216
|
+
AVSmpte436mPayloadSampleCoding sample_coding,
|
|
217
|
+
void *log_ctx);
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Encode a AVSmpte291mAnc8bit into a AVSmpte436mCodedAnc
|
|
221
|
+
* @param[in] line_number the line number the ANC packet is on
|
|
222
|
+
* @param[in] wrapping_type the wrapping type
|
|
223
|
+
* @param[in] sample_coding the payload sample coding
|
|
224
|
+
* @param[in] payload the ANC packet to encode.
|
|
225
|
+
* @param[in] log_ctx context pointer for av_log
|
|
226
|
+
* @param[out] out The encoded ANC packet.
|
|
227
|
+
* @return returns 0 on success, otherwise < 0.
|
|
228
|
+
*/
|
|
229
|
+
int av_smpte_291m_anc_8bit_encode(AVSmpte436mCodedAnc *out,
|
|
230
|
+
uint16_t line_number,
|
|
231
|
+
AVSmpte436mWrappingType wrapping_type,
|
|
232
|
+
AVSmpte436mPayloadSampleCoding sample_coding,
|
|
233
|
+
const AVSmpte291mAnc8bit *payload,
|
|
234
|
+
void *log_ctx);
|
|
235
|
+
|
|
236
|
+
/** AVSmpte291mAnc8bit::did when carrying CTA-708 data (for AV_CODEC_ID_EIA_608) */
|
|
237
|
+
#define AV_SMPTE_291M_ANC_DID_CTA_708 0x61
|
|
238
|
+
|
|
239
|
+
/** AVSmpte291mAnc8bit::sdid_or_dbn when carrying CTA-708 data (for AV_CODEC_ID_EIA_608) */
|
|
240
|
+
#define AV_SMPTE_291M_ANC_SDID_CTA_708 0x1
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Try to decode an ANC packet into EIA-608/CTA-708 data (AV_CODEC_ID_EIA_608). This
|
|
244
|
+
* @param[in] anc The ANC packet.
|
|
245
|
+
* @param[in] log_ctx Context pointer for av_log
|
|
246
|
+
* @param[out] cc_data the buffer to store the extracted EIA-608/CTA-708 data,
|
|
247
|
+
* you can pass NULL to not store the data.
|
|
248
|
+
* the required size is 3 * cc_count bytes.
|
|
249
|
+
* SMPTE_291M_ANC_PAYLOAD_CAPACITY is always enough size.
|
|
250
|
+
* @return returns cc_count (>= 0) on success, AVERROR(EAGAIN) if it wasn't a CTA-708 ANC packet, < 0 on error.
|
|
251
|
+
*/
|
|
252
|
+
int av_smpte_291m_anc_8bit_extract_cta_708(const AVSmpte291mAnc8bit *anc, uint8_t *cc_data, void *log_ctx);
|
|
253
|
+
|
|
254
|
+
#endif /* AVCODEC_SMPTE_436M_H */
|
|
@@ -926,7 +926,7 @@ typedef struct AVStream {
|
|
|
926
926
|
* the sixth @ref AVStreamGroup.streams "stream" in the group is "512,512",
|
|
927
927
|
* etc.
|
|
928
928
|
*
|
|
929
|
-
* The following is an example of a canvas with
|
|
929
|
+
* The following is an example of a canvas with overlapping tiles:
|
|
930
930
|
*
|
|
931
931
|
* +-----------+
|
|
932
932
|
* | %%%%% |
|
|
@@ -1420,7 +1420,7 @@ typedef struct AVFormatContext {
|
|
|
1420
1420
|
#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input.
|
|
1421
1421
|
#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS
|
|
1422
1422
|
#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container
|
|
1423
|
-
#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the
|
|
1423
|
+
#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the filling code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled
|
|
1424
1424
|
#define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible
|
|
1425
1425
|
#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it.
|
|
1426
1426
|
#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted
|
|
@@ -1670,7 +1670,7 @@ typedef struct AVFormatContext {
|
|
|
1670
1670
|
int use_wallclock_as_timestamps;
|
|
1671
1671
|
|
|
1672
1672
|
/**
|
|
1673
|
-
* Skip duration
|
|
1673
|
+
* Skip duration calculation in estimate_timings_from_pts.
|
|
1674
1674
|
* - encoding: unused
|
|
1675
1675
|
* - decoding: set by user
|
|
1676
1676
|
*
|
|
@@ -1773,7 +1773,7 @@ typedef struct AVFormatContext {
|
|
|
1773
1773
|
|
|
1774
1774
|
/**
|
|
1775
1775
|
* IO repositioned flag.
|
|
1776
|
-
* This is set by avformat when the
|
|
1776
|
+
* This is set by avformat when the underlying IO context read pointer
|
|
1777
1777
|
* is repositioned, for example when doing byte based seeking.
|
|
1778
1778
|
* Demuxers can use the flag to detect such changes.
|
|
1779
1779
|
*/
|
|
@@ -2253,7 +2253,7 @@ void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int i
|
|
|
2253
2253
|
* NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec.
|
|
2254
2254
|
*/
|
|
2255
2255
|
int av_find_best_stream(AVFormatContext *ic,
|
|
2256
|
-
enum
|
|
2256
|
+
enum AVMediaTypeFFmpeg type,
|
|
2257
2257
|
int wanted_stream_nb,
|
|
2258
2258
|
int related_stream,
|
|
2259
2259
|
const struct AVCodec **decoder_ret,
|
|
@@ -2593,7 +2593,7 @@ const AVOutputFormat *av_guess_format(const char *short_name,
|
|
|
2593
2593
|
*/
|
|
2594
2594
|
enum AVCodecID av_guess_codec(const AVOutputFormat *fmt, const char *short_name,
|
|
2595
2595
|
const char *filename, const char *mime_type,
|
|
2596
|
-
enum
|
|
2596
|
+
enum AVMediaTypeFFmpeg type);
|
|
2597
2597
|
|
|
2598
2598
|
/**
|
|
2599
2599
|
* Get timing information for the data currently output.
|