@yume-chan/scrcpy-decoder-webcodecs 0.0.0-20240714132542 → 0.0.0-next-20240917062356
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/CHANGELOG.md +14 -8
- package/LICENSE +21 -21
- package/README.md +49 -49
- package/esm/video/codec/h265.d.ts.map +1 -1
- package/esm/video/codec/h265.js +2 -0
- package/esm/video/codec/h265.js.map +1 -1
- package/esm/video/decoder.d.ts +8 -10
- package/esm/video/decoder.d.ts.map +1 -1
- package/esm/video/decoder.js +162 -68
- package/esm/video/decoder.js.map +1 -1
- package/esm/video/render/bitmap.d.ts +4 -4
- package/esm/video/render/bitmap.d.ts.map +1 -1
- package/esm/video/render/bitmap.js +9 -11
- package/esm/video/render/bitmap.js.map +1 -1
- package/esm/video/render/canvas.d.ts +9 -0
- package/esm/video/render/canvas.d.ts.map +1 -0
- package/esm/video/render/canvas.js +22 -0
- package/esm/video/render/canvas.js.map +1 -0
- package/esm/video/render/index.d.ts +2 -0
- package/esm/video/render/index.d.ts.map +1 -1
- package/esm/video/render/index.js +3 -0
- package/esm/video/render/index.js.map +1 -1
- package/esm/video/render/insertable-stream.d.ts +10 -0
- package/esm/video/render/insertable-stream.d.ts.map +1 -0
- package/esm/video/render/insertable-stream.js +45 -0
- package/esm/video/render/insertable-stream.js.map +1 -0
- package/esm/video/render/type.d.ts +3 -2
- package/esm/video/render/type.d.ts.map +1 -1
- package/esm/video/render/webgl.d.ts +5 -4
- package/esm/video/render/webgl.d.ts.map +1 -1
- package/esm/video/render/webgl.js +26 -15
- package/esm/video/render/webgl.js.map +1 -1
- package/package.json +9 -14
- package/src/video/codec/h265.ts +2 -0
- package/src/video/decoder.ts +185 -79
- package/src/video/render/bitmap.ts +11 -17
- package/src/video/render/canvas.ts +29 -0
- package/src/video/render/index.ts +4 -0
- package/src/video/render/insertable-stream.ts +62 -0
- package/src/video/render/type.ts +4 -2
- package/src/video/render/webgl.ts +47 -21
- package/tsconfig.build.json +24 -21
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
# Change Log - @yume-chan/scrcpy-decoder-webcodecs
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-next-20240917062356
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 53688d3: Use PNPM workspace and Changesets to manage the monorepo.
|
|
8
|
+
|
|
9
|
+
Because Changesets doesn't support alpha versions (`0.x.x`), this version is `1.0.0`. Future versions will follow SemVer rules, for example, breaking API changes will introduce a new major version.
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
6
12
|
|
|
7
|
-
-
|
|
8
|
-
- Updated dependencies
|
|
9
|
-
- @yume-chan/scrcpy-decoder-tinyh264@0.0.0-
|
|
10
|
-
- @yume-chan/no-data-view@0.0.0-
|
|
11
|
-
- @yume-chan/stream-extra@0.0.0-
|
|
12
|
-
- @yume-chan/scrcpy@0.0.0-
|
|
13
|
-
- @yume-chan/event@0.0.0-
|
|
13
|
+
- 8e4c1ef: Add a renderer based on Insertable Stream API
|
|
14
|
+
- Updated dependencies [53688d3]
|
|
15
|
+
- @yume-chan/scrcpy-decoder-tinyh264@0.0.0-next-20240917062356
|
|
16
|
+
- @yume-chan/no-data-view@0.0.0-next-20240917062356
|
|
17
|
+
- @yume-chan/stream-extra@0.0.0-next-20240917062356
|
|
18
|
+
- @yume-chan/scrcpy@0.0.0-next-20240917062356
|
|
19
|
+
- @yume-chan/event@0.0.0-next-20240917062356
|
|
14
20
|
|
|
15
21
|
This log was last generated on Tue, 18 Jun 2024 02:49:43 GMT and should not be manually modified.
|
|
16
22
|
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020-2024 Simon Chan
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-2024 Simon Chan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img alt="Tango" src="https://raw.githubusercontent.com/yume-chan/ya-webadb/main/.github/logo.svg" width="200">
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<h1 align="center">@yume-chan/scrcpy-decoder-webcodecs</h1>
|
|
6
|
-
|
|
7
|
-
<p align="center">
|
|
8
|
-
Raw H.264 stream decoder and renderer using WebCodecs API (requires modern browser).
|
|
9
|
-
</p>
|
|
10
|
-
|
|
11
|
-
<p align="center">
|
|
12
|
-
<a href="https://github.com/yume-chan/ya-webadb/blob/main/LICENSE">
|
|
13
|
-
<img alt="MIT License" src="https://img.shields.io/github/license/yume-chan/ya-webadb">
|
|
14
|
-
</a>
|
|
15
|
-
<a href="https://github.com/yume-chan/ya-webadb/releases">
|
|
16
|
-
<img alt="GitHub release" src="https://img.shields.io/github/v/release/yume-chan/ya-webadb?logo=github">
|
|
17
|
-
</a>
|
|
18
|
-
<a href="https://bundlephobia.com/package/@yume-chan/scrcpy-decoder-webcodecs">
|
|
19
|
-
<img alt="Package Size" src="https://img.shields.io/bundlephobia/minzip/%40yume-chan%2Fscrcpy-decoder-webcodecs">
|
|
20
|
-
</a>
|
|
21
|
-
<a href="https://www.npmjs.com/package/@yume-chan/scrcpy-decoder-webcodecs">
|
|
22
|
-
<img alt="npm" src="https://img.shields.io/npm/dm/%40yume-chan/scrcpy-decoder-webcodecs?logo=npm">
|
|
23
|
-
</a>
|
|
24
|
-
<a href="https://discord.gg/26k3ttC2PN">
|
|
25
|
-
<img alt="Discord" src="https://img.shields.io/discord/1120215514732564502?logo=discord&logoColor=%23ffffff&label=Discord">
|
|
26
|
-
</a>
|
|
27
|
-
</p>
|
|
28
|
-
|
|
29
|
-
This package is part of [Tango ADB](https://github.com/yume-chan/ya-webadb). Generally you need multiple packages to build a complete ADB client that can run on Web browsers and Node.js. Read the documentation for more information.
|
|
30
|
-
|
|
31
|
-
## Documentation
|
|
32
|
-
|
|
33
|
-
Check the latest documentation at https://docs.tangoapp.dev/scrcpy/video/web-codecs/
|
|
34
|
-
|
|
35
|
-
## Sponsors
|
|
36
|
-
|
|
37
|
-
[Become a backer](https://opencollective.com/ya-webadb) and get your image on our README on Github with a link to your site.
|
|
38
|
-
|
|
39
|
-
<a href="https://opencollective.com/ya-webadb/backer/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/0/avatar.svg?requireActive=false"></a>
|
|
40
|
-
<a href="https://opencollective.com/ya-webadb/backer/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/1/avatar.svg?requireActive=false"></a>
|
|
41
|
-
<a href="https://opencollective.com/ya-webadb/backer/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/2/avatar.svg?requireActive=false"></a>
|
|
42
|
-
<a href="https://opencollective.com/ya-webadb/backer/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/3/avatar.svg?requireActive=false"></a>
|
|
43
|
-
<a href="https://opencollective.com/ya-webadb/backer/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/4/avatar.svg?requireActive=false"></a>
|
|
44
|
-
<a href="https://opencollective.com/ya-webadb/backer/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/5/avatar.svg?requireActive=false"></a>
|
|
45
|
-
<a href="https://opencollective.com/ya-webadb/backer/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/6/avatar.svg?requireActive=false"></a>
|
|
46
|
-
<a href="https://opencollective.com/ya-webadb/backer/7/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/7/avatar.svg?requireActive=false"></a>
|
|
47
|
-
<a href="https://opencollective.com/ya-webadb/backer/8/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/8/avatar.svg?requireActive=false"></a>
|
|
48
|
-
<a href="https://opencollective.com/ya-webadb/backer/9/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/9/avatar.svg?requireActive=false"></a>
|
|
49
|
-
<a href="https://opencollective.com/ya-webadb/backer/10/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/10/avatar.svg?requireActive=false"></a>
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img alt="Tango" src="https://raw.githubusercontent.com/yume-chan/ya-webadb/main/.github/logo.svg" width="200">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">@yume-chan/scrcpy-decoder-webcodecs</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
Raw H.264 stream decoder and renderer using WebCodecs API (requires modern browser).
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://github.com/yume-chan/ya-webadb/blob/main/LICENSE">
|
|
13
|
+
<img alt="MIT License" src="https://img.shields.io/github/license/yume-chan/ya-webadb">
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://github.com/yume-chan/ya-webadb/releases">
|
|
16
|
+
<img alt="GitHub release" src="https://img.shields.io/github/v/release/yume-chan/ya-webadb?logo=github">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://bundlephobia.com/package/@yume-chan/scrcpy-decoder-webcodecs">
|
|
19
|
+
<img alt="Package Size" src="https://img.shields.io/bundlephobia/minzip/%40yume-chan%2Fscrcpy-decoder-webcodecs">
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://www.npmjs.com/package/@yume-chan/scrcpy-decoder-webcodecs">
|
|
22
|
+
<img alt="npm" src="https://img.shields.io/npm/dm/%40yume-chan/scrcpy-decoder-webcodecs?logo=npm">
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://discord.gg/26k3ttC2PN">
|
|
25
|
+
<img alt="Discord" src="https://img.shields.io/discord/1120215514732564502?logo=discord&logoColor=%23ffffff&label=Discord">
|
|
26
|
+
</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
This package is part of [Tango ADB](https://github.com/yume-chan/ya-webadb). Generally you need multiple packages to build a complete ADB client that can run on Web browsers and Node.js. Read the documentation for more information.
|
|
30
|
+
|
|
31
|
+
## Documentation
|
|
32
|
+
|
|
33
|
+
Check the latest documentation at https://docs.tangoapp.dev/scrcpy/video/web-codecs/
|
|
34
|
+
|
|
35
|
+
## Sponsors
|
|
36
|
+
|
|
37
|
+
[Become a backer](https://opencollective.com/ya-webadb) and get your image on our README on Github with a link to your site.
|
|
38
|
+
|
|
39
|
+
<a href="https://opencollective.com/ya-webadb/backer/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/0/avatar.svg?requireActive=false"></a>
|
|
40
|
+
<a href="https://opencollective.com/ya-webadb/backer/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/1/avatar.svg?requireActive=false"></a>
|
|
41
|
+
<a href="https://opencollective.com/ya-webadb/backer/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/2/avatar.svg?requireActive=false"></a>
|
|
42
|
+
<a href="https://opencollective.com/ya-webadb/backer/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/3/avatar.svg?requireActive=false"></a>
|
|
43
|
+
<a href="https://opencollective.com/ya-webadb/backer/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/4/avatar.svg?requireActive=false"></a>
|
|
44
|
+
<a href="https://opencollective.com/ya-webadb/backer/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/5/avatar.svg?requireActive=false"></a>
|
|
45
|
+
<a href="https://opencollective.com/ya-webadb/backer/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/6/avatar.svg?requireActive=false"></a>
|
|
46
|
+
<a href="https://opencollective.com/ya-webadb/backer/7/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/7/avatar.svg?requireActive=false"></a>
|
|
47
|
+
<a href="https://opencollective.com/ya-webadb/backer/8/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/8/avatar.svg?requireActive=false"></a>
|
|
48
|
+
<a href="https://opencollective.com/ya-webadb/backer/9/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/9/avatar.svg?requireActive=false"></a>
|
|
49
|
+
<a href="https://opencollective.com/ya-webadb/backer/10/website?requireActive=false" target="_blank"><img src="https://opencollective.com/ya-webadb/backer/10/avatar.svg?requireActive=false"></a>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"h265.d.ts","sourceRoot":"","sources":["../../../src/video/codec/h265.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,qBAAa,WAAY,SAAQ,WAAW;;gBAKpC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI;IAO9C,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"h265.d.ts","sourceRoot":"","sources":["../../../src/video/codec/h265.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,qBAAa,WAAY,SAAQ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,EAAE;YAClC,SAAS,CAAC,qBAAqB,CAAC,8BAA8B,EAAE,CAAC,CAAC,CAAC;YACnE,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,QAAQ,EAAE;YAC5D,GAAG,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC;SACjD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;YACpB,KAAK;YACL,UAAU,EAAE,YAAY;YACxB,WAAW,EAAE,aAAa;YAC1B,kBAAkB,EAAE,IAAI;SAC3B,CAAC,CAAC;IACP,CAAC;CACJ"}
|
package/esm/video/decoder.d.ts
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import type { ScrcpyMediaStreamPacket } from "@yume-chan/scrcpy";
|
|
2
2
|
import { ScrcpyVideoCodecId } from "@yume-chan/scrcpy";
|
|
3
|
-
import type { ScrcpyVideoDecoder, ScrcpyVideoDecoderCapability
|
|
3
|
+
import type { ScrcpyVideoDecoder, ScrcpyVideoDecoderCapability } from "@yume-chan/scrcpy-decoder-tinyh264";
|
|
4
4
|
import { WritableStream } from "@yume-chan/stream-extra";
|
|
5
|
-
|
|
5
|
+
import type { WebCodecsVideoDecoderRenderer } from "./render/index.js";
|
|
6
|
+
export interface WebCodecsVideoDecoderInit {
|
|
6
7
|
/**
|
|
7
8
|
* The video codec to decode
|
|
8
9
|
*/
|
|
9
10
|
codec: ScrcpyVideoCodecId;
|
|
10
|
-
|
|
11
|
-
* Whether to allow capturing the canvas content using APIs like `readPixels` and `toDataURL`.
|
|
12
|
-
* Enable this option may reduce performance.
|
|
13
|
-
*/
|
|
14
|
-
enableCapture?: boolean | undefined;
|
|
11
|
+
renderer: WebCodecsVideoDecoderRenderer;
|
|
15
12
|
}
|
|
16
13
|
export declare class WebCodecsVideoDecoder implements ScrcpyVideoDecoder {
|
|
17
14
|
#private;
|
|
18
|
-
static isSupported(): boolean;
|
|
15
|
+
static get isSupported(): boolean;
|
|
19
16
|
static readonly capabilities: Record<string, ScrcpyVideoDecoderCapability>;
|
|
20
17
|
get codec(): ScrcpyVideoCodecId;
|
|
21
18
|
get writable(): WritableStream<ScrcpyMediaStreamPacket>;
|
|
22
|
-
get renderer():
|
|
19
|
+
get renderer(): WebCodecsVideoDecoderRenderer;
|
|
23
20
|
get framesRendered(): number;
|
|
24
21
|
get framesSkipped(): number;
|
|
25
22
|
get sizeChanged(): import("@yume-chan/event").AddEventListener<{
|
|
@@ -29,7 +26,8 @@ export declare class WebCodecsVideoDecoder implements ScrcpyVideoDecoder {
|
|
|
29
26
|
/**
|
|
30
27
|
* Create a new WebCodecs video decoder.
|
|
31
28
|
*/
|
|
32
|
-
constructor({ codec,
|
|
29
|
+
constructor({ codec, renderer }: WebCodecsVideoDecoderInit);
|
|
30
|
+
snapshot(): Promise<Blob | undefined>;
|
|
33
31
|
dispose(): void;
|
|
34
32
|
}
|
|
35
33
|
//# sourceMappingURL=decoder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../src/video/decoder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EACR,kBAAkB,EAClB,4BAA4B,
|
|
1
|
+
{"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../src/video/decoder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EACR,kBAAkB,EAClB,4BAA4B,EAC/B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAIzD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAsFvE,MAAM,WAAW,yBAAyB;IACtC;;OAEG;IACH,KAAK,EAAE,kBAAkB,CAAC;IAE1B,QAAQ,EAAE,6BAA6B,CAAC;CAC3C;AAED,qBAAa,qBAAsB,YAAW,kBAAkB;;IAC5D,MAAM,KAAK,WAAW,YAErB;IAED,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAKpE;IAGN,IAAI,KAAK,uBAER;IAKD,IAAI,QAAQ,4CAEX;IAMD,IAAI,QAAQ,kCAEX;IAID,IAAI,cAAc,WAEjB;IAGD,IAAI,aAAa,WAEhB;IAGD,IAAI,WAAW;eAD0B,MAAM;gBAAU,MAAM;gBAG9D;IAUD;;OAEG;gBACS,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,yBAAyB;IAoHpD,QAAQ;IAYd,OAAO;CAQV"}
|
package/esm/video/decoder.js
CHANGED
|
@@ -1,16 +1,87 @@
|
|
|
1
1
|
import { EventEmitter } from "@yume-chan/event";
|
|
2
2
|
import { ScrcpyVideoCodecId } from "@yume-chan/scrcpy";
|
|
3
|
-
import { createCanvas } from "@yume-chan/scrcpy-decoder-tinyh264";
|
|
4
3
|
import { WritableStream } from "@yume-chan/stream-extra";
|
|
5
4
|
import { Av1Codec, H264Decoder, H265Decoder } from "./codec/index.js";
|
|
6
|
-
|
|
5
|
+
class Pool {
|
|
6
|
+
#controller;
|
|
7
|
+
#readable = new ReadableStream({
|
|
8
|
+
start: (controller) => {
|
|
9
|
+
this.#controller = controller;
|
|
10
|
+
},
|
|
11
|
+
pull: (controller) => {
|
|
12
|
+
controller.enqueue(this.#initializer());
|
|
13
|
+
},
|
|
14
|
+
}, { highWaterMark: 0 });
|
|
15
|
+
#reader = this.#readable.getReader();
|
|
16
|
+
#initializer;
|
|
17
|
+
#size = 0;
|
|
18
|
+
#capacity;
|
|
19
|
+
constructor(initializer, capacity) {
|
|
20
|
+
this.#initializer = initializer;
|
|
21
|
+
this.#capacity = capacity;
|
|
22
|
+
}
|
|
23
|
+
async borrow() {
|
|
24
|
+
const result = await this.#reader.read();
|
|
25
|
+
return result.value;
|
|
26
|
+
}
|
|
27
|
+
return(value) {
|
|
28
|
+
if (this.#size < this.#capacity) {
|
|
29
|
+
this.#controller.enqueue(value);
|
|
30
|
+
this.#size += 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
class VideoFrameCapturer {
|
|
35
|
+
#canvas;
|
|
36
|
+
#context;
|
|
37
|
+
constructor() {
|
|
38
|
+
if (typeof OffscreenCanvas !== "undefined") {
|
|
39
|
+
this.#canvas = new OffscreenCanvas(1, 1);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.#canvas = document.createElement("canvas");
|
|
43
|
+
this.#canvas.width = 1;
|
|
44
|
+
this.#canvas.height = 1;
|
|
45
|
+
}
|
|
46
|
+
this.#context = this.#canvas.getContext("bitmaprenderer", {
|
|
47
|
+
alpha: false,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async capture(frame) {
|
|
51
|
+
this.#canvas.width = frame.displayWidth;
|
|
52
|
+
this.#canvas.height = frame.displayHeight;
|
|
53
|
+
const bitmap = await createImageBitmap(frame);
|
|
54
|
+
this.#context.transferFromImageBitmap(bitmap);
|
|
55
|
+
if (this.#canvas instanceof OffscreenCanvas) {
|
|
56
|
+
return await this.#canvas.convertToBlob({
|
|
57
|
+
type: "image/png",
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
this.#canvas.toBlob((blob) => {
|
|
63
|
+
if (!blob) {
|
|
64
|
+
reject(new Error("Failed to convert canvas to blob"));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
resolve(blob);
|
|
68
|
+
}
|
|
69
|
+
}, "image/png");
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const VideoFrameCapturerPool =
|
|
75
|
+
/* #__PURE__ */
|
|
76
|
+
new Pool(() => new VideoFrameCapturer(), 4);
|
|
7
77
|
export class WebCodecsVideoDecoder {
|
|
8
|
-
static isSupported() {
|
|
78
|
+
static get isSupported() {
|
|
9
79
|
return typeof globalThis.VideoDecoder !== "undefined";
|
|
10
80
|
}
|
|
11
81
|
static capabilities = {
|
|
12
82
|
h264: {},
|
|
13
83
|
h265: {},
|
|
84
|
+
av1: {},
|
|
14
85
|
};
|
|
15
86
|
#codec;
|
|
16
87
|
get codec() {
|
|
@@ -21,74 +92,53 @@ export class WebCodecsVideoDecoder {
|
|
|
21
92
|
get writable() {
|
|
22
93
|
return this.#writable;
|
|
23
94
|
}
|
|
95
|
+
#error;
|
|
96
|
+
#controller;
|
|
24
97
|
#renderer;
|
|
25
98
|
get renderer() {
|
|
26
99
|
return this.#renderer;
|
|
27
100
|
}
|
|
28
|
-
#
|
|
101
|
+
#framesDraw = 0;
|
|
102
|
+
#framesPresented = 0;
|
|
29
103
|
get framesRendered() {
|
|
30
|
-
return this.#
|
|
104
|
+
return this.#framesPresented;
|
|
31
105
|
}
|
|
32
|
-
#
|
|
106
|
+
#framesSkipped = 0;
|
|
33
107
|
get framesSkipped() {
|
|
34
|
-
return this.#
|
|
108
|
+
return this.#framesSkipped;
|
|
35
109
|
}
|
|
36
110
|
#sizeChanged = new EventEmitter();
|
|
37
111
|
get sizeChanged() {
|
|
38
112
|
return this.#sizeChanged.event;
|
|
39
113
|
}
|
|
40
114
|
#decoder;
|
|
41
|
-
#
|
|
42
|
-
#
|
|
115
|
+
#drawing = false;
|
|
116
|
+
#nextFrame;
|
|
117
|
+
#captureFrame;
|
|
43
118
|
#animationFrameId = 0;
|
|
44
119
|
/**
|
|
45
120
|
* Create a new WebCodecs video decoder.
|
|
46
121
|
*/
|
|
47
|
-
constructor({ codec,
|
|
122
|
+
constructor({ codec, renderer }) {
|
|
48
123
|
this.#codec = codec;
|
|
49
|
-
|
|
50
|
-
this.#renderer = canvas;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
this.#renderer = createCanvas();
|
|
54
|
-
}
|
|
55
|
-
try {
|
|
56
|
-
this.#frameSink = new WebGLFrameSink(this.#renderer, !!enableCapture);
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
this.#frameSink = new BitmapFrameSink(this.#renderer);
|
|
60
|
-
}
|
|
124
|
+
this.#renderer = renderer;
|
|
61
125
|
this.#decoder = new VideoDecoder({
|
|
62
126
|
output: (frame) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.#
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// PERF: Draw every frame to minimize latency at cost of performance.
|
|
71
|
-
// When multiple frames are drawn in one vertical sync interval,
|
|
72
|
-
// only the last one is visible to users.
|
|
73
|
-
// But this ensures users can always see the most up-to-date screen.
|
|
74
|
-
// This is also the behavior of official Scrcpy client.
|
|
75
|
-
// https://github.com/Genymobile/scrcpy/issues/3679
|
|
76
|
-
this.#updateSize(frame.displayWidth, frame.displayHeight);
|
|
77
|
-
this.#frameSink.draw(frame);
|
|
78
|
-
},
|
|
79
|
-
error(e) {
|
|
80
|
-
if (controller) {
|
|
81
|
-
try {
|
|
82
|
-
controller.error(e);
|
|
127
|
+
this.#captureFrame?.close();
|
|
128
|
+
// PERF: `VideoFrame#clone` is cheap
|
|
129
|
+
this.#captureFrame = frame.clone();
|
|
130
|
+
if (this.#drawing) {
|
|
131
|
+
if (this.#nextFrame) {
|
|
132
|
+
this.#nextFrame.close();
|
|
133
|
+
this.#framesSkipped += 1;
|
|
83
134
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
// `controller` may already in error state
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
error = e;
|
|
135
|
+
this.#nextFrame = frame;
|
|
136
|
+
return;
|
|
91
137
|
}
|
|
138
|
+
void this.#draw(frame);
|
|
139
|
+
},
|
|
140
|
+
error: (error) => {
|
|
141
|
+
this.#setError(error);
|
|
92
142
|
},
|
|
93
143
|
});
|
|
94
144
|
switch (this.#codec) {
|
|
@@ -102,43 +152,87 @@ export class WebCodecsVideoDecoder {
|
|
|
102
152
|
this.#codecDecoder = new Av1Codec(this.#decoder, this.#updateSize);
|
|
103
153
|
break;
|
|
104
154
|
}
|
|
105
|
-
let error;
|
|
106
|
-
let controller;
|
|
107
155
|
this.#writable = new WritableStream({
|
|
108
|
-
start: (
|
|
109
|
-
if (error) {
|
|
110
|
-
|
|
156
|
+
start: (controller) => {
|
|
157
|
+
if (this.#error) {
|
|
158
|
+
controller.error(this.#error);
|
|
111
159
|
}
|
|
112
160
|
else {
|
|
113
|
-
controller =
|
|
161
|
+
this.#controller = controller;
|
|
114
162
|
}
|
|
115
163
|
},
|
|
116
164
|
write: (packet) => {
|
|
117
165
|
this.#codecDecoder.decode(packet);
|
|
118
166
|
},
|
|
119
167
|
});
|
|
120
|
-
this.#
|
|
168
|
+
this.#onVerticalSync();
|
|
121
169
|
}
|
|
122
|
-
#
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
});
|
|
170
|
+
#setError(error) {
|
|
171
|
+
if (this.#controller) {
|
|
172
|
+
try {
|
|
173
|
+
this.#controller.error(error);
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
// ignore
|
|
177
|
+
}
|
|
131
178
|
}
|
|
179
|
+
else {
|
|
180
|
+
this.#error = error;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
async #draw(frame) {
|
|
184
|
+
try {
|
|
185
|
+
this.#drawing = true;
|
|
186
|
+
// PERF: Draw every frame to minimize latency at cost of performance.
|
|
187
|
+
// When multiple frames are drawn in one vertical sync interval,
|
|
188
|
+
// only the last one is visible to users.
|
|
189
|
+
// But this ensures users can always see the most up-to-date screen.
|
|
190
|
+
// This is also the behavior of official Scrcpy client.
|
|
191
|
+
// https://github.com/Genymobile/scrcpy/issues/3679
|
|
192
|
+
this.#updateSize(frame.displayWidth, frame.displayHeight);
|
|
193
|
+
await this.#renderer.draw(frame);
|
|
194
|
+
this.#framesDraw += 1;
|
|
195
|
+
frame.close();
|
|
196
|
+
if (this.#nextFrame) {
|
|
197
|
+
const frame = this.#nextFrame;
|
|
198
|
+
this.#nextFrame = undefined;
|
|
199
|
+
await this.#draw(frame);
|
|
200
|
+
}
|
|
201
|
+
this.#drawing = false;
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
this.#setError(error);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
#updateSize = (width, height) => {
|
|
208
|
+
this.#renderer.setSize(width, height);
|
|
209
|
+
this.#sizeChanged.fire({ width, height });
|
|
132
210
|
};
|
|
133
|
-
#
|
|
134
|
-
this.#
|
|
135
|
-
|
|
211
|
+
#onVerticalSync = () => {
|
|
212
|
+
if (this.#framesDraw > 0) {
|
|
213
|
+
this.#framesPresented += 1;
|
|
214
|
+
this.#framesSkipped += this.#framesDraw - 1;
|
|
215
|
+
this.#framesDraw = 0;
|
|
216
|
+
}
|
|
217
|
+
this.#animationFrameId = requestAnimationFrame(this.#onVerticalSync);
|
|
136
218
|
};
|
|
219
|
+
async snapshot() {
|
|
220
|
+
const frame = this.#captureFrame;
|
|
221
|
+
if (!frame) {
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
const capturer = await VideoFrameCapturerPool.borrow();
|
|
225
|
+
const result = await capturer.capture(frame);
|
|
226
|
+
VideoFrameCapturerPool.return(capturer);
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
137
229
|
dispose() {
|
|
138
230
|
cancelAnimationFrame(this.#animationFrameId);
|
|
139
231
|
if (this.#decoder.state !== "closed") {
|
|
140
232
|
this.#decoder.close();
|
|
141
233
|
}
|
|
234
|
+
this.#nextFrame?.close();
|
|
235
|
+
this.#captureFrame?.close();
|
|
142
236
|
}
|
|
143
237
|
}
|
|
144
238
|
//# sourceMappingURL=decoder.js.map
|
package/esm/video/decoder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decoder.js","sourceRoot":"","sources":["../../src/video/decoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAMvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"decoder.js","sourceRoot":"","sources":["../../src/video/decoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAMvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAItE,MAAM,IAAI;IACN,WAAW,CAAsC;IACjD,SAAS,GAAG,IAAI,cAAc,CAC1B;QACI,KAAK,EAAE,CAAC,UAAU,EAAE,EAAE;YAClB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAClC,CAAC;QACD,IAAI,EAAE,CAAC,UAAU,EAAE,EAAE;YACjB,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAC5C,CAAC;KACJ,EACD,EAAE,aAAa,EAAE,CAAC,EAAE,CACvB,CAAC;IACF,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;IAErC,YAAY,CAAU;IAEtB,KAAK,GAAG,CAAC,CAAC;IACV,SAAS,CAAS;IAElB,YAAY,WAAoB,EAAE,QAAgB;QAC9C,IAAI,CAAC,YAAY,GAAG,W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IAAI,CAAC,CAAC;YAC3B,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;YAC5C,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACzE,CAAC,CAAC;IAEF,KAAK,CAAC,QAAQ;QACV,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC;QACjC,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO,SAAS,CAAC;QACrB,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC,MAAM,EAAE,CAAC;QACvD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC7C,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,OAAO;QACH,oBAAoB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC7C,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACnC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC;QACD,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare class
|
|
1
|
+
import { CanvasWebCodecsVideoDecoderRenderer } from "./canvas.js";
|
|
2
|
+
export declare class BitmapWebCodecsDecoderRenderer extends CanvasWebCodecsVideoDecoderRenderer {
|
|
3
3
|
#private;
|
|
4
|
-
constructor(canvas
|
|
5
|
-
draw(frame: VideoFrame): void
|
|
4
|
+
constructor(canvas?: HTMLCanvasElement | OffscreenCanvas);
|
|
5
|
+
draw(frame: VideoFrame): Promise<void>;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=bitmap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitmap.d.ts","sourceRoot":"","sources":["../../../src/video/render/bitmap.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"bitmap.d.ts","sourceRoot":"","sources":["../../../src/video/render/bitmap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,aAAa,CAAC;AAElE,qBAAa,8BAA+B,SAAQ,mCAAmC;;gBAGvE,MAAM,CAAC,EAAE,iBAAiB,GAAG,eAAe;IAQlD,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAI/C"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { CanvasWebCodecsVideoDecoderRenderer } from "./canvas.js";
|
|
2
|
+
export class BitmapWebCodecsDecoderRenderer extends CanvasWebCodecsVideoDecoderRenderer {
|
|
2
3
|
#context;
|
|
3
4
|
constructor(canvas) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
createImageBitmap(frame)
|
|
8
|
-
.then((bitmap) => {
|
|
9
|
-
this.#context.transferFromImageBitmap(bitmap);
|
|
10
|
-
frame.close();
|
|
11
|
-
})
|
|
12
|
-
.catch((e) => {
|
|
13
|
-
console.warn("[@yume-chan/scrcpy-decoder-webcodecs]", "VideoDecoder error", e);
|
|
5
|
+
super(canvas);
|
|
6
|
+
this.#context = this.canvas.getContext("bitmaprenderer", {
|
|
7
|
+
alpha: false,
|
|
14
8
|
});
|
|
15
9
|
}
|
|
10
|
+
async draw(frame) {
|
|
11
|
+
const bitmap = await createImageBitmap(frame);
|
|
12
|
+
this.#context.transferFromImageBitmap(bitmap);
|
|
13
|
+
}
|
|
16
14
|
}
|
|
17
15
|
//# sourceMappingURL=bitmap.js.map
|