mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-03 17:59:50 +02:00
feat(decoder): add sizeChanged
event
This commit is contained in:
parent
4fbd24fc7f
commit
bef336da08
4 changed files with 23 additions and 1 deletions
|
@ -34,6 +34,7 @@
|
|||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@yume-chan/event": "workspace:^0.0.22",
|
||||
"@yume-chan/scrcpy": "workspace:^0.0.22",
|
||||
"@yume-chan/scrcpy-decoder-tinyh264": "workspace:^0.0.22",
|
||||
"@yume-chan/stream-extra": "workspace:^0.0.22",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { EventEmitter } from "@yume-chan/event";
|
||||
import type {
|
||||
ScrcpyMediaStreamDataPacket,
|
||||
ScrcpyMediaStreamPacket,
|
||||
|
@ -62,6 +63,11 @@ export class WebCodecsDecoder implements ScrcpyVideoDecoder {
|
|||
return this.#frameSkipped;
|
||||
}
|
||||
|
||||
#sizeChanged = new EventEmitter<{ width: number; height: number }>();
|
||||
get sizeChanged() {
|
||||
return this.#sizeChanged.event;
|
||||
}
|
||||
|
||||
#context: CanvasRenderingContext2D;
|
||||
#decoder: VideoDecoder;
|
||||
#config: Uint8Array | undefined;
|
||||
|
@ -132,6 +138,10 @@ export class WebCodecsDecoder implements ScrcpyVideoDecoder {
|
|||
|
||||
this.#renderer.width = croppedWidth;
|
||||
this.#renderer.height = croppedHeight;
|
||||
this.#sizeChanged.fire({
|
||||
width: croppedWidth,
|
||||
height: croppedHeight,
|
||||
});
|
||||
|
||||
// https://www.rfc-editor.org/rfc/rfc6381#section-3.3
|
||||
// ISO Base Media File Format Name Space
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue