mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 06:00:33 +02:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dac9dbce6e | ||
|
|
0e8b699fcd |
No files matched your search
+12
-1
@@ -81,8 +81,12 @@ class Media(unittest.TestCase):
|
|||||||
write_status(path, **values)
|
write_status(path, **values)
|
||||||
|
|
||||||
class FakeOverlay:
|
class FakeOverlay:
|
||||||
|
created = 0
|
||||||
|
|
||||||
def create(self, *a, **k):
|
def create(self, *a, **k):
|
||||||
return len(calls)
|
# Handles in creation order: surround 0, then screen 1 (theatre).
|
||||||
|
FakeOverlay.created += 1
|
||||||
|
return FakeOverlay.created - 1
|
||||||
|
|
||||||
def call(self, *a):
|
def call(self, *a):
|
||||||
pass
|
pass
|
||||||
@@ -131,6 +135,13 @@ class Media(unittest.TestCase):
|
|||||||
self.assertEqual(result['dropped'], 2)
|
self.assertEqual(result['dropped'], 2)
|
||||||
self.assertIn((0, 1, 1), calls[3:])
|
self.assertIn((0, 1, 1), calls[3:])
|
||||||
|
|
||||||
|
def test_theatre_surround_failure_does_not_stop_playback(self):
|
||||||
|
def fail_surround(n):
|
||||||
|
if n == 1: # the surround's upload is the first pixels call
|
||||||
|
raise RuntimeError('OpenVR SetOverlayRaw failed: 11')
|
||||||
|
result, _ = self.play_with('clip_SBS.mp4', on_pixels=fail_surround)
|
||||||
|
self.assertEqual((result['state'], result['frames']), ('ended', 4))
|
||||||
|
|
||||||
def test_stop_mid_video_reports_stopped(self):
|
def test_stop_mid_video_reports_stopped(self):
|
||||||
result, _ = self.play_with('clip_SBS.mp4', on_pixels=lambda n: n == 3 and stop_now())
|
result, _ = self.play_with('clip_SBS.mp4', on_pixels=lambda n: n == 3 and stop_now())
|
||||||
self.assertEqual(result['state'], 'stopped')
|
self.assertEqual(result['state'], 'stopped')
|
||||||
|
|||||||
+18
-10
@@ -88,12 +88,14 @@ class Overlay:
|
|||||||
def close(self):
|
def close(self):
|
||||||
# Best effort: SteamVR removes a disconnected client's overlays anyway,
|
# Best effort: SteamVR removes a disconnected client's overlays anyway,
|
||||||
# and a teardown error must not overwrite a finished playback's status.
|
# and a teardown error must not overwrite a finished playback's status.
|
||||||
for h in reversed(self.handles):
|
try:
|
||||||
try:
|
for h in reversed(self.handles):
|
||||||
self.call('DestroyOverlay', h)
|
try:
|
||||||
except RuntimeError:
|
self.call('DestroyOverlay', h)
|
||||||
pass
|
except Exception: # signals are already ignored here, so Stop isn't lost
|
||||||
self.vr.VR_ShutdownInternal()
|
pass
|
||||||
|
finally:
|
||||||
|
self.vr.VR_ShutdownInternal()
|
||||||
|
|
||||||
|
|
||||||
def probe(path):
|
def probe(path):
|
||||||
@@ -183,6 +185,8 @@ def play(args):
|
|||||||
except OverlayBusy:
|
except OverlayBusy:
|
||||||
pending.insert(0, item)
|
pending.insert(0, item)
|
||||||
return
|
return
|
||||||
|
except RuntimeError:
|
||||||
|
pass # the surround is cosmetic; never end playback over it
|
||||||
|
|
||||||
def hold(handle, data, w, h):
|
def hold(handle, data, w, h):
|
||||||
"""Keep a still (photo or splat) up until Stop, retrying through standby."""
|
"""Keep a still (photo or splat) up until Stop, retrying through standby."""
|
||||||
@@ -203,10 +207,14 @@ def play(args):
|
|||||||
try:
|
try:
|
||||||
vr = Overlay()
|
vr = Overlay()
|
||||||
if args.theatre:
|
if args.theatre:
|
||||||
surround = vr.create('framecontrol.media.surround', 40, 4, order=0)
|
try:
|
||||||
vr.call('SetOverlayAlpha', surround, .85)
|
surround = vr.create('framecontrol.media.surround', 40, 4, order=0)
|
||||||
if not show(surround, b'\x00\x00\x00\xff', 1, 1):
|
vr.call('SetOverlayAlpha', surround, .85)
|
||||||
pending.append((surround, b'\x00\x00\x00\xff', 1, 1))
|
if not show(surround, b'\x00\x00\x00\xff', 1, 1):
|
||||||
|
pending.append((surround, b'\x00\x00\x00\xff', 1, 1))
|
||||||
|
except RuntimeError as e:
|
||||||
|
# Cosmetic: play without the dark surround rather than not at all.
|
||||||
|
print('Theatre surround unavailable: %s' % e, flush=True)
|
||||||
screen = vr.create('framecontrol.media.screen', 3 if args.theatre else 1.6, 2,
|
screen = vr.create('framecontrol.media.screen', 3 if args.theatre else 1.6, 2,
|
||||||
plan['layout'] != 'mono', aspect)
|
plan['layout'] != 'mono', aspect)
|
||||||
if splat:
|
if splat:
|
||||||
|
|||||||
Reference in new issue
Block a user