@yume-chan/scrcpy 0.0.17 → 0.0.19
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.json +39 -3
- package/CHANGELOG.md +22 -4
- package/LICENSE +1 -1
- package/README.md +149 -82
- package/bin/scrcpy-server +0 -0
- package/bin/version.d.ts +1 -1
- package/bin/version.js +1 -1
- package/esm/adb/client.d.ts +40 -39
- package/esm/adb/client.d.ts.map +1 -1
- package/esm/adb/client.js +223 -217
- package/esm/adb/client.js.map +1 -1
- package/esm/adb/connection.d.ts +48 -37
- package/esm/adb/connection.d.ts.map +1 -1
- package/esm/adb/connection.js +121 -101
- package/esm/adb/connection.js.map +1 -1
- package/esm/adb/index.d.ts +3 -3
- package/esm/adb/index.js +3 -3
- package/esm/adb/options/1_16.d.ts +7 -7
- package/esm/adb/options/1_16.d.ts.map +1 -1
- package/esm/adb/options/1_16.js +19 -19
- package/esm/adb/options/1_16.js.map +1 -1
- package/esm/adb/options/1_22.d.ts +7 -7
- package/esm/adb/options/1_22.d.ts.map +1 -1
- package/esm/adb/options/1_22.js +16 -16
- package/esm/adb/options/1_22.js.map +1 -1
- package/esm/adb/options/1_26.d.ts +9 -0
- package/esm/adb/options/1_26.d.ts.map +1 -0
- package/esm/adb/options/1_26.js +11 -0
- package/esm/adb/options/1_26.js.map +1 -0
- package/esm/adb/options/2_0.d.ts +8 -0
- package/esm/adb/options/2_0.d.ts.map +1 -0
- package/esm/adb/options/2_0.js +13 -0
- package/esm/adb/options/2_0.js.map +1 -0
- package/esm/adb/options/index.d.ts +3 -3
- package/esm/adb/options/index.js +3 -3
- package/esm/adb/options/types.d.ts +23 -22
- package/esm/adb/options/types.d.ts.map +1 -1
- package/esm/adb/options/types.js +36 -29
- package/esm/adb/options/types.js.map +1 -1
- package/esm/codec/av1.d.ts +33 -0
- package/esm/codec/av1.d.ts.map +1 -0
- package/esm/codec/av1.js +35 -0
- package/esm/codec/av1.js.map +1 -0
- package/esm/codec/h264.d.ts +98 -0
- package/esm/codec/h264.d.ts.map +1 -0
- package/esm/codec/h264.js +477 -0
- package/esm/codec/h264.js.map +1 -0
- package/esm/codec/h265.d.ts +36 -0
- package/esm/codec/h265.d.ts.map +1 -0
- package/esm/codec/h265.js +38 -0
- package/esm/codec/h265.js.map +1 -0
- package/esm/codec/index.d.ts +4 -0
- package/esm/codec/index.d.ts.map +1 -0
- package/esm/codec/index.js +4 -0
- package/esm/codec/index.js.map +1 -0
- package/esm/codec.d.ts +33 -33
- package/esm/codec.js +36 -36
- package/esm/control/back-or-screen-on.d.ts +3 -0
- package/esm/control/back-or-screen-on.d.ts.map +1 -0
- package/esm/control/back-or-screen-on.js +2 -0
- package/esm/control/back-or-screen-on.js.map +1 -0
- package/esm/control/basic.d.ts +5 -0
- package/esm/control/basic.d.ts.map +1 -0
- package/esm/control/basic.js +3 -0
- package/esm/control/basic.js.map +1 -0
- package/esm/control/hover-helper.d.ts +18 -0
- package/esm/control/hover-helper.d.ts.map +1 -0
- package/esm/control/hover-helper.js +44 -0
- package/esm/control/hover-helper.js.map +1 -0
- package/esm/control/index.d.ts +11 -7
- package/esm/control/index.d.ts.map +1 -1
- package/esm/control/index.js +11 -7
- package/esm/control/index.js.map +1 -1
- package/esm/control/inject-keycode.d.ts +194 -52
- package/esm/control/inject-keycode.d.ts.map +1 -1
- package/esm/control/inject-keycode.js +199 -53
- package/esm/control/inject-keycode.js.map +1 -1
- package/esm/control/inject-scroll.d.ts +3 -0
- package/esm/control/inject-scroll.d.ts.map +1 -0
- package/esm/control/inject-scroll.js +2 -0
- package/esm/control/inject-scroll.js.map +1 -0
- package/esm/control/inject-text.d.ts +8 -8
- package/esm/control/inject-text.d.ts.map +1 -1
- package/esm/control/inject-text.js +6 -6
- package/esm/control/inject-text.js.map +1 -1
- package/esm/control/inject-touch.d.ts +37 -29
- package/esm/control/inject-touch.d.ts.map +1 -1
- package/esm/control/inject-touch.js +62 -29
- package/esm/control/inject-touch.js.map +1 -1
- package/esm/control/rotate-device.d.ts +6 -6
- package/esm/control/rotate-device.d.ts.map +1 -1
- package/esm/control/rotate-device.js +3 -4
- package/esm/control/rotate-device.js.map +1 -1
- package/esm/control/serializer.d.ts +35 -22
- package/esm/control/serializer.d.ts.map +1 -1
- package/esm/control/serializer.js +82 -72
- package/esm/control/serializer.js.map +1 -1
- package/esm/control/set-clipboard.d.ts +3 -0
- package/esm/control/set-clipboard.d.ts.map +1 -0
- package/esm/control/set-clipboard.js +2 -0
- package/esm/control/set-clipboard.js.map +1 -0
- package/esm/control/set-screen-power-mode.d.ts +11 -11
- package/esm/control/set-screen-power-mode.d.ts.map +1 -1
- package/esm/control/set-screen-power-mode.js +11 -11
- package/esm/control/set-screen-power-mode.js.map +1 -1
- package/esm/control/simple.d.ts +5 -0
- package/esm/control/simple.d.ts.map +1 -0
- package/esm/control/simple.js +3 -0
- package/esm/control/simple.js.map +1 -0
- package/esm/control/type.d.ts +14 -14
- package/esm/control/type.js +18 -18
- package/esm/decoder.d.ts +2 -0
- package/esm/decoder.d.ts.map +1 -0
- package/esm/decoder.js +2 -0
- package/esm/decoder.js.map +1 -0
- package/esm/device-message/ack-clipboard.d.ts +9 -0
- package/esm/device-message/ack-clipboard.d.ts.map +1 -0
- package/esm/device-message/ack-clipboard.js +6 -0
- package/esm/device-message/ack-clipboard.js.map +1 -0
- package/esm/device-message/clipboard.d.ts +9 -9
- package/esm/device-message/clipboard.d.ts.map +1 -1
- package/esm/device-message/clipboard.js +6 -6
- package/esm/device-message/clipboard.js.map +1 -1
- package/esm/device-message/index.d.ts +4 -3
- package/esm/device-message/index.d.ts.map +1 -1
- package/esm/device-message/index.js +4 -3
- package/esm/device-message/index.js.map +1 -1
- package/esm/device-message/stream.d.ts +7 -6
- package/esm/device-message/stream.d.ts.map +1 -1
- package/esm/device-message/stream.js +19 -15
- package/esm/device-message/stream.js.map +1 -1
- package/esm/device-message/type.d.ts +4 -4
- package/esm/device-message/type.js +6 -6
- package/esm/index.d.ts +5 -5
- package/esm/index.js +5 -5
- package/esm/options/1.17.d.ts +3 -0
- package/esm/options/1.17.d.ts.map +1 -0
- package/esm/options/1.17.js +2 -0
- package/esm/options/1.17.js.map +1 -0
- package/esm/options/1_16/codec-options.d.ts +20 -18
- package/esm/options/1_16/codec-options.d.ts.map +1 -1
- package/esm/options/1_16/codec-options.js +25 -26
- package/esm/options/1_16/codec-options.js.map +1 -1
- package/esm/options/1_16/float-to-uint16.d.ts +5 -0
- package/esm/options/1_16/float-to-uint16.d.ts.map +1 -0
- package/esm/options/1_16/float-to-uint16.js +27 -0
- package/esm/options/1_16/float-to-uint16.js.map +1 -0
- package/esm/options/1_16/h264-configuration.d.ts +49 -0
- package/esm/options/1_16/h264-configuration.d.ts.map +1 -0
- package/esm/options/1_16/h264-configuration.js +414 -0
- package/esm/options/1_16/h264-configuration.js.map +1 -0
- package/esm/options/1_16/index.d.ts +4 -3
- package/esm/options/1_16/index.d.ts.map +1 -1
- package/esm/options/1_16/index.js +4 -3
- package/esm/options/1_16/index.js.map +1 -1
- package/esm/options/1_16/init.d.ts +66 -0
- package/esm/options/1_16/init.d.ts.map +1 -0
- package/esm/options/1_16/init.js +16 -0
- package/esm/options/1_16/init.js.map +1 -0
- package/esm/options/1_16/message.d.ts +32 -0
- package/esm/options/1_16/message.d.ts.map +1 -0
- package/esm/options/1_16/message.js +37 -0
- package/esm/options/1_16/message.js.map +1 -0
- package/esm/options/1_16/options.d.ts +102 -96
- package/esm/options/1_16/options.d.ts.map +1 -1
- package/esm/options/1_16/options.js +189 -187
- package/esm/options/1_16/options.js.map +1 -1
- package/esm/options/1_16/scroll.d.ts +28 -0
- package/esm/options/1_16/scroll.d.ts.map +1 -0
- package/esm/options/1_16/scroll.js +56 -0
- package/esm/options/1_16/scroll.js.map +1 -0
- package/esm/options/1_16/sps.d.ts +1 -1
- package/esm/options/1_16/sps.d.ts.map +1 -1
- package/esm/options/1_16/sps.js +25 -17
- package/esm/options/1_16/sps.js.map +1 -1
- package/esm/options/1_17.d.ts +32 -0
- package/esm/options/1_17.d.ts.map +1 -0
- package/esm/options/1_17.js +36 -0
- package/esm/options/1_17.js.map +1 -0
- package/esm/options/1_18.d.ts +21 -19
- package/esm/options/1_18.d.ts.map +1 -1
- package/esm/options/1_18.js +45 -45
- package/esm/options/1_18.js.map +1 -1
- package/esm/options/1_21.d.ts +22 -9
- package/esm/options/1_21.d.ts.map +1 -1
- package/esm/options/1_21.js +36 -25
- package/esm/options/1_21.js.map +1 -1
- package/esm/options/1_22/index.d.ts +3 -0
- package/esm/options/1_22/index.d.ts.map +1 -0
- package/esm/options/1_22/index.js +3 -0
- package/esm/options/1_22/index.js.map +1 -0
- package/esm/options/1_22/init.d.ts +17 -0
- package/esm/options/1_22/init.d.ts.map +1 -0
- package/esm/options/1_22/init.js +2 -0
- package/esm/options/1_22/init.js.map +1 -0
- package/esm/options/{1_22.d.ts → 1_22/options.d.ts} +30 -40
- package/esm/options/1_22/options.d.ts.map +1 -0
- package/esm/options/{1_22.js → 1_22/options.js} +26 -30
- package/esm/options/1_22/options.js.map +1 -0
- package/esm/options/1_22/scroll.d.ts +17 -0
- package/esm/options/1_22/scroll.d.ts.map +1 -0
- package/esm/options/1_22/scroll.js +15 -0
- package/esm/options/1_22/scroll.js.map +1 -0
- package/esm/options/1_23.d.ts +12 -11
- package/esm/options/1_23.d.ts.map +1 -1
- package/esm/options/1_23.js +34 -33
- package/esm/options/1_23.js.map +1 -1
- package/esm/options/1_24.d.ts +9 -8
- package/esm/options/1_24.d.ts.map +1 -1
- package/esm/options/1_24.js +12 -12
- package/esm/options/1_24.js.map +1 -1
- package/esm/options/1_25/index.d.ts +3 -0
- package/esm/options/1_25/index.d.ts.map +1 -0
- package/esm/options/1_25/index.js +3 -0
- package/esm/options/1_25/index.js.map +1 -0
- package/esm/options/1_25/options.d.ts +7 -0
- package/esm/options/1_25/options.d.ts.map +1 -0
- package/esm/options/1_25/options.js +8 -0
- package/esm/options/1_25/options.js.map +1 -0
- package/esm/options/1_25/scroll.d.ts +20 -0
- package/esm/options/1_25/scroll.d.ts.map +1 -0
- package/esm/options/1_25/scroll.js +33 -0
- package/esm/options/1_25/scroll.js.map +1 -0
- package/esm/options/1_26.d.ts +57 -0
- package/esm/options/1_26.d.ts.map +1 -0
- package/esm/options/1_26.js +67 -0
- package/esm/options/1_26.js.map +1 -0
- package/esm/options/2.d.ts +57 -0
- package/esm/options/2.d.ts.map +1 -0
- package/esm/options/2.js +67 -0
- package/esm/options/2.js.map +1 -0
- package/esm/options/2_0.d.ts +87 -0
- package/esm/options/2_0.d.ts.map +1 -0
- package/esm/options/2_0.js +175 -0
- package/esm/options/2_0.js.map +1 -0
- package/esm/options/codec.d.ts +52 -0
- package/esm/options/codec.d.ts.map +1 -0
- package/esm/options/codec.js +26 -0
- package/esm/options/codec.js.map +1 -0
- package/esm/options/index.d.ts +8 -7
- package/esm/options/index.d.ts.map +1 -1
- package/esm/options/index.js +8 -7
- package/esm/options/index.js.map +1 -1
- package/esm/options/latest.d.ts +12 -0
- package/esm/options/latest.d.ts.map +1 -0
- package/esm/options/latest.js +8 -0
- package/esm/options/latest.js.map +1 -0
- package/esm/options/types.d.ts +46 -44
- package/esm/options/types.d.ts.map +1 -1
- package/esm/options/types.js +17 -15
- package/esm/options/types.js.map +1 -1
- package/package.json +20 -12
- package/scripts/fetch-server.cjs +19 -9
- package/src/adb/client.ts +184 -147
- package/src/adb/connection.ts +95 -31
- package/src/adb/index.ts +3 -3
- package/src/adb/options/1_16.ts +15 -6
- package/src/adb/options/1_22.ts +12 -6
- package/src/adb/options/index.ts +3 -3
- package/src/adb/options/types.ts +34 -14
- package/src/control/back-or-screen-on.ts +4 -0
- package/src/control/hover-helper.ts +54 -0
- package/src/control/index.ts +11 -7
- package/src/control/inject-keycode.ts +203 -45
- package/src/control/inject-scroll.ts +4 -0
- package/src/control/inject-text.ts +7 -8
- package/src/control/inject-touch.ts +58 -14
- package/src/control/rotate-device.ts +7 -6
- package/src/control/serializer.ts +111 -43
- package/src/control/set-clipboard.ts +4 -0
- package/src/control/set-screen-power-mode.ts +7 -8
- package/src/device-message/ack-clipboard.ts +10 -0
- package/src/device-message/clipboard.ts +8 -8
- package/src/device-message/index.ts +4 -3
- package/src/device-message/stream.ts +17 -7
- package/src/index.ts +5 -5
- package/src/options/1_16/codec-options.ts +16 -11
- package/src/options/1_16/h264-configuration.ts +485 -0
- package/src/options/1_16/index.ts +4 -3
- package/src/options/1_16/options.ts +180 -130
- package/src/options/1_16/scroll.ts +74 -0
- package/src/options/1_18.ts +22 -12
- package/src/options/1_21.ts +30 -13
- package/src/options/1_22/index.ts +2 -0
- package/src/options/{1_22.ts → 1_22/options.ts} +9 -17
- package/src/options/1_22/scroll.ts +26 -0
- package/src/options/1_23.ts +30 -20
- package/src/options/1_24.ts +5 -3
- package/src/options/1_25/index.ts +2 -0
- package/src/options/1_25/options.ts +13 -0
- package/src/options/1_25/scroll.ts +49 -0
- package/src/options/index.ts +8 -7
- package/src/options/types.ts +36 -19
- package/tsconfig.build.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/esm/decoder/index.d.ts +0 -28
- package/esm/decoder/index.d.ts.map +0 -1
- package/esm/decoder/index.js +0 -2
- package/esm/decoder/index.js.map +0 -1
- package/esm/decoder/tinyh264/index.d.ts +0 -20
- package/esm/decoder/tinyh264/index.d.ts.map +0 -1
- package/esm/decoder/tinyh264/index.js +0 -86
- package/esm/decoder/tinyh264/index.js.map +0 -1
- package/esm/decoder/tinyh264/worker.d.ts +0 -2
- package/esm/decoder/tinyh264/worker.d.ts.map +0 -1
- package/esm/decoder/tinyh264/worker.js +0 -3
- package/esm/decoder/tinyh264/worker.js.map +0 -1
- package/esm/decoder/tinyh264/wrapper.d.ts +0 -21
- package/esm/decoder/tinyh264/wrapper.d.ts.map +0 -1
- package/esm/decoder/tinyh264/wrapper.js +0 -74
- package/esm/decoder/tinyh264/wrapper.js.map +0 -1
- package/esm/decoder/types.d.ts +0 -2
- package/esm/decoder/types.d.ts.map +0 -1
- package/esm/decoder/types.js +0 -2
- package/esm/decoder/types.js.map +0 -1
- package/esm/decoder/web-codecs/index.d.ts +0 -22
- package/esm/decoder/web-codecs/index.d.ts.map +0 -1
- package/esm/decoder/web-codecs/index.js +0 -81
- package/esm/decoder/web-codecs/index.js.map +0 -1
- package/esm/options/1_22.d.ts.map +0 -1
- package/esm/options/1_22.js.map +0 -1
- package/src/options/1_16/sps.ts +0 -300
- package/tsconfig.test.tsbuildinfo +0 -1
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { PromiseResolver } from '@yume-chan/async';
|
|
2
|
-
import { WritableStream } from '@yume-chan/stream-extra';
|
|
3
|
-
import { AndroidCodecLevel, AndroidCodecProfile } from '../../codec.js';
|
|
4
|
-
import { createTinyH264Wrapper } from './wrapper.js';
|
|
5
|
-
let cachedInitializePromise;
|
|
6
|
-
function initialize() {
|
|
7
|
-
if (!cachedInitializePromise) {
|
|
8
|
-
cachedInitializePromise = Promise.all([import('yuv-buffer'), import('yuv-canvas')]).then(([YuvBuffer, { default: YuvCanvas }]) => ({
|
|
9
|
-
YuvBuffer, YuvCanvas
|
|
10
|
-
}));
|
|
11
|
-
}
|
|
12
|
-
return cachedInitializePromise;
|
|
13
|
-
}
|
|
14
|
-
export class TinyH264Decoder {
|
|
15
|
-
maxProfile = AndroidCodecProfile.Baseline;
|
|
16
|
-
maxLevel = AndroidCodecLevel.Level4;
|
|
17
|
-
_renderer;
|
|
18
|
-
get renderer() { return this._renderer; }
|
|
19
|
-
_frameRendered = 0;
|
|
20
|
-
get frameRendered() { return this._frameRendered; }
|
|
21
|
-
_writable;
|
|
22
|
-
get writable() { return this._writable; }
|
|
23
|
-
_yuvCanvas;
|
|
24
|
-
_initializer;
|
|
25
|
-
constructor() {
|
|
26
|
-
initialize();
|
|
27
|
-
this._renderer = document.createElement('canvas');
|
|
28
|
-
this._writable = new WritableStream({
|
|
29
|
-
write: async (packet) => {
|
|
30
|
-
switch (packet.type) {
|
|
31
|
-
case 'configuration':
|
|
32
|
-
this.configure(packet.data);
|
|
33
|
-
break;
|
|
34
|
-
case 'frame':
|
|
35
|
-
if (!this._initializer) {
|
|
36
|
-
throw new Error('Decoder not initialized');
|
|
37
|
-
}
|
|
38
|
-
const wrapper = await this._initializer.promise;
|
|
39
|
-
wrapper.feed(packet.data.slice().buffer);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
async configure(config) {
|
|
46
|
-
this.dispose();
|
|
47
|
-
this._initializer = new PromiseResolver();
|
|
48
|
-
const { YuvBuffer, YuvCanvas } = await initialize();
|
|
49
|
-
if (!this._yuvCanvas) {
|
|
50
|
-
this._yuvCanvas = YuvCanvas.attach(this._renderer);
|
|
51
|
-
;
|
|
52
|
-
}
|
|
53
|
-
const { encodedWidth, encodedHeight } = config;
|
|
54
|
-
const chromaWidth = encodedWidth / 2;
|
|
55
|
-
const chromaHeight = encodedHeight / 2;
|
|
56
|
-
this._renderer.width = config.croppedWidth;
|
|
57
|
-
this._renderer.height = config.croppedHeight;
|
|
58
|
-
const format = YuvBuffer.format({
|
|
59
|
-
width: encodedWidth,
|
|
60
|
-
height: encodedHeight,
|
|
61
|
-
chromaWidth,
|
|
62
|
-
chromaHeight,
|
|
63
|
-
cropLeft: config.cropLeft,
|
|
64
|
-
cropTop: config.cropTop,
|
|
65
|
-
cropWidth: config.croppedWidth,
|
|
66
|
-
cropHeight: config.croppedHeight,
|
|
67
|
-
displayWidth: config.croppedWidth,
|
|
68
|
-
displayHeight: config.croppedHeight,
|
|
69
|
-
});
|
|
70
|
-
const wrapper = await createTinyH264Wrapper();
|
|
71
|
-
this._initializer.resolve(wrapper);
|
|
72
|
-
const uPlaneOffset = encodedWidth * encodedHeight;
|
|
73
|
-
const vPlaneOffset = uPlaneOffset + chromaWidth * chromaHeight;
|
|
74
|
-
wrapper.onPictureReady(({ data }) => {
|
|
75
|
-
this._frameRendered += 1;
|
|
76
|
-
const array = new Uint8Array(data);
|
|
77
|
-
const frame = YuvBuffer.frame(format, YuvBuffer.lumaPlane(format, array, encodedWidth, 0), YuvBuffer.chromaPlane(format, array, chromaWidth, uPlaneOffset), YuvBuffer.chromaPlane(format, array, chromaWidth, vPlaneOffset));
|
|
78
|
-
this._yuvCanvas.drawFrame(frame);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
dispose() {
|
|
82
|
-
this._initializer?.promise.then(wrapper => wrapper.dispose());
|
|
83
|
-
this._initializer = undefined;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decoder/tinyh264/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAAE,qBAAqB,EAAwB,MAAM,cAAc,CAAC;AAE3E,IAAI,uBAAyI,CAAC;AAC9I,SAAS,UAAU;IACf,IAAI,CAAC,uBAAuB,EAAE;QAC1B,uBAAuB,GAAG,OAAO,CAAC,GAAG,CACjC,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAC/C,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YAC7C,SAAS,EAAE,SAAS;SACvB,CAAC,CAAC,CAAC;KACP;IAED,OAAO,uBAAuB,CAAC;AACnC,CAAC;AAED,MAAM,OAAO,eAAe;IACR,UAAU,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IAE1C,QAAQ,GAAG,iBAAiB,CAAC,MAAM,C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MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC,EACnD,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,CAAC,EAC/D,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,CAAC,CAClE,CAAC;YACF,IAAI,CAAC,UAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;IAClC,CAAC;CACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/decoder/tinyh264/worker.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/decoder/tinyh264/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,IAAI,EAAE,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AutoDisposable } from '@yume-chan/event';
|
|
2
|
-
export interface PictureReadyEventArgs {
|
|
3
|
-
renderStateId: number;
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
data: ArrayBuffer;
|
|
7
|
-
}
|
|
8
|
-
export declare class TinyH264Wrapper extends AutoDisposable {
|
|
9
|
-
readonly streamId: number;
|
|
10
|
-
private readonly pictureReadyEvent;
|
|
11
|
-
get onPictureReady(): {
|
|
12
|
-
(listener: import("@yume-chan/event").EventListener<PictureReadyEventArgs, unknown, [], unknown>): import("@yume-chan/event").RemoveEventListener;
|
|
13
|
-
<TThis, TArgs extends unknown[]>(listener: import("@yume-chan/event").EventListener<PictureReadyEventArgs, TThis, TArgs, unknown>, thisArg: TThis, ...args: TArgs): import("@yume-chan/event").RemoveEventListener;
|
|
14
|
-
};
|
|
15
|
-
constructor(streamId: number);
|
|
16
|
-
private handlePictureReady;
|
|
17
|
-
feed(data: ArrayBuffer): void;
|
|
18
|
-
dispose(): void;
|
|
19
|
-
}
|
|
20
|
-
export declare function createTinyH264Wrapper(): Promise<TinyH264Wrapper>;
|
|
21
|
-
//# sourceMappingURL=wrapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../src/decoder/tinyh264/wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAA4B,MAAM,kBAAkB,CAAC;AAO5E,MAAM,WAAW,qBAAqB;IAClC,aAAa,EAAE,MAAM,CAAC;IAEtB,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,EAAE,MAAM,CAAC;IAEf,IAAI,EAAE,WAAW,CAAC;CACrB;AAcD,qBAAa,eAAgB,SAAQ,cAAc;IAC/C,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA6C;IAC/E,IAAW,cAAc;;;MAA2C;gBAEjD,QAAQ,EAAE,MAAM;IAOnC,OAAO,CAAC,kBAAkB,CAExB;IAEK,IAAI,CAAC,IAAI,EAAE,WAAW;IAUb,OAAO;CAO1B;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC,CA8BhE"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { PromiseResolver } from '@yume-chan/async';
|
|
2
|
-
import { AutoDisposable, EventEmitter } from '@yume-chan/event';
|
|
3
|
-
let worker;
|
|
4
|
-
let workerReady = false;
|
|
5
|
-
const pendingResolvers = [];
|
|
6
|
-
let streamId = 0;
|
|
7
|
-
const PICTURE_READY_SUBSCRIPTIONS = new Map();
|
|
8
|
-
function subscribePictureReady(streamId, handler) {
|
|
9
|
-
PICTURE_READY_SUBSCRIPTIONS.set(streamId, handler);
|
|
10
|
-
return {
|
|
11
|
-
dispose() {
|
|
12
|
-
PICTURE_READY_SUBSCRIPTIONS.delete(streamId);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export class TinyH264Wrapper extends AutoDisposable {
|
|
17
|
-
streamId;
|
|
18
|
-
pictureReadyEvent = new EventEmitter();
|
|
19
|
-
get onPictureReady() { return this.pictureReadyEvent.event; }
|
|
20
|
-
constructor(streamId) {
|
|
21
|
-
super();
|
|
22
|
-
this.streamId = streamId;
|
|
23
|
-
this.addDisposable(subscribePictureReady(streamId, this.handlePictureReady));
|
|
24
|
-
}
|
|
25
|
-
handlePictureReady = (e) => {
|
|
26
|
-
this.pictureReadyEvent.fire(e);
|
|
27
|
-
};
|
|
28
|
-
feed(data) {
|
|
29
|
-
worker.postMessage({
|
|
30
|
-
type: 'decode',
|
|
31
|
-
data: data,
|
|
32
|
-
offset: 0,
|
|
33
|
-
length: data.byteLength,
|
|
34
|
-
renderStateId: this.streamId,
|
|
35
|
-
}, [data]);
|
|
36
|
-
}
|
|
37
|
-
dispose() {
|
|
38
|
-
super.dispose();
|
|
39
|
-
worker.postMessage({
|
|
40
|
-
type: 'release',
|
|
41
|
-
renderStateId: this.streamId,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export function createTinyH264Wrapper() {
|
|
46
|
-
if (!worker) {
|
|
47
|
-
worker = new Worker(new URL('./worker.js', import.meta.url));
|
|
48
|
-
worker.addEventListener('message', (e) => {
|
|
49
|
-
const { data } = e;
|
|
50
|
-
switch (data.type) {
|
|
51
|
-
case 'decoderReady':
|
|
52
|
-
workerReady = true;
|
|
53
|
-
for (const resolver of pendingResolvers) {
|
|
54
|
-
resolver.resolve(new TinyH264Wrapper(streamId));
|
|
55
|
-
streamId += 1;
|
|
56
|
-
}
|
|
57
|
-
pendingResolvers.length = 0;
|
|
58
|
-
break;
|
|
59
|
-
case 'pictureReady':
|
|
60
|
-
PICTURE_READY_SUBSCRIPTIONS.get(data.renderStateId)?.(data);
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
if (!workerReady) {
|
|
66
|
-
const resolver = new PromiseResolver();
|
|
67
|
-
pendingResolvers.push(resolver);
|
|
68
|
-
return resolver.promise;
|
|
69
|
-
}
|
|
70
|
-
const decoder = new TinyH264Wrapper(streamId);
|
|
71
|
-
streamId += 1;
|
|
72
|
-
return Promise.resolve(decoder);
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=wrapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../../src/decoder/tinyh264/wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAc,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE5E,IAAI,MAA0B,CAAC;AAC/B,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,MAAM,gBAAgB,GAAuC,EAAE,CAAC;AAChE,IAAI,QAAQ,GAAG,CAAC,CAAC;AAYjB,MAAM,2BAA2B,GAAG,IAAI,GAAG,EAA8C,CAAC;AAE1F,SAAS,qBAAqB,CAAC,QAAgB,EAAE,OAA2C;IACxF,2BAA2B,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAEnD,OAAO;QACH,OAAO;YACH,2BAA2B,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACjD,CAAC;KACJ,CAAC;AACN,CAAC;AAED,MAAM,OAAO,eAAgB,SAAQ,cAAc;IAC/B,QAAQ,CAAS;IAEhB,iBAAiB,GAAG,IAAI,YAAY,EAAyB,CAAC;IAC/E,IAAW,cAAc,KAAK,OAAO,IAAI,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AC,OAAO,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;wBAChD,QAAQ,IAAI,CAAC,CAAC;qBACjB;oBACD,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;oBAC5B,MAAM;gBACV,KAAK,cAAc;oBACf,2BAA2B,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;oBAC5D,MAAM;aACb;QACL,CAAC,CAAC,CAAC;KACN;IAED,IAAI,CAAC,WAAW,EAAE;QACd,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAmB,CAAC;QACxD,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,OAAO,QAAQ,CAAC,OAAO,CAAC;KAC3B;IAED,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC9C,QAAQ,IAAI,CAAC,CAAC;IACd,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC"}
|
package/esm/decoder/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/decoder/types.ts"],"names":[],"mappings":""}
|
package/esm/decoder/types.js
DELETED
package/esm/decoder/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/decoder/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { WritableStream } from '@yume-chan/stream-extra';
|
|
2
|
-
import type { ScrcpyVideoStreamPacket } from '../../options/index.js';
|
|
3
|
-
import type { H264Decoder } from '../types.js';
|
|
4
|
-
export declare class WebCodecsDecoder implements H264Decoder {
|
|
5
|
-
readonly maxProfile: undefined;
|
|
6
|
-
readonly maxLevel: undefined;
|
|
7
|
-
private _writable;
|
|
8
|
-
get writable(): WritableStream<ScrcpyVideoStreamPacket>;
|
|
9
|
-
private _renderer;
|
|
10
|
-
get renderer(): HTMLCanvasElement;
|
|
11
|
-
private _frameRendered;
|
|
12
|
-
get frameRendered(): number;
|
|
13
|
-
private context;
|
|
14
|
-
private decoder;
|
|
15
|
-
private lastFrame;
|
|
16
|
-
private animationFrame;
|
|
17
|
-
constructor();
|
|
18
|
-
private render;
|
|
19
|
-
private configure;
|
|
20
|
-
dispose(): void;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decoder/web-codecs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,aAAa,CAAC;AAMlE,qBAAa,gBAAiB,YAAW,WAAW;IAGhD,SAAgB,UAAU,YAAa;IACvC,SAAgB,QAAQ,YAAa;IAErC,OAAO,CAAC,SAAS,CAA0C;IAC3D,IAAW,QAAQ,4CAA6B;IAEhD,OAAO,CAAC,SAAS,CAAoB;IACrC,IAAW,QAAQ,sBAA6B;IAEhD,OAAO,CAAC,cAAc,CAAK;IAC3B,IAAW,aAAa,WAAkC;IAE1D,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,OAAO,CAAe;IAG9B,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,cAAc,CAAa;;IAwCnC,OAAO,CAAC,MAAM,CASZ;IAEF,OAAO,CAAC,SAAS;IAeV,OAAO;CAIjB"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { WritableStream } from '@yume-chan/stream-extra';
|
|
2
|
-
function toHex(value) {
|
|
3
|
-
return value.toString(16).padStart(2, '0').toUpperCase();
|
|
4
|
-
}
|
|
5
|
-
export class WebCodecsDecoder {
|
|
6
|
-
// Usually, browsers can decode most configurations,
|
|
7
|
-
// So let device choose best profile and level for itself.
|
|
8
|
-
maxProfile = undefined;
|
|
9
|
-
maxLevel = undefined;
|
|
10
|
-
_writable;
|
|
11
|
-
get writable() { return this._writable; }
|
|
12
|
-
_renderer;
|
|
13
|
-
get renderer() { return this._renderer; }
|
|
14
|
-
_frameRendered = 0;
|
|
15
|
-
get frameRendered() { return this._frameRendered; }
|
|
16
|
-
context;
|
|
17
|
-
decoder;
|
|
18
|
-
// Limit FPS to system refresh rate
|
|
19
|
-
lastFrame;
|
|
20
|
-
animationFrame = 0;
|
|
21
|
-
constructor() {
|
|
22
|
-
this._renderer = document.createElement('canvas');
|
|
23
|
-
this.context = this._renderer.getContext('2d');
|
|
24
|
-
this.decoder = new VideoDecoder({
|
|
25
|
-
output: (frame) => {
|
|
26
|
-
if (this.lastFrame) {
|
|
27
|
-
this.lastFrame.close();
|
|
28
|
-
}
|
|
29
|
-
this.lastFrame = frame;
|
|
30
|
-
if (!this.animationFrame) {
|
|
31
|
-
// Start render loop on first frame
|
|
32
|
-
this.render();
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
error() { },
|
|
36
|
-
});
|
|
37
|
-
this._writable = new WritableStream({
|
|
38
|
-
write: async (packet) => {
|
|
39
|
-
switch (packet.type) {
|
|
40
|
-
case 'configuration':
|
|
41
|
-
this.configure(packet.data);
|
|
42
|
-
break;
|
|
43
|
-
case 'frame':
|
|
44
|
-
this.decoder.decode(new EncodedVideoChunk({
|
|
45
|
-
// Treat `undefined` as `key`, otherwise won't decode.
|
|
46
|
-
type: packet.keyframe === false ? 'delta' : 'key',
|
|
47
|
-
timestamp: 0,
|
|
48
|
-
data: packet.data,
|
|
49
|
-
}));
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
render = () => {
|
|
56
|
-
if (this.lastFrame) {
|
|
57
|
-
this._frameRendered += 1;
|
|
58
|
-
this.context.drawImage(this.lastFrame, 0, 0);
|
|
59
|
-
this.lastFrame.close();
|
|
60
|
-
this.lastFrame = undefined;
|
|
61
|
-
}
|
|
62
|
-
this.animationFrame = requestAnimationFrame(this.render);
|
|
63
|
-
};
|
|
64
|
-
configure(config) {
|
|
65
|
-
const { profileIndex, constraintSet, levelIndex } = config;
|
|
66
|
-
this._renderer.width = config.croppedWidth;
|
|
67
|
-
this._renderer.height = config.croppedHeight;
|
|
68
|
-
// https://www.rfc-editor.org/rfc/rfc6381#section-3.3
|
|
69
|
-
// ISO Base Media File Format Name Space
|
|
70
|
-
const codec = `avc1.${[profileIndex, constraintSet, levelIndex].map(toHex).join('')}`;
|
|
71
|
-
this.decoder.configure({
|
|
72
|
-
codec: codec,
|
|
73
|
-
optimizeForLatency: true,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
dispose() {
|
|
77
|
-
cancelAnimationFrame(this.animationFrame);
|
|
78
|
-
this.decoder.close();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decoder/web-codecs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAKzD,SAAS,KAAK,CAAC,KAAa;IACxB,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAC7D,CAAC;AAED,MAAM,OAAO,gBAAgB;IACzB,oDAAoD;IACpD,0DAA0D;IAC1C,UAAU,GAAG,SAAS,CAAC;IACvB,QAAQ,GAAG,SAAS,CAAC;IAE7B,SAAS,CAA0C;IAC3D,IAAW,QAAQ,KAAK,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAExC,SAAS,CAAoB;IACrC,IAAW,QAAQ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{"version":3,"file":"1_22.d.ts","sourceRoot":"","sources":["../../src/options/1_22.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAE1E,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAChE,eAAe,EAAE,OAAO,CAAC;IAEzB;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,oCAAoC;;;;;;;;;wBAGxB,CAAC;AAE1B,oBAAY,oCAAoC,GAC5C,OAAO,oCAAoC,CAAC,OAAO,CAAC,CAAC;AAEzD,qBAAa,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,CAClF,SAAQ,iBAAiB,CAAC,CAAC,CAAC;gBACT,IAAI,EAAE,OAAO,CAAC,qBAAqB,CAAC;IAWvC,eAAe,IAAI,CAAC;IAUpB,mCAAmC,CAC/C,OAAO,EAAE,oCAAoC,GAC9C,UAAU;CAGhB"}
|
package/esm/options/1_22.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"1_22.js","sourceRoot":"","sources":["../../src/options/1_22.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,oCAAoC,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAA8B,MAAM,WAAW,CAAC;AA2B1E,MAAM,CAAC,MAAM,oCAAoC,GAC7C,IAAI,MAAM,EAAE;KACP,MAAM,CAAC,oCAAoC,CAAC;KAC5C,KAAK,CAAC,SAAS,CAAC,CAAC;AAK1B,MAAM,OAAO,iBACT,SAAQ,iBAAoB;IAC5B,YAAmB,IAAoC;QACnD,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,iDAAiD;YACjD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;YAC5B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC3B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;SAC9B;QAED,KAAK,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEe,eAAe;QAC3B,OAAO;YACH,GAAG,KAAK,CAAC,eAAe,EAAE;YAC1B,eAAe,EAAE,IAAI;YACrB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,IAAI;YACnB,cAAc,EAAE,KAAK;SACxB,CAAC;IACN,CAAC;IAEe,mCAAmC,CAC/C,OAA6C;QAE7C,OAAO,oCAAoC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC;CACJ"}
|
package/src/options/1_16/sps.ts
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
// cspell: ignore golomb
|
|
2
|
-
// cspell: ignore qpprime
|
|
3
|
-
|
|
4
|
-
class BitReader {
|
|
5
|
-
private buffer: Uint8Array;
|
|
6
|
-
|
|
7
|
-
private bytePosition = 0;
|
|
8
|
-
|
|
9
|
-
private bitPosition = 0;
|
|
10
|
-
|
|
11
|
-
public constructor(buffer: Uint8Array) {
|
|
12
|
-
this.buffer = buffer;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public read(length: number): number {
|
|
16
|
-
let result = 0;
|
|
17
|
-
for (let i = 0; i < length; i += 1) {
|
|
18
|
-
result = (result << 1) | this.next();
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public next(): number {
|
|
24
|
-
const value = (this.buffer[this.bytePosition]! >> (7 - this.bitPosition)) & 1;
|
|
25
|
-
this.bitPosition += 1;
|
|
26
|
-
if (this.bitPosition === 8) {
|
|
27
|
-
this.bytePosition += 1;
|
|
28
|
-
this.bitPosition = 0;
|
|
29
|
-
}
|
|
30
|
-
return value;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public decodeExponentialGolombNumber(): number {
|
|
34
|
-
let length = 0;
|
|
35
|
-
while (this.next() === 0) {
|
|
36
|
-
length += 1;
|
|
37
|
-
}
|
|
38
|
-
if (length === 0) {
|
|
39
|
-
return 0;
|
|
40
|
-
}
|
|
41
|
-
return (1 << length | this.read(length)) - 1;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function* iterateNalu(buffer: Uint8Array): Generator<Uint8Array> {
|
|
46
|
-
// -1 means we haven't found the first start code
|
|
47
|
-
let start = -1;
|
|
48
|
-
let writeIndex = 0;
|
|
49
|
-
|
|
50
|
-
// How many `0x00`s in a row we have counted
|
|
51
|
-
let zeroCount = 0;
|
|
52
|
-
|
|
53
|
-
let inEmulation = false;
|
|
54
|
-
|
|
55
|
-
for (const byte of buffer) {
|
|
56
|
-
buffer[writeIndex] = byte;
|
|
57
|
-
writeIndex += 1;
|
|
58
|
-
|
|
59
|
-
if (inEmulation) {
|
|
60
|
-
if (byte > 0x03) {
|
|
61
|
-
// `0x00000304` or larger are invalid
|
|
62
|
-
throw new Error('Invalid data');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
inEmulation = false;
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (byte == 0x00) {
|
|
70
|
-
zeroCount += 1;
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const lastZeroCount = zeroCount;
|
|
75
|
-
zeroCount = 0;
|
|
76
|
-
|
|
77
|
-
if (start === -1) {
|
|
78
|
-
// 0x000001 is the start code
|
|
79
|
-
// But it can be preceded by any number of zeros
|
|
80
|
-
// So 2 is the minimal
|
|
81
|
-
if (lastZeroCount >= 2 && byte === 0x01) {
|
|
82
|
-
// Found start of first NAL unit
|
|
83
|
-
writeIndex = 0;
|
|
84
|
-
start = 0;
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Not begin with start code
|
|
89
|
-
throw new Error('Invalid data');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (lastZeroCount < 2) {
|
|
93
|
-
// zero or one `0x00`s are acceptable
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (byte === 0x01) {
|
|
98
|
-
// Remove all leading `0x00`s and this `0x01`
|
|
99
|
-
writeIndex -= lastZeroCount + 1;
|
|
100
|
-
|
|
101
|
-
// Found another NAL unit
|
|
102
|
-
yield buffer.subarray(start, writeIndex);
|
|
103
|
-
|
|
104
|
-
start = writeIndex;
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (lastZeroCount > 2) {
|
|
109
|
-
// Too much `0x00`s
|
|
110
|
-
throw new Error('Invalid data');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
switch (byte) {
|
|
114
|
-
case 0x02:
|
|
115
|
-
// Didn't find why, but 7.4.1 NAL unit semantics forbids `0x000002` appearing in NAL units
|
|
116
|
-
throw new Error('Invalid data');
|
|
117
|
-
case 0x03:
|
|
118
|
-
// `0x000003` is the "emulation_prevention_three_byte"
|
|
119
|
-
// `0x00000300`, `0x00000301`, `0x00000302` and `0x00000303` represent
|
|
120
|
-
// `0x000000`, `0x000001`, `0x000002` and `0x000003` respectively
|
|
121
|
-
|
|
122
|
-
// Remove current byte
|
|
123
|
-
writeIndex -= 1;
|
|
124
|
-
|
|
125
|
-
inEmulation = true;
|
|
126
|
-
break;
|
|
127
|
-
default:
|
|
128
|
-
// `0x000004` or larger are ok
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (inEmulation || zeroCount !== 0) {
|
|
134
|
-
throw new Error('Invalid data');
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
yield buffer.subarray(start, writeIndex);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// 7.3.2.1.1 Sequence parameter set data syntax
|
|
141
|
-
export function parse_sequence_parameter_set(buffer: ArrayBuffer) {
|
|
142
|
-
for (const nalu of iterateNalu(new Uint8Array(buffer))) {
|
|
143
|
-
const reader = new BitReader(nalu);
|
|
144
|
-
if (reader.next() !== 0) {
|
|
145
|
-
throw new Error('Invalid data');
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const nal_ref_idc = reader.read(2);
|
|
149
|
-
const nal_unit_type = reader.read(5);
|
|
150
|
-
|
|
151
|
-
if (nal_unit_type !== 7) {
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (nal_ref_idc === 0) {
|
|
156
|
-
throw new Error('Invalid data');
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const profile_idc = reader.read(8);
|
|
160
|
-
const constraint_set = reader.read(8);
|
|
161
|
-
|
|
162
|
-
const constraint_set_reader = new BitReader(new Uint8Array([constraint_set]));
|
|
163
|
-
const constraint_set0_flag = !!constraint_set_reader.next();
|
|
164
|
-
const constraint_set1_flag = !!constraint_set_reader.next();
|
|
165
|
-
const constraint_set2_flag = !!constraint_set_reader.next();
|
|
166
|
-
const constraint_set3_flag = !!constraint_set_reader.next();
|
|
167
|
-
const constraint_set4_flag = !!constraint_set_reader.next();
|
|
168
|
-
const constraint_set5_flag = !!constraint_set_reader.next();
|
|
169
|
-
|
|
170
|
-
// reserved_zero_2bits
|
|
171
|
-
if (constraint_set_reader.read(2) !== 0) {
|
|
172
|
-
throw new Error('Invalid data');
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const level_idc = reader.read(8);
|
|
176
|
-
const seq_parameter_set_id = reader.decodeExponentialGolombNumber();
|
|
177
|
-
|
|
178
|
-
if (profile_idc === 100 || profile_idc === 110 ||
|
|
179
|
-
profile_idc === 122 || profile_idc === 244 || profile_idc === 44 ||
|
|
180
|
-
profile_idc === 83 || profile_idc === 86 || profile_idc === 118 ||
|
|
181
|
-
profile_idc === 128 || profile_idc === 138 || profile_idc === 139 ||
|
|
182
|
-
profile_idc === 134) {
|
|
183
|
-
const chroma_format_idc = reader.decodeExponentialGolombNumber();
|
|
184
|
-
if (chroma_format_idc === 3) {
|
|
185
|
-
// separate_colour_plane_flag
|
|
186
|
-
reader.next();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// bit_depth_luma_minus8
|
|
190
|
-
reader.decodeExponentialGolombNumber();
|
|
191
|
-
// bit_depth_chroma_minus8
|
|
192
|
-
reader.decodeExponentialGolombNumber();
|
|
193
|
-
|
|
194
|
-
// qpprime_y_zero_transform_bypass_flag
|
|
195
|
-
reader.next();
|
|
196
|
-
|
|
197
|
-
const seq_scaling_matrix_present_flag = !!reader.next();
|
|
198
|
-
if (seq_scaling_matrix_present_flag) {
|
|
199
|
-
const seq_scaling_list_present_flag: boolean[] = [];
|
|
200
|
-
for (let i = 0; i < ((chroma_format_idc !== 3) ? 8 : 12); i++) {
|
|
201
|
-
seq_scaling_list_present_flag[i] = !!reader.next();
|
|
202
|
-
if (seq_scaling_list_present_flag[i])
|
|
203
|
-
if (i < 6) {
|
|
204
|
-
// TODO
|
|
205
|
-
// scaling_list( ScalingList4x4[ i ], 16,
|
|
206
|
-
// UseDefaultScalingMatrix4x4Flag[ i ])
|
|
207
|
-
} else {
|
|
208
|
-
// TODO
|
|
209
|
-
// scaling_list( ScalingList8x8[ i − 6 ], 64,
|
|
210
|
-
// UseDefaultScalingMatrix8x8Flag[ i − 6 ] )
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// log2_max_frame_num_minus4
|
|
217
|
-
reader.decodeExponentialGolombNumber();
|
|
218
|
-
const pic_order_cnt_type = reader.decodeExponentialGolombNumber();
|
|
219
|
-
if (pic_order_cnt_type === 0) {
|
|
220
|
-
// log2_max_pic_order_cnt_lsb_minus4
|
|
221
|
-
reader.decodeExponentialGolombNumber();
|
|
222
|
-
} else if (pic_order_cnt_type === 1) {
|
|
223
|
-
// delta_pic_order_always_zero_flag
|
|
224
|
-
reader.next();
|
|
225
|
-
// offset_for_non_ref_pic
|
|
226
|
-
reader.decodeExponentialGolombNumber();
|
|
227
|
-
// offset_for_top_to_bottom_field
|
|
228
|
-
reader.decodeExponentialGolombNumber();
|
|
229
|
-
const num_ref_frames_in_pic_order_cnt_cycle = reader.decodeExponentialGolombNumber();
|
|
230
|
-
const offset_for_ref_frame: number[] = [];
|
|
231
|
-
for (let i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++) {
|
|
232
|
-
offset_for_ref_frame[i] = reader.decodeExponentialGolombNumber();
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// max_num_ref_frames
|
|
237
|
-
reader.decodeExponentialGolombNumber();
|
|
238
|
-
// gaps_in_frame_num_value_allowed_flag
|
|
239
|
-
reader.next();
|
|
240
|
-
const pic_width_in_mbs_minus1 = reader.decodeExponentialGolombNumber();
|
|
241
|
-
const pic_height_in_map_units_minus1 = reader.decodeExponentialGolombNumber();
|
|
242
|
-
|
|
243
|
-
const frame_mbs_only_flag = reader.next();
|
|
244
|
-
if (!frame_mbs_only_flag) {
|
|
245
|
-
// mb_adaptive_frame_field_flag
|
|
246
|
-
reader.next();
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// direct_8x8_inference_flag
|
|
250
|
-
reader.next();
|
|
251
|
-
|
|
252
|
-
const frame_cropping_flag = !!reader.next();
|
|
253
|
-
let frame_crop_left_offset: number;
|
|
254
|
-
let frame_crop_right_offset: number;
|
|
255
|
-
let frame_crop_top_offset: number;
|
|
256
|
-
let frame_crop_bottom_offset: number;
|
|
257
|
-
if (frame_cropping_flag) {
|
|
258
|
-
frame_crop_left_offset = reader.decodeExponentialGolombNumber();
|
|
259
|
-
frame_crop_right_offset = reader.decodeExponentialGolombNumber();
|
|
260
|
-
frame_crop_top_offset = reader.decodeExponentialGolombNumber();
|
|
261
|
-
frame_crop_bottom_offset = reader.decodeExponentialGolombNumber();
|
|
262
|
-
} else {
|
|
263
|
-
frame_crop_left_offset = 0;
|
|
264
|
-
frame_crop_right_offset = 0;
|
|
265
|
-
frame_crop_top_offset = 0;
|
|
266
|
-
frame_crop_bottom_offset = 0;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
const vui_parameters_present_flag = !!reader.next();
|
|
270
|
-
if (vui_parameters_present_flag) {
|
|
271
|
-
// TODO
|
|
272
|
-
// vui_parameters( )
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
return {
|
|
276
|
-
profile_idc,
|
|
277
|
-
constraint_set,
|
|
278
|
-
constraint_set0_flag,
|
|
279
|
-
constraint_set1_flag,
|
|
280
|
-
constraint_set2_flag,
|
|
281
|
-
constraint_set3_flag,
|
|
282
|
-
constraint_set4_flag,
|
|
283
|
-
constraint_set5_flag,
|
|
284
|
-
level_idc,
|
|
285
|
-
seq_parameter_set_id,
|
|
286
|
-
pic_width_in_mbs_minus1,
|
|
287
|
-
pic_height_in_map_units_minus1,
|
|
288
|
-
frame_mbs_only_flag,
|
|
289
|
-
frame_cropping_flag,
|
|
290
|
-
frame_crop_left_offset,
|
|
291
|
-
frame_crop_right_offset,
|
|
292
|
-
frame_crop_top_offset,
|
|
293
|
-
frame_crop_bottom_offset,
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
throw new Error('Invalid data');
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
export type SequenceParameterSet = ReturnType<typeof parse_sequence_parameter_set>;
|