conformtools 0.6.20 → 0.6.21
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/dist/{bridge-MLBUD6XW.js → bridge-GW2VQP2I.js} +1 -1
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/{chunk-HROU7LLU.js → chunk-26ZNWQLT.js} +1 -1
- package/dist/{chunk-2GRXBIJB.js → chunk-2WD3MDPB.js} +1 -1
- package/dist/{chunk-WYI4LL4P.js → chunk-5WL2ZPPB.js} +5 -5
- package/dist/{chunk-GBNPOZ32.js → chunk-5XJVAA6N.js} +1 -1
- package/dist/{chunk-JVJUJKUP.js → chunk-5YCUHHZO.js} +1 -1
- package/dist/{chunk-6IL7M3VP.js → chunk-AY72AUHE.js} +87 -87
- package/dist/chunk-BUOYYO22.js +3 -0
- package/dist/{chunk-2S2ZPQQD.js → chunk-CXOK4SF6.js} +1 -1
- package/dist/{chunk-2DEUYEQD.js → chunk-I6WBZBGN.js} +1 -1
- package/dist/{chunk-567IWIX6.js → chunk-JCNKPRYY.js} +1 -1
- package/dist/{chunk-L2RTMZCN.js → chunk-LKX3HCRN.js} +1 -1
- package/dist/{chunk-HCT34NDA.js → chunk-M56WEBZY.js} +1 -1
- package/dist/{chunk-EWW5KWAO.js → chunk-OR6IMPAS.js} +1 -1
- package/dist/{chunk-V2FVIZT7.js → chunk-P6MSAFNR.js} +1 -1
- package/dist/{chunk-ATEWMIY5.js → chunk-PENDVYIL.js} +1 -1
- package/dist/{chunk-GHP6HDLM.js → chunk-QJPOC4SW.js} +1 -1
- package/dist/{chunk-4UT55WZA.js → chunk-SQCGMF6W.js} +1 -1
- package/dist/{chunk-IPQLKAF2.js → chunk-VG73BE6N.js} +1 -1
- package/dist/{chunk-4V3KLFCJ.js → chunk-WW6XAQKM.js} +1 -1
- package/dist/{chunk-OSPDH2RK.js → chunk-X7C4YS2J.js} +1 -1
- package/dist/{chunk-A7AYMSY7.js → chunk-XAUMTGJZ.js} +2 -2
- package/dist/{chunk-LUKA7UUJ.js → chunk-Z42CP7YT.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/{cr3-wasm-DIWL7CPH.js → cr3-wasm-CVZ2A7HA.js} +1 -1
- package/dist/{dng-wasm-PE463PG2.js → dng-wasm-TN64FKIN.js} +1 -1
- package/dist/{dpx-wasm-DKE3LJ6Z.js → dpx-wasm-BO2NDGTA.js} +1 -1
- package/dist/{exr-wasm-HAFH3YA5.js → exr-wasm-W4K6W6JZ.js} +1 -1
- package/dist/flame/hook/conformtools_flame/verbs.py +21 -4
- package/dist/{framing-U46POZQG.js → framing-GOLRVBBJ.js} +1 -1
- package/dist/gfx-worker.js +1 -1
- package/dist/{h264-4ETGWMKR.js → h264-LC27KFZT.js} +1 -1
- package/dist/{h264-mxf-EFHHQL7X.js → h264-mxf-GQCFBTTP.js} +1 -1
- package/dist/{host-relink-MVHI3YQI.js → host-relink-BYLBYTPH.js} +1 -1
- package/dist/{hosted-6BLHLZXM.js → hosted-ASNIPMSH.js} +1 -1
- package/dist/hosts-EYVK23A3.js +3 -0
- package/dist/http.js +2 -2
- package/dist/{inspect-5TMUYGAL.js → inspect-63MCOFOQ.js} +4 -4
- package/dist/{isobmff-55TPOVCK.js → isobmff-IMEN2G3B.js} +1 -1
- package/dist/{mc-video-GKWEWCEQ.js → mc-video-G4KNAHGG.js} +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{media-HCKSVARE.js → media-Z23SL7RZ.js} +1 -1
- package/dist/{media_core-XOKN7UUF.js → media_core-KHSB6EFN.js} +2 -2
- package/dist/{mxf-AJTCMKTX.js → mxf-ZEM6EEZU.js} +1 -1
- package/dist/{ops-UGZODMYE.js → ops-T6ZV7RAM.js} +1 -1
- package/dist/{r3d-EKISZSKU.js → r3d-6P6K47AH.js} +1 -1
- package/dist/{r3d-XHSJUARW.js → r3d-ISLQ6I3S.js} +1 -1
- package/dist/{still-IDLCMQRD.js → still-DMZJUM7M.js} +1 -1
- package/dist/{still-wasm-54HEDTRX.js → still-wasm-ZLP224QL.js} +1 -1
- package/dist/{tiff-wasm-O7XUGXIO.js → tiff-wasm-TAEKNO4Q.js} +1 -1
- package/dist/{timeline-TFF3L7JP.js → timeline-P4GJT36O.js} +1 -1
- package/dist/wasm/media_core_bg.wasm +0 -0
- package/dist/wasm-threads/media_core_bg.wasm +0 -0
- package/dist/{wav-OLA3QYFJ.js → wav-BNOX5U7S.js} +1 -1
- package/package.json +5 -5
- package/dist/chunk-Y7PFSVRX.js +0 -3
- package/dist/hosts-7UO4QETB.js +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as F}from"./chunk-3PVQ5QP4.js";import{b as ge,c as we,f as _e}from"./chunk-VFXMP7IF.js";import{f as X,h as he}from"./chunk-
|
|
3
|
+
import{a as F}from"./chunk-3PVQ5QP4.js";import{b as ge,c as we,f as _e}from"./chunk-VFXMP7IF.js";import{f as X,h as he}from"./chunk-I6WBZBGN.js";import{a as be}from"./chunk-WW6XAQKM.js";import{i as N}from"./chunk-CXOK4SF6.js";import{b as P,d as T,f as E}from"./chunk-NU3X7P4N.js";import{Ha as pe,ea as ce,fa as le,ja as ue,oa as me,wa as de,xa as fe}from"./chunk-LKX3HCRN.js";import{a as ae}from"./chunk-COALWMI7.js";import{A as J,C as K,H as V,O as v,P as z,Q as se,T as ie,aa as b,b as D,ba as x,ca as k,d as ee,da as y,e as re,h as te,l as ne,m as j,t as W,u as L,w as oe,x as R}from"./chunk-MU5AGXSH.js";var G=!1,O=8,Ae=0,De=3,U=2;async function ze(e){let t=new Uint8Array(await e.slice(0,16).arrayBuffer()),n=i=>String.fromCharCode(t[i],t[i+1],t[i+2],t[i+3]);if(t[0]===6&&t[1]===14&&t[2]===43&&t[3]===52)return"mxf";if(n(4)==="RED1"||n(4)==="RED2")return"r3d";let r=t[0]<<24|t[1]<<16|t[2]<<8|t[3],s=n(4);return/^[A-Za-z0-9 ]{4}$/.test(s)&&(r>=8||r===1)&&r<=e.size?"isobmff":null}function ke(e){let t=e.toLowerCase();return t.endsWith(".braw")?"braw":t.endsWith(".crm")?"crm":"mov"}function Ne(e){return async(t,n)=>new Uint8Array(await e.slice(t,Math.min(t+n,e.size)).arrayBuffer())}function ye(e){let t=e.timecode;return!t||!t.fps_denominator?null:t.fps_numerator/t.fps_denominator}async function ir(e){return await pe(),xe?xe.clip(e,G?"rec709":"",()=>$e(e)):$e(e)}var xe=null;async function $e(e){let t=await ze(e),n=[];if(t==="r3d"){let r=e,s=r.parts&&r.bases?r.parts:[{name:e.name,size:e.size}],o=r.bases??[0],i=async(u,d,f)=>{let p=o[u]+d;return new Uint8Array(await e.slice(p,Math.min(p+f,o[u]+s[u].size)).arrayBuffer())},c=JSON.stringify(s.map(u=>({name:u.name,size:u.size}))),a=JSON.parse(await fe(i,c)),l=JSON.parse(await ue(i,c));return s.length===1&&/_\d{3}\.r3d$/i.test(e.name)&&!/_001\.r3d$/i.test(e.name)&&n.push("spanned R3D part \u2014 only this part's frames are indexed"),{frames:l.map(u=>({offset:o[u.part??0]+u.essenceOffset,size:u.essenceLength})),w:a.width??0,h:a.height??0,fps:ye(a),startFrame:a.timecode?.start_frame??0,dropFrame:a.timecode?.drop_frame??!1,label:"R3D",spec:{codec:"r3d",subbands:Ae},geometrySpec:{codec:"r3d",subbands:De},index:null,warnings:n}}if(t==="mxf"){let r=Ne(e),s=JSON.parse(await de(r,e.size));if(!s)throw new Error(`${e.name}: MXF index unreadable`);let o=JSON.parse(await me(r,e.size)),i=[];for(let p=0;p<o.frame_count;p++)i.push({offset:o.frames[p*2],size:o.frames[p*2+1]});let c=i.filter(p=>p.size===0).length;c&&n.push(`${c} frame(s) had no locatable picture KLV`);let a=s.width??0,l=s.height??0,u=(s.inner_codec??"").toLowerCase(),d=null,f="MXF";return u==="arriraw"?(d={codec:"arriraw",w:a,h:l,scale:O},f="ARRIRAW"):u==="xocn"?(d={codec:"xocn",scale:O,...G?{display:"rec709"}:{}},f="X-OCN"):await le(r,e.size)?(d={codec:"vc3",scale:O},f="DNxHR"):await ce(r,e.size)?(d={codec:"prores"},f="ProRes"):n.push(`MXF inner codec ${u||"unknown"} not wired to the fingerprint pool`),{frames:d?i:[],w:a,h:l,fps:ye(s),startFrame:s.timecode?.start_frame??0,dropFrame:s.timecode?.drop_frame??!1,label:f,spec:d,geometrySpec:d&&d.codec==="arriraw"?{...d,scale:U}:d&&d.codec==="xocn"?{codec:"xocn",scale:U,...G?{display:"rec709"}:{}}:d&&d.codec==="vc3"?{codec:"vc3",scale:U}:null,index:null,warnings:n}}if(t==="isobmff"){let r=await he(e),s=ke(e.name);if(r.kind==="prores")return{frames:r.offs,w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:X(r.kind),spec:{codec:"prores"},geometrySpec:null,index:r,warnings:n};if(r.kind==="h264"||r.kind==="hevc")return{frames:r.offs,w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:X(r.kind),spec:null,geometrySpec:null,index:r,warnings:n};let o=s==="braw"?{codec:"braw",scale:O}:r.codec==="aprh"||r.codec==="aprn"?{codec:"proresraw",scale:O}:null;return o||n.push(`codec ${r.codec} not wired to the fingerprint pool`),{frames:o?r.offs:[],w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:o?s==="braw"?"BRAW":"ProRes RAW":`unsupported (${r.codec})`,spec:o,geometrySpec:o?{...o,scale:U}:null,index:r,warnings:n}}throw new Error(`${e.name}: unrecognised container`)}var Y=null;var Te=Number(D("CONFORM_DECODERS")??0)||Math.max(2,Math.min(Math.floor(re()/2),Math.floor(ee()/2**31))),Z=0,ve=[],Me=async(...e)=>{Z>=Te?await new Promise(t=>ve.push(t)):Z++;try{return await ie(...e)}finally{let t=ve.shift();t?t():Z--}};async function Re(){let e=te()==="win32"?"conformtools-decode.exe":"conformtools-decode",t=[D("CONFORM_NATIVE_DECODE"),ne(e),W(new URL(`./${e}`,import.meta.url)),W(new URL(`../../rust/target/release/${e}`,import.meta.url))].filter(Boolean);for(let n of t)if(await oe(n))return n;return null}var S=class extends Error{constructor(n,r){super(r);this.why=n}};function Pr(e){let t=null;try{t=JSON.parse(e.trim().split(`
|
|
4
4
|
`).pop())}catch{}if(t?.why==="not_entitled")throw new ae("not_entitled",t.detail??"this machine is not licensed");return t?.detail??e.trim()}function Fe(e,t){try{let n=JSON.parse(e.trim().split(`
|
|
5
5
|
`).pop()??"");return new S(n.why,n.detail)}catch{return new S("decoder",`the native decoder exited ${t}: ${e.trim().slice(-300)}`)}}function Er(e){return Y?.owns(e)?Y.meta(`probe|${e}`,()=>Se(e)):Se(e)}async function Se(e){let t=await Re();if(!t)throw new S("missing",j("the native decoder (conformtools-decode)"));let n=[],r=await Me(t,["probe",e],s=>n.push(s));if(r.code!==0)throw Fe(r.stderr,r.code);return JSON.parse(new TextDecoder().decode(Pe(n)))}function Pe(e){let t=e.reduce((s,o)=>s+o.length,0),n=new Uint8Array(t),r=0;for(let s of e)n.set(s,r),r+=s.length;return n}async function Ue(e,t,n,r,s){let o=await Re();if(!o)throw new S("missing",j("the native decoder (conformtools-decode)"));let i=null,c=[],a=0,l=f=>{let p=new Uint8Array(f),m=0;for(;m<f;){let h=c[0],g=Math.min(h.length,f-m);p.set(h.subarray(0,g),m),m+=g,g===h.length?c.shift():c[0]=h.subarray(g)}return a-=f,p},u=[e,t,"--width",String(s.width??32768)];s.from!=null&&u.push("--from",String(s.from)),s.count!=null&&u.push("--count",String(s.count)),s.range&&u.push("--range",s.range);let d=await Me(o,u,f=>{if(c.push(f),a+=f.length,!i){let m=Pe(c.splice(0));c.push(m);let h=m.indexOf(10);if(h<0)return;i=JSON.parse(new TextDecoder().decode(m.subarray(0,h))),l(h+1),n(i)}let p=4+i.w*i.h*(i.bpp??(e==="rgb16"?6:4));for(;a>=p;){let m=l(p);r(new DataView(m.buffer).getUint32(0,!0),m.subarray(4))}},{signal:s.signal});if(d.code!==0||!i)throw Fe(d.stderr,d.code)}function Ee(e,t,n,r={}){return Ue("bgra",e,t,n,r)}var Ie=["none","rle","zips","zip","piz","pxr24","b44","b44a","dwaa","dwab","htj2k"],I=e=>(e>>4)*10+(e&15);function He(e){let t=I(e&63),n=I(e>>>8&127),r=I(e>>>16&127),s=I(e>>>24&63),o=i=>String(i).padStart(2,"0");return`${o(s)}:${o(r)}:${o(n)}${e&64?";":":"}${o(t)}`}function Be(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.length<8||t.getUint32(0,!0)!==20000630)return null;let n={fps:null,timecode:null,width:0,height:0,display:null,compression:null,attributes:[]},r=8,s=()=>{let i=r;for(;r<e.length&&e[r]!==0;)r++;let c=new TextDecoder().decode(e.subarray(i,r));return r++,c},o=i=>({width:t.getInt32(i+8,!0)-t.getInt32(i,!0)+1,height:t.getInt32(i+12,!0)-t.getInt32(i+4,!0)+1});for(;r<e.length;){let i=s();if(!i)break;let c=s();if(r+4>e.length)return null;let a=t.getInt32(r,!0);if(r+=4,a<0||r+a>e.length)return null;if(n.attributes.push(`${i}:${c}`),i==="framesPerSecond"&&c==="rational"&&a>=8){let l=t.getInt32(r,!0),u=t.getUint32(r+4,!0);n.fps=u?l/u:null}else i==="timeCode"&&c==="timecode"&&a>=8?n.timecode=He(t.getUint32(r,!0)):i==="dataWindow"&&c==="box2i"&&a>=16?{width:n.width,height:n.height}=o(r):i==="displayWindow"&&c==="box2i"&&a>=16?n.display=o(r):i==="compression"&&a>=1&&(n.compression=Ie[e[r]]??`type ${e[r]}`);r+=a}return n}async function je(e){let t=e,n=null,r=/^(.*?)\[(\d+)-(\d+)\](.*)$/.exec(b(e));if(await R(e))n=/^(.*?)(\d+)(\.exr)$/i;else{t=x(e);let o=r?[null,r[1],r[2],r[4]]:/^(.*?)(\d+)(\.exr)$/i.exec(b(e));if(!o)return{frames:[e],numbers:[]};let i=c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=new RegExp(`^${i(o[1])}(\\d{${o[2].length}})${i(o[3])}$`,"i")}let s=[];for await(let o of v(t)){let i=o.isFile?n.exec(o.name):null;i&&s.push({n:Number(i[i.length===4?2:1]),f:y(t,o.name)})}return s.sort((o,i)=>o.n-i.n),{frames:s.map(o=>o.f),numbers:s.map(o=>o.n)}}async function Q(e){let t=await je(e),n=t.frames[0];if(!n)throw new Error(`no .exr frames for '${b(e)}'`);let r=await z(n),s;try{s=Be(await r.readAt(0,Math.min(r.size,1<<20)))}finally{await r.close()}if(!s)throw new Error(`'${b(n)}' is not an OpenEXR file`);let o=Math.max(1,t.frames.length),i=t.numbers.length>1?t.numbers[t.numbers.length-1]-t.numbers[0]+1-t.numbers.length:0,c=s.fps??0;return{id:b(n),kind:"external",target_url:n,local_path:n,content_kind:o>1?"video":"still",source_fps:s.fps??void 0,source_timecode:s.timecode??void 0,source_resolution_w:s.width,source_resolution_h:s.height,available_range:{start:{value:0,rate:c},duration:{value:o,rate:c}},streams:[{kind:"video",codec:"exr",width:s.width,height:s.height,rate:s.fps??void 0,codec_specific:{compression:s.compression}}],vendor_metadata:{exr:{frames:o,first_frame:t.numbers[0]??null,last_frame:t.numbers[t.numbers.length-1]??null,missing_frames:i,display_window:s.display,attributes:s.attributes,fps_source:s.fps!=null?"header framesPerSecond":"not in the header",timecode_source:s.timecode?"header timeCode (first frame)":"not in the header"}}}}var C=new Set([".mov",".mp4",".m4v",".mxf",".wav",".braw",".crm",".r3d",".aif",".aiff"]);async function We(e){let t=await z(e);return{path:e,file:t,size:t.size}}function Le(e){return(t,n)=>e.file.readAt(t,n)}async function Je(e){let t=F(b(e));if(!t)return[e];let n=x(e),r=[];for await(let s of v(n)){if(!s.isFile)continue;let o=F(s.name);o&&o.clipBase===t.clipBase&&r.push({n:o.partNumber,p:y(n,s.name)})}return r.sort((s,o)=>s.n-o.n).map(s=>s.p)}async function Ke(e){let t=[],n=[];for await(let r of v(e))!r.isFile||r.name.startsWith(".")||(F(r.name)?t.push(r.name):C.has(k(r.name).toLowerCase())&&n.push(r.name));if(t.length)return y(e,t.sort()[0]);if(n.length===1)return y(e,n[0]);throw n.length?(n.sort(),new Error(`'${b(e)}' is a folder of ${n.length} clips (${n.slice(0,3).join(", ")}${n.length>3?", \u2026":""}): probe one of them, or media_find to list them all`)):new Error(`'${b(e)}' is a folder with no media file in it (looked for ${[...C].join(" ")}, and RED parts)`)}async function q(e){await R(e)&&(e=await Ke(e));let t=we(b(e));if(!t)throw new Error(`unsupported media file '${b(e)}' (supported: ${[...C].join(" ")})`);let n=await Je(e),r=await Promise.all(n.map(We));return{source:_e(t,r.map(o=>ge(b(o.path),{fileSize:o.size,read:Le(o)}))),parts:r,format:t,anchor:n[0],close:()=>r.forEach(o=>o.file.close())}}async function Br(e,t,n,r){if(!/h264|avc|hevc|h265/.test(n)){let s=null,o=await q(e);try{return await N(o.source,{verb:"decode",index:t,intent:"park"})}catch(i){s=i}finally{o.close()}try{return await Oe(e,t,r)}catch(i){throw/no decoder/.test(String(s))?i:s instanceof Error?s:new Error(String(s))}}return Oe(e,t,r)}async function Oe(e,t,n){t=Math.round(t);let r=0,s=0,o=null;if(await Ee(e,c=>{r=c.w,s=c.h},(c,a)=>{c===t&&(o=a)},{from:t,count:1,width:n}),!o)throw new Error(`the OS decoder returned no frame ${t} of ${b(e)}`);let i=o;for(let c=0;c<i.length;c+=4){let a=i[c];i[c]=i[c+2],i[c+2]=a}return{rgba:i,width:r,height:s}}async function A(e){if(await R(e)){let n=[];for await(let r of v(e))r.isFile&&/\.exr$/i.test(r.name)&&!r.name.startsWith(".")&&n.push(r.name);if(n.length)return Q(y(e,n.sort()[0]))}if(/\.exr$/i.test(e))return Q(e);let t=await q(e);try{let n=await N(t.source,{verb:"inspect"});if(!n)throw new Error(`could not read '${b(e)}' as ${t.format}`);return n.target_url=t.anchor,n.local_path=t.anchor,n.id=n.id||b(t.anchor),t.parts.length>1&&((n.vendor_metadata??={}).spanned_parts=t.parts.map(r=>b(r.path))),n.size_bytes=t.parts.reduce((r,s)=>r+s.size,0),n}finally{t.close()}}function Ve(e,t,n,r){let s=Math.abs(r*1001-Math.round(r*1001/1e3)*1e3)<1?Math.round(r)*1e3/1001:r,o=Math.floor(e*s/t+1e-6);return{tc:P(o,r),frames:Math.round(n*s/t)}}var Xe=e=>String(Math.round(e*1e3)/1e3);function jr(e,t){let n=e.streams?.find(m=>m.kind==="video"),r=e.streams?.filter(m=>m.kind==="audio")??[],s=e.vendor_metadata?.bext;if(!n&&e.available_range&&r[0]?.rate){let m=r[0].rate,h=e.available_range.duration.value,_=(t?[t]:[24e3/1001,24]).map(w=>{let $=Ve(s?.time_reference??0,s?.sample_rate||m,h,w);return`${s?`start TC ${$.tc}, `:""}${$.frames} frames @ ${Xe(w)} fps`});return[e.target_url??"",`audio only; ${h} samples (${(h/m).toFixed(3)} s)${s?`; BWF time_reference ${s.time_reference}`:"; no BWF timecode"}`,..._,...t?[]:["(pass fps for the project's rate)"],...r.map((w,$)=>`audio ${r.length>1?`${$+1}: `:""}${w.codec??"pcm"} ${w.channels??"?"}ch ${w.rate} Hz ${w.bit_depth??"?"}-bit`)].join(`
|
|
6
6
|
`)}let o=e.available_range?.duration?.value??e.declared_duration?.value??null,i=e.source_fps??n?.rate??null,c=e.size_bytes,a=e.vendor_metadata?.spanned_parts,l=n?.codec_specific??{},u=[l.profile?`${l.profile} (${l.fourcc})`:l.fourcc,l.pixel_format,n?.bit_depth?`${n.bit_depth}-bit`:null,l.colr?`color ${l.colr.primaries}/${l.colr.transfer}/${l.colr.matrix} (primaries/transfer/matrix)`:null].filter(Boolean).join(", "),d=e.source_pixel_aspect&&Math.abs(e.source_pixel_aspect-1)>.001?e.source_pixel_aspect:null,f=d&&n?.width&&n?.height?`pixel aspect ${Math.round(d*1e3)/1e3}: stored ${n.width}x${n.height}, shown ${(n.width*d/n.height).toFixed(2)}:1 (squeezed; a trim keeps it, a square-pixel copy is a new render)`:null,p=e.raw_extraction?.mov_probe?.every_sample_is_keyframe===!1&&n?"long-GOP (not every frame is a keyframe): media_trim starts on the keyframe at or before the frame asked for":null;return[e.target_url??"",n?`${n.codec??"?"} ${n.width??"?"}x${n.height??"?"}${i?` @ ${Math.round(i*1e3)/1e3} fps`:""}${u?`; ${u}`:""}`:"no video track",...[f,p].filter(m=>!!m),`start TC ${e.source_timecode??"none"}; ${o!=null?`${o} frames`:"length unknown"}${o!=null&&i?` (${(o/i).toFixed(2)} s)`:""}`,r.length?r.map((m,h)=>{let g=m.codec_specific?.channel_layout;return`audio ${r.length>1?`${h+1}: `:""}${m.codec??"pcm"} ${m.channels??"?"}ch${g?` (${g})`:""} ${m.rate??"?"} Hz ${m.bit_depth??"?"}-bit`}).join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{Gb as L,Hb as A,Ib as E,Jb as P,Kb as T,Lb as M,Mb as N,Nb as D,Ob as z,Pb as B,Qb as I,tb as S}from"./chunk-
|
|
3
|
+
import{Gb as L,Hb as A,Ib as E,Jb as P,Kb as T,Lb as M,Mb as N,Nb as D,Ob as z,Pb as B,Qb as I,tb as S}from"./chunk-AY72AUHE.js";import{a as b}from"./chunk-COALWMI7.js";import{aa as p,u as R}from"./chunk-MU5AGXSH.js";async function W(r,t){let c=t.media_root?[t.media_root]:await z();if(!c.length)throw new b("invalid_args","no media_root given and no remembered locations \u2014 pass the folder to link from");for(let e of c)try{if(!(await R(e)).isDirectory)throw 0}catch{throw new b("invalid_args",`media_root is not a folder on this machine: ${e}`)}let i=A(r,{ref_ids:t.ref_ids,lane:t.lane,reset:t.reset});if(!i.length)return{session:r,changed:!1,note:"",text:"nothing in scope: every reference in scope is already linked (use reset=true to re-point) or the ids/lane matched nothing"};if(t.reset)for(let e of i)e.binding_state="unbound",delete e.coverage_reason;let m=[],k=!1,u=[];for(let e of c)if(t.gather==="path")for(let n of i){let l=n.local_path??n.target_url??"",o=l?await P(e,l):null;o?m.push(o):u.push(`${n.id} ${p(l)}: not at its recorded path under ${e}`)}else{let n=await E(e,i,t.cap,{byName:t.criteria?.file_name!==!1,exts:t.criteria?.extensions});m.push(...n.paths),k||=n.capped}let{refs:$,failed:_}=await T([...new Set(m)]);t.remember&&t.media_root&&await B(t.media_root);let y=new Set(i.map(e=>e.id)),f=S(r,$,y);if(f.splits.length){r=f.session;let e=new Set([...y,...f.splits.flatMap(n=>n.into)]);i=(r.media_references??[]).filter(n=>e.has(n.id));for(let n of f.splits){let l=o=>p(i.find(G=>G.id===o)?.target_url??o);u.push(`split ${n.ref_id} across ${n.into.length} section file(s): ${n.into.map(l).join(", ")}`)}}let d=L(t.criteria),a=M(r,i,$,d,t.tolerances),O=t.criteria?.picture?await N(r,a):[],s=e=>a.rows.filter(n=>n.status===e).length,U=c.map(e=>e.split(/[\\/]/).filter(Boolean).pop()??e).join(", "),v=[`${t.dry_run?"would link":"found"} ${s("matched")} of ${i.length} clip${i.length===1?"":"s"} in ${U}${s("ambiguous")?`, ${s("ambiguous")} with more than one match`:""}${i.length-s("matched")-s("ambiguous")?`, ${i.length-s("matched")-s("ambiguous")} not found there`:""}${t.dry_run?" (dry run: nothing changed)":""}`,`scope: ${i.length} reference(s)${t.lane!=="both"?` (${t.lane} lane)`:""}${t.ref_ids?` (zone of ${t.ref_ids.length})`:""}; gather=${t.gather} under ${c.join(", ")}: ${$.length} candidate clip(s)${k?` (CAPPED at ${t.cap} \u2014 narrow the folder)`:""}`,`criteria: ${[...Object.entries(d).filter(([,e])=>e===!0).map(([e])=>e),...t.criteria?.picture?["picture"]:[]].join(", ")}${d.fileName?` (${d.fileNameMode})`:""}${d.fileExtensions?`; ext ${d.fileExtensions}`:""}; timecode containment + fps always on`,..._.length?[`could not probe ${_.length}: ${_.slice(0,5).join("; ")}`]:[],...u.slice(0,20),...O.slice(0,40)];if(t.dry_run)return{session:r,changed:!1,note:"",text:[...v,I(r,a,{compare:t.compare}),"(dry run \u2014 nothing changed; pass accept=[{ref_id,candidate_id}] to commit chosen rows, or run again without dry_run to apply every matched row)"].join(`
|
|
4
4
|
`)};let h,g=[];if(t.accept?.length){h=[];for(let e of t.accept){let n=a.rows.find(o=>o.ref_id===e.ref_id);n&&(n.candidate?.id===e.candidate_id||n.alternatives.some(o=>o.id===e.candidate_id))?h.push(e):g.push(`${e.ref_id} \u2192 ${e.candidate_id}: not a proposed match or alternative for that reference`)}}else h=a.rows.filter(e=>e.status==="matched"&&e.candidate).map(e=>({ref_id:e.ref_id,candidate_id:e.candidate.id}));let w=D(r,a,h),x=w.session.media_references??[],j=x.filter(e=>i.some(n=>n.id===e.id)&&e.binding_state==="linked").length,q=w.applied,C=x.filter(e=>i.some(n=>n.id===e.id)&&e.binding_state!=="linked").map(e=>` - ${e.id} ${p(e.target_url??"")}: ${e.coverage_reason??(a.rows.find(n=>n.ref_id===e.id)?.status==="ambiguous"?"ambiguous \u2014 pick one with accept":"no file matched")}`),F=[...v,`Linked ${j} of ${i.length}${g.length?`; ${g.length} pick(s) vetoed`:""}`,...q.map(e=>`- ${e.ref_id}: ${p(e.before.path??"?")} \u2192 ${e.after.path}${e.warning?` \u26A0 ${e.warning}`:""}`),...g.map(e=>` \u2717 ${e}`),...C.length?["unresolved:",...C]:[]].join(`
|
|
5
5
|
`);return{session:w.session,changed:!0,note:`relink ${t.gather} ${c[0]} (${j}/${i.length})`,text:F}}export{W as a};
|