PageSourceSearch

https://clipcat.ai/_next/static/chunks/24824.b49b84ec562cbcda.js

js clipcat.ai collected 2026-10-05 11:58:47 UTC 5,516 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[24824],{24824:(e,t,s)=>{s.d(t,{createFrameProvider:()=>n});var i=s(92840);class r{constructor(e,t,s){this.decoder=null,this.outputs=[],this.feedIndex=0,this.started=!1,this.dead=!1,this.flushedEnd=!1,this.pendingResolve=null,this.samples=e,this.config=t,this.syncIndices=s}static async create(e){if("u"<typeof VideoDecoder)return console.warn("[export-perf] 回退原因:浏览器无 VideoDecoder"),null;try{let t=await s.e(9598).then(s.bind(s,91205)),i=t.createFile(),d=null,n=!1,a=null,o=[];i.onError=(e,t)=>{a=t},i.onReady=e=>{d=e;let t=e.videoTracks[0];if(!t){a="无视频轨";return}if(t.nb_samples>36e3){n=!0;return}i.setExtractionOptions(t.id,void 0,{nbSamples:t.nb_samples}),i.start()},i.onSamples=(e,t,s)=>{for(let e of s)e.data&&o.push({tsUs:Math.round(e.cts/e.timescale*1e6),durUs:Math.round(e.duration/e.timescale*1e6),isSync:e.is_sync,data:e.data})};let l=t.MP4BoxBuffer.fromArrayBuffer(e.slice(0),0);if(i.appendBuffer(l),i.flush(),a||n||!d||0===o.length)return console.warn(`[export-perf] 回退原因:解封装失败 err=${a} tooMany=${n} hasMovie=${!!d} samples=${o.length}`),null;let h=o.reduce((e,t)=>Math.min(e,t.tsUs),1/0),u=o.map(e=>({...e,tsUs:e.tsUs-h})),c=u.map((e,t)=>e.isSync?t:-1).filter(e=>e>=0);if(0===c.length)return null;let f=d.videoTracks[0],p=i.getTrackById(f.id).mdia.minf.stbl.stsd.entries[0],m=((e,t)=>{let s=e.avcC??e.hvcC;if(!s)return;let i=t();return s.write(i),new Uint8Array(i.buffer,8)})(p,()=>new t.DataStream),g={codec:f.codec,codedWidth:f.video?.width??f.track_width,codedHeight:f.video?.height??f.track_height,...m?{description:m}:{}};if(!(await VideoDecoder.isConfigSupported(g)).supported)return console.warn(`[export-perf] 回退原因:编码不被支持 codec=${g.codec} desc=${!!m}`),null;return new r(u,g,c)}
1catch(e){return console.warn("[export-perf] 回退原因:解码器初始化异常",e),null}}ensureDecoder(){return this.decoder||(this.decoder=new VideoDecoder({output:e=>{if(this.outputs.push(e),this.pendingResolve){let e=this.pendingResolve;this.pendingResolve=null,e()}},error:e=>{if(console.warn("[export-perf] 运行时回退:解码器报错",e),this.dead=!0,this.pendingResolve){let e=this.pendingResolve;this.pendingResolve=null,e()}}})),this.decoder}seekToKeyframe(e){let t=this.ensureDecoder();for(let e of("unconfigured"!==t.state&&t.reset(),t.configure(this.config),this.outputs))e.close();this.outputs=[];let s=this.syncIndices[0];for(let t of this.syncIndices)if(this.samples[t].tsUs<=e)s=t;else break;this.feedIndex=s,this.started=!0,this.flushedEnd=!1}fillQueue(){let e=this.ensureDecoder();for(;this.feedIndex<this.samples.length&&e.decodeQueueSize<16;){let t=this.samples[this.feedIndex];e.decode(new EncodedVideoChunk({type:t.isSync?"key":"delta",timestamp:t.tsUs,duration:t.durUs,data:t.data})),this.feedIndex++}}bestLEQ(e){let t=null;for(let s of this.outputs)if(s.timestamp<=e)t=s;else break;return t}pruneOlderThan(e){let t=[];for(let s of this.outputs)s.timestamp<e.timestamp?s.close():t.push(s);this.outputs=t}async frameAt(e){if(this.dead)return null;let t=Math.max(0,Math.round(1e6*e));try{(!this.started||this.outputs.length>0&&t<this.outputs[0].timestamp)&&this.seekToKeyframe(t);let e=this.ensureDecoder();for(;!this.dead;){let s=this.bestLEQ(t),r=this.outputs.some(e=>e.timestamp>t);if(s&&r||(s&&this.pruneOlderThan(s),this.fillQueue(),this.bestLEQ(t)&&this.outputs.some(e=>e.timestamp>t)))break;if(this.feedIndex>=this.samples.length){if(!this.flushedEnd&&"configured"===e.state){await (0,i.wj)(e.flush(),5e3,"解码器收尾 flush"),this.flushedEnd=!0;continue}break}await new Promise(e=>{let t=setTimeout(()=>{this.pendingResolve=null,e(!1)},5e3);this.pendingResolve=()=>{clearTimeout(t),e(!0)}}
1)||(console.warn("[export-perf] 运行时回退:等待解码输出超时(疑似硬件解码器卡死)"),this.dead=!0)}if(this.dead)return null;let s=this.bestLEQ(t);if(!s)return this.dead=!0,null;return this.pruneOlderThan(s),{image:s,width:s.displayWidth,height:s.displayHeight}}catch{return this.dead=!0,null}}dispose(){for(let e of this.outputs)e.close();if(this.outputs=[],this.decoder&&"closed"!==this.decoder.state)try{this.decoder.close()}catch{}this.decoder=null}}class d{constructor(e){this.landed=-1,this.frameStep=0,this.video=e}seek(e){let t=this.video;return new Promise(s=>{let i=Math.max(0,Math.min(e,(t.duration||e)-.001));if(.001>Math.abs(t.currentTime-i))return void s();let r=!1,d=()=>{r||(r=!0,t.removeEventListener("seeked",d),s())};t.addEventListener("seeked",d),t.currentTime=i,setTimeout(d,200)})}async frameAt(e){let t=this.video;if(!(this.landed>=0&&this.frameStep>0&&e>=this.landed&&e<this.landed+this.frameStep)){await this.seek(e);let s=t.currentTime,i=this.landed>=0?s-this.landed:0;i>0&&i<=.1&&(this.frameStep=this.frameStep>0?Math.min(this.frameStep,i):i),this.landed=s}return{image:t,width:t.videoWidth,height:t.videoHeight}}}let n=async e=>{let t=new Map;await Promise.all(Array.from(e.entries()).map(async([e,s])=>{let i=await r.create(s.buffer);t.set(e,{decoder:i,seeker:new d(s.video)})}));let s=Array.from(t.values()).filter(e=>e.decoder).length;return console.warn(`[export-perf] 解码快路径生效素材 ${s}/${t.size}(其余走 seek 回退)`),{async getFrame(e,s){let i=t.get(e);if(!i)return null;if(i.decoder){let e=await i.decoder.frameAt(s);if(e)return e;i.decoder.dispose(),i.decoder=null}return i.seeker.frameAt(s)},dispose(){for(let e of t.values())e.decoder?.dispose();t.clear()}}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.