File tree Expand file tree Collapse file tree 5 files changed +29
-15
lines changed
Expand file tree Collapse file tree 5 files changed +29
-15
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import ShaderPass from 'graphics/ShaderPass';
33import BlendShader from 'shaders/BlendShader' ;
44import CopyShader from 'shaders/CopyShader' ;
55import blendModes from 'graphics/blendModes' ;
6+ import { base64ToBytes } from 'utils/data' ;
67import { createRenderTarget } from './common' ;
78
89export default class Composer {
@@ -30,7 +31,7 @@ export default class Composer {
3031 getImage ( format = 'image/png' ) {
3132 const img = this . renderer . domElement . toDataURL ( format ) ;
3233 const data = img . replace ( / ^ d a t a : i m a g e \/ \w + ; b a s e 6 4 , / , '' ) ;
33- return Buffer . from ( data , 'base64' ) ;
34+ return base64ToBytes ( data ) ;
3435 }
3536
3637 setSize ( width , height ) {
Original file line number Diff line number Diff line change 11import fs from 'fs' ;
22import path from 'path' ;
33import yauzl from 'yauzl' ;
4- import { streamToBuffer } from 'utils/data' ;
54
65const plugins = { } ;
76
@@ -15,6 +14,16 @@ function getPluginId(file) {
1514 return path . parse ( file ) . base ;
1615}
1716
17+ function streamToBuffer ( stream ) {
18+ const chunks = [ ] ;
19+
20+ return new Promise ( ( resolve , reject ) => {
21+ stream . on ( 'data' , chunk => chunks . push ( chunk ) ) ;
22+ stream . on ( 'error' , reject ) ;
23+ stream . on ( 'end' , ( ) => resolve ( Buffer . concat ( chunks ) ) ) ;
24+ } ) ;
25+ }
26+
1827function loadModule ( id , data ) {
1928 initPlugin ( id ) ;
2029
Original file line number Diff line number Diff line change @@ -36,12 +36,12 @@ export async function dataToBlob(data, ext) {
3636 return new Blob ( [ new Uint8Array ( data ) . buffer ] , { type : mime . getType ( ext ) } ) ;
3737}
3838
39- export function streamToBuffer ( stream ) {
40- const chunks = [ ] ;
41-
42- return new Promise ( ( resolve , reject ) => {
43- stream . on ( 'data' , chunk => chunks . push ( chunk ) ) ;
44- stream . on ( 'error' , reject ) ;
45- stream . on ( 'end' , ( ) => resolve ( Buffer . concat ( chunks ) ) ) ;
46- } ) ;
39+ export function base64ToBytes ( base64 ) {
40+ const str = atob ( base64 ) ;
41+ const len = str . length ;
42+ const bytes = new Uint8Array ( len ) ;
43+ for ( let i = 0 ; i < len ; i ++ ) {
44+ bytes [ i ] = str . charCodeAt ( i ) ;
45+ }
46+ return bytes ;
4747}
Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ export default class RenderProcess extends Process {
5656 'yuv420p' ,
5757 '-f' ,
5858 format ,
59+ '-analyzeduration' ,
60+ 2147483647 ,
61+ '-probesize' ,
62+ 2147483647 ,
5963 ] ;
6064
6165 // Encoding options
Original file line number Diff line number Diff line change @@ -23,18 +23,18 @@ export default function Setting({
2323 < div className = { styles . label } style = { { width : labelWidth } } >
2424 { label }
2525 </ div >
26- { InputCompnent && (
27- < div style = { { width : inputWidth } } >
26+ < div style = { { width : inputWidth } } >
27+ { InputCompnent && (
2828 < InputCompnent
2929 { ...inputProps }
3030 { ...otherProps }
3131 name = { name }
3232 value = { value }
3333 onChange = { onChange }
3434 />
35- { children }
36- </ div >
37- ) }
35+ ) }
36+ { children }
37+ </ div >
3838 </ div >
3939 ) ;
4040}
You can’t perform that action at this time.
0 commit comments