Skip to content

Commit 70b72cc

Browse files
Closure Teamcopybara-github
authored andcommitted
Add more types to w3c_webcodecs.
PiperOrigin-RevId: 554030024
1 parent 2f48e59 commit 70b72cc

File tree

1 file changed

+214
-0
lines changed

1 file changed

+214
-0
lines changed

externs/browser/w3c_webcodecs.js

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,217 @@ VideoFrame.prototype.copyTo = function(destination, options) {};
227227
VideoFrame.prototype.clone = function() {};
228228

229229
VideoFrame.prototype.close = function() {};
230+
231+
232+
/**
233+
* @record
234+
* @struct
235+
* @see https://www.w3.org/TR/webcodecs-avc-codec-registration/#avc-encoder-config
236+
*/
237+
function AvcEncoderConfig() {}
238+
239+
/** @type {(undefined|string)} */
240+
AvcEncoderConfig.prototype.format;
241+
242+
/**
243+
* @record
244+
* @struct
245+
* @see https://www.w3.org/TR/webcodecs/#dictdef-encodedvideochunkinit
246+
*/
247+
function EncodedVideoChunkInit() {}
248+
249+
/** @type {(!ArrayBuffer|!ArrayBufferView)} */
250+
EncodedVideoChunkInit.prototype.data;
251+
252+
/** @type {(undefined|number)} */
253+
EncodedVideoChunkInit.prototype.duration;
254+
255+
/** @type {number} */
256+
EncodedVideoChunkInit.prototype.timestamp;
257+
258+
/** @type {string} */
259+
EncodedVideoChunkInit.prototype.type;
260+
261+
262+
/**
263+
* @record
264+
* @struct
265+
* @see https://www.w3.org/TR/webcodecs/#callbackdef-encodedvideochunkoutputcallback
266+
*/
267+
function EncodedVideoChunkOutputCallback() {}
268+
269+
270+
/**
271+
* @record
272+
* @struct
273+
* @see https://www.w3.org/TR/webcodecs/#encoded-video-chunk-metadata
274+
*/
275+
function EncodedVideoChunkMetadata() {}
276+
277+
/** @type {(undefined|!VideoDecoderConfig)} */
278+
EncodedVideoChunkMetadata.prototype.decoderConfig;
279+
280+
/** @type {(undefined|number)} */
281+
EncodedVideoChunkMetadata.prototype.temporalLayerId;
282+
283+
284+
/**
285+
* @record
286+
* @struct
287+
* @see https://www.w3.org/TR/webcodecs/#dictdef-videodecoderconfig
288+
*/
289+
function VideoDecoderConfig() {}
290+
/** @type {string} */
291+
VideoDecoderConfig.prototype.codec;
292+
293+
/** @type {(undefined|number)} */
294+
VideoDecoderConfig.prototype.codedHeight;
295+
296+
/** @type {(undefined|number)} */
297+
VideoDecoderConfig.prototype.codedWidth;
298+
299+
/** @type {(undefined|!VideoColorSpaceInit)} */
300+
VideoDecoderConfig.prototype.colorSpace;
301+
302+
/** @type {(undefined|!ArrayBuffer|!ArrayBufferView)} */
303+
VideoDecoderConfig.prototype.description;
304+
305+
/** @type {(undefined|number)} */
306+
VideoDecoderConfig.prototype.displayAspectHeight;
307+
308+
/** @type {(undefined|number)} */
309+
VideoDecoderConfig.prototype.displayAspectWidth;
310+
311+
/** @type {(undefined|string)} */
312+
VideoDecoderConfig.prototype.hardwareAcceleration;
313+
314+
/** @type {(undefined|boolean)} */
315+
VideoDecoderConfig.prototype.optimizeForLatency;
316+
317+
318+
/**
319+
* @record
320+
* @struct
321+
* @see https://www.w3.org/TR/webcodecs/#dictdef-videodecoderinit
322+
*/
323+
function VideoDecoderInit() {}
324+
325+
/** @type {!WebCodecsErrorCallback} */
326+
VideoDecoderInit.prototype.error;
327+
328+
/** @type {!VideoFrameOutputCallback} */
329+
VideoDecoderInit.prototype.output;
330+
331+
332+
/**
333+
* @record
334+
* @struct
335+
* @see https://www.w3.org/TR/webcodecs/#dictdef-videodecodersupport
336+
*/
337+
function VideoDecoderSupport() {}
338+
339+
/** @type {!VideoDecoderConfig} */
340+
VideoDecoderSupport.prototype.config;
341+
342+
/** @type {boolean} */
343+
VideoDecoderSupport.prototype.supported;
344+
345+
346+
/**
347+
* @record
348+
* @struct
349+
* @see https://www.w3.org/TR/webcodecs/#dictdef-videoencoderconfig
350+
*/
351+
function VideoEncoderConfig() {}
352+
353+
/** @type {(undefined|string)} */
354+
VideoEncoderConfig.prototype.alpha;
355+
356+
/** @type {(undefined|!AvcEncoderConfig)} */
357+
VideoEncoderConfig.prototype.avc;
358+
359+
/** @type {(undefined|number)} */
360+
VideoEncoderConfig.prototype.bitrate;
361+
362+
/** @type {(undefined|string)} */
363+
VideoEncoderConfig.prototype.bitrateMode;
364+
365+
/** @type {string} */
366+
VideoEncoderConfig.prototype.codec;
367+
368+
/** @type {(undefined|number)} */
369+
VideoEncoderConfig.prototype.displayHeight;
370+
371+
/** @type {(undefined|number)} */
372+
VideoEncoderConfig.prototype.displayWidth;
373+
374+
/** @type {(undefined|number)} */
375+
VideoEncoderConfig.prototype.framerate;
376+
377+
/** @type {(undefined|string)} */
378+
VideoEncoderConfig.prototype.hardwareAcceleration;
379+
380+
/** @type {number} */
381+
VideoEncoderConfig.prototype.height;
382+
383+
/** @type {(undefined|string)} */
384+
VideoEncoderConfig.prototype.latencyMode;
385+
386+
/** @type {(undefined|string)} */
387+
VideoEncoderConfig.prototype.scalabilityMode;
388+
389+
/** @type {number} */
390+
VideoEncoderConfig.prototype.width;
391+
392+
393+
/**
394+
* @record
395+
* @struct
396+
* @see https://www.w3.org/TR/webcodecs/#video-encoder-options
397+
*/
398+
function VideoEncoderEncodeOptions() {}
399+
400+
/** @type {(undefined|null|boolean)} */
401+
VideoEncoderEncodeOptions.prototype.keyFrame;
402+
403+
404+
/**
405+
* @record
406+
* @struct
407+
* @see https://www.w3.org/TR/webcodecs/#dictdef-videoencoderinit
408+
*/
409+
function VideoEncoderInit() {}
410+
411+
/** @type {!WebCodecsErrorCallback} */
412+
VideoEncoderInit.prototype.error;
413+
414+
/** @type {!EncodedVideoChunkOutputCallback} */
415+
VideoEncoderInit.prototype.output;
416+
417+
418+
/**
419+
* @record
420+
* @struct
421+
* @see https://www.w3.org/TR/webcodecs/#video-encoder-support
422+
*/
423+
function VideoEncoderSupport() {}
424+
425+
/** @type {!VideoEncoderConfig} */
426+
VideoEncoderSupport.prototype.config;
427+
428+
/** @type {boolean} */
429+
VideoEncoderSupport.prototype.supported;
430+
431+
/**
432+
* @record
433+
* @struct
434+
* @see https://www.w3.org/TR/webcodecs/#callbackdef-videoframeoutputcallback
435+
*/
436+
function VideoFrameOutputCallback() {}
437+
438+
/**
439+
* @record
440+
* @struct
441+
* @see https://www.w3.org/TR/webcodecs/#callbackdef-webcodecserrorcallback
442+
*/
443+
function WebCodecsErrorCallback() {}

0 commit comments

Comments
 (0)