webatem 2.3.2__tar.gz → 2.4.1__tar.gz

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 (136) hide show
  1. {webatem-2.3.2 → webatem-2.4.1}/PKG-INFO +5 -4
  2. {webatem-2.3.2 → webatem-2.4.1}/README.md +4 -3
  3. {webatem-2.3.2 → webatem-2.4.1}/atem_control/apps.py +14 -0
  4. {webatem-2.3.2 → webatem-2.4.1}/atem_control/media_pool/watcher.py +72 -10
  5. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/js/atem_control.js +50 -2
  6. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/vendor/webatem.css +1 -1
  7. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_settings_transition.html +14 -5
  8. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_settings_usk.html +8 -2
  9. webatem-2.4.1/atem_control/templates/control/_transition_style.html +26 -0
  10. {webatem-2.3.2 → webatem-2.4.1}/pyproject.toml +1 -1
  11. {webatem-2.3.2 → webatem-2.4.1}/webatem.egg-info/PKG-INFO +5 -4
  12. webatem-2.3.2/atem_control/templates/control/_transition_style.html +0 -19
  13. {webatem-2.3.2 → webatem-2.4.1}/LICENSE +0 -0
  14. {webatem-2.3.2 → webatem-2.4.1}/atem_control/__init__.py +0 -0
  15. {webatem-2.3.2 → webatem-2.4.1}/atem_control/activity.py +0 -0
  16. {webatem-2.3.2 → webatem-2.4.1}/atem_control/control/__init__.py +0 -0
  17. {webatem-2.3.2 → webatem-2.4.1}/atem_control/control/activity.py +0 -0
  18. {webatem-2.3.2 → webatem-2.4.1}/atem_control/control/commands.py +0 -0
  19. {webatem-2.3.2 → webatem-2.4.1}/atem_control/control/consumer.py +0 -0
  20. {webatem-2.3.2 → webatem-2.4.1}/atem_control/control/device_api.py +0 -0
  21. {webatem-2.3.2 → webatem-2.4.1}/atem_control/control/logging.py +0 -0
  22. {webatem-2.3.2 → webatem-2.4.1}/atem_control/control/views.py +0 -0
  23. {webatem-2.3.2 → webatem-2.4.1}/atem_control/discovery.py +0 -0
  24. {webatem-2.3.2 → webatem-2.4.1}/atem_control/hooks.py +0 -0
  25. {webatem-2.3.2 → webatem-2.4.1}/atem_control/hyperdeck/__init__.py +0 -0
  26. {webatem-2.3.2 → webatem-2.4.1}/atem_control/hyperdeck/connection.py +0 -0
  27. {webatem-2.3.2 → webatem-2.4.1}/atem_control/hyperdeck/views.py +0 -0
  28. {webatem-2.3.2 → webatem-2.4.1}/atem_control/ip_upload_lock.py +0 -0
  29. {webatem-2.3.2 → webatem-2.4.1}/atem_control/media_pool/__init__.py +0 -0
  30. {webatem-2.3.2 → webatem-2.4.1}/atem_control/media_pool/broadcast.py +0 -0
  31. {webatem-2.3.2 → webatem-2.4.1}/atem_control/media_pool/still_cache.py +0 -0
  32. {webatem-2.3.2 → webatem-2.4.1}/atem_control/media_pool/views.py +0 -0
  33. {webatem-2.3.2 → webatem-2.4.1}/atem_control/migrations/0001_initial.py +0 -0
  34. {webatem-2.3.2 → webatem-2.4.1}/atem_control/migrations/0002_legacy_log.py +0 -0
  35. {webatem-2.3.2 → webatem-2.4.1}/atem_control/migrations/__init__.py +0 -0
  36. {webatem-2.3.2 → webatem-2.4.1}/atem_control/models.py +0 -0
  37. {webatem-2.3.2 → webatem-2.4.1}/atem_control/netutil.py +0 -0
  38. {webatem-2.3.2 → webatem-2.4.1}/atem_control/profile/__init__.py +0 -0
  39. {webatem-2.3.2 → webatem-2.4.1}/atem_control/profile/dialog.py +0 -0
  40. {webatem-2.3.2 → webatem-2.4.1}/atem_control/profile/export.py +0 -0
  41. {webatem-2.3.2 → webatem-2.4.1}/atem_control/profile/views.py +0 -0
  42. {webatem-2.3.2 → webatem-2.4.1}/atem_control/routing.py +0 -0
  43. {webatem-2.3.2 → webatem-2.4.1}/atem_control/sightings.py +0 -0
  44. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/apple-touch-icon.png +0 -0
  45. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/brand.css +0 -0
  46. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/favicon-32.png +0 -0
  47. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/favicon.ico +0 -0
  48. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/Archivo-400-latin-ext.woff2 +0 -0
  49. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/Archivo-400-latin.woff2 +0 -0
  50. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/Archivo-500-latin-ext.woff2 +0 -0
  51. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/Archivo-500-latin.woff2 +0 -0
  52. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/Archivo-600-latin-ext.woff2 +0 -0
  53. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/Archivo-600-latin.woff2 +0 -0
  54. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/Archivo-800-latin-ext.woff2 +0 -0
  55. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/Archivo-800-latin.woff2 +0 -0
  56. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
  57. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/IBMPlexMono-400-latin.woff2 +0 -0
  58. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/IBMPlexMono-500-latin-ext.woff2 +0 -0
  59. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/IBMPlexMono-500-latin.woff2 +0 -0
  60. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/IBMPlexMono-600-latin-ext.woff2 +0 -0
  61. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/IBMPlexMono-600-latin.woff2 +0 -0
  62. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/OFL-Archivo.txt +0 -0
  63. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/fonts/OFL-IBMPlexMono.txt +0 -0
  64. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/icon-192.png +0 -0
  65. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/icon-512.png +0 -0
  66. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/icon-maskable-512.png +0 -0
  67. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/manifest.webmanifest +0 -0
  68. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/mark.svg +0 -0
  69. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/tray/linux-24.png +0 -0
  70. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/tray/mac-22.png +0 -0
  71. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/tray/mac-44.png +0 -0
  72. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/tray/win-16.png +0 -0
  73. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/brand/tray/win-32.png +0 -0
  74. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/css/atem_connect.css +0 -0
  75. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/css/atem_control.css +0 -0
  76. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/icon.png +0 -0
  77. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/js/atem_connect.js +0 -0
  78. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/js/atem_control_page.js +0 -0
  79. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/js/atem_discovery.js +0 -0
  80. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/js/atem_hyperdeck.js +0 -0
  81. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/js/atem_profile.js +0 -0
  82. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/js/atem_realtime_slider.js +0 -0
  83. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/js/custom-scrollbar.js +0 -0
  84. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/js/recent_label.js +0 -0
  85. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/js/wa-select.js +0 -0
  86. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/vendor/README.md +0 -0
  87. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/vendor/alpine.min.js +0 -0
  88. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/vendor/alpinejs-collapse-3.14.3.min.js +0 -0
  89. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/vendor/bootstrap-icons/bootstrap-icons.min.css +0 -0
  90. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/vendor/bootstrap-icons/fonts/bootstrap-icons.woff +0 -0
  91. {webatem-2.3.2 → webatem-2.4.1}/atem_control/static/vendor/bootstrap-icons/fonts/bootstrap-icons.woff2 +0 -0
  92. {webatem-2.3.2 → webatem-2.4.1}/atem_control/storage.py +0 -0
  93. {webatem-2.3.2 → webatem-2.4.1}/atem_control/tally.py +0 -0
  94. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/connect.html +0 -0
  95. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_atem_info.html +0 -0
  96. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_fade_to_black.html +0 -0
  97. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_fairlight.html +0 -0
  98. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_header.html +0 -0
  99. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_hyperdeck_panel.html +0 -0
  100. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_macros.html +0 -0
  101. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_media_pool.html +0 -0
  102. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_profile_modal.html +0 -0
  103. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_settings_dsk.html +0 -0
  104. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_slider.html +0 -0
  105. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_transition_controls.html +0 -0
  106. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_usk_fly.html +0 -0
  107. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_usk_keyframe.html +0 -0
  108. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_usk_mask.html +0 -0
  109. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control/_usk_slider.html +0 -0
  110. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templates/control.html +0 -0
  111. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templatetags/__init__.py +0 -0
  112. {webatem-2.3.2 → webatem-2.4.1}/atem_control/templatetags/static_v.py +0 -0
  113. {webatem-2.3.2 → webatem-2.4.1}/atem_control/uploader.py +0 -0
  114. {webatem-2.3.2 → webatem-2.4.1}/atem_control/urls.py +0 -0
  115. {webatem-2.3.2 → webatem-2.4.1}/setup.cfg +0 -0
  116. {webatem-2.3.2 → webatem-2.4.1}/webatem/__init__.py +0 -0
  117. {webatem-2.3.2 → webatem-2.4.1}/webatem/__main__.py +0 -0
  118. {webatem-2.3.2 → webatem-2.4.1}/webatem/applog.py +0 -0
  119. {webatem-2.3.2 → webatem-2.4.1}/webatem/asgi.py +0 -0
  120. {webatem-2.3.2 → webatem-2.4.1}/webatem/context.py +0 -0
  121. {webatem-2.3.2 → webatem-2.4.1}/webatem/launcher.py +0 -0
  122. {webatem-2.3.2 → webatem-2.4.1}/webatem/server.py +0 -0
  123. {webatem-2.3.2 → webatem-2.4.1}/webatem/settings.py +0 -0
  124. {webatem-2.3.2 → webatem-2.4.1}/webatem/templates/base.html +0 -0
  125. {webatem-2.3.2 → webatem-2.4.1}/webatem/templates/brand/_mark.svg +0 -0
  126. {webatem-2.3.2 → webatem-2.4.1}/webatem/templates/launcher.html +0 -0
  127. {webatem-2.3.2 → webatem-2.4.1}/webatem/uninstall.py +0 -0
  128. {webatem-2.3.2 → webatem-2.4.1}/webatem/updates.py +0 -0
  129. {webatem-2.3.2 → webatem-2.4.1}/webatem/urls.py +0 -0
  130. {webatem-2.3.2 → webatem-2.4.1}/webatem/views.py +0 -0
  131. {webatem-2.3.2 → webatem-2.4.1}/webatem/websocket.py +0 -0
  132. {webatem-2.3.2 → webatem-2.4.1}/webatem.egg-info/SOURCES.txt +0 -0
  133. {webatem-2.3.2 → webatem-2.4.1}/webatem.egg-info/dependency_links.txt +0 -0
  134. {webatem-2.3.2 → webatem-2.4.1}/webatem.egg-info/entry_points.txt +0 -0
  135. {webatem-2.3.2 → webatem-2.4.1}/webatem.egg-info/requires.txt +0 -0
  136. {webatem-2.3.2 → webatem-2.4.1}/webatem.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webatem
3
- Version: 2.3.2
3
+ Version: 2.4.1
4
4
  Summary: Browser-based control for Blackmagic ATEM switchers: run it, open the browser, your switchers are there
5
5
  Author: Lucas Romanenko
6
6
  License: MIT
@@ -133,9 +133,10 @@ with mine".
133
133
 
134
134
  It should work more widely than that. The protocol is the same across the
135
135
  range, the control surface is built from what each switcher reports about
136
- itself rather than from a hardcoded model list, and features a switcher does
137
- not have simply do not appear. But should is not the same as does, and
138
- nobody has checked.
136
+ itself rather than from a hardcoded model list: features a switcher does
137
+ not have do not appear, or appear greyed where the switcher reports it has
138
+ none of something (a DVE, a stinger). But should is not the same as does,
139
+ and nobody has checked.
139
140
 
140
141
  So if you have a Mini, a Mini Pro, a Television Studio, a 2 M/E or 4 M/E, or
141
142
  anything else with an ATEM badge on it, **trying this and telling me what
@@ -103,9 +103,10 @@ with mine".
103
103
 
104
104
  It should work more widely than that. The protocol is the same across the
105
105
  range, the control surface is built from what each switcher reports about
106
- itself rather than from a hardcoded model list, and features a switcher does
107
- not have simply do not appear. But should is not the same as does, and
108
- nobody has checked.
106
+ itself rather than from a hardcoded model list: features a switcher does
107
+ not have do not appear, or appear greyed where the switcher reports it has
108
+ none of something (a DVE, a stinger). But should is not the same as does,
109
+ and nobody has checked.
109
110
 
110
111
  So if you have a Mini, a Mini Pro, a Television Studio, a 2 M/E or 4 M/E, or
111
112
  anything else with an ATEM badge on it, **trying this and telling me what
@@ -1,5 +1,17 @@
1
+ import sys
2
+
1
3
  from django.apps import AppConfig
2
4
 
5
+ # Threads in this process take turns with the GIL at least this often (the
6
+ # interpreter's default is 5 ms). Every switcher session's UDP thread has to
7
+ # read and acknowledge its packets within milliseconds while other threads
8
+ # work (a still being decoded, a page being rendered): a switcher resends
9
+ # what it hasn't had acknowledged after ~80 ms, and a 4K still comes at line
10
+ # rate. With 5 ms turns an offline replay of a 4K Plus download beside one
11
+ # busy pure-Python thread never finished; with 1 ms it took 11 s
12
+ # (2026-11-04).
13
+ GIL_SWITCH_INTERVAL = 0.001
14
+
3
15
 
4
16
  class AtemControlConfig(AppConfig):
5
17
  default_auto_field = 'django.db.models.BigAutoField'
@@ -12,6 +24,8 @@ class AtemControlConfig(AppConfig):
12
24
  label = 'webatem_atem'
13
25
 
14
26
  def ready(self):
27
+ if sys.getswitchinterval() > GIL_SWITCH_INTERVAL:
28
+ sys.setswitchinterval(GIL_SWITCH_INTERVAL)
15
29
  # Register the Channels bridge with the media_pool sub-package's
16
30
  # on_watcher_created hook. Must happen before any watcher.acquire()
17
31
  # call — importing the module runs its top-level on_watcher_created()
@@ -71,6 +71,7 @@ Upload-lockout pattern (2026-07-02 semantics):
71
71
  import base64
72
72
  import io
73
73
  import logging
74
+ import inspect
74
75
  import queue
75
76
  import threading
76
77
  import time
@@ -112,11 +113,18 @@ _TASK_DECODE = 'decode'
112
113
  _TASK_DOWNLOAD = 'download'
113
114
  _TASK_STOP = 'stop'
114
115
 
115
- # Per-slot download timeout (native interleaved transfer). Healthy
116
- # transfers are ~2s measured on LAN; 15s is ~7x headroom and still
117
- # generous for VPN links, while keeping the retry cycle fast when a
118
- # transfer dies (a long timeout only delays the retry).
119
- DOWNLOAD_TIMEOUT = 15.0
116
+ # Per-slot download limits (native interleaved transfer). A download gives
117
+ # up after DOWNLOAD_STALL_TIMEOUT with no data arriving (waiting for the
118
+ # lock counts as no data) and after DOWNLOAD_MAX_SECONDS in all. A 1080p
119
+ # still is ~2 s on a LAN, but a 4K one is 12 MB or more on the wire and an
120
+ # 8K one four times that: the old fixed 15 s cut a 4K Plus's first still
121
+ # off mid-stream every time, and the release of the store lock that came
122
+ # with it left the switcher's transfer engine refusing every request after
123
+ # (a 4K Plus, 2026-11-04). bmdwire before 1.11 has no stall timeout; the
124
+ # download then gets DOWNLOAD_TIMEOUT, as it always did.
125
+ DOWNLOAD_STALL_TIMEOUT = 15.0
126
+ DOWNLOAD_MAX_SECONDS = 240.0
127
+ DOWNLOAD_TIMEOUT = DOWNLOAD_STALL_TIMEOUT
120
128
 
121
129
  # A failed download is NEVER dropped (changed 2026-07-03): while the watcher
122
130
  # is alive and the slot still needs its thumb, the task re-queues itself
@@ -136,6 +144,11 @@ DOWNLOAD_TIMEOUT = 15.0
136
144
  # the store is free, and the thumb arrives as soon as it is.
137
145
  DOWNLOAD_RETRY_BACKOFF = 2.0
138
146
  DOWNLOAD_RETRY_BACKOFF_MAX = 30.0
147
+ # A retry's pause never holds up the other slots: with other tasks queued it
148
+ # goes to the back of the queue, and alone it waits at most this long at a
149
+ # time before looking again, so a still that arrives meanwhile isn't stuck
150
+ # behind a slot that keeps failing.
151
+ DOWNLOAD_RETRY_IDLE_STEP = 2.0
139
152
  # What the operator is told. Previews that have waited this long for
140
153
  # another client's turn show the media pool's waiting notice (ATEM Software
141
154
  # Control loading its thumbnails takes ~40 s for 20 stills, so a normal turn
@@ -234,6 +247,14 @@ def _thumb_from_png(png: bytes) -> Optional[str]:
234
247
  return 'data:image/jpeg;base64,' + base64.b64encode(thumb_bytes).decode('ascii')
235
248
 
236
249
 
250
+ def _takes_stall_timeout(download_still) -> bool:
251
+ """Whether this bmdwire's download_still has ``stall_timeout`` (1.11)."""
252
+ try:
253
+ return 'stall_timeout' in inspect.signature(download_still).parameters
254
+ except (TypeError, ValueError):
255
+ return False
256
+
257
+
237
258
  def _empty_slot(idx: int) -> dict:
238
259
  return {'index': idx, 'isUsed': False, 'hash': '', 'fileName': '', 'thumb': None,
239
260
  'previewFailed': False}
@@ -285,6 +306,8 @@ class MediaPoolWatcher:
285
306
  self._waiting_since: Optional[float] = None
286
307
  self._preview_waiting = False
287
308
  self._failing_since: Dict[int, float] = {}
309
+ # slot -> when its next download may start, after a failure's pause.
310
+ self._retry_due: Dict[int, float] = {}
288
311
 
289
312
  # The SHARED pooled connection this watcher rides (binder-owned).
290
313
  # _pool_instance is the pool entry dict, kept for the identity-
@@ -363,6 +386,7 @@ class MediaPoolWatcher:
363
386
  # ones here would suppress every fresh enqueue.
364
387
  self._work_queue = queue.Queue()
365
388
  self._pending_downloads.clear()
389
+ self._retry_due.clear()
366
390
  self._worker_thread = threading.Thread(
367
391
  target=self._run_worker,
368
392
  daemon=True,
@@ -1187,9 +1211,24 @@ class MediaPoolWatcher:
1187
1211
  # anyway, and the recheck above retires the task the moment it
1188
1212
  # stops being needed.) One that only waited its turn goes at once.
1189
1213
  if attempt > 1 and not waited:
1190
- if self._stop_event.wait(min(DOWNLOAD_RETRY_BACKOFF * (attempt - 1),
1191
- DOWNLOAD_RETRY_BACKOFF_MAX)):
1192
- return False
1214
+ now = time.monotonic()
1215
+ with self._state_lock:
1216
+ due = self._retry_due.pop(slot_idx, None)
1217
+ if due is None:
1218
+ due = now + min(DOWNLOAD_RETRY_BACKOFF * (attempt - 1),
1219
+ DOWNLOAD_RETRY_BACKOFF_MAX)
1220
+ remaining = due - now
1221
+ if remaining > 0:
1222
+ if not self._work_queue.empty():
1223
+ # Others are waiting: they go first, this one after.
1224
+ return self._retry_later(slot_idx, expected_hash, attempt,
1225
+ waited, due)
1226
+ step = min(remaining, DOWNLOAD_RETRY_IDLE_STEP)
1227
+ if self._stop_event.wait(step):
1228
+ return False
1229
+ if step < remaining:
1230
+ return self._retry_later(slot_idx, expected_hash, attempt,
1231
+ waited, due)
1193
1232
 
1194
1233
  # Failures re-queue the whole task FOREVER (capped backoff) while
1195
1234
  # the slot still needs its thumb — settled content gets no further
@@ -1206,8 +1245,13 @@ class MediaPoolWatcher:
1206
1245
  failure = 'pooled connection not ready'
1207
1246
  else:
1208
1247
  try:
1209
- raw_ycbcr = conn.download_still(
1210
- slot_idx, timeout=DOWNLOAD_TIMEOUT)
1248
+ if _takes_stall_timeout(conn.download_still):
1249
+ raw_ycbcr = conn.download_still(
1250
+ slot_idx, timeout=DOWNLOAD_MAX_SECONDS,
1251
+ stall_timeout=DOWNLOAD_STALL_TIMEOUT)
1252
+ else:
1253
+ raw_ycbcr = conn.download_still(
1254
+ slot_idx, timeout=DOWNLOAD_TIMEOUT)
1211
1255
  except Exception as e:
1212
1256
  failure = str(e)
1213
1257
  if raw_ycbcr is None:
@@ -1238,6 +1282,11 @@ class MediaPoolWatcher:
1238
1282
  f"{slot_idx} failed (attempt {attempt}): {failure} "
1239
1283
  f"— will keep retrying while the slot needs it"
1240
1284
  )
1285
+ if not turn:
1286
+ with self._state_lock:
1287
+ self._retry_due[slot_idx] = time.monotonic() + min(
1288
+ DOWNLOAD_RETRY_BACKOFF * attempt,
1289
+ DOWNLOAD_RETRY_BACKOFF_MAX)
1241
1290
  try:
1242
1291
  self._work_queue.put_nowait(
1243
1292
  (_TASK_DOWNLOAD, slot_idx, expected_hash, attempt + 1,
@@ -1262,6 +1311,19 @@ class MediaPoolWatcher:
1262
1311
  self._do_decode(slot_idx, raw_ycbcr, expected_hash, w, h)
1263
1312
  return False
1264
1313
 
1314
+ def _retry_later(self, slot_idx: int, expected_hash: str, attempt: int,
1315
+ waited: bool, due: float) -> bool:
1316
+ """Put a retry whose pause isn't over at the back of the queue, its
1317
+ claim kept. True iff it was queued."""
1318
+ with self._state_lock:
1319
+ self._retry_due[slot_idx] = due
1320
+ try:
1321
+ self._work_queue.put_nowait(
1322
+ (_TASK_DOWNLOAD, slot_idx, expected_hash, attempt, waited))
1323
+ except Exception:
1324
+ return False
1325
+ return True
1326
+
1265
1327
  def _do_decode(self, slot_idx: int, raw: bytes, expected_hash: str, w: int, h: int):
1266
1328
  if not raw:
1267
1329
  return
@@ -2814,7 +2814,15 @@
2814
2814
  colorGenerators: 0,
2815
2815
  multiviewWindows: 0,
2816
2816
  fairlightStrips: 0,
2817
- macros: 0
2817
+ macros: 0,
2818
+ // The DVE / stinger / SuperSource block counts from the
2819
+ // switcher's _top (bmdwire's topology_block_counts). null
2820
+ // means unknown and greys nothing; only a reported 0 greys
2821
+ // what depends on the block (lacksBlock). A bmdwire without
2822
+ // these keys leaves them undefined, which is unknown too.
2823
+ dves: null,
2824
+ stingers: null,
2825
+ superSources: null
2818
2826
  },
2819
2827
  // Must exist in the initial state so the merge in updateState
2820
2828
  // (which only copies keys that are already defined) picks it
@@ -2954,8 +2962,48 @@
2954
2962
  "DVE": 3
2955
2963
  };
2956
2964
  const typeValue = typeof keyType === "string" ? typeMap[keyType] : keyType;
2965
+ if (typeValue === 3 && this.lacksBlock("dves")) return;
2957
2966
  this.send("set_usk_type", { key_index: uskIndex, key_type: typeValue });
2958
2967
  },
2968
+ // What the switcher says it lacks. True only when its _top reported
2969
+ // 0 blocks of ``kind`` ('dves' | 'stingers' | 'superSources'); an
2970
+ // unknown count (null, or undefined from an older bmdwire) is never
2971
+ // "lacks", so a switcher that hasn't said keeps every control.
2972
+ lacksBlock(kind) {
2973
+ return this.state.topology?.[kind] === 0;
2974
+ },
2975
+ // Why a control is greyed, for its tooltip; null (no title) when it
2976
+ // isn't.
2977
+ lacksBlockTitle(kind) {
2978
+ if (!this.lacksBlock(kind)) return null;
2979
+ return {
2980
+ dves: "This switcher has no DVE",
2981
+ stingers: "This switcher has no stinger",
2982
+ superSources: "This switcher has no SuperSource"
2983
+ }[kind] ?? null;
2984
+ },
2985
+ // The block a transition style needs: DVE (3) and Stinger (4).
2986
+ transitionStyleBlock(style) {
2987
+ return { 3: "dves", 4: "stingers" }[style] ?? null;
2988
+ },
2989
+ transitionStyleMissing(style) {
2990
+ const kind = this.transitionStyleBlock(style);
2991
+ return kind !== null && this.lacksBlock(kind);
2992
+ },
2993
+ transitionStyleTitle(style) {
2994
+ const kind = this.transitionStyleBlock(style);
2995
+ return kind === null ? null : this.lacksBlockTitle(kind);
2996
+ },
2997
+ setTransitionStyle(style) {
2998
+ if (this.transitionStyleMissing(style)) return;
2999
+ this.send("set_transition_style", { style });
3000
+ },
3001
+ // The greying classes, the same pair the settings-dependent controls
3002
+ // use. A switcher SET to a style it says it lacks still shows it
3003
+ // selected (the style class is kept), only greyed.
3004
+ greyedClass(missing) {
3005
+ return missing ? " opacity-50 pointer-events-none" : "";
3006
+ },
2959
3007
  // Source-picker filter for dropdowns. ``ctx`` selects the
2960
3008
  // filter rule:
2961
3009
  // 'aux' — destinations valid for an aux output
@@ -3803,7 +3851,7 @@
3803
3851
  },
3804
3852
  getTransitionStyleButtonClass(styleIndex) {
3805
3853
  const isActive = this.state.mes[this.activeMe].transition.style === styleIndex;
3806
- return isActive ? "btn btn-sm btn-warning shadow-lg" : "btn btn-sm btn-outline hover:border-[oklch(var(--wa))]";
3854
+ return (isActive ? "btn btn-sm btn-warning shadow-lg" : "btn btn-sm btn-outline hover:border-[oklch(var(--wa))]") + this.greyedClass(this.transitionStyleMissing(styleIndex));
3807
3855
  },
3808
3856
  getTransitionSelectionButtonClass(keyType, keyIndex = null) {
3809
3857
  const selection = this.state.mes[this.activeMe].transition.selection;