conformtools 0.6.4 → 0.6.6
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 +3 -3
- package/dist/account-HDXVTS5T.js +3 -0
- package/dist/avid-panel/MANIFEST.json +11 -0
- package/dist/avid-panel/avid-manifest.json +46 -0
- package/dist/avid-panel/icon.svg +4 -0
- package/dist/avid-panel/icons/conformtools.svg +4 -0
- package/dist/avid-panel/index.html +26 -0
- package/dist/avid-panel/panel.css +12 -0
- package/dist/avid-panel/panel.js +7 -0
- package/dist/bridge-D5KPIUSY.js +3 -0
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/chunk-3OCQA33E.js +3 -0
- package/dist/chunk-3XD6NC4G.js +10 -0
- package/dist/chunk-5JBUCVRI.js +20 -0
- package/dist/chunk-5RSNFPED.js +8 -0
- package/dist/{chunk-BW2NQ54J.js → chunk-5SUGU2YR.js} +1 -1
- package/dist/{chunk-HKP4P6JN.js → chunk-6ML26TIK.js} +1 -1
- package/dist/chunk-7MC7M2Y5.js +3 -0
- package/dist/chunk-AS7IXHYM.js +19 -0
- package/dist/chunk-BL6L5ZBP.js +39 -0
- package/dist/chunk-C5IX63YF.js +3 -0
- package/dist/chunk-EJGVNQ3E.js +8 -0
- package/dist/{chunk-EPZ6NWE4.js → chunk-HGDO3OED.js} +1 -1
- package/dist/chunk-JV7TZDKJ.js +3 -0
- package/dist/chunk-LFJLRLEP.js +3 -0
- package/dist/chunk-NFJHWZJX.js +3 -0
- package/dist/{chunk-WT6NIJCB.js → chunk-NQHQKEP5.js} +1 -1
- package/dist/chunk-NU3X7P4N.js +3 -0
- package/dist/chunk-OJWIBQK4.js +376 -0
- package/dist/chunk-OVUCL3YY.js +5 -0
- package/dist/chunk-PFISREY4.js +3 -0
- package/dist/chunk-PFZVET7S.js +3 -0
- package/dist/chunk-PLRB2YXJ.js +3 -0
- package/dist/chunk-RFIPLBQ4.js +5 -0
- package/dist/chunk-SZD4C5MB.js +6 -0
- package/dist/chunk-TXQR2HI2.js +4 -0
- package/dist/chunk-UKKRZ574.js +7 -0
- package/dist/{chunk-EO5NIBOV.js → chunk-VS3MKKJ5.js} +1 -1
- package/dist/{chunk-42QQI3WX.js → chunk-X53BNWNV.js} +1 -1
- package/dist/{chunk-QTPCU2TF.js → chunk-XNR7M4VX.js} +1 -1
- package/dist/{claude-setup-BM3AAUKR.js → claude-setup-IIWUB4CE.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/conformtools-analyze +0 -0
- package/dist/conformtools-decode +0 -0
- package/dist/{cr3-wasm-WKWMEK3V.js → cr3-wasm-L2LFY3LM.js} +1 -1
- package/dist/{dng-wasm-Z5OVO4UI.js → dng-wasm-U6NC3MDK.js} +1 -1
- package/dist/{dpx-wasm-QNYXAOAJ.js → dpx-wasm-RMKEUKED.js} +1 -1
- package/dist/engine-P6H5P6HP.js +5 -0
- package/dist/{exr-wasm-BHSBJLQH.js → exr-wasm-LBAOMOZD.js} +1 -1
- package/dist/flame/hook/conformtools_flame/__init__.py +10 -0
- package/dist/flame/hook/conformtools_flame/building.py +191 -0
- package/dist/flame/hook/conformtools_flame/hook.py +177 -0
- package/dist/flame/hook/conformtools_flame/render.py +622 -0
- package/dist/flame/hook/conformtools_flame/util.py +33 -0
- package/dist/flame/hook/conformtools_flame/verbs.py +1037 -0
- package/dist/flame/hook/conformtools_flame_hook.py +42 -0
- package/dist/fonts/gfx/BarlowCondensed-Bold.ttf +0 -0
- package/dist/fonts/gfx/BarlowCondensed-Regular.ttf +0 -0
- package/dist/fonts/gfx/InstrumentSerif-Regular.ttf +0 -0
- package/dist/fonts/gfx/Inter-Bold.ttf +0 -0
- package/dist/fonts/gfx/Inter-Regular.ttf +0 -0
- package/dist/fonts/gfx/JetBrainsMono-Bold.ttf +0 -0
- package/dist/fonts/gfx/JetBrainsMono-Regular.ttf +0 -0
- package/dist/fonts/gfx/OFL.txt +100 -0
- package/dist/framing-SRCJKAYO.js +3 -0
- package/dist/gfx-worker.js +3 -0
- package/dist/h264-3ESGVT6G.js +3 -0
- package/dist/{h264-mxf-MWS7DDV7.js → h264-mxf-NPFS7NGH.js} +1 -1
- package/dist/host-relink-D6CB2VOQ.js +10 -0
- package/dist/hosts-W4AD2MYH.js +3 -0
- package/dist/http.js +3 -2
- package/dist/i2o-transfer +0 -0
- package/dist/inspect-7ASUPU73.js +68 -0
- package/dist/isobmff-SIOE67WL.js +3 -0
- package/dist/mcp.js +7 -8
- package/dist/media-7AUNRKHF.js +3 -0
- package/dist/media_core-Q2PIEV7D.js +9 -0
- package/dist/{media_core_bg-FGAR5KA5.js → media_core_bg-FDL7GJZP.js} +1 -1
- package/dist/mxf-74TTDICM.js +3 -0
- package/dist/nuke/panel/python/Startup/conformtools_nuke_startup.py +44 -0
- package/dist/nuke/panel/python/conformtools_nuke/__init__.py +10 -0
- package/dist/nuke/panel/python/conformtools_nuke/panel.py +217 -0
- package/dist/nuke/panel/python/conformtools_nuke/verbs.py +837 -0
- package/dist/{ops-73NR3X6R.js → ops-FSOOBXMV.js} +1 -1
- package/dist/peer-kit/ctpeer/__init__.py +21 -0
- package/dist/peer-kit/ctpeer/client.py +247 -0
- package/dist/peer-kit/ctpeer/neutral.py +178 -0
- package/dist/peer-kit/ctpeer/pairing.py +139 -0
- package/dist/peer-kit/ctpeer/protocol.py +209 -0
- package/dist/peer-kit/ctpeer/websocket.py +289 -0
- package/dist/premiere-uxp/index.js +5 -5
- package/dist/premiere-uxp/lib/clipmeta.js +6 -6
- package/dist/premiere-uxp/lib/ctx.js +30 -24
- package/dist/premiere-uxp/lib/edit.js +516 -0
- package/dist/premiere-uxp/lib/markers.js +5 -5
- package/dist/premiere-uxp/lib/pairing.js +14 -5
- package/dist/premiere-uxp/lib/premiere.js +10 -1
- package/dist/premiere-uxp/lib/probe.js +102 -0
- package/dist/premiere-uxp/lib/render.js +15 -8
- package/dist/premiere-uxp/lib/session.js +1 -1
- package/dist/premiere-uxp/lib/sizing.js +30 -17
- package/dist/premiere-uxp/lib/time.js +7 -1
- package/dist/premiere-uxp/lib/timeline.js +2 -2
- package/dist/premiere-uxp/lib/verbs.js +3 -2
- package/dist/premiere-uxp/lib/write.js +3 -3
- package/dist/premiere-uxp/manifest.json +1 -1
- package/dist/probe-F7WQHMIA.js +3 -0
- package/dist/r3d-YTLOMC7C.js +3 -0
- package/dist/{r3d-VUOYU2KQ.js → r3d-ZDJ3WURS.js} +1 -1
- package/dist/resolve-bridge.py +1262 -13
- package/dist/{still-4G25EYN5.js → still-ZG2RUQAL.js} +1 -1
- package/dist/store-ZHXLQCGN.js +3 -0
- package/dist/{tiff-wasm-QJPCR7JT.js → tiff-wasm-D2FJ3L56.js} +1 -1
- package/dist/timeline-6DYFDVEH.js +3 -0
- package/dist/timeline_core-IOENXK4Z.js +3 -0
- package/dist/wasm/media_core_bg.wasm +0 -0
- package/dist/wasm-threads/media_core_bg.wasm +0 -0
- package/dist/wav-OWMUGQMM.js +3 -0
- package/package.json +6 -4
- package/dist/chunk-6FVGUJ6L.js +0 -3
- package/dist/chunk-6TM32YIJ.js +0 -7
- package/dist/chunk-BUEIRRNY.js +0 -3
- package/dist/chunk-CL26XMDO.js +0 -3
- package/dist/chunk-DRHOPOC7.js +0 -3
- package/dist/chunk-GXEVALBL.js +0 -3
- package/dist/chunk-JB7PR2TQ.js +0 -3
- package/dist/chunk-QDWB7QU7.js +0 -3
- package/dist/chunk-QTKRMXL5.js +0 -363
- package/dist/chunk-SP5RGDAM.js +0 -3
- package/dist/chunk-TEZP6VEQ.js +0 -3
- package/dist/chunk-Y2BEEOPB.js +0 -3
- package/dist/h264-LIZVHN2W.js +0 -3
- package/dist/inspect-DZF537QL.js +0 -46
- package/dist/isobmff-HM3UPWPZ.js +0 -3
- package/dist/media_core-R5PPN3AY.js +0 -9
- package/dist/mxf-K465SWBN.js +0 -3
- package/dist/onnxruntime-web-stub-PKJ2NZBF.js +0 -3
- package/dist/r3d-RR3FUM6H.js +0 -3
- package/dist/sscd-embed-DHFTEIOC.js +0 -3
- package/dist/sscd-sweep-OYS4XAID.js +0 -3
- package/dist/timeline_core-VK2ZWPCO.js +0 -3
- package/dist/wav-63QF6SCT.js +0 -3
- /package/dist/{arriraw-3GKCR6K2.js → arriraw-YIJ3BYNN.js} +0 -0
- /package/dist/{chunk-WHY3DVXS.js → chunk-D6YDLKSA.js} +0 -0
- /package/dist/{media_core_bg-YK63OUDM.js → media_core_bg-XRBVKQZH.js} +0 -0
- /package/dist/{prores-L4JZZWGH.js → prores-RIG37OIH.js} +0 -0
- /package/dist/{timeline_core_bg-2TYWZ35G.js → timeline_core_bg-JW42YM3G.js} +0 -0
- /package/dist/{udf_bg-A4WEMSAX.js → udf_bg-B37GKRIH.js} +0 -0
package/dist/chunk-SP5RGDAM.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
function p(e,r,l,m){let u=new DataView(e.buffer,e.byteOffset,e.byteLength),t=r;for(;t+8<=l;){let n=u.getUint32(t),s=String.fromCharCode(e[t+4],e[t+5],e[t+6],e[t+7]),f=8;if(n===1){let g=u.getUint32(t+8),k=u.getUint32(t+12);n=g*2**32+k,f=16}else n===0&&(n=l-t);if(n<f||t+n>l)break;m(s,t+f,t+n),t+=n}}var C=new Set(["moov","trak","mdia","minf","stbl"]);function T(e){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),l=null,m=(t,n)=>{let s={},f=!1,g=(k,d)=>{p(e,k,d,(b,a,S)=>{if(C.has(b)){g(a,S);return}switch(b){case"hdlr":{String.fromCharCode(e[a+8],e[a+9],e[a+10],e[a+11])==="vide"&&(f=!0);break}case"stsd":{let i=a+8;s.codec=String.fromCharCode(e[i+4],e[i+5],e[i+6],e[i+7]),s.width=r.getUint16(i+32),s.height=r.getUint16(i+34);break}case"stsz":{let i=r.getUint32(a+4),c=r.getUint32(a+8),o=[];if(i===0)for(let h=0;h<c;h++)o.push(r.getUint32(a+12+h*4));else for(let h=0;h<c;h++)o.push(i);s.sampleSizes=o;break}case"stco":{let i=r.getUint32(a+4),c=[];for(let o=0;o<i;o++)c.push(r.getUint32(a+8+o*4));s.chunkOffsets=c;break}case"co64":{let i=r.getUint32(a+4),c=[];for(let o=0;o<i;o++){let h=r.getUint32(a+8+o*8),U=r.getUint32(a+12+o*8);c.push(h*2**32+U)}s.chunkOffsets=c;break}case"stsc":{let i=r.getUint32(a+4),c=[];for(let o=0;o<i;o++)c.push({firstChunk:r.getUint32(a+8+o*12),samplesPerChunk:r.getUint32(a+8+o*12+4),descIdx:r.getUint32(a+8+o*12+8)});s.sampleToChunk=c;break}}})};g(t,n),f&&s.chunkOffsets&&s.sampleSizes&&s.sampleToChunk&&(l=s)};if(((t,n)=>{p(e,t,n,(s,f,g)=>{s==="moov"&&p(e,f,g,(k,d,b)=>{k==="trak"&&m(d,b)})})})(0,e.length),!l)throw new Error("could not find a video sample table");return l}function w(e){let r=[],l=0;for(let m=0;m<e.chunkOffsets.length;m++){let u=1;for(let n=0;n<e.sampleToChunk.length;n++)m+1>=e.sampleToChunk[n].firstChunk&&(u=e.sampleToChunk[n].samplesPerChunk);let t=e.chunkOffsets[m];for(let n=0;n<u&&l<e.sampleSizes.length;n++){let s=e.sampleSizes[l];r.push({offset:t,size:s}),t+=s,l++}}return r}export{T as a,w as b};
|
package/dist/chunk-TEZP6VEQ.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{readFile as y,writeFile as P,appendFile as k,stat as f,readdir as U,mkdir as D,open as h,copyFile as O,mkdtemp as T,rm as R,chmod as $,rename as A,cp as M,statfs as S}from"node:fs/promises";import{execFile as W,spawn as F}from"node:child_process";import{createHash as E}from"node:crypto";import{createReadStream as B}from"node:fs";import{homedir as H,tmpdir as N,platform as C,release as z,arch as L,totalmem as I,availableParallelism as _}from"node:os";import{fileURLToPath as b}from"node:url";import j from"node:http";import m from"node:process";import{Buffer as x}from"node:buffer";import{join as w,resolve as v,sep as G}from"node:path";import{basename as Le,dirname as Ie,extname as _e,join as je,relative as Ge,resolve as Je}from"node:path";{let e=globalThis.fetch,t=typeof globalThis.Deno<"u";e&&!t&&(globalThis.fetch=(async(n,o)=>{let r=typeof n=="string"?n:n instanceof URL?n.href:n.url;if(r.startsWith("file:")){let i=await y(b(r)),s=r.endsWith(".wasm")?"application/wasm":"application/octet-stream";return new Response(i,{status:200,headers:{"content-type":s}})}return e(n,o)}))}var p=e=>m.env[e],ne=()=>Number(p("CONFORM_MEMORY_GB")??0)*2**30||I(),oe=()=>_(),se=()=>m.argv.slice(2),ie=e=>m.exit(e),ae=()=>m.platform,ce=()=>m.arch;function le(){let e=m.versions.deno;return{platform:`${C()} ${z()} ${L()}`,runtime:e?`deno ${e}`:`node ${m.version}`}}var me=()=>p("CONFORM_MCP_HOME")??w(g(),".conform-mcp"),g=()=>p("HOME")??H();function ue(e){let t=e.trim();if(t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1)),/^file:\/\//i.test(t))try{t=b(t)}catch{}return t==="~"?t=g():(t.startsWith("~/")||t.startsWith("~\\"))&&(t=w(g(),t.slice(2))),t&&v(t)+(/[\\/]$/.test(t)&&!/[\\/]$/.test(v(t))?G:"")}var de=e=>b(e);async function fe(e){let t=await f(e);return{isFile:t.isFile(),isDirectory:t.isDirectory(),size:t.size,mtimeMs:t.mtimeMs}}async function pe(e){try{return await f(e),!0}catch{return!1}}async function ge(e){try{return(await f(e)).isFile()}catch{return!1}}async function ye(e){try{return(await f(e)).isDirectory()}catch{return!1}}async function he(e){let t=await y(e);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}var be=e=>y(e,"utf8"),we=(e,t)=>P(e,t),xe=(e,t,n)=>n?.append?k(e,t):P(e,t);async function ve(e){await D(e,{recursive:!0})}var Pe=e=>R(e,{force:!0}),Re=(e,t)=>$(e,t).catch(()=>{}),Ae=(e,t)=>O(e,t),Fe=(e,t)=>A(e,t),ke=e=>R(e,{recursive:!0,force:!0}),Ue=(e,t)=>M(e,t,{recursive:!0,verbatimSymlinks:!0});async function De(e){try{let t=await S(e);return Number(t.bavail)*Number(t.bsize)}catch{return null}}var Oe=(e="conform-")=>T(w(N(),e));async function*Te(e){for(let t of await U(e,{withFileTypes:!0}))yield{name:t.name,isFile:t.isFile(),isDirectory:t.isDirectory()}}async function $e(e){let t=await h(e,"r"),n=(await t.stat()).size;return{path:e,size:n,async readAt(o,r){let i=new Uint8Array(r),s=0;for(;s<r;){let{bytesRead:c}=await t.read(i,s,r-s,o+s);if(!c)break;s+=c}return s===r?i:i.subarray(0,s)},close:()=>t.close()}}async function Me(e){let t=await h(e,"w");return{async writeAt(n,o){let r=0;for(;r<o.length;){let{bytesWritten:i}=await t.write(o,r,o.length-r,n+r);r+=i}},truncate:n=>t.truncate(n),close:()=>t.close()}}function J(e,t,n={}){return new Promise(o=>{W(e,t,{maxBuffer:1<<30,env:n.env?{...m.env,...n.env}:void 0,timeout:n.timeoutMs},(r,i,s)=>{let c=r?.code??0;o({success:!r,code:c,stdout:String(i),stderr:String(s)})})})}function Se(e,t,n,o={}){return new Promise((r,i)=>{let s=F(e,t,{env:o.env?{...m.env,...o.env}:void 0,stdio:["ignore","pipe","pipe"]}),c="";s.stdout.on("data",a=>n(a)),s.stderr.on("data",a=>{c+=new TextDecoder().decode(a)}),s.on("error",i),s.on("close",a=>r({code:a,stderr:c})),o.signal?.addEventListener("abort",()=>s.kill(),{once:!0})})}function We(e,t,n,o){let r=F(e,t,{stdio:["pipe","pipe","pipe"]});r.stdout.on("data",a=>n(a)),r.stderr.on("data",a=>o?.(new TextDecoder().decode(a)));let i=new Promise(a=>{r.on("close",l=>a(l)),r.on("error",()=>a(null))}),s=[r,r.stdout,r.stderr,r.stdin],c=a=>{for(let l of s)(a?l.ref:l.unref)?.call(l)};return c(!1),{write:a=>new Promise((l,u)=>{r.stdin.write(a,d=>d?u(d):l())}),hold:c,close:()=>{try{r.stdin.end(),r.kill()}catch{}},exited:i}}async function Ee(e){if(p("CONFORM_NO_BROWSER"))return!1;let[t,n]=m.platform==="darwin"?["open",[e]]:m.platform==="win32"?["cmd",["/c","start","",e.replace(/&/g,"^&")]]:["xdg-open",[e]];return(await J(t,n)).success}function Be(e,t){let n=j.createServer(async(o,r)=>{try{let i=[];if(o.method!=="GET"&&o.method!=="HEAD")for await(let u of o)i.push(u);let s=i.length>0,c=new Headers;for(let[u,d]of Object.entries(o.headers))d!=null&&c.set(u,Array.isArray(d)?d.join(", "):d);let a=`http://${o.headers.host??`${e.hostname}:${e.port}`}${o.url??"/"}`,l=await t(new Request(a,{method:o.method,headers:c,body:s?x.concat(i):void 0}));r.statusCode=l.status,l.headers.forEach((u,d)=>r.setHeader(d,u)),r.end(x.from(await l.arrayBuffer()))}catch(i){r.statusCode=500,r.end(JSON.stringify({ok:!1,code:"internal",message:i instanceof Error?i.message:String(i)}))}});return n.listen(e.port,e.hostname,()=>{let o=n.address();e.onListen?.(typeof o=="object"&&o?o.port:e.port)}),{close:()=>n.close()}}async function He(e){let t=E("sha256");for await(let n of B(e))t.update(n);return t.digest("hex")}async function Ne(e,t,n){let o=`${t}.part`;for(let r=0;;r++){let i=0;try{i=(await f(o)).size}catch{}try{let s=await fetch(e,{headers:i?{Range:`bytes=${i}-`}:{}});if(s.status===416)break;if(!s.ok||!s.body)throw new Error(`${e} answered ${s.status}`);i&&s.status!==206&&(i=0);let c=i+Number(s.headers.get("content-length")??0),a=await h(o,i?"a":"w");try{let l=i;for await(let u of s.body)await a.write(u),l+=u.length,n?.(l,c)}finally{await a.close()}break}catch(s){if(r>=4)throw s;await new Promise(c=>setTimeout(c,2e3*(r+1)))}}await A(o,t)}export{b as a,p as b,ne as c,oe as d,se as e,ie as f,ae as g,ce as h,le as i,me as j,g as k,ue as l,de as m,fe as n,pe as o,ge as p,ye as q,he as r,be as s,we as t,xe as u,ve as v,Pe as w,Re as x,Ae as y,Fe as z,ke as A,Ue as B,De as C,Oe as D,Te as E,$e as F,Me as G,J as H,Se as I,We as J,Ee as K,Be as L,He as M,Ne as N,Le as O,Ie as P,_e as Q,je as R,Ge as S,Je as T};
|
package/dist/chunk-Y2BEEOPB.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
var s=288,u=8;function A(r,o=288){let t=o*o,l=new Float32Array(r.length*3*t);for(let n=0;n<r.length;n++){let a=r[n],c=n*3*t;for(let e=0;e<t;e++)l[c+e]=a[e*4]/255,l[c+t+e]=a[e*4+1]/255,l[c+2*t+e]=a[e*4+2]/255}return l}function i(r,o){let t=0,l=Math.min(r.length,o.length);for(let n=0;n<l;n++)t+=r[n]*o[n];return t}function p(r){let o=0;for(let t=0;t<r.length;t++)o+=r[t]*r[t];return Math.sqrt(o)}export{s as a,u as b,A as c,i as d,p as e};
|
package/dist/h264-LIZVHN2W.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as M}from"./chunk-QDWB7QU7.js";import{a as v,b as S}from"./chunk-SP5RGDAM.js";import{a as F}from"./chunk-TK55FA56.js";import"./chunk-PSANHDZM.js";var V=8,H=1500,P=new WeakMap;async function C(t){let o=P.get(t);return o||(o=k(t),P.set(t,o)),o}async function k(t){if(typeof VideoDecoder>"u")throw new Error("h264: WebCodecs (VideoDecoder) not available in this context");let o=t.parts[0],e=await F({fileSize:o.fileSize,read:o.read}),a=S(v(e)),r=M(e);if(!r)throw new Error("h264: no H.264/HEVC config in container");let s=r.decodeToPres.length||a.length,f=new Int32Array(s);for(let n=0;n<r.decodeToPres.length;n++)f[r.decodeToPres[n]]=n;let u=[];for(let n=0;n<r.keyframes.length;n++){let l=r.keyframes[n],m=n+1<r.keyframes.length?r.keyframes[n+1]:a.length;u.push([l,m])}let c={offs:a,cfg:r,gops:u,presToDecode:f,count:s,dec:null,wanted:-1,got:null,gotResolve:null,fedThrough:-1,queue:Promise.resolve()};return c.dec=new VideoDecoder({output:n=>{Number(n.timestamp)===c.wanted&&!c.got?(c.got=n,c.gotResolve?.()):n.close()},error:()=>{c.fedThrough=-1}}),c.dec.configure({codec:r.codec,description:r.description,optimizeForLatency:!0,hardwareAcceleration:"prefer-hardware"}),c}function R(t,o){let e=0,a=t.length-1,r=0;for(;e<=a;){let s=e+a>>1;t[s][0]<=o?(r=s,e=s+1):a=s-1}return r}async function I(t){let o=t.codedWidth,e=t.codedHeight;try{let a=o*e*4,r=new Uint8Array(a);return await t.copyTo(r,{format:"RGBA",colorSpace:"srgb"}),{width:o,height:e,rgba:r}}catch{let r=new OffscreenCanvas(o,e).getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("h264: no 2d context for frame readback");r.drawImage(t,0,0);let s=r.getImageData(0,0,o,e);return{width:o,height:e,rgba:new Uint8Array(s.data.buffer)}}}async function O(t,o){let e=await C(t);if(e.count===0)throw new Error("h264: empty clip");if(o<0||o>=e.count)throw new Error(`COVERAGE_MISS: frame ${o} outside 0..${e.count-1}`);let a,r=new Promise(f=>{a=f}),s=e.queue;e.queue=e.queue.then(()=>r),await s;try{let f=t.parts[0],u=e.presToDecode[o],c=R(e.gops,u),[n,l]=e.gops[c];for(let m=0;m<2;m++){let T=m===0&&e.fedThrough>n&&e.fedThrough<=l&&u>=e.fedThrough,w=T?e.fedThrough:n;if(!T&&e.fedThrough!==-1){try{await e.dec.flush()}catch{}e.fedThrough=-1}let h=Math.min(l,u+1+V);e.wanted=o,e.got=null;let D=new Promise(d=>{e.gotResolve=d});if(h>w){let d=1/0,y=0;for(let i=w;i<h;i++)d=Math.min(d,e.offs[i].offset),y=Math.max(y,e.offs[i].offset+e.offs[i].size);let E=await f.read(d,y-d);for(let i=w;i<h;i++){let b=e.offs[i];e.dec.decode(new EncodedVideoChunk({type:i===n?"key":"delta",timestamp:e.cfg.decodeToPres[i],data:E.subarray(b.offset-d,b.offset-d+b.size)}))}e.fedThrough=h}let A=new Promise(d=>setTimeout(d,H));if(await Promise.race([D,A]),!e.got){try{await e.dec.flush()}catch{}e.fedThrough=-1}let p=e.got;if(e.wanted=-1,e.gotResolve=null,e.got=null,!!p)try{return await I(p)}finally{p.close()}}throw new Error(`h264: frame ${o} did not decode`)}finally{a()}}async function g(){return(await import("./isobmff-HM3UPWPZ.js")).isobmffFormat}var U={async inspect(t){return(await g()).inspect(t)},async extract(t){return(await g()).extract(t)},async sparsify(t,o){return(await g()).sparsify(t,o)},async trim(t,o){return(await g()).trim(t,o)},async decode(t,o){return O(t,o)}};export{U as h264Format};
|