@yume-chan/scrcpy-decoder-webcodecs 0.0.0-20240714132542
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 +75 -0
- package/LICENSE +21 -0
- package/README.md +49 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +2 -0
- package/esm/index.js.map +1 -0
- package/esm/video/codec/av1.d.ts +8 -0
- package/esm/video/codec/av1.d.ts.map +1 -0
- package/esm/video/codec/av1.js +71 -0
- package/esm/video/codec/av1.js.map +1 -0
- package/esm/video/codec/h264.d.ts +7 -0
- package/esm/video/codec/h264.d.ts.map +1 -0
- package/esm/video/codec/h264.js +27 -0
- package/esm/video/codec/h264.js.map +1 -0
- package/esm/video/codec/h265.d.ts +7 -0
- package/esm/video/codec/h265.d.ts.map +1 -0
- package/esm/video/codec/h265.js +30 -0
- package/esm/video/codec/h265.js.map +1 -0
- package/esm/video/codec/h26x.d.ts +9 -0
- package/esm/video/codec/h26x.d.ts.map +1 -0
- package/esm/video/codec/h26x.js +35 -0
- package/esm/video/codec/h26x.js.map +1 -0
- package/esm/video/codec/index.d.ts +7 -0
- package/esm/video/codec/index.d.ts.map +1 -0
- package/esm/video/codec/index.js +7 -0
- package/esm/video/codec/index.js.map +1 -0
- package/esm/video/codec/type.d.ts +8 -0
- package/esm/video/codec/type.d.ts.map +1 -0
- package/esm/video/codec/type.js +2 -0
- package/esm/video/codec/type.js.map +1 -0
- package/esm/video/codec/utils.d.ts +4 -0
- package/esm/video/codec/utils.d.ts.map +1 -0
- package/esm/video/codec/utils.js +10 -0
- package/esm/video/codec/utils.js.map +1 -0
- package/esm/video/decoder.d.ts +35 -0
- package/esm/video/decoder.d.ts.map +1 -0
- package/esm/video/decoder.js +144 -0
- package/esm/video/decoder.js.map +1 -0
- package/esm/video/index.d.ts +4 -0
- package/esm/video/index.d.ts.map +1 -0
- package/esm/video/index.js +4 -0
- package/esm/video/index.js.map +1 -0
- package/esm/video/render/bitmap.d.ts +7 -0
- package/esm/video/render/bitmap.d.ts.map +1 -0
- package/esm/video/render/bitmap.js +17 -0
- package/esm/video/render/bitmap.js.map +1 -0
- package/esm/video/render/index.d.ts +4 -0
- package/esm/video/render/index.d.ts.map +1 -0
- package/esm/video/render/index.js +4 -0
- package/esm/video/render/index.js.map +1 -0
- package/esm/video/render/type.d.ts +4 -0
- package/esm/video/render/type.d.ts.map +1 -0
- package/esm/video/render/type.js +2 -0
- package/esm/video/render/type.js.map +1 -0
- package/esm/video/render/webgl.d.ts +16 -0
- package/esm/video/render/webgl.d.ts.map +1 -0
- package/esm/video/render/webgl.js +90 -0
- package/esm/video/render/webgl.js.map +1 -0
- package/package.json +52 -0
- package/src/index.ts +1 -0
- package/src/video/codec/av1.ts +101 -0
- package/src/video/codec/h264.ts +42 -0
- package/src/video/codec/h265.ts +47 -0
- package/src/video/codec/h26x.ts +45 -0
- package/src/video/codec/index.ts +6 -0
- package/src/video/codec/type.ts +12 -0
- package/src/video/codec/utils.ts +11 -0
- package/src/video/decoder.ts +197 -0
- package/src/video/index.ts +3 -0
- package/src/video/render/bitmap.ts +24 -0
- package/src/video/render/index.ts +3 -0
- package/src/video/render/type.ts +3 -0
- package/src/video/render/webgl.ts +118 -0
- package/tsconfig.build.json +21 -0
- package/tsconfig.build.tsbuildinfo +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Change Log - @yume-chan/scrcpy-decoder-webcodecs
|
|
2
|
+
|
|
3
|
+
## 0.0.0-20240714132542
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Switch to PNPM workspace and changesets
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @yume-chan/scrcpy-decoder-tinyh264@0.0.0-20240714132542
|
|
10
|
+
- @yume-chan/no-data-view@0.0.0-20240714132542
|
|
11
|
+
- @yume-chan/stream-extra@0.0.0-20240714132542
|
|
12
|
+
- @yume-chan/scrcpy@0.0.0-20240714132542
|
|
13
|
+
- @yume-chan/event@0.0.0-20240714132542
|
|
14
|
+
|
|
15
|
+
This log was last generated on Tue, 18 Jun 2024 02:49:43 GMT and should not be manually modified.
|
|
16
|
+
|
|
17
|
+
## 0.0.24
|
|
18
|
+
|
|
19
|
+
Tue, 18 Jun 2024 02:49:43 GMT
|
|
20
|
+
|
|
21
|
+
### Updates
|
|
22
|
+
|
|
23
|
+
- Support decoding AV1
|
|
24
|
+
- Add `enableCapture` option to `WebCodecsVideoDecoder` which allows `renderer.readPixels` and `renderer.toDataURL` to work. The performance will be slightly affected when enabled.
|
|
25
|
+
|
|
26
|
+
## 0.0.23
|
|
27
|
+
|
|
28
|
+
Thu, 21 Mar 2024 03:15:10 GMT
|
|
29
|
+
|
|
30
|
+
### Updates
|
|
31
|
+
|
|
32
|
+
- Add `sizeChanged` event
|
|
33
|
+
- Add WebGL and Bitmap based video renderers, which are 1.5 to 3 times faster on Android devices
|
|
34
|
+
|
|
35
|
+
## 0.0.22
|
|
36
|
+
|
|
37
|
+
Wed, 13 Dec 2023 05:57:27 GMT
|
|
38
|
+
|
|
39
|
+
_Version update only_
|
|
40
|
+
|
|
41
|
+
## 0.0.21
|
|
42
|
+
|
|
43
|
+
Fri, 25 Aug 2023 14:05:18 GMT
|
|
44
|
+
|
|
45
|
+
_Version update only_
|
|
46
|
+
|
|
47
|
+
## 0.0.20
|
|
48
|
+
|
|
49
|
+
Mon, 05 Jun 2023 02:51:41 GMT
|
|
50
|
+
|
|
51
|
+
### Updates
|
|
52
|
+
|
|
53
|
+
- Add support for decoding H.265 on supported browsers (Chrome works, Microsoft Edge with HEVC Video Extension from Microsoft Store doesn't decode H.265 correctly).
|
|
54
|
+
|
|
55
|
+
## 0.0.19
|
|
56
|
+
|
|
57
|
+
Sun, 09 Apr 2023 05:55:33 GMT
|
|
58
|
+
|
|
59
|
+
_Version update only_
|
|
60
|
+
|
|
61
|
+
## 0.0.18
|
|
62
|
+
|
|
63
|
+
Wed, 25 Jan 2023 21:33:49 GMT
|
|
64
|
+
|
|
65
|
+
### Updates
|
|
66
|
+
|
|
67
|
+
- Change to not use vertical sync to minimize latency
|
|
68
|
+
|
|
69
|
+
## 0.0.17
|
|
70
|
+
|
|
71
|
+
Tue, 18 Oct 2022 09:32:30 GMT
|
|
72
|
+
|
|
73
|
+
### Updates
|
|
74
|
+
|
|
75
|
+
- Separated from `@yume-chan/scrcpy` for simpler dependency management.
|
package/LICENSE
ADDED
|
@@ -0,0 +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.
|
package/README.md
ADDED
|
@@ -0,0 +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>
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
package/esm/index.js
ADDED
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ScrcpyMediaStreamPacket } from "@yume-chan/scrcpy";
|
|
2
|
+
import type { CodecDecoder } from "./type.js";
|
|
3
|
+
export declare class Av1Codec implements CodecDecoder {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(decoder: VideoDecoder, updateSize: (width: number, height: number) => void);
|
|
6
|
+
decode(packet: ScrcpyMediaStreamPacket): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=av1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"av1.d.ts","sourceRoot":"","sources":["../../../src/video/codec/av1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAGjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAG9C,qBAAa,QAAS,YAAW,YAAY;;gBAKrC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI;IAyEvD,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI;CAehD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Av1 } from "@yume-chan/scrcpy";
|
|
2
|
+
import { decimalTwoDigits } from "./utils.js";
|
|
3
|
+
export class Av1Codec {
|
|
4
|
+
#decoder;
|
|
5
|
+
#updateSize;
|
|
6
|
+
constructor(decoder, updateSize) {
|
|
7
|
+
this.#decoder = decoder;
|
|
8
|
+
this.#updateSize = updateSize;
|
|
9
|
+
}
|
|
10
|
+
#configure(data) {
|
|
11
|
+
const parser = new Av1(data);
|
|
12
|
+
const sequenceHeader = parser.searchSequenceHeaderObu();
|
|
13
|
+
if (!sequenceHeader) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const { seq_profile: seqProfile, seq_level_idx: [seqLevelIdx = 0], max_frame_width_minus_1, max_frame_height_minus_1, color_config: { BitDepth, mono_chrome: monoChrome, subsampling_x: subsamplingX, subsampling_y: subsamplingY, chroma_sample_position: chromaSamplePosition, color_description_present_flag, }, } = sequenceHeader;
|
|
17
|
+
let colorPrimaries;
|
|
18
|
+
let transferCharacteristics;
|
|
19
|
+
let matrixCoefficients;
|
|
20
|
+
let colorRange;
|
|
21
|
+
if (color_description_present_flag) {
|
|
22
|
+
({
|
|
23
|
+
color_primaries: colorPrimaries,
|
|
24
|
+
transfer_characteristics: transferCharacteristics,
|
|
25
|
+
matrix_coefficients: matrixCoefficients,
|
|
26
|
+
color_range: colorRange,
|
|
27
|
+
} = sequenceHeader.color_config);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
colorPrimaries = Av1.ColorPrimaries.Bt709;
|
|
31
|
+
transferCharacteristics = Av1.TransferCharacteristics.Bt709;
|
|
32
|
+
matrixCoefficients = Av1.MatrixCoefficients.Bt709;
|
|
33
|
+
colorRange = false;
|
|
34
|
+
}
|
|
35
|
+
const width = max_frame_width_minus_1 + 1;
|
|
36
|
+
const height = max_frame_height_minus_1 + 1;
|
|
37
|
+
this.#updateSize(width, height);
|
|
38
|
+
const codec = [
|
|
39
|
+
"av01",
|
|
40
|
+
seqProfile.toString(16),
|
|
41
|
+
decimalTwoDigits(seqLevelIdx) +
|
|
42
|
+
(sequenceHeader.seq_tier[0] ? "H" : "M"),
|
|
43
|
+
decimalTwoDigits(BitDepth),
|
|
44
|
+
monoChrome ? "1" : "0",
|
|
45
|
+
(subsamplingX ? "1" : "0") +
|
|
46
|
+
(subsamplingY ? "1" : "0") +
|
|
47
|
+
chromaSamplePosition.toString(),
|
|
48
|
+
decimalTwoDigits(colorPrimaries),
|
|
49
|
+
decimalTwoDigits(transferCharacteristics),
|
|
50
|
+
decimalTwoDigits(matrixCoefficients),
|
|
51
|
+
colorRange ? "1" : "0",
|
|
52
|
+
].join(".");
|
|
53
|
+
this.#decoder.configure({
|
|
54
|
+
codec,
|
|
55
|
+
optimizeForLatency: true,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
decode(packet) {
|
|
59
|
+
if (packet.type === "configuration") {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this.#configure(packet.data);
|
|
63
|
+
this.#decoder.decode(new EncodedVideoChunk({
|
|
64
|
+
// Treat `undefined` as `key`, otherwise it won't decode.
|
|
65
|
+
type: packet.keyframe === false ? "delta" : "key",
|
|
66
|
+
timestamp: 0,
|
|
67
|
+
data: packet.data,
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=av1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"av1.js","sourceRoot":"","sources":["../../../src/video/codec/av1.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { H26xDecoder } from "./h26x.js";
|
|
2
|
+
export declare class H264Decoder extends H26xDecoder {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(decoder: VideoDecoder, updateSize: (width: number, height: number) => void);
|
|
5
|
+
configure(data: Uint8Array): void;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=h264.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h264.d.ts","sourceRoot":"","sources":["../../../src/video/codec/h264.ts"],"names":[],"mappings":"AAEA,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;CAuB7C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { h264ParseConfiguration } from "@yume-chan/scrcpy";
|
|
2
|
+
import { H26xDecoder } from "./h26x.js";
|
|
3
|
+
import { hexTwoDigits } from "./utils.js";
|
|
4
|
+
export class H264Decoder extends H26xDecoder {
|
|
5
|
+
#decoder;
|
|
6
|
+
#updateSize;
|
|
7
|
+
constructor(decoder, updateSize) {
|
|
8
|
+
super(decoder);
|
|
9
|
+
this.#decoder = decoder;
|
|
10
|
+
this.#updateSize = updateSize;
|
|
11
|
+
}
|
|
12
|
+
configure(data) {
|
|
13
|
+
const { profileIndex, constraintSet, levelIndex, croppedWidth, croppedHeight, } = h264ParseConfiguration(data);
|
|
14
|
+
this.#updateSize(croppedWidth, croppedHeight);
|
|
15
|
+
// https://www.rfc-editor.org/rfc/rfc6381#section-3.3
|
|
16
|
+
// ISO Base Media File Format Name Space
|
|
17
|
+
const codec = "avc1." +
|
|
18
|
+
hexTwoDigits(profileIndex) +
|
|
19
|
+
hexTwoDigits(constraintSet) +
|
|
20
|
+
hexTwoDigits(levelIndex);
|
|
21
|
+
this.#decoder.configure({
|
|
22
|
+
codec: codec,
|
|
23
|
+
optimizeForLatency: true,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=h264.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h264.js","sourceRoot":"","sources":["../../../src/video/codec/h264.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,OAAO,WAAY,SAAQ,WAAW;IACxC,QAAQ,CAAe;IACvB,WAAW,CAA0C;IAErD,YACI,OAAqB,EACrB,UAAmD;QAEnD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAEQ,SAAS,CAAC,IAAgB;QAC/B,MAAM,EACF,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,aAAa,GAChB,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAEjC,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;QAE9C,qDAAqD;QACrD,wCAAwC;QACxC,MAAM,KAAK,GACP,OAAO;YACP,YAAY,CAAC,YAAY,CAAC;YAC1B,YAAY,CAAC,aAAa,CAAC;YAC3B,YAAY,CAAC,UAAU,CAAC,CAAC;QAC7B,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;YACpB,KAAK,EAAE,KAAK;YACZ,kBAAkB,EAAE,IAAI;SAC3B,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { H26xDecoder } from "./h26x.js";
|
|
2
|
+
export declare class H265Decoder extends H26xDecoder {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(decoder: VideoDecoder, updateSize: (width: number, height: number) => void);
|
|
5
|
+
configure(data: Uint8Array): void;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=h265.d.ts.map
|
|
@@ -0,0 +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;CA2B7C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getUint32LittleEndian } from "@yume-chan/no-data-view";
|
|
2
|
+
import { h265ParseConfiguration } from "@yume-chan/scrcpy";
|
|
3
|
+
import { H26xDecoder } from "./h26x.js";
|
|
4
|
+
import { hexDigits } from "./utils.js";
|
|
5
|
+
export class H265Decoder extends H26xDecoder {
|
|
6
|
+
#decoder;
|
|
7
|
+
#updateSize;
|
|
8
|
+
constructor(decoder, updateSize) {
|
|
9
|
+
super(decoder);
|
|
10
|
+
this.#decoder = decoder;
|
|
11
|
+
this.#updateSize = updateSize;
|
|
12
|
+
}
|
|
13
|
+
configure(data) {
|
|
14
|
+
const { generalProfileSpace, generalProfileIndex, generalProfileCompatibilitySet, generalTierFlag, generalLevelIndex, generalConstraintSet, croppedWidth, croppedHeight, } = h265ParseConfiguration(data);
|
|
15
|
+
this.#updateSize(croppedWidth, croppedHeight);
|
|
16
|
+
const codec = [
|
|
17
|
+
"hev1",
|
|
18
|
+
["", "A", "B", "C"][generalProfileSpace] +
|
|
19
|
+
generalProfileIndex.toString(),
|
|
20
|
+
hexDigits(getUint32LittleEndian(generalProfileCompatibilitySet, 0)),
|
|
21
|
+
(generalTierFlag ? "H" : "L") + generalLevelIndex.toString(),
|
|
22
|
+
...Array.from(generalConstraintSet, hexDigits),
|
|
23
|
+
].join(".");
|
|
24
|
+
this.#decoder.configure({
|
|
25
|
+
codec,
|
|
26
|
+
optimizeForLatency: true,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=h265.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h265.js","sourceRoot":"","sources":["../../../src/video/codec/h265.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,OAAO,WAAY,SAAQ,WAAW;IACxC,QAAQ,CAAe;IACvB,WAAW,CAA0C;IAErD,YACI,OAAqB,EACrB,UAAmD;QAEnD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAEQ,SAAS,CAAC,IAAgB;QAC/B,MAAM,EACF,mBAAmB,EACnB,mBAAmB,EACnB,8BAA8B,EAC9B,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,aAAa,GAChB,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAEjC,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;QAE9C,MAAM,KAAK,GAAG;YACV,MAAM;YACN,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,mBAAmB,CAAE;gBACrC,mBAAmB,CAAC,QAAQ,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,kBAAkB,EAAE,IAAI;SAC3B,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ScrcpyMediaStreamPacket } from "@yume-chan/scrcpy";
|
|
2
|
+
import type { CodecDecoder } from "./type.js";
|
|
3
|
+
export declare abstract class H26xDecoder implements CodecDecoder {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(decoder: VideoDecoder);
|
|
6
|
+
abstract configure(data: Uint8Array): void;
|
|
7
|
+
decode(packet: ScrcpyMediaStreamPacket): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=h26x.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h26x.d.ts","sourceRoot":"","sources":["../../../src/video/codec/h26x.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,8BAAsB,WAAY,YAAW,YAAY;;gBAIzC,OAAO,EAAE,YAAY;IAIjC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAE1C,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI;CA8BhD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export class H26xDecoder {
|
|
2
|
+
#config;
|
|
3
|
+
#decoder;
|
|
4
|
+
constructor(decoder) {
|
|
5
|
+
this.#decoder = decoder;
|
|
6
|
+
}
|
|
7
|
+
decode(packet) {
|
|
8
|
+
if (packet.type === "configuration") {
|
|
9
|
+
this.#config = packet.data;
|
|
10
|
+
this.configure(packet.data);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
// For H.264 and H.265, when the stream is in Annex B format
|
|
14
|
+
// (which Scrcpy uses, as Android MediaCodec produces),
|
|
15
|
+
// configuration data needs to be combined with the first frame data.
|
|
16
|
+
// https://www.w3.org/TR/webcodecs-avc-codec-registration/#encodedvideochunk-type
|
|
17
|
+
let data;
|
|
18
|
+
if (this.#config !== undefined) {
|
|
19
|
+
data = new Uint8Array(this.#config.length + packet.data.length);
|
|
20
|
+
data.set(this.#config, 0);
|
|
21
|
+
data.set(packet.data, this.#config.length);
|
|
22
|
+
this.#config = undefined;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
data = packet.data;
|
|
26
|
+
}
|
|
27
|
+
this.#decoder.decode(new EncodedVideoChunk({
|
|
28
|
+
// Treat `undefined` as `key`, otherwise won't decode.
|
|
29
|
+
type: packet.keyframe === false ? "delta" : "key",
|
|
30
|
+
timestamp: 0,
|
|
31
|
+
data,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=h26x.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h26x.js","sourceRoot":"","sources":["../../../src/video/codec/h26x.ts"],"names":[],"mappings":"AAIA,MAAM,OAAgB,WAAW;IAC7B,OAAO,CAAyB;IAChC,QAAQ,CAAe;IAEvB,YAAY,OAAqB;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAID,MAAM,CAAC,MAA+B;QAClC,IAAI,MAAM,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;YAClC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC;YAC3B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC5B,OAAO;QACX,CAAC;QAED,4DAA4D;QAC5D,uDAAuD;QACvD,qEAAqE;QACrE,iFAAiF;QACjF,IAAI,IAAgB,CAAC;QACrB,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC7B,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAChE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAC1B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC3C,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QAC7B,CAAC;aAAM,CAAC;YACJ,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACvB,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,MAAM,CAChB,IAAI,iBAAiB,CAAC;YAClB,sDAAsD;YACtD,IAAI,EAAE,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;YACjD,SAAS,EAAE,CAAC;YACZ,IAAI;SACP,CAAC,CACL,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/video/codec/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/video/codec/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ScrcpyMediaStreamPacket } from "@yume-chan/scrcpy";
|
|
2
|
+
export interface CodecDecoder {
|
|
3
|
+
decode(packet: ScrcpyMediaStreamPacket): void;
|
|
4
|
+
}
|
|
5
|
+
export interface CodecDecoderConstructor {
|
|
6
|
+
new (decoder: VideoDecoder, updateSize: (width: number, height: number) => void): CodecDecoder;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/video/codec/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE,MAAM,WAAW,YAAY;IACzB,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAC;CACjD;AAED,MAAM,WAAW,uBAAuB;IACpC,KACI,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,GACpD,YAAY,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/video/codec/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/video/codec/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,UAEtC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,UAEzC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAE7C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function hexDigits(value) {
|
|
2
|
+
return value.toString(16).toUpperCase();
|
|
3
|
+
}
|
|
4
|
+
export function hexTwoDigits(value) {
|
|
5
|
+
return value.toString(16).toUpperCase().padStart(2, "0");
|
|
6
|
+
}
|
|
7
|
+
export function decimalTwoDigits(value) {
|
|
8
|
+
return value.toString(10).padStart(2, "0");
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/video/codec/utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,CAAC,KAAa;IACnC,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC1C,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ScrcpyMediaStreamPacket } from "@yume-chan/scrcpy";
|
|
2
|
+
import { ScrcpyVideoCodecId } from "@yume-chan/scrcpy";
|
|
3
|
+
import type { ScrcpyVideoDecoder, ScrcpyVideoDecoderCapability, TinyH264DecoderInit } from "@yume-chan/scrcpy-decoder-tinyh264";
|
|
4
|
+
import { WritableStream } from "@yume-chan/stream-extra";
|
|
5
|
+
export interface WebCodecsVideoDecoderInit extends TinyH264DecoderInit {
|
|
6
|
+
/**
|
|
7
|
+
* The video codec to decode
|
|
8
|
+
*/
|
|
9
|
+
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;
|
|
15
|
+
}
|
|
16
|
+
export declare class WebCodecsVideoDecoder implements ScrcpyVideoDecoder {
|
|
17
|
+
#private;
|
|
18
|
+
static isSupported(): boolean;
|
|
19
|
+
static readonly capabilities: Record<string, ScrcpyVideoDecoderCapability>;
|
|
20
|
+
get codec(): ScrcpyVideoCodecId;
|
|
21
|
+
get writable(): WritableStream<ScrcpyMediaStreamPacket>;
|
|
22
|
+
get renderer(): HTMLCanvasElement | OffscreenCanvas;
|
|
23
|
+
get framesRendered(): number;
|
|
24
|
+
get framesSkipped(): number;
|
|
25
|
+
get sizeChanged(): import("@yume-chan/event").AddEventListener<{
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
}, unknown>;
|
|
29
|
+
/**
|
|
30
|
+
* Create a new WebCodecs video decoder.
|
|
31
|
+
*/
|
|
32
|
+
constructor({ codec, canvas, enableCapture }: WebCodecsVideoDecoderInit);
|
|
33
|
+
dispose(): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=decoder.d.ts.map
|
|
@@ -0,0 +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,EAC5B,mBAAmB,EACtB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAOzD,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IAClE;;OAEG;IACH,KAAK,EAAE,kBAAkB,CAAC;IAE1B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvC;AAED,qBAAa,qBAAsB,YAAW,kBAAkB;;IAC5D,MAAM,CAAC,WAAW;IAIlB,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAIpE;IAGN,IAAI,KAAK,uBAER;IAKD,IAAI,QAAQ,4CAEX;IAGD,IAAI,QAAQ,wCAEX;IAGD,IAAI,cAAc,WAEjB;IAGD,IAAI,aAAa,WAEhB;IAGD,IAAI,WAAW;eAD0B,MAAM;gBAAU,MAAM;gBAG9D;IAQD;;OAEG;gBACS,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,yBAAyB;IA4GvE,OAAO;CAMV"}
|