Stefan Schuermans commited on 2014-05-11 14:25:42
Showing 4 changed files, with 17 additions and 8 deletions.
... | ... |
@@ -31,7 +31,8 @@ class Synchronizer: |
31 | 31 |
self.select_timeout = 0.1 # timeout (s) for select syscall |
32 | 32 |
self.speed_change = 0.05 # change of MPlayer speed for catching up |
33 | 33 |
# create static objects |
34 |
- self.re_mplayer_pos = re.compile(r"[AV]: *([0-9]+.[0-9]+) *\([0-9:.]*\) of .*") |
|
34 |
+ self.re_mplayer_audio_pos = re.compile(r"A: *([0-9]+.[0-9]+) *\([0-9:.]*\) of .*") |
|
35 |
+ self.re_mplayer_video_pos = re.compile(r"A: *([0-9]+.[0-9]+) *V: *[0-9]+.[0-9]+ A-V: .*") |
|
35 | 36 |
self.re_ignore_prefix = re.compile(r"[0-9a-zA-Z_]+__(.*)") |
36 | 37 |
# create member variables |
37 | 38 |
self.mplayer = None |
... | ... |
@@ -99,11 +100,19 @@ class Synchronizer: |
99 | 100 |
else: |
100 | 101 |
self.dbg_print("MPlayer stdout: " + line) |
101 | 102 |
if not err: |
102 |
- # MPlayer position information |
|
103 |
- m_mplayer_pos = self.re_mplayer_pos.match(line) |
|
104 |
- if m_mplayer_pos: |
|
103 |
+ # MPlayer position information (audio) |
|
104 |
+ m_mplayer_audio_pos = self.re_mplayer_audio_pos.match(line) |
|
105 |
+ if m_mplayer_audio_pos: |
|
105 | 106 |
self.mplayer_timestamp = datetime.datetime.now() |
106 |
- self.mplayer_pos = float(m_mplayer_pos.group(1)) |
|
107 |
+ self.mplayer_pos = float(m_mplayer_audio_pos.group(1)) |
|
108 |
+ # synchronize |
|
109 |
+ self.sync() |
|
110 |
+ else: |
|
111 |
+ # MPlayer position information (video) |
|
112 |
+ m_mplayer_video_pos = self.re_mplayer_video_pos.match(line) |
|
113 |
+ if m_mplayer_video_pos: |
|
114 |
+ self.mplayer_timestamp = datetime.datetime.now() |
|
115 |
+ self.mplayer_pos = float(m_mplayer_video_pos.group(1)) |
|
107 | 116 |
# synchronize |
108 | 117 |
self.sync() |
109 | 118 |
|
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
#! /usr/bin/env python |
2 | 2 |
|
3 | 3 |
# BlinkenArea Stage Director |
4 |
-# Copyright 2013-2014 Stefan Schuermans <stefan@blinkenarea.org> |
|
4 |
+# Copyright 2013-2014 Stefan Schuermans <stefan@schuermans.info> |
|
5 | 5 |
# Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
6 | 6 |
# a blinkenarea.org project - https://www.blinkenarea.org/ |
7 | 7 |
|
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
#! /usr/bin/env python |
2 | 2 |
|
3 | 3 |
# BlinkenArea Stage Director |
4 |
-# Copyright 2013-2014 Stefan Schuermans <stefan@blinkenarea.org> |
|
4 |
+# Copyright 2013-2014 Stefan Schuermans <stefan@schuermans.info> |
|
5 | 5 |
# Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
6 | 6 |
# a blinkenarea.org project - https://www.blinkenarea.org/ |
7 | 7 |
|
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
#! /usr/bin/env python |
2 | 2 |
|
3 | 3 |
# BlinkenArea Stage Director |
4 |
-# Copyright 2013-2014 Stefan Schuermans <stefan@blinkenarea.org> |
|
4 |
+# Copyright 2013-2014 Stefan Schuermans <stefan@schuermans.info> |
|
5 | 5 |
# Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
6 | 6 |
# a blinkenarea.org project - https://www.blinkenarea.org/ |
7 | 7 |
|
8 | 8 |