@yume-chan/scrcpy 0.0.17 → 0.0.18

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.
Files changed (214) hide show
  1. package/CHANGELOG.json +21 -3
  2. package/CHANGELOG.md +13 -4
  3. package/LICENSE +1 -1
  4. package/README.md +41 -24
  5. package/bin/scrcpy-server +0 -0
  6. package/bin/version.d.ts +1 -1
  7. package/bin/version.js +1 -1
  8. package/esm/adb/client.d.ts +15 -14
  9. package/esm/adb/client.d.ts.map +1 -1
  10. package/esm/adb/client.js +66 -41
  11. package/esm/adb/client.js.map +1 -1
  12. package/esm/adb/connection.d.ts +16 -7
  13. package/esm/adb/connection.d.ts.map +1 -1
  14. package/esm/adb/connection.js +21 -13
  15. package/esm/adb/connection.js.map +1 -1
  16. package/esm/adb/options/1_16.d.ts +4 -4
  17. package/esm/adb/options/1_16.d.ts.map +1 -1
  18. package/esm/adb/options/1_16.js +2 -2
  19. package/esm/adb/options/1_16.js.map +1 -1
  20. package/esm/adb/options/1_22.d.ts +4 -4
  21. package/esm/adb/options/1_22.d.ts.map +1 -1
  22. package/esm/adb/options/1_22.js +2 -2
  23. package/esm/adb/options/1_22.js.map +1 -1
  24. package/esm/adb/options/types.d.ts +10 -9
  25. package/esm/adb/options/types.d.ts.map +1 -1
  26. package/esm/adb/options/types.js +11 -4
  27. package/esm/adb/options/types.js.map +1 -1
  28. package/esm/control/back-or-screen-on.d.ts +3 -0
  29. package/esm/control/back-or-screen-on.d.ts.map +1 -0
  30. package/esm/control/back-or-screen-on.js +2 -0
  31. package/esm/control/back-or-screen-on.js.map +1 -0
  32. package/esm/control/hover-helper.d.ts +18 -0
  33. package/esm/control/hover-helper.d.ts.map +1 -0
  34. package/esm/control/hover-helper.js +44 -0
  35. package/esm/control/hover-helper.js.map +1 -0
  36. package/esm/control/index.d.ts +11 -7
  37. package/esm/control/index.d.ts.map +1 -1
  38. package/esm/control/index.js +11 -7
  39. package/esm/control/index.js.map +1 -1
  40. package/esm/control/inject-keycode.d.ts +12 -4
  41. package/esm/control/inject-keycode.d.ts.map +1 -1
  42. package/esm/control/inject-keycode.js +15 -7
  43. package/esm/control/inject-keycode.js.map +1 -1
  44. package/esm/control/inject-scroll.d.ts +3 -0
  45. package/esm/control/inject-scroll.d.ts.map +1 -0
  46. package/esm/control/inject-scroll.js +2 -0
  47. package/esm/control/inject-scroll.js.map +1 -0
  48. package/esm/control/inject-text.d.ts +2 -2
  49. package/esm/control/inject-text.d.ts.map +1 -1
  50. package/esm/control/inject-touch.d.ts +12 -4
  51. package/esm/control/inject-touch.d.ts.map +1 -1
  52. package/esm/control/inject-touch.js +44 -11
  53. package/esm/control/inject-touch.js.map +1 -1
  54. package/esm/control/rotate-device.d.ts +2 -2
  55. package/esm/control/rotate-device.d.ts.map +1 -1
  56. package/esm/control/serializer.d.ts +22 -11
  57. package/esm/control/serializer.d.ts.map +1 -1
  58. package/esm/control/serializer.js +32 -26
  59. package/esm/control/serializer.js.map +1 -1
  60. package/esm/control/set-clipboard.d.ts +3 -0
  61. package/esm/control/set-clipboard.d.ts.map +1 -0
  62. package/esm/control/set-clipboard.js +2 -0
  63. package/esm/control/set-clipboard.js.map +1 -0
  64. package/esm/control/set-screen-power-mode.d.ts +2 -2
  65. package/esm/control/set-screen-power-mode.d.ts.map +1 -1
  66. package/esm/device-message/ack-clipboard.d.ts +9 -0
  67. package/esm/device-message/ack-clipboard.d.ts.map +1 -0
  68. package/esm/device-message/ack-clipboard.js +6 -0
  69. package/esm/device-message/ack-clipboard.js.map +1 -0
  70. package/esm/device-message/clipboard.d.ts +3 -3
  71. package/esm/device-message/clipboard.d.ts.map +1 -1
  72. package/esm/device-message/clipboard.js +4 -4
  73. package/esm/device-message/clipboard.js.map +1 -1
  74. package/esm/device-message/index.d.ts +4 -3
  75. package/esm/device-message/index.d.ts.map +1 -1
  76. package/esm/device-message/index.js +4 -3
  77. package/esm/device-message/index.js.map +1 -1
  78. package/esm/device-message/stream.d.ts +4 -3
  79. package/esm/device-message/stream.d.ts.map +1 -1
  80. package/esm/device-message/stream.js +8 -4
  81. package/esm/device-message/stream.js.map +1 -1
  82. package/esm/options/1_16/codec-options.d.ts +3 -2
  83. package/esm/options/1_16/codec-options.d.ts.map +1 -1
  84. package/esm/options/1_16/codec-options.js +6 -7
  85. package/esm/options/1_16/codec-options.js.map +1 -1
  86. package/esm/options/1_16/h264-configuration.d.ts +49 -0
  87. package/esm/options/1_16/h264-configuration.d.ts.map +1 -0
  88. package/esm/options/1_16/h264-configuration.js +414 -0
  89. package/esm/options/1_16/h264-configuration.js.map +1 -0
  90. package/esm/options/1_16/index.d.ts +4 -3
  91. package/esm/options/1_16/index.d.ts.map +1 -1
  92. package/esm/options/1_16/index.js +4 -3
  93. package/esm/options/1_16/index.js.map +1 -1
  94. package/esm/options/1_16/options.d.ts +17 -20
  95. package/esm/options/1_16/options.d.ts.map +1 -1
  96. package/esm/options/1_16/options.js +51 -49
  97. package/esm/options/1_16/options.js.map +1 -1
  98. package/esm/options/1_16/scroll.d.ts +27 -0
  99. package/esm/options/1_16/scroll.d.ts.map +1 -0
  100. package/esm/options/1_16/scroll.js +56 -0
  101. package/esm/options/1_16/scroll.js.map +1 -0
  102. package/esm/options/1_16/sps.d.ts +1 -1
  103. package/esm/options/1_16/sps.d.ts.map +1 -1
  104. package/esm/options/1_16/sps.js +25 -17
  105. package/esm/options/1_16/sps.js.map +1 -1
  106. package/esm/options/1_18.d.ts +6 -6
  107. package/esm/options/1_18.d.ts.map +1 -1
  108. package/esm/options/1_18.js +5 -5
  109. package/esm/options/1_18.js.map +1 -1
  110. package/esm/options/1_21.d.ts +12 -1
  111. package/esm/options/1_21.d.ts.map +1 -1
  112. package/esm/options/1_21.js +14 -3
  113. package/esm/options/1_21.js.map +1 -1
  114. package/esm/options/1_22/index.d.ts +3 -0
  115. package/esm/options/1_22/index.d.ts.map +1 -0
  116. package/esm/options/1_22/index.js +3 -0
  117. package/esm/options/1_22/index.js.map +1 -0
  118. package/esm/options/{1_22.d.ts → 1_22/options.d.ts} +4 -15
  119. package/esm/options/1_22/options.d.ts.map +1 -0
  120. package/esm/options/{1_22.js → 1_22/options.js} +5 -9
  121. package/esm/options/1_22/options.js.map +1 -0
  122. package/esm/options/1_22/scroll.d.ts +17 -0
  123. package/esm/options/1_22/scroll.d.ts.map +1 -0
  124. package/esm/options/1_22/scroll.js +15 -0
  125. package/esm/options/1_22/scroll.js.map +1 -0
  126. package/esm/options/1_23.d.ts +3 -3
  127. package/esm/options/1_23.d.ts.map +1 -1
  128. package/esm/options/1_23.js +7 -6
  129. package/esm/options/1_23.js.map +1 -1
  130. package/esm/options/1_25/index.d.ts +3 -0
  131. package/esm/options/1_25/index.d.ts.map +1 -0
  132. package/esm/options/1_25/index.js +3 -0
  133. package/esm/options/1_25/index.js.map +1 -0
  134. package/esm/options/1_25/options.d.ts +6 -0
  135. package/esm/options/1_25/options.d.ts.map +1 -0
  136. package/esm/options/1_25/options.js +8 -0
  137. package/esm/options/1_25/options.js.map +1 -0
  138. package/esm/options/1_25/scroll.d.ts +19 -0
  139. package/esm/options/1_25/scroll.d.ts.map +1 -0
  140. package/esm/options/1_25/scroll.js +33 -0
  141. package/esm/options/1_25/scroll.js.map +1 -0
  142. package/esm/options/index.d.ts +5 -4
  143. package/esm/options/index.d.ts.map +1 -1
  144. package/esm/options/index.js +5 -4
  145. package/esm/options/index.js.map +1 -1
  146. package/esm/options/types.d.ts +14 -12
  147. package/esm/options/types.d.ts.map +1 -1
  148. package/esm/options/types.js +6 -4
  149. package/esm/options/types.js.map +1 -1
  150. package/package.json +19 -12
  151. package/scripts/fetch-server.cjs +19 -9
  152. package/src/adb/client.ts +142 -89
  153. package/src/adb/connection.ts +77 -30
  154. package/src/adb/options/1_16.ts +13 -6
  155. package/src/adb/options/1_22.ts +12 -6
  156. package/src/adb/options/types.ts +34 -14
  157. package/src/control/back-or-screen-on.ts +4 -0
  158. package/src/control/hover-helper.ts +56 -0
  159. package/src/control/index.ts +11 -7
  160. package/src/control/inject-keycode.ts +23 -10
  161. package/src/control/inject-scroll.ts +4 -0
  162. package/src/control/inject-touch.ts +58 -14
  163. package/src/control/serializer.ts +106 -41
  164. package/src/control/set-clipboard.ts +4 -0
  165. package/src/device-message/ack-clipboard.ts +10 -0
  166. package/src/device-message/clipboard.ts +8 -8
  167. package/src/device-message/index.ts +4 -3
  168. package/src/device-message/stream.ts +17 -7
  169. package/src/options/1_16/codec-options.ts +17 -10
  170. package/src/options/1_16/h264-configuration.ts +485 -0
  171. package/src/options/1_16/index.ts +4 -3
  172. package/src/options/1_16/options.ts +175 -130
  173. package/src/options/1_16/scroll.ts +76 -0
  174. package/src/options/1_18.ts +22 -12
  175. package/src/options/1_21.ts +31 -13
  176. package/src/options/1_22/index.ts +2 -0
  177. package/src/options/{1_22.ts → 1_22/options.ts} +8 -17
  178. package/src/options/1_22/scroll.ts +26 -0
  179. package/src/options/1_23.ts +32 -20
  180. package/src/options/1_25/index.ts +2 -0
  181. package/src/options/1_25/options.ts +12 -0
  182. package/src/options/1_25/scroll.ts +52 -0
  183. package/src/options/index.ts +5 -4
  184. package/src/options/types.ts +34 -17
  185. package/tsconfig.build.json +1 -1
  186. package/tsconfig.build.tsbuildinfo +1 -1
  187. package/esm/decoder/index.d.ts +0 -28
  188. package/esm/decoder/index.d.ts.map +0 -1
  189. package/esm/decoder/index.js +0 -2
  190. package/esm/decoder/index.js.map +0 -1
  191. package/esm/decoder/tinyh264/index.d.ts +0 -20
  192. package/esm/decoder/tinyh264/index.d.ts.map +0 -1
  193. package/esm/decoder/tinyh264/index.js +0 -86
  194. package/esm/decoder/tinyh264/index.js.map +0 -1
  195. package/esm/decoder/tinyh264/worker.d.ts +0 -2
  196. package/esm/decoder/tinyh264/worker.d.ts.map +0 -1
  197. package/esm/decoder/tinyh264/worker.js +0 -3
  198. package/esm/decoder/tinyh264/worker.js.map +0 -1
  199. package/esm/decoder/tinyh264/wrapper.d.ts +0 -21
  200. package/esm/decoder/tinyh264/wrapper.d.ts.map +0 -1
  201. package/esm/decoder/tinyh264/wrapper.js +0 -74
  202. package/esm/decoder/tinyh264/wrapper.js.map +0 -1
  203. package/esm/decoder/types.d.ts +0 -2
  204. package/esm/decoder/types.d.ts.map +0 -1
  205. package/esm/decoder/types.js +0 -2
  206. package/esm/decoder/types.js.map +0 -1
  207. package/esm/decoder/web-codecs/index.d.ts +0 -22
  208. package/esm/decoder/web-codecs/index.d.ts.map +0 -1
  209. package/esm/decoder/web-codecs/index.js +0 -81
  210. package/esm/decoder/web-codecs/index.js.map +0 -1
  211. package/esm/options/1_22.d.ts.map +0 -1
  212. package/esm/options/1_22.js.map +0 -1
  213. package/src/options/1_16/sps.ts +0 -300
  214. package/tsconfig.test.tsbuildinfo +0 -1
@@ -1,5 +1,5 @@
1
- import Struct, { placeholder } from '@yume-chan/struct';
2
- import { ScrcpyControlMessageType } from './type.js';
1
+ import Struct, { NumberFieldDefinition, NumberFieldType, placeholder, } from "@yume-chan/struct";
2
+ import { ScrcpyControlMessageType } from "./type.js";
3
3
  // https://developer.android.com/reference/android/view/MotionEvent#constants_1
4
4
  export var AndroidMotionEventAction;
5
5
  (function (AndroidMotionEventAction) {
@@ -17,14 +17,47 @@ export var AndroidMotionEventAction;
17
17
  AndroidMotionEventAction[AndroidMotionEventAction["ButtonPress"] = 11] = "ButtonPress";
18
18
  AndroidMotionEventAction[AndroidMotionEventAction["ButtonRelease"] = 12] = "ButtonRelease";
19
19
  })(AndroidMotionEventAction = AndroidMotionEventAction || (AndroidMotionEventAction = {}));
20
+ // eslint-disable-next-line @typescript-eslint/no-namespace
21
+ export var ScrcpyPointerId;
22
+ (function (ScrcpyPointerId) {
23
+ ScrcpyPointerId.Mouse = BigInt(-1);
24
+ ScrcpyPointerId.Finger = BigInt(-2);
25
+ ScrcpyPointerId.VirtualMouse = BigInt(-3);
26
+ ScrcpyPointerId.VirtualFinger = BigInt(-4);
27
+ })(ScrcpyPointerId = ScrcpyPointerId || (ScrcpyPointerId = {}));
28
+ export function clamp(value, min, max) {
29
+ if (value < min) {
30
+ return min;
31
+ }
32
+ if (value > max) {
33
+ return max;
34
+ }
35
+ return value;
36
+ }
37
+ export const ScrcpyFloatToUint16NumberType = {
38
+ size: 2,
39
+ signed: false,
40
+ deserialize(array, littleEndian) {
41
+ const value = NumberFieldType.Uint16.deserialize(array, littleEndian);
42
+ // https://github.com/Genymobile/scrcpy/blob/1f138aef41de651668043b32c4effc2d4adbfc44/server/src/main/java/com/genymobile/scrcpy/Binary.java#L22
43
+ return value === 0xffff ? 1 : value / 0x10000;
44
+ },
45
+ serialize(dataView, offset, value, littleEndian) {
46
+ // https://github.com/Genymobile/scrcpy/blob/1f138aef41de651668043b32c4effc2d4adbfc44/app/src/util/binary.h#L51
47
+ value = clamp(value, -1, 1);
48
+ value = value === 1 ? 0xffff : value * 0x10000;
49
+ NumberFieldType.Uint16.serialize(dataView, offset, value, littleEndian);
50
+ },
51
+ };
52
+ const ScrcpyFloatToUint16FieldDefinition = new NumberFieldDefinition(ScrcpyFloatToUint16NumberType);
20
53
  export const ScrcpyInjectTouchControlMessage = new Struct()
21
- .uint8('type', ScrcpyControlMessageType.InjectTouch)
22
- .uint8('action', placeholder())
23
- .uint64('pointerId')
24
- .uint32('pointerX')
25
- .uint32('pointerY')
26
- .uint16('screenWidth')
27
- .uint16('screenHeight')
28
- .uint16('pressure')
29
- .uint32('buttons');
54
+ .uint8("type", ScrcpyControlMessageType.InjectTouch)
55
+ .uint8("action", placeholder())
56
+ .uint64("pointerId")
57
+ .uint32("pointerX")
58
+ .uint32("pointerY")
59
+ .uint16("screenWidth")
60
+ .uint16("screenHeight")
61
+ .field("pressure", ScrcpyFloatToUint16FieldDefinition)
62
+ .uint32("buttons");
30
63
  //# sourceMappingURL=inject-touch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"inject-touch.js","sourceRoot":"","sources":["../../src/control/inject-touch.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,WAAW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AAC;QAC5B,KAAK,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,OAAO,CAAC;QAC/C,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC5E,CAAC;CACJ,CAAC;AAEF,MAAM,kCAAkC,GAAG,IAAI,qBAAqB,CAChE,6BAA6B,CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,MAAM,EAAE;KACtD,KAAK,CAAC,MAAM,EAAE,wBAAwB,CAAC,WAAoB,CAAC;KAC5D,KAAK,CAAC,QAAQ,EAAE,WAAW,EAA4B,CAAC;KACxD,MAAM,CAAC,WAAW,CAAC;KACnB,MAAM,CAAC,UAAU,CAAC;KAClB,MAAM,CAAC,UAAU,CAAC;KAClB,MAAM,CAAC,aAAa,CAAC;KACrB,MAAM,CAAC,cAAc,CAAC;KACtB,KAAK,CAAC,UAAU,EAAE,kCAAkC,CAAC;KACrD,MAAM,CAAC,SAAS,CAAC,CAAC"}
@@ -2,6 +2,6 @@ import Struct from '@yume-chan/struct';
2
2
  import { ScrcpyControlMessageType } from './type.js';
3
3
  export declare const ScrcpyRotateDeviceControlMessage: Struct<{
4
4
  type: ScrcpyControlMessageType.RotateDevice;
5
- }, never, {}, undefined>;
6
- export declare type ScrcpyRotateDeviceControlMessage = typeof ScrcpyRotateDeviceControlMessage['TInit'];
5
+ }, never, Record<never, never>, undefined>;
6
+ export type ScrcpyRotateDeviceControlMessage = typeof ScrcpyRotateDeviceControlMessage['TInit'];
7
7
  //# sourceMappingURL=rotate-device.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rotate-device.d.ts","sourceRoot":"","sources":["../../src/control/rotate-device.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,eAAO,MAAM,gCAAgC;;wBAEyB,CAAA;AAEtE,oBAAY,gCAAgC,GACxC,OAAO,gCAAgC,CAAC,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"rotate-device.d.ts","sourceRoot":"","sources":["../../src/control/rotate-device.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,eAAO,MAAM,gCAAgC;;0CAEyB,CAAA;AAEtE,MAAM,MAAM,gCAAgC,GACxC,OAAO,gCAAgC,CAAC,OAAO,CAAC,CAAC"}
@@ -1,20 +1,31 @@
1
- import type { WritableStream } from '@yume-chan/stream-extra';
2
- import type { ScrcpyInjectScrollControlMessage1_22, ScrcpyOptions } from '../options/index.js';
3
- import { AndroidKeyEventAction, ScrcpyInjectKeyCodeControlMessage } from './inject-keycode.js';
4
- import { ScrcpyInjectTouchControlMessage } from './inject-touch.js';
5
- import { AndroidScreenPowerMode } from './set-screen-power-mode.js';
6
- import { ScrcpyControlMessageType } from './type.js';
1
+ import { type WritableStream } from "@yume-chan/stream-extra";
2
+ import { type ScrcpyOptions } from "../options/index.js";
3
+ import { ScrcpyInjectKeyCodeControlMessage, type AndroidKeyEventAction } from "./inject-keycode.js";
4
+ import { type ScrcpyInjectScrollControlMessage } from "./inject-scroll.js";
5
+ import { ScrcpyInjectTouchControlMessage } from "./inject-touch.js";
6
+ import { type AndroidScreenPowerMode } from "./set-screen-power-mode.js";
7
+ import { ScrcpyControlMessageType } from "./type.js";
7
8
  export declare class ScrcpyControlMessageSerializer {
8
9
  private options;
9
10
  /** Control message type values for current version of server */
10
11
  private types;
11
12
  private writer;
12
- constructor(stream: WritableStream<Uint8Array>, options: ScrcpyOptions<any>);
13
- getTypeValue(type: ScrcpyControlMessageType): number;
14
- injectKeyCode(message: Omit<ScrcpyInjectKeyCodeControlMessage, 'type'>): Promise<void>;
13
+ private scrollController;
14
+ constructor(stream: WritableStream<Uint8Array>, options: ScrcpyOptions<object>);
15
+ getActualMessageType(type: ScrcpyControlMessageType): number;
16
+ addMessageType<T extends {
17
+ type: ScrcpyControlMessageType;
18
+ }>(message: Omit<T, "type">, type: T["type"]): T;
19
+ injectKeyCode(message: Omit<ScrcpyInjectKeyCodeControlMessage, "type">): Promise<void>;
15
20
  injectText(text: string): Promise<void>;
16
- injectTouch(message: Omit<ScrcpyInjectTouchControlMessage, 'type'>): Promise<void>;
17
- injectScroll(message: Omit<ScrcpyInjectScrollControlMessage1_22, 'type'>): Promise<void>;
21
+ /**
22
+ * `pressure` is a float value between 0 and 1.
23
+ */
24
+ injectTouch(message: Omit<ScrcpyInjectTouchControlMessage, "type">): Promise<void>;
25
+ /**
26
+ * `scrollX` and `scrollY` are float values between 0 and 1.
27
+ */
28
+ injectScroll(message: Omit<ScrcpyInjectScrollControlMessage, "type">): Promise<void> | undefined;
18
29
  backOrScreenOn(action: AndroidKeyEventAction): Promise<void>;
19
30
  setScreenPowerMode(mode: AndroidScreenPowerMode): Promise<void>;
20
31
  rotateDevice(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/control/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAA+B,MAAM,yBAAyB,CAAC;AAE3F,OAAO,KAAK,EAAE,oCAAoC,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AAE/F,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAA0C,MAAM,4BAA4B,CAAC;AAC5G,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,qBAAa,8BAA8B;IACvC,OAAO,CAAC,OAAO,CAAqB;IACpC,gEAAgE;IAChE,OAAO,CAAC,KAAK,CAA6B;IA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,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC;IAS3B,oBAAoB,CAAC,IAAI,EAAE,wBAAwB,GAAG,MAAM;IAQ5D,cAAc,CAAC,CAAC,SAAS;QAAE,IAAI,EAAE,wBAAwB,CAAA;KAAE,EAC9D,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,EACxB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,GAChB,CAAC;IAKG,aAAa,CAChB,OAAO,EAAE,IAAI,CAAC,iCAAiC,EAAE,MAAM,CAAC;IAYrD,UAAU,CAAC,IAAI,EAAE,MAAM;IAW9B;;OAEG;IACI,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,+BAA+B,EAAE,MAAM,CAAC;IAWzE;;OAEG;IACI,YAAY,CACf,OAAO,EAAE,IAAI,CAAC,gCAAgC,EAAE,MAAM,CAAC;IAa9C,cAAc,CAAC,MAAM,EAAE,qBAAqB;IAalD,kBAAkB,CAAC,IAAI,EAAE,sBAAsB;IAW/C,YAAY;IAUZ,KAAK;CAGf"}
@@ -1,54 +1,61 @@
1
- import { ScrcpyInjectKeyCodeControlMessage } from './inject-keycode.js';
2
- import { ScrcpyInjectTextControlMessage } from './inject-text.js';
3
- import { ScrcpyInjectTouchControlMessage } from './inject-touch.js';
4
- import { ScrcpyRotateDeviceControlMessage } from './rotate-device.js';
5
- import { ScrcpySetScreenPowerModeControlMessage } from './set-screen-power-mode.js';
6
- import { ScrcpyControlMessageType } from './type.js';
1
+ import { ScrcpyInjectKeyCodeControlMessage, } from "./inject-keycode.js";
2
+ import { ScrcpyInjectTextControlMessage } from "./inject-text.js";
3
+ import { ScrcpyInjectTouchControlMessage } from "./inject-touch.js";
4
+ import { ScrcpyRotateDeviceControlMessage } from "./rotate-device.js";
5
+ import { ScrcpySetScreenPowerModeControlMessage, } from "./set-screen-power-mode.js";
6
+ import { ScrcpyControlMessageType } from "./type.js";
7
7
  export class ScrcpyControlMessageSerializer {
8
8
  options;
9
9
  /** Control message type values for current version of server */
10
10
  types;
11
11
  writer;
12
+ scrollController;
12
13
  constructor(stream, options) {
14
+ this.writer = stream.getWriter();
13
15
  this.options = options;
14
16
  this.types = options.getControlMessageTypes();
15
- this.writer = stream.getWriter();
17
+ this.scrollController = options.getScrollController();
16
18
  }
17
- getTypeValue(type) {
19
+ getActualMessageType(type) {
18
20
  const value = this.types.indexOf(type);
19
21
  if (value === -1) {
20
- throw new Error('Not supported');
22
+ throw new Error("Not supported");
21
23
  }
22
24
  return value;
23
25
  }
26
+ addMessageType(message, type) {
27
+ message.type = this.getActualMessageType(type);
28
+ return message;
29
+ }
24
30
  injectKeyCode(message) {
25
- return this.writer.write(ScrcpyInjectKeyCodeControlMessage.serialize({
26
- ...message,
27
- type: this.getTypeValue(ScrcpyControlMessageType.InjectKeyCode),
28
- }));
31
+ return this.writer.write(ScrcpyInjectKeyCodeControlMessage.serialize(this.addMessageType(message, ScrcpyControlMessageType.InjectKeyCode)));
29
32
  }
30
33
  injectText(text) {
31
34
  return this.writer.write(ScrcpyInjectTextControlMessage.serialize({
32
35
  text,
33
- type: this.getTypeValue(ScrcpyControlMessageType.InjectText),
36
+ type: this.getActualMessageType(ScrcpyControlMessageType.InjectText),
34
37
  }));
35
38
  }
39
+ /**
40
+ * `pressure` is a float value between 0 and 1.
41
+ */
36
42
  injectTouch(message) {
37
- return this.writer.write(ScrcpyInjectTouchControlMessage.serialize({
38
- ...message,
39
- type: this.getTypeValue(ScrcpyControlMessageType.InjectTouch),
40
- }));
43
+ return this.writer.write(ScrcpyInjectTouchControlMessage.serialize(this.addMessageType(message, ScrcpyControlMessageType.InjectTouch)));
41
44
  }
45
+ /**
46
+ * `scrollX` and `scrollY` are float values between 0 and 1.
47
+ */
42
48
  injectScroll(message) {
43
- return this.writer.write(this.options.serializeInjectScrollControlMessage({
44
- ...message,
45
- type: this.getTypeValue(ScrcpyControlMessageType.InjectScroll),
46
- }));
49
+ const data = this.scrollController.serializeScrollMessage(this.addMessageType(message, ScrcpyControlMessageType.InjectScroll));
50
+ if (!data) {
51
+ return;
52
+ }
53
+ return this.writer.write(data);
47
54
  }
48
55
  async backOrScreenOn(action) {
49
56
  const buffer = this.options.serializeBackOrScreenOnControlMessage({
50
57
  action,
51
- type: this.getTypeValue(ScrcpyControlMessageType.BackOrScreenOn),
58
+ type: this.getActualMessageType(ScrcpyControlMessageType.BackOrScreenOn),
52
59
  });
53
60
  if (buffer) {
54
61
  return await this.writer.write(buffer);
@@ -57,17 +64,16 @@ export class ScrcpyControlMessageSerializer {
57
64
  setScreenPowerMode(mode) {
58
65
  return this.writer.write(ScrcpySetScreenPowerModeControlMessage.serialize({
59
66
  mode,
60
- type: this.getTypeValue(ScrcpyControlMessageType.SetScreenPowerMode),
67
+ type: this.getActualMessageType(ScrcpyControlMessageType.SetScreenPowerMode),
61
68
  }));
62
69
  }
63
70
  rotateDevice() {
64
71
  return this.writer.write(ScrcpyRotateDeviceControlMessage.serialize({
65
- type: this.getTypeValue(ScrcpyControlMessageType.RotateDevice),
72
+ type: this.getActualMessageType(ScrcpyControlMessageType.RotateDevice),
66
73
  }));
67
74
  }
68
75
  close() {
69
76
  return this.writer.close();
70
77
  }
71
78
  }
72
- ;
73
79
  //# sourceMappingURL=serializer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/control/serializer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAA0B,sCAAsC,EAAE,MAAM,4BAA4B,CAAC;AAC5G,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,MAAM,OAAO,8BAA8B;IAC/B,OAAO,CAAqB;IACpC,g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AI,CAAC,oBAAoB,CAC3B,wBAAwB,CAAC,YAAY,CACxC;SACJ,CAAC,CACL,CAAC;IACN,CAAC;IAEM,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;CACJ"}
@@ -0,0 +1,3 @@
1
+ import { type ScrcpySetClipboardControlMessage1_21 } from "../options/index.js";
2
+ export type ScrcpySetClipboardControlMessage = ScrcpySetClipboardControlMessage1_21;
3
+ //# sourceMappingURL=set-clipboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-clipboard.d.ts","sourceRoot":"","sources":["../../src/control/set-clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oCAAoC,EAAE,MAAM,qBAAqB,CAAC;AAEhF,MAAM,MAAM,gCAAgC,GACxC,oCAAoC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=set-clipboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-clipboard.js","sourceRoot":"","sources":["../../src/control/set-clipboard.ts"],"names":[],"mappings":""}
@@ -7,6 +7,6 @@ export declare enum AndroidScreenPowerMode {
7
7
  export declare const ScrcpySetScreenPowerModeControlMessage: Struct<{
8
8
  type: ScrcpyControlMessageType.SetScreenPowerMode;
9
9
  mode: AndroidScreenPowerMode;
10
- }, never, {}, undefined>;
11
- export declare type ScrcpySetScreenPowerModeControlMessage = typeof ScrcpySetScreenPowerModeControlMessage['TInit'];
10
+ }, never, Record<never, never>, undefined>;
11
+ export type ScrcpySetScreenPowerModeControlMessage = typeof ScrcpySetScreenPowerModeControlMessage['TInit'];
12
12
  //# sourceMappingURL=set-screen-power-mode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"set-screen-power-mode.d.ts","sourceRoot":"","sources":["../../src/control/set-screen-power-mode.ts"],"names":[],"mappings":"AAAA,OAAO,MAAuB,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAGrD,oBAAY,sBAAsB;IAC9B,GAAG,IAAI;IACP,MAAM,IAAI;CACb;AAED,eAAO,MAAM,sCAAsC;;;wBAGU,CAAC;AAE9D,oBAAY,sCAAsC,GAC9C,OAAO,sCAAsC,CAAC,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"set-screen-power-mode.d.ts","sourceRoot":"","sources":["../../src/control/set-screen-power-mode.ts"],"names":[],"mappings":"AAAA,OAAO,MAAuB,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAGrD,oBAAY,sBAAsB;IAC9B,GAAG,IAAI;IACP,MAAM,IAAI;CACb;AAED,eAAO,MAAM,sCAAsC;;;0CAGU,CAAC;AAE9D,MAAM,MAAM,sCAAsC,GAC9C,OAAO,sCAAsC,CAAC,OAAO,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import Struct from "@yume-chan/struct";
2
+ import { ScrcpyDeviceMessageType } from "./type.js";
3
+ export declare const ScrcpyAckClipboardDeviceMessage: Struct<{
4
+ sequence: bigint;
5
+ }, never, {
6
+ type: ScrcpyDeviceMessageType.AckClipboard;
7
+ }, undefined>;
8
+ export type ScrcpyAckClipboardDeviceMessage = typeof ScrcpyAckClipboardDeviceMessage["TDeserializeResult"];
9
+ //# sourceMappingURL=ack-clipboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ack-clipboard.d.ts","sourceRoot":"","sources":["../../src/device-message/ack-clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,eAAO,MAAM,+BAA+B;;;;aAEuB,CAAC;AAEpE,MAAM,MAAM,+BAA+B,GACvC,OAAO,+BAA+B,CAAC,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import Struct from "@yume-chan/struct";
2
+ import { ScrcpyDeviceMessageType } from "./type.js";
3
+ export const ScrcpyAckClipboardDeviceMessage = new Struct()
4
+ .uint64("sequence")
5
+ .extra({ type: ScrcpyDeviceMessageType.AckClipboard });
6
+ //# sourceMappingURL=ack-clipboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ack-clipboard.js","sourceRoot":"","sources":["../../src/device-message/ack-clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,MAAM,EAAE;KACtD,MAAM,CAAC,UAAU,CAAC;KAClB,KAAK,CAAC,EAAE,IAAI,EAAE,uBAAuB,CAAC,YAAqB,EAAE,CAAC,CAAC"}
@@ -1,10 +1,10 @@
1
- import Struct from '@yume-chan/struct';
2
- import { ScrcpyDeviceMessageType } from './type.js';
1
+ import Struct from "@yume-chan/struct";
2
+ import { ScrcpyDeviceMessageType } from "./type.js";
3
3
  export declare const ScrcpyClipboardDeviceMessage: Struct<{
4
4
  length: number;
5
5
  content: string;
6
6
  }, "length", {
7
7
  type: ScrcpyDeviceMessageType.Clipboard;
8
8
  }, undefined>;
9
- export declare type ScrcpyClipboardDeviceMessage = typeof ScrcpyClipboardDeviceMessage['TDeserializeResult'];
9
+ export type ScrcpyClipboardDeviceMessage = typeof ScrcpyClipboardDeviceMessage["TDeserializeResult"];
10
10
  //# sourceMappingURL=clipboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/device-message/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,eAAO,MAAM,4BAA4B;;;;;aAI2B,CAAC;AAErE,oBAAY,4BAA4B,GACpC,OAAO,4BAA4B,CAAC,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/device-message/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,eAAO,MAAM,4BAA4B;;;;;aAGuB,CAAC;AAEjE,MAAM,MAAM,4BAA4B,GACpC,OAAO,4BAA4B,CAAC,oBAAoB,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
- import Struct from '@yume-chan/struct';
2
- import { ScrcpyDeviceMessageType } from './type.js';
1
+ import Struct from "@yume-chan/struct";
2
+ import { ScrcpyDeviceMessageType } from "./type.js";
3
3
  export const ScrcpyClipboardDeviceMessage = new Struct()
4
- .uint32('length')
5
- .string('content', { lengthField: 'length' })
4
+ .uint32("length")
5
+ .string("content", { lengthField: "length" })
6
6
  .extra({ type: ScrcpyDeviceMessageType.Clipboard });
7
7
  //# sourceMappingURL=clipboard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/device-message/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,CAAC,MAAM,4BAA4B,GACrC,IAAI,MAAM,EAAE;KACP,MAAM,CAAC,QAAQ,CAAC;KAChB,MAAM,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;KAC5C,KAAK,CAAC,EAAE,IAAI,EAAE,uBAAuB,CAAC,SAAkB,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/device-message/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,MAAM,EAAE;KACnD,MAAM,CAAC,QAAQ,CAAC;KAChB,MAAM,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;KAC5C,KAAK,CAAC,EAAE,IAAI,EAAE,uBAAuB,CAAC,SAAkB,EAAE,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
- export * from './clipboard.js';
2
- export * from './stream.js';
3
- export * from './type.js';
1
+ export * from "./ack-clipboard.js";
2
+ export * from "./clipboard.js";
3
+ export * from "./stream.js";
4
+ export * from "./type.js";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/device-message/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/device-message/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
@@ -1,4 +1,5 @@
1
- export * from './clipboard.js';
2
- export * from './stream.js';
3
- export * from './type.js';
1
+ export * from "./ack-clipboard.js";
2
+ export * from "./clipboard.js";
3
+ export * from "./stream.js";
4
+ export * from "./type.js";
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/device-message/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/device-message/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
@@ -1,6 +1,7 @@
1
- import { BufferedTransformStream } from '@yume-chan/stream-extra';
2
- import { ScrcpyClipboardDeviceMessage } from './clipboard.js';
3
- export declare type ScrcpyDeviceMessage = ScrcpyClipboardDeviceMessage;
1
+ import { BufferedTransformStream } from "@yume-chan/stream-extra";
2
+ import { ScrcpyAckClipboardDeviceMessage } from "./ack-clipboard.js";
3
+ import { ScrcpyClipboardDeviceMessage } from "./clipboard.js";
4
+ export type ScrcpyDeviceMessage = ScrcpyClipboardDeviceMessage | ScrcpyAckClipboardDeviceMessage;
4
5
  export declare class ScrcpyDeviceMessageDeserializeStream extends BufferedTransformStream<ScrcpyDeviceMessage> {
5
6
  constructor();
6
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/device-message/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAE9D,oBAAY,mBAAmB,GACzB,4BAA4B,CAAC;AAEnC,qBAAa,oCAAqC,SAAQ,uBAAuB,CAAC,mBAAmB,CAAC;;CAYrG"}
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/device-message/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAG9D,MAAM,MAAM,mBAAmB,GACzB,4BAA4B,GAC5B,+BAA+B,CAAC;AAEtC,qBAAa,oCAAqC,SAAQ,uBAAuB,CAAC,mBAAmB,CAAC;;CAkBrG"}
@@ -1,14 +1,18 @@
1
- import { BufferedTransformStream } from '@yume-chan/stream-extra';
2
- import { ScrcpyClipboardDeviceMessage } from './clipboard.js';
1
+ import { BufferedTransformStream } from "@yume-chan/stream-extra";
2
+ import { ScrcpyAckClipboardDeviceMessage } from "./ack-clipboard.js";
3
+ import { ScrcpyClipboardDeviceMessage } from "./clipboard.js";
4
+ import { ScrcpyDeviceMessageType } from "./type.js";
3
5
  export class ScrcpyDeviceMessageDeserializeStream extends BufferedTransformStream {
4
6
  constructor() {
5
7
  super(async (stream) => {
6
8
  const type = await stream.read(1);
7
9
  switch (type[0]) {
8
- case 0:
10
+ case ScrcpyDeviceMessageType.Clipboard:
9
11
  return await ScrcpyClipboardDeviceMessage.deserialize(stream);
12
+ case ScrcpyDeviceMessageType.AckClipboard:
13
+ return await ScrcpyAckClipboardDeviceMessage.deserialize(stream);
10
14
  default:
11
- throw new Error('unknown control message type');
15
+ throw new Error("unknown control message type");
12
16
  }
13
17
  });
14
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/device-message/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAK9D,MAAM,OAAO,oCAAqC,SAAQ,uBAA4C;IAClG;QACI,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACnB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClC,QAAQ,IAAI,CAAC,CAAC,CAAC,EAAE;gBACb,KAAK,CAAC;oBACF,OAAO,MAAM,4BAA4B,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAClE;oBACI,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;aACvD;QACL,CAAC,CAAC,CAAA;IACN,CAAC;CACJ"}
1
+ {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/device-message/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAMpD,MAAM,OAAO,oCAAqC,SAAQ,uBAA4C;IAClG;QACI,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACnB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClC,QAAQ,IAAI,CAAC,CAAC,CAAC,EAAE;gBACb,KAAK,uBAAuB,CAAC,SAAS;oBAClC,OAAO,MAAM,4BAA4B,CAAC,WAAW,CACjD,MAAM,CACT,CAAC;gBACN,KAAK,uBAAuB,CAAC,YAAY;oBACrC,OAAO,MAAM,+BAA+B,CAAC,WAAW,CACpD,MAAM,CACT,CAAC;gBACN;oBACI,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;aACvD;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -1,5 +1,5 @@
1
- import type { AndroidCodecLevel, AndroidCodecProfile } from '../../codec.js';
2
- import type { ScrcpyOptionValue } from '../types.js';
1
+ import { type AndroidCodecLevel, type AndroidCodecProfile } from "../../codec.js";
2
+ import { type ScrcpyOptionValue } from "../types.js";
3
3
  /**
4
4
  * If the option you need is not in this type,
5
5
  * please file an issue on GitHub.
@@ -8,6 +8,7 @@ export interface CodecOptionsInit {
8
8
  profile: AndroidCodecProfile;
9
9
  level: AndroidCodecLevel;
10
10
  iFrameInterval: number;
11
+ maxBframes: number;
11
12
  repeatPreviousFrameAfter: number;
12
13
  maxPtsGapToEncoder: number;
13
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"codec-options.d.ts","sourceRoot":"","sources":["../../../src/options/1_16/codec-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,KAAK,EAAE,iBAAiB,CAAC;IAEzB,cAAc,EAAE,MAAM,CAAC;IACvB,wBAAwB,EAAE,MAAM,CAAC;IACjC,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAWD,qBAAa,YAAa,YAAW,iBAAiB;IAC3C,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;gBAErB,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAI5C,aAAa,IAAI,MAAM,GAAG,SAAS;CAe7C"}
1
+ {"version":3,"file":"codec-options.d.ts","sourceRoot":"","sources":["../../../src/options/1_16/codec-options.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,KAAK,EAAE,iBAAiB,CAAC;IAEzB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,wBAAwB,EAAE,MAAM,CAAC;IACjC,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAaD,qBAAa,YAAa,YAAW,iBAAiB;IAC3C,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;gBAErB,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAI5C,aAAa,IAAI,MAAM,GAAG,SAAS;CAgB7C"}
@@ -1,9 +1,9 @@
1
1
  function toDashCase(input) {
2
- return input.replace(/([A-Z])/g, '-$1').toLowerCase();
2
+ return input.replace(/([A-Z])/g, "-$1").toLowerCase();
3
3
  }
4
4
  const CODEC_OPTION_TYPES = {
5
- repeatPreviousFrameAfter: 'long',
6
- maxPtsGapToEncoder: 'long',
5
+ repeatPreviousFrameAfter: "long",
6
+ maxPtsGapToEncoder: "long",
7
7
  };
8
8
  export class CodecOptions {
9
9
  value;
@@ -11,17 +11,16 @@ export class CodecOptions {
11
11
  this.value = value;
12
12
  }
13
13
  toOptionValue() {
14
- const entries = Object.entries(this.value)
15
- .filter(([key, value]) => value !== undefined);
14
+ const entries = Object.entries(this.value).filter(([, value]) => value !== undefined);
16
15
  if (entries.length === 0) {
17
16
  return undefined;
18
17
  }
19
18
  return entries
20
19
  .map(([key, value]) => {
21
20
  const type = CODEC_OPTION_TYPES[key];
22
- return `${toDashCase(key)}${type ? `:${type}` : ''}=${value}`;
21
+ return `${toDashCase(key)}${type ? `:${type}` : ""}=${value}`;
23
22
  })
24
- .join(',');
23
+ .join(",");
25
24
  }
26
25
  }
27
26
  //# sourceMappingURL=codec-options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec-options.js","sourceRoot":"","sources":["../../../src/options/1_16/codec-options.ts"],"names":[],"mappings":"AAgBA,SAAS,UAAU,CAAC,KAAa;IAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,kBAAkB,GAAyE;IAC7F,wBAAwB,EAAE,MAAM;IAChC,kBAAkB,EAAE,MAAM;CAC7B,CAAC;AAEF,MAAM,OAAO,YAAY;IACd,KAAK,CAA4B;IAExC,YAAmB,KAAgC;QAC/C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAEM,aAAa;QAChB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;aACrC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;QAEnD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,OAAO,SAAS,CAAC;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AAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,EAAE,CAAC;QAClE,CAAC,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;CACJ"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Split NAL units from a H.264 Annex B stream.
3
+ *
4
+ * The input is not modified.
5
+ * The returned NAL units are views of the input (no memory allocation nor copy),
6
+ * and still contains emulation prevention bytes.
7
+ *
8
+ * This methods returns a generator, so it can be stopped immediately
9
+ * after the interested NAL unit is found.
10
+ */
11
+ export declare function splitH264Stream(buffer: Uint8Array): Generator<Uint8Array>;
12
+ /**
13
+ * Remove emulation prevention bytes from a H.264 NAL Unit.
14
+ *
15
+ * The input is not modified.
16
+ * If the input doesn't contain any emulation prevention bytes,
17
+ * the input is returned as-is.
18
+ * Otherwise, a new `Uint8Array` is created and returned.
19
+ */
20
+ export declare function removeH264Emulation(buffer: Uint8Array): Uint8Array;
21
+ export declare function parseSequenceParameterSet(buffer: Uint8Array): {
22
+ profile_idc: number;
23
+ constraint_set: number;
24
+ constraint_set0_flag: boolean;
25
+ constraint_set1_flag: boolean;
26
+ constraint_set2_flag: boolean;
27
+ constraint_set3_flag: boolean;
28
+ constraint_set4_flag: boolean;
29
+ constraint_set5_flag: boolean;
30
+ level_idc: number;
31
+ seq_parameter_set_id: number;
32
+ pic_width_in_mbs_minus1: number;
33
+ pic_height_in_map_units_minus1: number;
34
+ frame_mbs_only_flag: number;
35
+ frame_cropping_flag: boolean;
36
+ frame_crop_left_offset: number;
37
+ frame_crop_right_offset: number;
38
+ frame_crop_top_offset: number;
39
+ frame_crop_bottom_offset: number;
40
+ };
41
+ /**
42
+ * Find Sequence Parameter Set (SPS) and Picture Parameter Set (PPS)
43
+ * from H.264 Annex B formatted data.
44
+ */
45
+ export declare function parseH264Configuration(buffer: Uint8Array): {
46
+ sequenceParameterSet: Uint8Array;
47
+ pictureParameterSet: Uint8Array;
48
+ };
49
+ //# sourceMappingURL=h264-configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"h264-configuration.d.ts","sourceRoot":"","sources":["../../../src/options/1_16/h264-configuration.ts"],"names":[],"mappings":"AAqDA;;;;;;;;;GASG;AACH,wBAAiB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,CAiF1E;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,cA0HrD;AAID,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,UAAU;;;;;;;;;;;;;;;;;;;EAsK3D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU;;;EAgCxD"}