react-native-skia-webgpu-video 0.0.0-stage → 0.1.0-beta.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.
Files changed (236) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +303 -2
  3. package/android/BUILD_VALIDATION.md +62 -0
  4. package/android/CMakeLists.txt +99 -0
  5. package/android/build-validation.json +262 -0
  6. package/android/build.gradle +185 -0
  7. package/android/cpp/EncoderTargets.cpp +226 -0
  8. package/android/cpp/EncoderTargets.h +70 -0
  9. package/android/cpp/JNIHelpers.cpp +15 -0
  10. package/android/cpp/JNIHelpers.h +20 -0
  11. package/android/cpp/NativeEventDispatcher.cpp +59 -0
  12. package/android/cpp/NativeEventDispatcher.h +31 -0
  13. package/android/cpp/NativeHardwareBuffer.cpp +397 -0
  14. package/android/cpp/NativeHardwareBuffer.h +34 -0
  15. package/android/cpp/NativeRgbaBuffer.cpp +45 -0
  16. package/android/cpp/NativeRgbaBuffer.h +9 -0
  17. package/android/cpp/ReturnedVideoFrames.h +37 -0
  18. package/android/cpp/RgbaFrameLease.h +53 -0
  19. package/android/cpp/VideoCapabilities.cpp +87 -0
  20. package/android/cpp/VideoCapabilities.h +44 -0
  21. package/android/cpp/VideoComposition.cpp +170 -0
  22. package/android/cpp/VideoComposition.h +36 -0
  23. package/android/cpp/VideoCompositionFramesExtractor.cpp +82 -0
  24. package/android/cpp/VideoCompositionFramesExtractor.h +48 -0
  25. package/android/cpp/VideoCompositionFramesExtractorHostObject.cpp +230 -0
  26. package/android/cpp/VideoCompositionFramesExtractorHostObject.h +42 -0
  27. package/android/cpp/VideoCompositionFramesExtractorSyncHostObject.cpp +133 -0
  28. package/android/cpp/VideoCompositionFramesExtractorSyncHostObject.h +46 -0
  29. package/android/cpp/VideoEncoderHostObject.cpp +318 -0
  30. package/android/cpp/VideoEncoderHostObject.h +76 -0
  31. package/android/cpp/VideoFrame.cpp +293 -0
  32. package/android/cpp/VideoFrame.h +27 -0
  33. package/android/cpp/VideoPlayer.cpp +96 -0
  34. package/android/cpp/VideoPlayer.h +52 -0
  35. package/android/cpp/VideoPlayerHostObject.cpp +225 -0
  36. package/android/cpp/VideoPlayerHostObject.h +43 -0
  37. package/android/cpp/cpp-adapter.cpp +316 -0
  38. package/android/gradle.properties +5 -0
  39. package/android/instrumentation-inventory.json +178 -0
  40. package/android/proguard-rules.pro +4 -0
  41. package/android/src/main/AndroidManifest.xml +2 -0
  42. package/android/src/main/java/com/azzapp/rnskv/AudioCompositionExporter.java +537 -0
  43. package/android/src/main/java/com/azzapp/rnskv/AudioCompositionPlayer.java +321 -0
  44. package/android/src/main/java/com/azzapp/rnskv/BufferLifetime.java +55 -0
  45. package/android/src/main/java/com/azzapp/rnskv/DecodeRequests.java +100 -0
  46. package/android/src/main/java/com/azzapp/rnskv/DecoderWindow.java +55 -0
  47. package/android/src/main/java/com/azzapp/rnskv/EGLResourcesHolder.java +132 -0
  48. package/android/src/main/java/com/azzapp/rnskv/EGLUtils.java +225 -0
  49. package/android/src/main/java/com/azzapp/rnskv/FrameSize.java +50 -0
  50. package/android/src/main/java/com/azzapp/rnskv/GLFrameExtractor.java +510 -0
  51. package/android/src/main/java/com/azzapp/rnskv/JNIHelpers.java +12 -0
  52. package/android/src/main/java/com/azzapp/rnskv/NativeEventDispatcher.java +25 -0
  53. package/android/src/main/java/com/azzapp/rnskv/NativeHardwareBuffer.java +62 -0
  54. package/android/src/main/java/com/azzapp/rnskv/NativeRgbaBuffer.java +35 -0
  55. package/android/src/main/java/com/azzapp/rnskv/ReactNativeSkiaVideoModule.java +45 -0
  56. package/android/src/main/java/com/azzapp/rnskv/ReactNativeSkiaVideoPackage.java +43 -0
  57. package/android/src/main/java/com/azzapp/rnskv/ReactNativeSkiaVideoSpec.java +9 -0
  58. package/android/src/main/java/com/azzapp/rnskv/RgbaBufferAllocator.java +83 -0
  59. package/android/src/main/java/com/azzapp/rnskv/RgbaLayout.java +33 -0
  60. package/android/src/main/java/com/azzapp/rnskv/SurfaceOutputPolicy.java +13 -0
  61. package/android/src/main/java/com/azzapp/rnskv/TextureRenderer.java +150 -0
  62. package/android/src/main/java/com/azzapp/rnskv/TimeHelpers.java +11 -0
  63. package/android/src/main/java/com/azzapp/rnskv/VideoCapabilities.java +354 -0
  64. package/android/src/main/java/com/azzapp/rnskv/VideoComposition.java +147 -0
  65. package/android/src/main/java/com/azzapp/rnskv/VideoCompositionDecoder.java +772 -0
  66. package/android/src/main/java/com/azzapp/rnskv/VideoCompositionFramesExtractor.java +354 -0
  67. package/android/src/main/java/com/azzapp/rnskv/VideoCompositionFramesExtractorSync.java +241 -0
  68. package/android/src/main/java/com/azzapp/rnskv/VideoCompositionItemDecoder.java +492 -0
  69. package/android/src/main/java/com/azzapp/rnskv/VideoEncoder.java +639 -0
  70. package/android/src/main/java/com/azzapp/rnskv/VideoFrame.java +74 -0
  71. package/android/src/main/java/com/azzapp/rnskv/VideoPlayer.java +361 -0
  72. package/cpp/RNSVCheckedSizes.h +54 -0
  73. package/cpp/RNSVEventEmitter.cpp +199 -0
  74. package/cpp/RNSVEventEmitter.h +31 -0
  75. package/cpp/RNSVHostObject.cpp +79 -0
  76. package/cpp/RNSVHostObject.h +67 -0
  77. package/cpp/RNSVMemoryBudget.cpp +68 -0
  78. package/cpp/RNSVMemoryBudget.h +100 -0
  79. package/cpp/RNSVRuntimeLifecycleMonitor.cpp +88 -0
  80. package/cpp/RNSVRuntimeLifecycleMonitor.h +33 -0
  81. package/docs/ANDROID_DEVICE_306.md +95 -0
  82. package/docs/ANDROID_EXPORT_CACHE_306.md +48 -0
  83. package/docs/ANDROID_MEMORY_RETENTION_306.md +67 -0
  84. package/docs/BENCHMARKS.md +368 -0
  85. package/docs/IOS_DEVICE_TESTS.md +115 -0
  86. package/docs/IOS_SIMULATOR_TESTS.md +74 -0
  87. package/docs/MIGRATION.md +82 -0
  88. package/docs/NATIVE_MEMORY_INVESTIGATION_306.md +88 -0
  89. package/docs/PERFORMANCE_AB_IPHONE_303.md +196 -0
  90. package/docs/PERFORMANCE_AB_SIMULATOR.md +135 -0
  91. package/docs/PERFORMANCE_AB_SOAK_SIMULATOR.md +84 -0
  92. package/docs/PERFORMANCE_IPHONE_306_OPTIMIZATION.md +76 -0
  93. package/docs/PERFORMANCE_SIMULATOR.md +89 -0
  94. package/docs/PERFORMANCE_SIMULATOR_INITIAL.md +96 -0
  95. package/docs/PERFORMANCE_SOAK_IPHONE_303.md +41 -0
  96. package/docs/UPSTREAM_NOTES.md +188 -0
  97. package/docs/assets/banner.svg +26 -0
  98. package/examples/webgpu-overlay.ts +147 -0
  99. package/ios/AVAssetTrackUtils.h +24 -0
  100. package/ios/AudioCompositionUtils.h +27 -0
  101. package/ios/AudioCompositionUtils.mm +113 -0
  102. package/ios/DecoderWindow.h +52 -0
  103. package/ios/NativeResourceStats.h +32 -0
  104. package/ios/RNSVColorSpace.h +50 -0
  105. package/ios/RNSVJSIUtils.h +46 -0
  106. package/ios/RNSVScopedPixelBuffer.h +17 -0
  107. package/ios/RNSVVideoPlayer.h +46 -0
  108. package/ios/RNSVVideoPlayer.mm +410 -0
  109. package/ios/ReactNativeSkiaVideo.h +8 -0
  110. package/ios/ReactNativeSkiaVideo.mm +310 -0
  111. package/ios/SeekPolicy.h +27 -0
  112. package/ios/VideoComposition.h +148 -0
  113. package/ios/VideoCompositionFramesExtractorHostObject.h +105 -0
  114. package/ios/VideoCompositionFramesExtractorHostObject.mm +686 -0
  115. package/ios/VideoCompositionFramesExtractorSyncHostObject.h +37 -0
  116. package/ios/VideoCompositionFramesExtractorSyncHostObject.mm +168 -0
  117. package/ios/VideoCompositionItemDecoder.h +60 -0
  118. package/ios/VideoCompositionItemDecoder.mm +480 -0
  119. package/ios/VideoEncoderHostObject.h +83 -0
  120. package/ios/VideoEncoderHostObject.mm +706 -0
  121. package/ios/VideoFrame.h +66 -0
  122. package/ios/VideoFrame.mm +108 -0
  123. package/ios/VideoPlayerHostObject.h +52 -0
  124. package/ios/VideoPlayerHostObject.mm +332 -0
  125. package/lib/module/NativeReactNativeSkiaVideo.js +5 -0
  126. package/lib/module/NativeReactNativeSkiaVideo.js.map +1 -0
  127. package/lib/module/RNSkiaVideoModule.js +20 -0
  128. package/lib/module/RNSkiaVideoModule.js.map +1 -0
  129. package/lib/module/canvas.js +18 -0
  130. package/lib/module/canvas.js.map +1 -0
  131. package/lib/module/exportCache.js +22 -0
  132. package/lib/module/exportCache.js.map +1 -0
  133. package/lib/module/exportFrames.js +338 -0
  134. package/lib/module/exportFrames.js.map +1 -0
  135. package/lib/module/exportQueue.js +52 -0
  136. package/lib/module/exportQueue.js.map +1 -0
  137. package/lib/module/exportTarget.js +137 -0
  138. package/lib/module/exportTarget.js.map +1 -0
  139. package/lib/module/exportVideoComposition.js +492 -0
  140. package/lib/module/exportVideoComposition.js.map +1 -0
  141. package/lib/module/frameInterop.js +532 -0
  142. package/lib/module/frameInterop.js.map +1 -0
  143. package/lib/module/gpu.js +222 -0
  144. package/lib/module/gpu.js.map +1 -0
  145. package/lib/module/gpuDevice.js +54 -0
  146. package/lib/module/gpuDevice.js.map +1 -0
  147. package/lib/module/index.js +36 -0
  148. package/lib/module/index.js.map +1 -0
  149. package/lib/module/memory.js +38 -0
  150. package/lib/module/memory.js.map +1 -0
  151. package/lib/module/package.json +1 -0
  152. package/lib/module/previewLifecycle.js +52 -0
  153. package/lib/module/previewLifecycle.js.map +1 -0
  154. package/lib/module/runtimeYield.js +10 -0
  155. package/lib/module/runtimeYield.js.map +1 -0
  156. package/lib/module/types.js +4 -0
  157. package/lib/module/types.js.map +1 -0
  158. package/lib/module/utils/useEventListener.js +18 -0
  159. package/lib/module/utils/useEventListener.js.map +1 -0
  160. package/lib/module/videoCompositionPlayer.js +348 -0
  161. package/lib/module/videoCompositionPlayer.js.map +1 -0
  162. package/lib/module/videoFrameImage.js +185 -0
  163. package/lib/module/videoFrameImage.js.map +1 -0
  164. package/lib/module/videoPlayer.js +172 -0
  165. package/lib/module/videoPlayer.js.map +1 -0
  166. package/lib/module/yuvBlit.js +299 -0
  167. package/lib/module/yuvBlit.js.map +1 -0
  168. package/lib/typescript/package.json +1 -0
  169. package/lib/typescript/src/NativeReactNativeSkiaVideo.d.ts +7 -0
  170. package/lib/typescript/src/NativeReactNativeSkiaVideo.d.ts.map +1 -0
  171. package/lib/typescript/src/RNSkiaVideoModule.d.ts +4 -0
  172. package/lib/typescript/src/RNSkiaVideoModule.d.ts.map +1 -0
  173. package/lib/typescript/src/canvas.d.ts +4 -0
  174. package/lib/typescript/src/canvas.d.ts.map +1 -0
  175. package/lib/typescript/src/exportCache.d.ts +6 -0
  176. package/lib/typescript/src/exportCache.d.ts.map +1 -0
  177. package/lib/typescript/src/exportFrames.d.ts +57 -0
  178. package/lib/typescript/src/exportFrames.d.ts.map +1 -0
  179. package/lib/typescript/src/exportQueue.d.ts +5 -0
  180. package/lib/typescript/src/exportQueue.d.ts.map +1 -0
  181. package/lib/typescript/src/exportTarget.d.ts +28 -0
  182. package/lib/typescript/src/exportTarget.d.ts.map +1 -0
  183. package/lib/typescript/src/exportVideoComposition.d.ts +68 -0
  184. package/lib/typescript/src/exportVideoComposition.d.ts.map +1 -0
  185. package/lib/typescript/src/frameInterop.d.ts +17 -0
  186. package/lib/typescript/src/frameInterop.d.ts.map +1 -0
  187. package/lib/typescript/src/gpu.d.ts +39 -0
  188. package/lib/typescript/src/gpu.d.ts.map +1 -0
  189. package/lib/typescript/src/gpuDevice.d.ts +11 -0
  190. package/lib/typescript/src/gpuDevice.d.ts.map +1 -0
  191. package/lib/typescript/src/index.d.ts +21 -0
  192. package/lib/typescript/src/index.d.ts.map +1 -0
  193. package/lib/typescript/src/memory.d.ts +25 -0
  194. package/lib/typescript/src/memory.d.ts.map +1 -0
  195. package/lib/typescript/src/previewLifecycle.d.ts +22 -0
  196. package/lib/typescript/src/previewLifecycle.d.ts.map +1 -0
  197. package/lib/typescript/src/runtimeYield.d.ts +4 -0
  198. package/lib/typescript/src/runtimeYield.d.ts.map +1 -0
  199. package/lib/typescript/src/types.d.ts +631 -0
  200. package/lib/typescript/src/types.d.ts.map +1 -0
  201. package/lib/typescript/src/utils/useEventListener.d.ts +5 -0
  202. package/lib/typescript/src/utils/useEventListener.d.ts.map +1 -0
  203. package/lib/typescript/src/videoCompositionPlayer.d.ts +85 -0
  204. package/lib/typescript/src/videoCompositionPlayer.d.ts.map +1 -0
  205. package/lib/typescript/src/videoFrameImage.d.ts +60 -0
  206. package/lib/typescript/src/videoFrameImage.d.ts.map +1 -0
  207. package/lib/typescript/src/videoPlayer.d.ts +99 -0
  208. package/lib/typescript/src/videoPlayer.d.ts.map +1 -0
  209. package/lib/typescript/src/yuvBlit.d.ts +50 -0
  210. package/lib/typescript/src/yuvBlit.d.ts.map +1 -0
  211. package/package.json +154 -4
  212. package/patches/react-native-skia+3.7.0.patch +502 -0
  213. package/react-native-skia-webgpu-video.podspec +35 -0
  214. package/scripts/apply-skia-canvas-patch.mjs +48 -0
  215. package/scripts/skia-canvas-patch.json +291 -0
  216. package/src/NativeReactNativeSkiaVideo.ts +8 -0
  217. package/src/RNSkiaVideoModule.ts +27 -0
  218. package/src/canvas.ts +22 -0
  219. package/src/exportCache.ts +27 -0
  220. package/src/exportFrames.ts +421 -0
  221. package/src/exportQueue.ts +65 -0
  222. package/src/exportTarget.ts +179 -0
  223. package/src/exportVideoComposition.ts +718 -0
  224. package/src/frameInterop.ts +684 -0
  225. package/src/gpu.ts +290 -0
  226. package/src/gpuDevice.ts +80 -0
  227. package/src/index.tsx +45 -0
  228. package/src/memory.ts +48 -0
  229. package/src/previewLifecycle.ts +60 -0
  230. package/src/runtimeYield.ts +6 -0
  231. package/src/types.ts +661 -0
  232. package/src/utils/useEventListener.ts +22 -0
  233. package/src/videoCompositionPlayer.ts +520 -0
  234. package/src/videoFrameImage.ts +205 -0
  235. package/src/videoPlayer.ts +318 -0
  236. package/src/yuvBlit.ts +331 -0
@@ -0,0 +1,68 @@
1
+ import type { ExportOptions, FrameDrawer, VideoComposition, VideoFrame } from "./types.js";
2
+ export type VideoFrameProcessingContext = {
3
+ frames: Record<string, VideoFrame>;
4
+ currentTime: number;
5
+ width: number;
6
+ height: number;
7
+ videoComposition: VideoComposition;
8
+ isCancelled: () => boolean;
9
+ };
10
+ /** Optional per-export GPU, 3D or ML adapter. Construct resources on the
11
+ * export runtime; the legacy draw callback stays synchronous. */
12
+ export type VideoFrameProcessor = {
13
+ prepareFrame: (context: VideoFrameProcessingContext) => void | Promise<void>;
14
+ /** Must finish every GPU/ML read before settling. A rejected cleanup is
15
+ * conservatively retained and prevents another export on that runtime. */
16
+ dispose: () => void | Promise<void>;
17
+ };
18
+ /** Cumulative wall-clock milliseconds per export stage, measured on the
19
+ * export runtime. Stages are sequential, so they add up to `totalMs`. */
20
+ export type ExportProfile = {
21
+ frames: number;
22
+ totalMs: number;
23
+ /** Native decoding up to each frame time. */
24
+ decodeMs: number;
25
+ /** Wrapping or copying decoded frames for Skia, and closing replaced ones. */
26
+ importMs: number;
27
+ /** createFrameProcessor's prepareFrame. */
28
+ prepareMs: number;
29
+ /** GPU export: lending and wrapping an encoder buffer, including waits
30
+ * for the bounded pool to return one. */
31
+ targetMs: number;
32
+ /** drawFrame, before/afterDrawFrame and progress scheduling. */
33
+ drawMs: number;
34
+ /** The checked flush(true): waiting for the GPU to complete the frame. */
35
+ gpuMs: number;
36
+ /** Readback when used, submission to the encoder including its
37
+ * backpressure, and the final file write. */
38
+ encodeMs: number;
39
+ /** Between frames, on the export runtime's event loop. */
40
+ yieldMs: number;
41
+ };
42
+ export type VideoExportArguments<T = undefined> = ExportOptions & {
43
+ videoComposition: VideoComposition;
44
+ drawFrame: FrameDrawer<T>;
45
+ beforeDrawFrame?: () => T;
46
+ afterDrawFrame?: (context: T) => void;
47
+ onProgress?: (progress: {
48
+ framesCompleted: number;
49
+ nbFrames: number;
50
+ }) => void;
51
+ abortSignal?: AbortSignal;
52
+ /** A worklet factory, initialized once. prepareFrame completes before
53
+ * drawing; dispose completes before export resolves or rejects. */
54
+ createFrameProcessor?: (context: {
55
+ width: number;
56
+ height: number;
57
+ videoComposition: VideoComposition;
58
+ isCancelled: () => boolean;
59
+ }) => VideoFrameProcessor | Promise<VideoFrameProcessor>;
60
+ /** Called once, after the last frame is written and before the export
61
+ * resolves. Measuring adds a few clock reads per frame; omit to skip it. */
62
+ onProfile?: (profile: ExportProfile) => void;
63
+ };
64
+ /** Public drawing/timing contract preserved; one step is submitted at a time.
65
+ * Native input and output queues, the shared budget and serialized exports
66
+ * prevent slow GPU/codec/ML consumers from growing an unbounded frame backlog. */
67
+ export declare const exportVideoComposition: <T = undefined>(args: VideoExportArguments<T>) => Promise<void>;
68
+ //# sourceMappingURL=exportVideoComposition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exportVideoComposition.d.ts","sourceRoot":"","sources":["../../../src/exportVideoComposition.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,gBAAgB,EAGhB,UAAU,EACX,MAAM,YAAS,CAAC;AA4BjB,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,WAAW,EAAE,MAAM,OAAO,CAAC;CAC5B,CAAC;AAEF;iEACiE;AACjE,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,CAAC,OAAO,EAAE,2BAA2B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E;8EAC0E;IAC1E,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC,CAAC;AAEF;yEACyE;AACzE,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EA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ClD,MAAM,oBAAoB,CAAC,CAAC,CAAC,KAC5B,OAAO,CAAC,IAAI,CAA+D,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { SkImage } from "react-native-skia";
2
+ import type { VideoFrame } from "./types.js";
3
+ /** Clear a runtime's imported images after ending all its producers.
4
+ * Do not clear a paused producer's current frame: its native source has
5
+ * already been released, and the owned snapshot is its remaining pixels. */
6
+ export declare const clearVideoFrameImages: (releaseStagingSurface?: boolean) => void;
7
+ /** Release an item which has left a composition or a producer being closed. */
8
+ export declare const releaseVideoFrameImage: (frame: VideoFrame) => void;
9
+ /** Returns immutable, owned pixels. WebGPU uploads Android RGBA pixels or blits
10
+ * native buffers into one reusable texture, then snapshots a fresh Skia view.
11
+ * Graphite-backed snapshots bypass the raster ImageProvider's image-count LRU.
12
+ * Wait for completion before releasing sources or rewriting the scratch texture. */
13
+ export declare const imageFromVideoFrame: (frame: VideoFrame) => SkImage | null;
14
+ /** Stage all issued frames, including items a callback currently hides.
15
+ * This releases decoder leases promptly instead of waiting for JS GC. */
16
+ export declare const ownVideoFrames: (frames: Record<string, VideoFrame>) => Record<string, VideoFrame>;
17
+ //# sourceMappingURL=frameInterop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frameInterop.d.ts","sourceRoot":"","sources":["../../../src/frameInterop.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAY,OAAO,EAAa,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAiJ1C;;4EAE4E;AAC5E,eAAO,MAAM,qBAAqB,GAAI,+BAA6B,KAAG,IA8BrE,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,GAAI,OAAO,UAAU,KAAG,IAmB1D,CAAC;AAEF;;;oFAGoF;AACpF,eAAO,MAAM,mBAAmB,GAAI,OAAO,UAAU,KAAG,OAAO,GAAG,IAiXjE,CAAC;AAEF;yEACyE;AACzE,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,KACjC,MAAM,CAAC,MAAM,EAAE,UAAU,CAkG3B,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { SkCanvas, SkImage, SkSurface } from "react-native-skia";
2
+ export { getVideoGpuDevice } from "./gpuDevice.js";
3
+ export type VideoGpuTextureFormat = "rgba8unorm" | "bgra8unorm" | "rgba16float" | "r8unorm" | "depth24plus" | "depth32float";
4
+ export type VideoGpuTarget = {
5
+ readonly texture: GPUTexture;
6
+ readonly image: SkImage | null;
7
+ readonly surface: SkSurface | null;
8
+ readonly canvas: SkCanvas | null;
9
+ };
10
+ export type VideoGpuTextureOptions = {
11
+ width: number;
12
+ height: number;
13
+ format?: VideoGpuTextureFormat;
14
+ usage?: GPUTextureUsageFlags;
15
+ /** Images sample the texture; surfaces let Skia draw into it. Both are
16
+ * restricted to the color formats supported by Skia's native interop. */
17
+ skia?: "image" | "surface" | "none";
18
+ label?: string;
19
+ };
20
+ export type VideoGpuScope = {
21
+ readonly device: GPUDevice;
22
+ createTexture: (options: VideoGpuTextureOptions) => VideoGpuTarget;
23
+ createBuffer: (descriptor: GPUBufferDescriptor) => GPUBuffer;
24
+ /** Register pending CPU/ML work which reads this scope's resources. */
25
+ track: <T>(start: () => Promise<T>) => Promise<T>;
26
+ /** Submit owned Skia recordings, await tracked jobs and the shared GPU queue. */
27
+ drain: () => Promise<void>;
28
+ /** First detach every external image/surface consumer. Repeated calls return
29
+ * the same promise; failed GPU drain retains resources and reservations. */
30
+ dispose: () => Promise<void>;
31
+ };
32
+ /** Create once on the consuming runtime, reuse targets across frames, then
33
+ * dispose after removing consumers. Byte accounting is an explicit allocation
34
+ * estimate, not driver RSS: codecs, shaders and driver padding are separate. */
35
+ export declare const createVideoGpuScope: (options?: {
36
+ maxResources?: number;
37
+ maxPendingJobs?: number;
38
+ }) => VideoGpuScope;
39
+ //# sourceMappingURL=gpu.d.ts.map
@@ -0,0 +1 @@
1
+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,IAAI,CAAC,CAAC;IAC3B;gFAC4E;IAC5E,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAWF;;gFAEgF;AAChF,eAAO,MAAM,mBAAmB,GAAI,UAAU;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,KAAG,aAqOH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { NativeVideoFrame } from "react-native-webgpu";
2
+ export declare const getVideoGpuDevice: () => GPUDevice;
3
+ export declare const createNativeVideoGpuFrame: (pointer: bigint) => NativeVideoFrame;
4
+ export declare const nativeVideoTextureUsage: number;
5
+ export declare const rgbaVideoTextureUsage: number;
6
+ export declare const videoShaderStages: {
7
+ vertex: number;
8
+ fragment: number;
9
+ };
10
+ export declare const videoUniformBufferUsage: number;
11
+ //# sourceMappingURL=gpuDevice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpuDevice.d.ts","sourceRoot":"","sources":["../../../src/gpuDevice.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAsC5D,eAAO,MAAM,iBAAiB,QAAO,SAIpC,CAAC;AAEF,eAAO,MAAM,yBAAyB,GACpC,SAAS,MAAM,KACd,gBAKF,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAGV,CAAC;AAI3B,eAAO,MAAM,qBAAqB,QACkB,CAAC;AAGrD,eAAO,MAAM,iBAAiB;;;CAG7B,CAAC;AACF,eAAO,MAAM,uBAAuB,QACc,CAAC"}
@@ -0,0 +1,21 @@
1
+ import RNSkiaVideoModule from './RNSkiaVideoModule.js';
2
+ export { RNSkiaVideoModule as __RNSkiaVideoPrivateAPI };
3
+ export * from './types.js';
4
+ export * from './videoPlayer.js';
5
+ export * from './videoCompositionPlayer.js';
6
+ export * from './exportVideoComposition.js';
7
+ export * from './videoFrameImage.js';
8
+ export { clearVideoFrameImages, releaseVideoFrameImage } from './frameInterop.js';
9
+ export { configureVideoMemory, getVideoResourceStats } from './memory.js';
10
+ export type { VideoMemoryStats } from './memory.js';
11
+ export declare const getValidEncoderConfigurations: typeof RNSkiaVideoModule.getValidEncoderConfigurations;
12
+ export declare const getDecodingCapabilitiesFor: typeof RNSkiaVideoModule.getDecodingCapabilitiesFor;
13
+ /**
14
+ * Whether the device can encode with the given codec.
15
+ *
16
+ * Unlike the two above this is answered on both platforms. Use it to decide
17
+ * whether to offer a codec at all; exports fall back to H.264 by themselves
18
+ * when the answer is false.
19
+ */
20
+ export declare const isEncodingSupported: typeof RNSkiaVideoModule.isEncodingSupported;
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,wBAAqB,CAAC;AAGpD,OAAO,EAAE,iBAAiB,IAAI,uBAAuB,EAAE,CAAC;AAExD,cAAc,YAAS,CAAC;AACxB,cAAc,kBAAe,CAAC;AAC9B,cAAc,6BAA0B,CAAC;AACzC,cAAc,6BAA0B,CAAC;AACzC,cAAc,sBAAmB,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,mBAAgB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,aAAU,CAAC;AACvE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAU,CAAC;AAEjD,eAAO,MAAM,6BAA6B,EAAE,OAAO,iBAAiB,CAAC,6BASlE,CAAC;AAEJ,eAAO,MAAM,0BAA0B,EAAE,OAAO,iBAAiB,CAAC,0BAS/D,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,OAAO,iBAAiB,CAAC,mBACE,CAAC"}
@@ -0,0 +1,25 @@
1
+ export type VideoMemoryStats = {
2
+ currentBytes: number;
3
+ peakBytes: number;
4
+ allocations: number;
5
+ maxBytes: number;
6
+ };
7
+ /** Limits library-owned reservations across preview and export runtimes.
8
+ * Driver/codec caches must additionally be measured on the device. */
9
+ export declare const configureVideoMemory: ({ maxBytes }: {
10
+ maxBytes: number;
11
+ }) => void;
12
+ export declare const getVideoResourceStats: () => {
13
+ budget: {
14
+ currentBytes: number;
15
+ peakBytes: number;
16
+ allocations: number;
17
+ maxBytes: number;
18
+ } | null;
19
+ native: Record<string, number> | null;
20
+ backend: Record<string, string | number | boolean> | null;
21
+ };
22
+ export declare const frameByteSize: (width: number, height: number) => number;
23
+ export declare const reserveVideoMemory: (bytes: number, label: string) => number;
24
+ export declare const releaseVideoMemory: (reservation: number) => void;
25
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/memory.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;sEACsE;AACtE,eAAO,MAAM,oBAAoB,GAAI,cAAc;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,SAKtE,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;CAIhC,CAAC;AAEH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,MAa7D,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,KAAG,MAGjE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,KAAG,IAGxD,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { SkCanvas, SkImage, SkSurface } from "react-native-skia";
2
+ import type { VideoFrame } from "./types.js";
3
+ type PreviewResources = {
4
+ surface?: SkSurface | null;
5
+ canvas?: SkCanvas | null;
6
+ images?: Array<SkImage | null>;
7
+ frames?: VideoFrame[];
8
+ reservation?: number;
9
+ afterDraw?: (() => void) | null;
10
+ native?: {
11
+ dispose: () => void;
12
+ } | null;
13
+ };
14
+ /** Private UI-runtime quarantine. Detach consumers before calling this helper.
15
+ * A failed drain keeps every potentially referenced resource and its accounting
16
+ * alive until runtime teardown; native codecs can still close independently. */
17
+ export declare const disposePreviewResources: (resources: PreviewResources) => {
18
+ failed: boolean;
19
+ error: unknown;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=previewLifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"previewLifecycle.d.ts","sourceRoot":"","sources":["../../../src/previewLifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAE1C,KAAK,gBAAgB,GAAG;IACtB,OAAO,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF;;gFAEgF;AAChF,eAAO,MAAM,uBAAuB,GAAI,WAAW,gBAAgB;;WAEZ,OAAO;CAuC7D,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Continues on the calling worklet runtime's own event loop, so promise and
2
+ * native callbacks run between frames without a hop through the RN thread. */
3
+ export declare const yieldToRuntime: (fn: () => void) => void;
4
+ //# sourceMappingURL=runtimeYield.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeYield.d.ts","sourceRoot":"","sources":["../../../src/runtimeYield.ts"],"names":[],"mappings":"AAAA;8EAC8E;AAC9E,eAAO,MAAM,cAAc,GAAI,IAAI,MAAM,IAAI,KAAG,IAG/C,CAAC"}