@yume-chan/scrcpy 1.0.0 → 2.0.0

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 (386) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE +1 -1
  3. package/esm/1_15/impl/back-or-screen-on.d.ts +1 -1
  4. package/esm/1_15/impl/clipboard-stream.d.ts +3 -3
  5. package/esm/1_15/impl/defaults.d.ts +1 -2
  6. package/esm/1_15/impl/defaults.d.ts.map +1 -1
  7. package/esm/1_15/impl/defaults.js +2 -2
  8. package/esm/1_15/impl/defaults.js.map +1 -1
  9. package/esm/1_15/impl/init.d.ts +10 -2
  10. package/esm/1_15/impl/init.d.ts.map +1 -1
  11. package/esm/1_15/impl/init.js +15 -0
  12. package/esm/1_15/impl/init.js.map +1 -1
  13. package/esm/1_15/impl/inject-touch.d.ts +9 -9
  14. package/esm/1_15/impl/inject-touch.d.ts.map +1 -1
  15. package/esm/1_15/impl/inject-touch.js +14 -18
  16. package/esm/1_15/impl/inject-touch.js.map +1 -1
  17. package/esm/1_15/impl/media-stream-transformer.d.ts +3 -3
  18. package/esm/1_15/impl/scroll-controller.d.ts +5 -5
  19. package/esm/1_15/impl/scroll-controller.js +2 -2
  20. package/esm/1_15/impl/scroll-controller.js.map +1 -1
  21. package/esm/1_15/impl/set-clipboard.d.ts +3 -3
  22. package/esm/1_15/index.d.ts +0 -1
  23. package/esm/1_15/index.d.ts.map +1 -1
  24. package/esm/1_15/index.js +0 -1
  25. package/esm/1_15/index.js.map +1 -1
  26. package/esm/1_15/options.d.ts +3 -3
  27. package/esm/1_15/options.d.ts.map +1 -1
  28. package/esm/1_15/options.js.map +1 -1
  29. package/esm/1_15_1.d.ts +8 -0
  30. package/esm/1_15_1.d.ts.map +1 -0
  31. package/esm/1_15_1.js +7 -0
  32. package/esm/1_15_1.js.map +1 -0
  33. package/esm/1_16.d.ts +7 -1
  34. package/esm/1_16.d.ts.map +1 -1
  35. package/esm/1_16.js +6 -1
  36. package/esm/1_16.js.map +1 -1
  37. package/esm/1_17/impl/defaults.d.ts +1 -2
  38. package/esm/1_17/impl/defaults.d.ts.map +1 -1
  39. package/esm/1_17/index.d.ts +0 -1
  40. package/esm/1_17/index.d.ts.map +1 -1
  41. package/esm/1_17/index.js +0 -1
  42. package/esm/1_17/index.js.map +1 -1
  43. package/esm/1_17/options.d.ts +5 -5
  44. package/esm/1_17/options.d.ts.map +1 -1
  45. package/esm/1_17/options.js.map +1 -1
  46. package/esm/1_18/impl/back-or-screen-on.d.ts +5 -3
  47. package/esm/1_18/impl/back-or-screen-on.d.ts.map +1 -1
  48. package/esm/1_18/impl/back-or-screen-on.js +2 -5
  49. package/esm/1_18/impl/back-or-screen-on.js.map +1 -1
  50. package/esm/1_18/impl/defaults.d.ts +1 -2
  51. package/esm/1_18/impl/defaults.d.ts.map +1 -1
  52. package/esm/1_18/index.d.ts +0 -1
  53. package/esm/1_18/index.d.ts.map +1 -1
  54. package/esm/1_18/index.js +0 -1
  55. package/esm/1_18/index.js.map +1 -1
  56. package/esm/1_18/options.d.ts +5 -5
  57. package/esm/1_18/options.d.ts.map +1 -1
  58. package/esm/1_18/options.js.map +1 -1
  59. package/esm/1_19.d.ts +7 -1
  60. package/esm/1_19.d.ts.map +1 -1
  61. package/esm/1_19.js +6 -1
  62. package/esm/1_19.js.map +1 -1
  63. package/esm/1_20.d.ts +7 -1
  64. package/esm/1_20.d.ts.map +1 -1
  65. package/esm/1_20.js +6 -1
  66. package/esm/1_20.js.map +1 -1
  67. package/esm/1_21/impl/defaults.d.ts +1 -2
  68. package/esm/1_21/impl/defaults.d.ts.map +1 -1
  69. package/esm/1_21/impl/set-clipboard.d.ts +6 -6
  70. package/esm/1_21/index.d.ts +0 -1
  71. package/esm/1_21/index.d.ts.map +1 -1
  72. package/esm/1_21/index.js +0 -1
  73. package/esm/1_21/index.js.map +1 -1
  74. package/esm/1_21/options.d.ts +5 -5
  75. package/esm/1_21/options.d.ts.map +1 -1
  76. package/esm/1_21/options.js.map +1 -1
  77. package/esm/1_22/impl/defaults.d.ts +1 -2
  78. package/esm/1_22/impl/defaults.d.ts.map +1 -1
  79. package/esm/1_22/impl/index.d.ts +1 -1
  80. package/esm/1_22/impl/index.d.ts.map +1 -1
  81. package/esm/1_22/impl/index.js +1 -1
  82. package/esm/1_22/impl/index.js.map +1 -1
  83. package/esm/1_22/impl/scroll-controller.d.ts +10 -6
  84. package/esm/1_22/impl/scroll-controller.d.ts.map +1 -1
  85. package/esm/1_22/impl/scroll-controller.js +5 -5
  86. package/esm/1_22/impl/scroll-controller.js.map +1 -1
  87. package/esm/1_22/index.d.ts +0 -1
  88. package/esm/1_22/index.d.ts.map +1 -1
  89. package/esm/1_22/index.js +0 -1
  90. package/esm/1_22/index.js.map +1 -1
  91. package/esm/1_22/options.d.ts +5 -5
  92. package/esm/1_22/options.d.ts.map +1 -1
  93. package/esm/1_22/options.js.map +1 -1
  94. package/esm/1_23/impl/defaults.d.ts +1 -2
  95. package/esm/1_23/impl/defaults.d.ts.map +1 -1
  96. package/esm/1_23/index.d.ts +0 -1
  97. package/esm/1_23/index.d.ts.map +1 -1
  98. package/esm/1_23/index.js +0 -1
  99. package/esm/1_23/index.js.map +1 -1
  100. package/esm/1_23/options.d.ts +5 -5
  101. package/esm/1_23/options.d.ts.map +1 -1
  102. package/esm/1_23/options.js.map +1 -1
  103. package/esm/1_24/impl/defaults.d.ts +1 -2
  104. package/esm/1_24/impl/defaults.d.ts.map +1 -1
  105. package/esm/1_24/index.d.ts +0 -1
  106. package/esm/1_24/index.d.ts.map +1 -1
  107. package/esm/1_24/index.js +0 -1
  108. package/esm/1_24/index.js.map +1 -1
  109. package/esm/1_24/options.d.ts +5 -5
  110. package/esm/1_24/options.d.ts.map +1 -1
  111. package/esm/1_24/options.js.map +1 -1
  112. package/esm/1_25/impl/index.d.ts +1 -1
  113. package/esm/1_25/impl/index.d.ts.map +1 -1
  114. package/esm/1_25/impl/index.js +1 -1
  115. package/esm/1_25/impl/index.js.map +1 -1
  116. package/esm/1_25/impl/scroll-controller.d.ts +12 -11
  117. package/esm/1_25/impl/scroll-controller.d.ts.map +1 -1
  118. package/esm/1_25/impl/scroll-controller.js +17 -18
  119. package/esm/1_25/impl/scroll-controller.js.map +1 -1
  120. package/esm/1_25/index.d.ts +0 -1
  121. package/esm/1_25/index.d.ts.map +1 -1
  122. package/esm/1_25/index.js +0 -1
  123. package/esm/1_25/index.js.map +1 -1
  124. package/esm/1_25/options.d.ts +5 -5
  125. package/esm/1_25/options.d.ts.map +1 -1
  126. package/esm/1_25/options.js.map +1 -1
  127. package/esm/2_0/impl/defaults.d.ts +4 -6
  128. package/esm/2_0/impl/defaults.d.ts.map +1 -1
  129. package/esm/2_0/impl/defaults.js +3 -4
  130. package/esm/2_0/impl/defaults.js.map +1 -1
  131. package/esm/2_0/impl/init.d.ts +3 -3
  132. package/esm/2_0/impl/init.d.ts.map +1 -1
  133. package/esm/2_0/impl/inject-touch.d.ts +11 -11
  134. package/esm/2_0/impl/inject-touch.js +2 -2
  135. package/esm/2_0/impl/inject-touch.js.map +1 -1
  136. package/esm/2_0/impl/parse-audio-stream-metadata.d.ts +1 -1
  137. package/esm/2_0/impl/parse-audio-stream-metadata.d.ts.map +1 -1
  138. package/esm/2_0/impl/parse-audio-stream-metadata.js.map +1 -1
  139. package/esm/2_0/index.d.ts +0 -1
  140. package/esm/2_0/index.d.ts.map +1 -1
  141. package/esm/2_0/index.js +0 -1
  142. package/esm/2_0/index.js.map +1 -1
  143. package/esm/2_0/options.d.ts +8 -8
  144. package/esm/2_0/options.d.ts.map +1 -1
  145. package/esm/2_0/options.js.map +1 -1
  146. package/esm/2_1/impl/defaults.d.ts +4 -5
  147. package/esm/2_1/impl/defaults.d.ts.map +1 -1
  148. package/esm/2_1/impl/defaults.js.map +1 -1
  149. package/esm/2_1/impl/init.d.ts +2 -2
  150. package/esm/2_1/impl/init.d.ts.map +1 -1
  151. package/esm/2_1/index.d.ts +0 -1
  152. package/esm/2_1/index.d.ts.map +1 -1
  153. package/esm/2_1/index.js +0 -1
  154. package/esm/2_1/index.js.map +1 -1
  155. package/esm/2_1/options.d.ts +12 -12
  156. package/esm/2_1/options.d.ts.map +1 -1
  157. package/esm/2_1/options.js.map +1 -1
  158. package/esm/2_1_1.d.ts +8 -0
  159. package/esm/2_1_1.d.ts.map +1 -0
  160. package/esm/2_1_1.js +7 -0
  161. package/esm/2_1_1.js.map +1 -0
  162. package/esm/2_2/impl/defaults.d.ts +4 -5
  163. package/esm/2_2/impl/defaults.d.ts.map +1 -1
  164. package/esm/2_2/impl/defaults.js.map +1 -1
  165. package/esm/2_2/impl/init.d.ts +1 -1
  166. package/esm/2_2/impl/init.d.ts.map +1 -1
  167. package/esm/2_2/index.d.ts +0 -1
  168. package/esm/2_2/index.d.ts.map +1 -1
  169. package/esm/2_2/index.js +0 -1
  170. package/esm/2_2/index.js.map +1 -1
  171. package/esm/2_2/options.d.ts +12 -12
  172. package/esm/2_2/options.d.ts.map +1 -1
  173. package/esm/2_2/options.js.map +1 -1
  174. package/esm/2_3/impl/init.d.ts +2 -2
  175. package/esm/2_3/impl/init.d.ts.map +1 -1
  176. package/esm/2_3/index.d.ts +0 -1
  177. package/esm/2_3/index.d.ts.map +1 -1
  178. package/esm/2_3/index.js +0 -1
  179. package/esm/2_3/index.js.map +1 -1
  180. package/esm/2_3/options.d.ts +12 -12
  181. package/esm/2_3/options.d.ts.map +1 -1
  182. package/esm/2_3/options.js.map +1 -1
  183. package/esm/2_3_1.d.ts +8 -0
  184. package/esm/2_3_1.d.ts.map +1 -0
  185. package/esm/2_3_1.js +7 -0
  186. package/esm/2_3_1.js.map +1 -0
  187. package/esm/2_4/impl/serialize-uhid-create.d.ts +3 -3
  188. package/esm/2_4/impl/uhid-output-stream.d.ts +3 -3
  189. package/esm/2_4/index.d.ts +0 -1
  190. package/esm/2_4/index.d.ts.map +1 -1
  191. package/esm/2_4/index.js +0 -1
  192. package/esm/2_4/index.js.map +1 -1
  193. package/esm/2_4/options.d.ts +12 -12
  194. package/esm/2_4/options.d.ts.map +1 -1
  195. package/esm/2_4/options.js.map +1 -1
  196. package/esm/2_5.d.ts +7 -1
  197. package/esm/2_5.d.ts.map +1 -1
  198. package/esm/2_5.js +6 -1
  199. package/esm/2_5.js.map +1 -1
  200. package/esm/2_6/impl/defaults.d.ts +4 -5
  201. package/esm/2_6/impl/defaults.d.ts.map +1 -1
  202. package/esm/2_6/impl/defaults.js.map +1 -1
  203. package/esm/2_6/impl/init.d.ts +2 -2
  204. package/esm/2_6/impl/init.d.ts.map +1 -1
  205. package/esm/2_6/index.d.ts +0 -1
  206. package/esm/2_6/index.d.ts.map +1 -1
  207. package/esm/2_6/index.js +0 -1
  208. package/esm/2_6/index.js.map +1 -1
  209. package/esm/2_6/options.d.ts +12 -12
  210. package/esm/2_6/options.d.ts.map +1 -1
  211. package/esm/2_6/options.js.map +1 -1
  212. package/esm/2_6_1.d.ts +8 -0
  213. package/esm/2_6_1.d.ts.map +1 -0
  214. package/esm/2_6_1.js +7 -0
  215. package/esm/2_6_1.js.map +1 -0
  216. package/esm/2_7/impl/serialize-uhid-create.d.ts +7 -7
  217. package/esm/2_7/index.d.ts +0 -1
  218. package/esm/2_7/index.d.ts.map +1 -1
  219. package/esm/2_7/index.js +0 -1
  220. package/esm/2_7/index.js.map +1 -1
  221. package/esm/2_7/options.d.ts +12 -12
  222. package/esm/2_7/options.d.ts.map +1 -1
  223. package/esm/2_7/options.js.map +1 -1
  224. package/esm/3_0/impl/defaults.d.ts +5 -7
  225. package/esm/3_0/impl/defaults.d.ts.map +1 -1
  226. package/esm/3_0/impl/defaults.js +1 -2
  227. package/esm/3_0/impl/defaults.js.map +1 -1
  228. package/esm/3_0/impl/init.d.ts +3 -3
  229. package/esm/3_0/impl/init.d.ts.map +1 -1
  230. package/esm/3_0/index.d.ts +0 -1
  231. package/esm/3_0/index.d.ts.map +1 -1
  232. package/esm/3_0/index.js +0 -1
  233. package/esm/3_0/index.js.map +1 -1
  234. package/esm/3_0/options.d.ts +13 -13
  235. package/esm/3_0/options.d.ts.map +1 -1
  236. package/esm/3_0/options.js.map +1 -1
  237. package/esm/3_0_1.d.ts +8 -0
  238. package/esm/3_0_1.d.ts.map +1 -0
  239. package/esm/3_0_1.js +7 -0
  240. package/esm/3_0_1.js.map +1 -0
  241. package/esm/3_0_2.d.ts +8 -0
  242. package/esm/3_0_2.d.ts.map +1 -0
  243. package/esm/3_0_2.js +7 -0
  244. package/esm/3_0_2.js.map +1 -0
  245. package/esm/3_1/impl/defaults.d.ts +56 -0
  246. package/esm/3_1/impl/defaults.d.ts.map +1 -0
  247. package/esm/3_1/impl/defaults.js +6 -0
  248. package/esm/3_1/impl/defaults.js.map +1 -0
  249. package/esm/3_1/impl/index.d.ts +5 -0
  250. package/esm/3_1/impl/index.d.ts.map +1 -0
  251. package/esm/3_1/impl/index.js +4 -0
  252. package/esm/3_1/impl/index.js.map +1 -0
  253. package/esm/3_1/impl/init.d.ts +5 -0
  254. package/esm/3_1/impl/init.d.ts.map +1 -0
  255. package/esm/3_1/impl/init.js +2 -0
  256. package/esm/3_1/impl/init.js.map +1 -0
  257. package/esm/3_1/impl/prev.d.ts +2 -0
  258. package/esm/3_1/impl/prev.d.ts.map +1 -0
  259. package/esm/3_1/impl/prev.js +2 -0
  260. package/esm/3_1/impl/prev.js.map +1 -0
  261. package/esm/3_1/impl/serialize-uhid-create.d.ts +20 -0
  262. package/esm/3_1/impl/serialize-uhid-create.d.ts.map +1 -0
  263. package/esm/3_1/impl/serialize-uhid-create.js +14 -0
  264. package/esm/3_1/impl/serialize-uhid-create.js.map +1 -0
  265. package/esm/3_1/index.d.ts +2 -0
  266. package/esm/3_1/index.d.ts.map +1 -0
  267. package/esm/3_1/index.js +2 -0
  268. package/esm/3_1/index.js.map +1 -0
  269. package/esm/3_1/options.d.ts +90 -0
  270. package/esm/3_1/options.d.ts.map +1 -0
  271. package/esm/3_1/options.js +92 -0
  272. package/esm/3_1/options.js.map +1 -0
  273. package/esm/android/key-event.d.ts.map +1 -1
  274. package/esm/android/key-event.js +3 -2
  275. package/esm/android/key-event.js.map +1 -1
  276. package/esm/base/option-value.js +2 -2
  277. package/esm/base/option-value.js.map +1 -1
  278. package/esm/base/options.d.ts +6 -4
  279. package/esm/base/options.d.ts.map +1 -1
  280. package/esm/codec/h265.d.ts +23 -2
  281. package/esm/codec/h265.d.ts.map +1 -1
  282. package/esm/codec/h265.js +25 -3
  283. package/esm/codec/h265.js.map +1 -1
  284. package/esm/control/empty.d.ts +1 -1
  285. package/esm/control/inject-key-code.d.ts +9 -9
  286. package/esm/control/inject-text.d.ts +3 -3
  287. package/esm/control/set-screen-power-mode.d.ts +3 -3
  288. package/esm/control/start-app.d.ts +3 -3
  289. package/esm/control/uhid.d.ts +6 -6
  290. package/esm/index.d.ts +7 -0
  291. package/esm/index.d.ts.map +1 -1
  292. package/esm/index.js +7 -0
  293. package/esm/index.js.map +1 -1
  294. package/esm/latest.d.ts +8 -1
  295. package/esm/latest.d.ts.map +1 -1
  296. package/esm/latest.js +7 -1
  297. package/esm/latest.js.map +1 -1
  298. package/esm/utils/index.d.ts +0 -1
  299. package/esm/utils/index.d.ts.map +1 -1
  300. package/esm/utils/index.js +0 -1
  301. package/esm/utils/index.js.map +1 -1
  302. package/package.json +8 -8
  303. package/src/1_15/impl/defaults.ts +2 -2
  304. package/src/1_15/impl/init.ts +20 -2
  305. package/src/1_15/impl/inject-touch.ts +13 -12
  306. package/src/1_15/impl/scroll-controller.ts +2 -2
  307. package/src/1_15/index.ts +0 -1
  308. package/src/1_15/options.ts +2 -2
  309. package/src/1_15_1.ts +11 -0
  310. package/src/1_16.ts +11 -4
  311. package/src/1_17/index.ts +0 -1
  312. package/src/1_17/options.ts +6 -3
  313. package/src/1_18/impl/back-or-screen-on.ts +5 -9
  314. package/src/1_18/index.ts +0 -1
  315. package/src/1_18/options.ts +6 -3
  316. package/src/1_19.ts +11 -4
  317. package/src/1_20.ts +11 -4
  318. package/src/1_21/index.ts +0 -1
  319. package/src/1_21/options.ts +6 -3
  320. package/src/1_22/impl/index.ts +1 -0
  321. package/src/1_22/impl/scroll-controller.ts +10 -9
  322. package/src/1_22/index.ts +0 -1
  323. package/src/1_22/options.ts +6 -3
  324. package/src/1_23/index.ts +0 -1
  325. package/src/1_23/options.ts +6 -3
  326. package/src/1_24/index.ts +0 -1
  327. package/src/1_24/options.ts +6 -3
  328. package/src/1_25/impl/index.ts +1 -0
  329. package/src/1_25/impl/scroll-controller.ts +15 -10
  330. package/src/1_25/index.ts +0 -1
  331. package/src/1_25/options.ts +6 -3
  332. package/src/2_0/impl/defaults.ts +3 -4
  333. package/src/2_0/impl/init.ts +3 -3
  334. package/src/2_0/impl/inject-touch.ts +2 -2
  335. package/src/2_0/impl/parse-audio-stream-metadata.ts +1 -1
  336. package/src/2_0/index.ts +0 -1
  337. package/src/2_0/options.ts +6 -3
  338. package/src/2_1/impl/defaults.ts +1 -1
  339. package/src/2_1/impl/init.ts +2 -2
  340. package/src/2_1/index.ts +0 -1
  341. package/src/2_1/options.ts +12 -9
  342. package/src/2_1_1.ts +14 -0
  343. package/src/2_2/impl/defaults.ts +1 -1
  344. package/src/2_2/impl/init.ts +1 -1
  345. package/src/2_2/index.ts +0 -1
  346. package/src/2_2/options.ts +12 -9
  347. package/src/2_3/impl/init.ts +3 -2
  348. package/src/2_3/index.ts +0 -1
  349. package/src/2_3/options.ts +12 -9
  350. package/src/2_3_1.ts +14 -0
  351. package/src/2_4/index.ts +0 -1
  352. package/src/2_4/options.ts +12 -9
  353. package/src/2_5.ts +14 -4
  354. package/src/2_6/impl/defaults.ts +1 -1
  355. package/src/2_6/impl/init.ts +3 -2
  356. package/src/2_6/index.ts +0 -1
  357. package/src/2_6/options.ts +13 -10
  358. package/src/2_6_1.ts +14 -0
  359. package/src/2_7/index.ts +0 -1
  360. package/src/2_7/options.ts +12 -9
  361. package/src/3_0/impl/defaults.ts +2 -3
  362. package/src/3_0/impl/init.ts +4 -3
  363. package/src/3_0/index.ts +0 -1
  364. package/src/3_0/options.ts +12 -9
  365. package/src/3_0_1.ts +14 -0
  366. package/src/3_0_2.ts +14 -0
  367. package/src/3_1/impl/defaults.ts +8 -0
  368. package/src/3_1/impl/index.ts +7 -0
  369. package/src/3_1/impl/init.ts +5 -0
  370. package/src/3_1/impl/prev.ts +1 -0
  371. package/src/3_1/impl/serialize-uhid-create.ts +28 -0
  372. package/src/3_1/index.ts +1 -0
  373. package/src/3_1/options.ts +190 -0
  374. package/src/android/key-event.ts +3 -2
  375. package/src/base/option-value.ts +2 -2
  376. package/src/base/options.ts +11 -6
  377. package/src/codec/h265.ts +31 -5
  378. package/src/index.ts +7 -0
  379. package/src/latest.ts +17 -1
  380. package/src/utils/index.ts +0 -1
  381. package/tsconfig.build.tsbuildinfo +1 -1
  382. package/esm/utils/wrapper.d.ts +0 -37
  383. package/esm/utils/wrapper.d.ts.map +0 -1
  384. package/esm/utils/wrapper.js +0 -76
  385. package/esm/utils/wrapper.js.map +0 -1
  386. package/src/utils/wrapper.ts +0 -131
@@ -106,8 +106,9 @@ export class NewDisplay implements ScrcpyOptionValue {
106
106
  }
107
107
  }
108
108
 
109
- export interface Init extends Omit<PrevImpl.Init, "lockVideoOrientation"> {
110
- captureOrientation?: CaptureOrientation;
109
+ export interface Init<TVideo extends boolean>
110
+ extends Omit<PrevImpl.Init<TVideo>, "lockVideoOrientation"> {
111
+ captureOrientation?: CaptureOrientation | string | undefined;
111
112
  angle?: number;
112
113
  screenOffTimeout?: number | undefined;
113
114
 
@@ -116,6 +117,6 @@ export interface Init extends Omit<PrevImpl.Init, "lockVideoOrientation"> {
116
117
  // `display_id` and `new_display` can't be specified at the same time
117
118
  // but `serialize` method will exclude options that are same as the default value
118
119
  // so `displayId: 0` will be ignored
119
- newDisplay?: NewDisplay | undefined;
120
+ newDisplay?: NewDisplay | string | undefined;
120
121
  vdSystemDecorations?: boolean;
121
122
  }
package/src/3_0/index.ts CHANGED
@@ -1,2 +1 @@
1
- export * as ScrcpyOptions3_0Impl from "./impl/index.js";
2
1
  export * from "./options.js";
@@ -1,6 +1,6 @@
1
1
  import type { MaybePromiseLike } from "@yume-chan/async";
2
2
  import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
3
- import type { AsyncExactReadable } from "@yume-chan/struct";
3
+ import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
4
4
 
5
5
  import type {
6
6
  ScrcpyAudioStreamMetadata,
@@ -9,6 +9,7 @@ import type {
9
9
  ScrcpyEncoder,
10
10
  ScrcpyMediaStreamPacket,
11
11
  ScrcpyOptions,
12
+ ScrcpyOptionsListEncoders,
12
13
  ScrcpyScrollController,
13
14
  ScrcpyVideoStream,
14
15
  } from "../base/index.js";
@@ -41,10 +42,12 @@ import {
41
42
  UHidOutputStream,
42
43
  } from "./impl/index.js";
43
44
 
44
- export class ScrcpyOptions3_0 implements ScrcpyOptions<Init> {
45
+ export class ScrcpyOptions3_0<TVideo extends boolean>
46
+ implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
47
+ {
45
48
  static readonly Defaults = Defaults;
46
49
 
47
- readonly value: Required<Init>;
50
+ readonly value: Required<Init<TVideo>>;
48
51
 
49
52
  get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
50
53
  return ControlMessageTypes;
@@ -64,8 +67,8 @@ export class ScrcpyOptions3_0 implements ScrcpyOptions<Init> {
64
67
  return this.#uHidOutput;
65
68
  }
66
69
 
67
- constructor(init: Init) {
68
- this.value = { ...Defaults, ...init };
70
+ constructor(init: Init<TVideo>) {
71
+ this.value = { ...Defaults, ...init } as never;
69
72
 
70
73
  if (this.value.videoSource === "camera") {
71
74
  this.value.control = false;
@@ -86,7 +89,7 @@ export class ScrcpyOptions3_0 implements ScrcpyOptions<Init> {
86
89
  }
87
90
 
88
91
  serialize(): string[] {
89
- return serialize(this.value, Defaults);
92
+ return serialize<Init<boolean>>(this.value, Defaults);
90
93
  }
91
94
 
92
95
  setListDisplays(): void {
@@ -119,7 +122,7 @@ export class ScrcpyOptions3_0 implements ScrcpyOptions<Init> {
119
122
 
120
123
  async parseDeviceMessage(
121
124
  id: number,
122
- stream: AsyncExactReadable,
125
+ stream: ExactReadable | AsyncExactReadable,
123
126
  ): Promise<void> {
124
127
  if (await this.#clipboard?.parse(id, stream)) {
125
128
  return;
@@ -180,8 +183,8 @@ export class ScrcpyOptions3_0 implements ScrcpyOptions<Init> {
180
183
  }
181
184
  }
182
185
 
183
- type Init_ = Init;
186
+ type Init_<TVideo extends boolean> = Init<TVideo>;
184
187
 
185
188
  export namespace ScrcpyOptions3_0 {
186
- export type Init = Init_;
189
+ export type Init<TVideo extends boolean = boolean> = Init_<TVideo>;
187
190
  }
package/src/3_0_1.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { ScrcpyOptions3_0 } from "./3_0/index.js";
2
+
3
+ export class ScrcpyOptions3_0_1<
4
+ TVideo extends boolean,
5
+ > extends ScrcpyOptions3_0<TVideo> {
6
+ constructor(init: ScrcpyOptions3_0.Init<TVideo>) {
7
+ super(init);
8
+ }
9
+ }
10
+
11
+ export namespace ScrcpyOptions3_0_1 {
12
+ export type Init<TVideo extends boolean = boolean> =
13
+ ScrcpyOptions3_0.Init<TVideo>;
14
+ }
package/src/3_0_2.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { ScrcpyOptions3_0 } from "./3_0/index.js";
2
+
3
+ export class ScrcpyOptions3_0_2<
4
+ TVideo extends boolean,
5
+ > extends ScrcpyOptions3_0<TVideo> {
6
+ constructor(init: ScrcpyOptions3_0.Init<TVideo>) {
7
+ super(init);
8
+ }
9
+ }
10
+
11
+ export namespace ScrcpyOptions3_0_2 {
12
+ export type Init<TVideo extends boolean = boolean> =
13
+ ScrcpyOptions3_0.Init<TVideo>;
14
+ }
@@ -0,0 +1,8 @@
1
+ import type { Init } from "./init.js";
2
+ import { PrevImpl } from "./prev.js";
3
+
4
+ export const Defaults = /* #__PURE__ */ (() =>
5
+ ({
6
+ ...PrevImpl.Defaults,
7
+ vdDestroyContent: false,
8
+ }) as const satisfies Required<Init<true>>)();
@@ -0,0 +1,7 @@
1
+ export * from "../../3_0/impl/index.js";
2
+ export { Defaults } from "./defaults.js";
3
+ export type { Init } from "./init.js";
4
+ export {
5
+ serializeUHidCreateControlMessage,
6
+ UHidCreateControlMessage,
7
+ } from "./serialize-uhid-create.js";
@@ -0,0 +1,5 @@
1
+ import type { PrevImpl } from "./prev.js";
2
+
3
+ export interface Init<TVideo extends boolean> extends PrevImpl.Init<TVideo> {
4
+ vdDestroyContent?: boolean;
5
+ }
@@ -0,0 +1 @@
1
+ export * as PrevImpl from "../../3_0/impl/index.js";
@@ -0,0 +1,28 @@
1
+ import type { StructInit } from "@yume-chan/struct";
2
+ import { buffer, string, struct, u16, u8 } from "@yume-chan/struct";
3
+
4
+ import { ScrcpyControlMessageType } from "../../base/control-message-type.js";
5
+ import type { ScrcpyUHidCreateControlMessage } from "../../latest.js";
6
+
7
+ export const UHidCreateControlMessage = /* #__PURE__ */ (() =>
8
+ struct(
9
+ {
10
+ type: u8(ScrcpyControlMessageType.UHidCreate),
11
+ id: u16,
12
+ vendorId: u16,
13
+ productId: u16,
14
+ name: string(u8),
15
+ data: buffer(u16),
16
+ },
17
+ { littleEndian: false },
18
+ ))();
19
+
20
+ export type UHidCreateControlMessage = StructInit<
21
+ typeof UHidCreateControlMessage
22
+ >;
23
+
24
+ export function serializeUHidCreateControlMessage(
25
+ message: ScrcpyUHidCreateControlMessage,
26
+ ) {
27
+ return UHidCreateControlMessage.serialize(message);
28
+ }
@@ -0,0 +1 @@
1
+ export * from "./options.js";
@@ -0,0 +1,190 @@
1
+ import type { MaybePromiseLike } from "@yume-chan/async";
2
+ import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
3
+ import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
4
+
5
+ import type {
6
+ ScrcpyAudioStreamMetadata,
7
+ ScrcpyControlMessageType,
8
+ ScrcpyDisplay,
9
+ ScrcpyEncoder,
10
+ ScrcpyMediaStreamPacket,
11
+ ScrcpyOptions,
12
+ ScrcpyOptionsListEncoders,
13
+ ScrcpyScrollController,
14
+ ScrcpyVideoStream,
15
+ } from "../base/index.js";
16
+ import type {
17
+ ScrcpyBackOrScreenOnControlMessage,
18
+ ScrcpyInjectTouchControlMessage,
19
+ ScrcpySetClipboardControlMessage,
20
+ ScrcpyUHidCreateControlMessage,
21
+ ScrcpyUHidOutputDeviceMessage,
22
+ } from "../latest.js";
23
+
24
+ import type { Init } from "./impl/index.js";
25
+ import {
26
+ AckClipboardHandler,
27
+ ClipboardStream,
28
+ ControlMessageTypes,
29
+ createMediaStreamTransformer,
30
+ createScrollController,
31
+ Defaults,
32
+ parseAudioStreamMetadata,
33
+ parseDisplay,
34
+ parseEncoder,
35
+ parseVideoStreamMetadata,
36
+ serialize,
37
+ serializeBackOrScreenOnControlMessage,
38
+ serializeInjectTouchControlMessage,
39
+ serializeUHidCreateControlMessage,
40
+ setListDisplays,
41
+ setListEncoders,
42
+ UHidOutputStream,
43
+ } from "./impl/index.js";
44
+
45
+ export class ScrcpyOptions3_1<TVideo extends boolean>
46
+ implements ScrcpyOptions<Init<TVideo>>, ScrcpyOptionsListEncoders
47
+ {
48
+ static readonly Defaults = Defaults;
49
+
50
+ readonly value: Required<Init<TVideo>>;
51
+
52
+ get controlMessageTypes(): readonly ScrcpyControlMessageType[] {
53
+ return ControlMessageTypes;
54
+ }
55
+
56
+ #clipboard: ClipboardStream | undefined;
57
+ get clipboard(): ReadableStream<string> | undefined {
58
+ return this.#clipboard;
59
+ }
60
+
61
+ #ackClipboardHandler: AckClipboardHandler | undefined;
62
+
63
+ #uHidOutput: UHidOutputStream | undefined;
64
+ get uHidOutput():
65
+ | ReadableStream<ScrcpyUHidOutputDeviceMessage>
66
+ | undefined {
67
+ return this.#uHidOutput;
68
+ }
69
+
70
+ constructor(init: Init<TVideo>) {
71
+ this.value = { ...Defaults, ...init } as never;
72
+
73
+ if (this.value.videoSource === "camera") {
74
+ this.value.control = false;
75
+ }
76
+
77
+ if (this.value.audioDup) {
78
+ this.value.audioSource = "playback";
79
+ }
80
+
81
+ if (this.value.control) {
82
+ if (this.value.clipboardAutosync) {
83
+ this.#clipboard = new ClipboardStream();
84
+ this.#ackClipboardHandler = new AckClipboardHandler();
85
+ }
86
+
87
+ this.#uHidOutput = new UHidOutputStream();
88
+ }
89
+ }
90
+
91
+ serialize(): string[] {
92
+ return serialize<Init<boolean>>(this.value, Defaults);
93
+ }
94
+
95
+ setListDisplays(): void {
96
+ setListDisplays(this.value);
97
+ }
98
+
99
+ parseDisplay(line: string): ScrcpyDisplay | undefined {
100
+ return parseDisplay(line);
101
+ }
102
+
103
+ setListEncoders() {
104
+ setListEncoders(this.value);
105
+ }
106
+
107
+ parseEncoder(line: string): ScrcpyEncoder | undefined {
108
+ return parseEncoder(line);
109
+ }
110
+
111
+ parseVideoStreamMetadata(
112
+ stream: ReadableStream<Uint8Array>,
113
+ ): MaybePromiseLike<ScrcpyVideoStream> {
114
+ return parseVideoStreamMetadata(this.value, stream);
115
+ }
116
+
117
+ parseAudioStreamMetadata(
118
+ stream: ReadableStream<Uint8Array>,
119
+ ): MaybePromiseLike<ScrcpyAudioStreamMetadata> {
120
+ return parseAudioStreamMetadata(stream, this.value);
121
+ }
122
+
123
+ async parseDeviceMessage(
124
+ id: number,
125
+ stream: ExactReadable | AsyncExactReadable,
126
+ ): Promise<void> {
127
+ if (await this.#clipboard?.parse(id, stream)) {
128
+ return;
129
+ }
130
+
131
+ if (await this.#ackClipboardHandler?.parse(id, stream)) {
132
+ return;
133
+ }
134
+
135
+ throw new Error("Unknown device message");
136
+ }
137
+
138
+ endDeviceMessageStream(e?: unknown): void {
139
+ if (e) {
140
+ this.#clipboard?.error(e);
141
+ this.#ackClipboardHandler?.error(e);
142
+ } else {
143
+ this.#clipboard?.close();
144
+ this.#ackClipboardHandler?.close();
145
+ }
146
+ }
147
+
148
+ createMediaStreamTransformer(): TransformStream<
149
+ Uint8Array,
150
+ ScrcpyMediaStreamPacket
151
+ > {
152
+ return createMediaStreamTransformer(this.value);
153
+ }
154
+
155
+ serializeInjectTouchControlMessage(
156
+ message: ScrcpyInjectTouchControlMessage,
157
+ ): Uint8Array {
158
+ return serializeInjectTouchControlMessage(message);
159
+ }
160
+
161
+ serializeBackOrScreenOnControlMessage(
162
+ message: ScrcpyBackOrScreenOnControlMessage,
163
+ ): Uint8Array | undefined {
164
+ return serializeBackOrScreenOnControlMessage(message);
165
+ }
166
+
167
+ serializeSetClipboardControlMessage(
168
+ message: ScrcpySetClipboardControlMessage,
169
+ ): Uint8Array | [Uint8Array, Promise<void>] {
170
+ return this.#ackClipboardHandler!.serializeSetClipboardControlMessage(
171
+ message,
172
+ );
173
+ }
174
+
175
+ createScrollController(): ScrcpyScrollController {
176
+ return createScrollController();
177
+ }
178
+
179
+ serializeUHidCreateControlMessage(
180
+ message: ScrcpyUHidCreateControlMessage,
181
+ ): Uint8Array {
182
+ return serializeUHidCreateControlMessage(message);
183
+ }
184
+ }
185
+
186
+ type Init_<TVideo extends boolean> = Init<TVideo>;
187
+
188
+ export namespace ScrcpyOptions3_1 {
189
+ export type Init<TVideo extends boolean = boolean> = Init_<TVideo>;
190
+ }
@@ -30,8 +30,9 @@ export type AndroidKeyEventMeta =
30
30
  (typeof AndroidKeyEventMeta)[keyof typeof AndroidKeyEventMeta];
31
31
 
32
32
  // https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/view/KeyEvent.java;l=97;drc=95c1165bb895dd844e1793460710f7163dd330a3
33
- // Most names follow Web API `KeyboardEvent.code`,
34
- // Android-only (not exist in HID keyboard standard) keys are prefixed by `Android`.
33
+ // Android key code to Chrome key code: https://source.chromium.org/chromium/chromium/src/+/main:ui/events/keycodes/keyboard_code_conversion_android.cc
34
+ // Chrome key code to DOM key code: https://source.chromium.org/chromium/chromium/src/+/main:ui/events/keycodes/dom/dom_code_data.inc
35
+ // Some keys are not mapped to `KeyboardEvent.code`, only to `KeyboardEvent.key`: https://source.chromium.org/chromium/chromium/src/+/main:ui/events/keycodes/dom/dom_key_data.inc
35
36
  export const AndroidKeyCode = {
36
37
  AndroidHome: 3,
37
38
  AndroidBack: 4,
@@ -28,8 +28,8 @@ export function toScrcpyOptionValue<T>(value: unknown, empty: T): string | T {
28
28
  typeof value !== "number" &&
29
29
  typeof value !== "boolean"
30
30
  ) {
31
- throw new TypeError(`Invalid option value: ${String(value)}`);
31
+ throw new TypeError(`Invalid option value: ${JSON.stringify(value)}`);
32
32
  }
33
33
 
34
- return String(value);
34
+ return value.toString();
35
35
  }
@@ -1,6 +1,6 @@
1
1
  import type { MaybePromiseLike } from "@yume-chan/async";
2
2
  import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
3
- import type { AsyncExactReadable } from "@yume-chan/struct";
3
+ import type { AsyncExactReadable, ExactReadable } from "@yume-chan/struct";
4
4
 
5
5
  import type {
6
6
  ScrcpyBackOrScreenOnControlMessage,
@@ -35,10 +35,6 @@ export interface ScrcpyOptions<T extends object> {
35
35
 
36
36
  parseDisplay(line: string): ScrcpyDisplay | undefined;
37
37
 
38
- setListEncoders?(): void;
39
-
40
- parseEncoder?(line: string): ScrcpyEncoder | undefined;
41
-
42
38
  parseVideoStreamMetadata(
43
39
  stream: ReadableStream<Uint8Array>,
44
40
  ): MaybePromiseLike<ScrcpyVideoStream>;
@@ -47,7 +43,10 @@ export interface ScrcpyOptions<T extends object> {
47
43
  stream: ReadableStream<Uint8Array>,
48
44
  ): MaybePromiseLike<ScrcpyAudioStreamMetadata>;
49
45
 
50
- parseDeviceMessage(id: number, stream: AsyncExactReadable): Promise<void>;
46
+ parseDeviceMessage(
47
+ id: number,
48
+ stream: ExactReadable | AsyncExactReadable,
49
+ ): Promise<void>;
51
50
 
52
51
  endDeviceMessageStream(e?: unknown): void;
53
52
 
@@ -74,3 +73,9 @@ export interface ScrcpyOptions<T extends object> {
74
73
  message: ScrcpyUHidCreateControlMessage,
75
74
  ): Uint8Array;
76
75
  }
76
+
77
+ export interface ScrcpyOptionsListEncoders {
78
+ setListEncoders(): void;
79
+
80
+ parseEncoder(line: string): ScrcpyEncoder | undefined;
81
+ }
package/src/codec/h265.ts CHANGED
@@ -330,8 +330,10 @@ export function h265ParseSequenceParameterSet(nalu: Uint8Array) {
330
330
  if (pcm_enabled_flag) {
331
331
  pcm_sample_bit_depth_luma_minus1 = reader.read(4);
332
332
  pcm_sample_bit_depth_chroma_minus1 = reader.read(4);
333
- log2_min_pcm_luma_coding_block_size_minus3 = reader.read(4);
334
- log2_diff_max_min_pcm_luma_coding_block_size = reader.read(4);
333
+ log2_min_pcm_luma_coding_block_size_minus3 =
334
+ reader.decodeExponentialGolombNumber();
335
+ log2_diff_max_min_pcm_luma_coding_block_size =
336
+ reader.decodeExponentialGolombNumber();
335
337
  pcm_loop_filter_disabled_flag = !!reader.next();
336
338
  }
337
339
 
@@ -894,6 +896,30 @@ export function h265ParseShortTermReferencePictureSet(
894
896
  };
895
897
  }
896
898
 
899
+ export const H265AspectRatioIndicator = {
900
+ Unspecified: 0,
901
+ Square: 1,
902
+ _12_11: 2,
903
+ _10_11: 3,
904
+ _16_11: 4,
905
+ _40_33: 5,
906
+ _24_11: 6,
907
+ _20_11: 7,
908
+ _32_11: 8,
909
+ _80_33: 9,
910
+ _18_11: 10,
911
+ _15_11: 11,
912
+ _64_33: 12,
913
+ _160_99: 13,
914
+ _4_3: 15,
915
+ _3_2: 16,
916
+ _2_1: 17,
917
+ Extended: 255,
918
+ } as const;
919
+
920
+ export type H265AspectRatioIndicator =
921
+ (typeof H265AspectRatioIndicator)[keyof typeof H265AspectRatioIndicator];
922
+
897
923
  /**
898
924
  * E.2.1 VUI parameters syntax
899
925
  */
@@ -902,12 +928,12 @@ export function h265ParseVuiParameters(
902
928
  sps_max_sub_layers_minus1: number,
903
929
  ) {
904
930
  const aspect_ratio_info_present_flag = !!reader.next();
905
- let aspect_ratio_idc: number | undefined;
931
+ let aspect_ratio_idc: H265AspectRatioIndicator | undefined;
906
932
  let sar_width: number | undefined;
907
933
  let sar_height: number | undefined;
908
934
  if (aspect_ratio_info_present_flag) {
909
- aspect_ratio_idc = reader.read(8);
910
- if (aspect_ratio_idc === 255) {
935
+ aspect_ratio_idc = reader.read(8) as H265AspectRatioIndicator;
936
+ if (aspect_ratio_idc === H265AspectRatioIndicator.Extended) {
911
937
  sar_width = reader.read(16);
912
938
  sar_height = reader.read(16);
913
939
  }
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./1_15/index.js";
2
+ export * from "./1_15_1.js";
2
3
  export * from "./1_16.js";
3
4
  export * from "./1_17/index.js";
4
5
  export * from "./1_18/index.js";
@@ -11,13 +12,19 @@ export * from "./1_24/index.js";
11
12
  export * from "./1_25/index.js";
12
13
  export * from "./2_0/index.js";
13
14
  export * from "./2_1/index.js";
15
+ export * from "./2_1_1.js";
14
16
  export * from "./2_2/index.js";
15
17
  export * from "./2_3/index.js";
18
+ export * from "./2_3_1.js";
16
19
  export * from "./2_4/index.js";
17
20
  export * from "./2_5.js";
18
21
  export * from "./2_6/index.js";
22
+ export * from "./2_6_1.js";
19
23
  export * from "./2_7/index.js";
20
24
  export * from "./3_0/index.js";
25
+ export * from "./3_0_1.js";
26
+ export * from "./3_0_2.js";
27
+ export * from "./3_1/index.js";
21
28
  export * from "./android/index.js";
22
29
  export * from "./base/index.js";
23
30
  export * from "./codec/index.js";
package/src/latest.ts CHANGED
@@ -1,7 +1,23 @@
1
+ import { ScrcpyOptions3_1 } from "./3_1/options.js";
2
+
3
+ export class ScrcpyOptionsLatest<
4
+ TVideo extends boolean,
5
+ > extends ScrcpyOptions3_1<TVideo> {
6
+ constructor(init: ScrcpyOptions3_1.Init<TVideo>) {
7
+ super(init);
8
+ }
9
+ }
10
+
11
+ export namespace ScrcpyOptionsLatest {
12
+ export type Init<TVideo extends boolean = boolean> =
13
+ ScrcpyOptions3_1.Init<TVideo>;
14
+ }
15
+
1
16
  export {
2
17
  BackOrScreenOnControlMessage as ScrcpyBackOrScreenOnControlMessage,
3
18
  CaptureOrientation as ScrcpyCaptureOrientation,
4
19
  CodecOptions as ScrcpyCodecOptions,
20
+ Crop as ScrcpyCrop,
5
21
  InjectScrollControlMessage as ScrcpyInjectScrollControlMessage,
6
22
  InjectTouchControlMessage as ScrcpyInjectTouchControlMessage,
7
23
  InstanceId as ScrcpyInstanceId,
@@ -12,4 +28,4 @@ export {
12
28
  SetClipboardControlMessage as ScrcpySetClipboardControlMessage,
13
29
  UHidCreateControlMessage as ScrcpyUHidCreateControlMessage,
14
30
  UHidOutputDeviceMessage as ScrcpyUHidOutputDeviceMessage,
15
- } from "./3_0/impl/index.js";
31
+ } from "./3_1/impl/index.js";
@@ -1,4 +1,3 @@
1
1
  export * from "./clamp.js";
2
2
  export * from "./constants.js";
3
3
  export * from "./omit.js";
4
- export * from "./wrapper.js";