Browse Source

* Video decoder

Michael Van Canneyt 3 months ago
parent
commit
c78cdfcf40
1 changed files with 39 additions and 1 deletions
  1. 39 1
      packages/rtl/src/weborworker.pas

+ 39 - 1
packages/rtl/src/weborworker.pas

@@ -2007,7 +2007,7 @@ type
     FencodeQueueSize: NativeInt; external name 'encodeQueueSize';
     FState: string; external name 'state';
   Public
-    class function isConfigSupported(aOptions : TJSNewVideoEncoderOptions) : boolean;
+    class function isConfigSupported(aOptions : TJSVideoEncoderConfiguration) : boolean;
     constructor new(aOptions : TJSNewVideoEncoderOptions);
     procedure close;
     procedure configure(aConfig :TJSVideoEncoderConfiguration);
@@ -2016,9 +2016,47 @@ type
     procedure reset;
     property encodeQueueSize : NativeInt Read FencodeQueueSize;
     property State : string read FState;
+  end;
+
+  TJSVideoDecoderOutputCallBack = reference to procedure (aData : TJSVideoFrame);
+  TJSVideoDecoderErrorCallBack = reference to procedure (aError: TJSError);
 
+  TJSNewVideoDecoderOptions = class external name 'Object' (TJSObject)
+    output : TJSVideoDecoderOutputCallback;
+    error : TJSVideoDecoderErrorCallback;
   end;
 
+  TJSVideoDecoderConfiguration = class external name 'Object' (TJSObject)
+    codec : string;
+    codedWidth : NativeInt;
+    codedHeight: NativeInt;
+    displayAspectWidth : NativeInt;
+    displayAspectHeight : NativeInt;
+    colorSpace : TJSVideoColorSpace;
+    hardwareAcceleration : string;
+    optimizeForLatency : Boolean;
+  end;
+
+  { TJSVideoDecoder }
+
+  TJSVideoDecoder = class external name 'VideoDecoder' (TJSEventTarget)
+  private
+    FdecodeQueueSize: NativeInt; external name 'decodeQueueSize';
+    FState: string; external name 'state';
+  public
+    constructor new(aOptions : TJSNewVideoDecoderOptions);
+    class function isConfigSupported(aOptions : TJSVideoDecoderConfiguration) : boolean;
+    procedure close;
+    procedure configure(aConfig :TJSVideoEncoderConfiguration);
+    procedure decode(Frame : TJSEncodedVideoChunk);
+    procedure flush;
+    procedure reset;
+    procedure configure(aConfig :TJSVideoDecoderConfiguration);
+    property decodeQueueSize : NativeInt Read FdecodeQueueSize;
+    property State : string read FState;
+  end;
+
+
   TJSScriptContext = (jscUnknown,jscMainBrowserThread,jscWebWorker,jscServiceWorker);