@pictor-sdk/video-android 0.1.0 → 0.1.4

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 (29) hide show
  1. package/android/build.gradle +36 -9
  2. package/android/consumer-rules.pro +47 -0
  3. package/android/src/main/AndroidManifest.xml +15 -1
  4. package/android/src/main/cpp/pictor_videosurface.cpp +88 -8
  5. package/android/src/main/java/dev/pictor/video/AudioMixer.kt +39 -4
  6. package/android/src/main/java/dev/pictor/video/BoundedWait.kt +89 -0
  7. package/android/src/main/java/dev/pictor/video/CadenceShaderProgram.kt +29 -0
  8. package/android/src/main/java/dev/pictor/video/CompositionSeek.kt +8 -0
  9. package/android/src/main/java/dev/pictor/video/CompositionSpike.kt +23 -13
  10. package/android/src/main/java/dev/pictor/video/CompositionVideoItem.kt +16 -0
  11. package/android/src/main/java/dev/pictor/video/CompositionWindow.kt +17 -0
  12. package/android/src/main/java/dev/pictor/video/ExportGate.kt +421 -44
  13. package/android/src/main/java/dev/pictor/video/FrameClock.kt +6 -1
  14. package/android/src/main/java/dev/pictor/video/GateLadder.kt +405 -0
  15. package/android/src/main/java/dev/pictor/video/MediaStoreSave.kt +216 -9
  16. package/android/src/main/java/dev/pictor/video/PictorVideoModule.kt +13 -0
  17. package/android/src/main/java/dev/pictor/video/RunRegistry.kt +108 -0
  18. package/android/src/main/java/dev/pictor/video/SkiaPassThroughEffect.kt +4 -0
  19. package/dist/index.d.mts +27 -0
  20. package/dist/index.d.ts +27 -0
  21. package/dist/index.js +15 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +15 -3
  24. package/dist/index.mjs.map +1 -1
  25. package/package.json +3 -3
  26. package/plugin/gradleProperties.js +9 -6
  27. package/src/NativePictorVideo.ts +11 -0
  28. package/src/compositionSpike.ts +9 -0
  29. package/src/exporter.ts +41 -3
package/dist/index.mjs CHANGED
@@ -586,6 +586,7 @@ function compositionSpikeSpec(project, mix, resolve) {
586
586
  const playlist = playlistOf(project);
587
587
  const items = [];
588
588
  const unsupported = playlist.unsupported.map((u) => `${u.clipId}: ${u.reason}`);
589
+ const clips = new Map(project.clips.map((clip) => [clip.id, clip]));
589
590
  for (const item of playlist.items) {
590
591
  const uri = resolve(item.source);
591
592
  if (uri === null) {
@@ -596,6 +597,8 @@ function compositionSpikeSpec(project, mix, resolve) {
596
597
  uri,
597
598
  startUs: Number(item.startUs),
598
599
  endUs: Number(item.endUs),
600
+ sourceDurationUs: clips.get(item.clipId)?.metadata.duration,
601
+ timelineEndUs: Number(item.timelineEndUs),
599
602
  speed: item.speed
600
603
  });
601
604
  }
@@ -1797,9 +1800,10 @@ function createMedia3VideoExporter(options) {
1797
1800
  );
1798
1801
  }
1799
1802
  const resources = overlayPlan.resources;
1803
+ const viaMedia3 = options.videoSpeedVia === "media3";
1800
1804
  const shards = plan.map((shard, index) => {
1801
1805
  const clip = playable[index];
1802
- const cadence = cadenceFor(shard.plan.frames);
1806
+ const cadence = viaMedia3 && clip.speed !== 1 ? null : cadenceFor(shard.plan.frames);
1803
1807
  return {
1804
1808
  uri: uris[index],
1805
1809
  startMs: Math.round(clip.sourceIn / 1e3),
@@ -1818,11 +1822,19 @@ function createMedia3VideoExporter(options) {
1818
1822
  What matters is that the *source's* audio never enters this pipeline:
1819
1823
  a per-shard audio track has to be re-encoded to concatenate, which is
1820
1824
  what put a second generation on everything the user hears.
1825
+
1826
+ `ExportGate` notes that `setRemoveAudio` beside a speed change is a
1827
+ combination Media3 warns about, and that was tried as a candidate
1828
+ fix for the high-rate export stall: giving the re-timing the real
1829
+ stream instead of silence. It made no difference to the fault — the
1830
+ encoder stopped at exactly the same place — so the change was
1831
+ reverted rather than kept for a benefit that could not be shown.
1832
+ See `docs/research/export-speed-stall.md`.
1821
1833
  */
1822
1834
  forceAudioTrack: true,
1823
1835
  removeAudio: true,
1824
- emitsPerInput: cadence.emitsPerInput,
1825
- outputPtsUs: cadence.outputPtsUs,
1836
+ emitsPerInput: cadence?.emitsPerInput,
1837
+ outputPtsUs: cadence?.outputPtsUs,
1826
1838
  spanUs: Math.round(shard.plan.frameCount * 1e6 / fps)
1827
1839
  };
1828
1840
  });