Skip to content

Commit 0dfb098

Browse files
author
Gary Keeble
committed
Log Sync using Measure Mode
Identify an event (start of roll or flip) on the log, mark it (M key) scroll video until the first frame of the event is shown, press [Alt]M to sync marker point of log to this video point.
1 parent 808767f commit 0dfb098

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ <h4>Log sync</h4>
224224
<span class="glyphicon glyphicon-step-forward"></span>
225225
</button>
226226
</div>
227-
<input type="text" class="form-control video-offset" value="+0.0" size="5">
227+
<input type="text" class="form-control video-offset" value="+0.0" size="7">
228228
</div>
229229
</div>
230230
</li>

js/main.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,16 @@ function BlackboxLogViewer() {
130130
}
131131
}
132132

133-
function setVideoOffset(offset) {
133+
function setVideoOffset(offset, withoutRefresh) { // optionally prevent the graph refresh until later
134134
videoOffset = offset;
135135

136136
/*
137137
* Round to 2 dec places for display and put a plus at the start for positive values to emphasize the fact it's
138138
* an offset
139139
*/
140-
$(".video-offset").val((videoOffset >= 0 ? "+" : "") + (videoOffset.toFixed(2) != videoOffset ? videoOffset.toFixed(2) : videoOffset));
140+
$(".video-offset").val((videoOffset >= 0 ? "+" : "") + (videoOffset.toFixed(3) != videoOffset ? videoOffset.toFixed(3) : videoOffset));
141141

142-
invalidateGraph();
142+
if (wihtoutRefresh) invalidateGraph();
143143
}
144144

145145
function isInteger(value) {
@@ -909,13 +909,19 @@ function BlackboxLogViewer() {
909909
}
910910
e.preventDefault();
911911
break;
912-
case "M".charCodeAt(0):
913-
if (!(shifted)) {
912+
case "M".charCodeAt(0):
913+
if (e.altKey && hasMarker && hasVideo && hasLog) { // adjust the video sync offset and remove marker
914+
try{
915+
setVideoOffset(videoOffset + (stringTimetoMsec($(".graph-time-marker").val()) / 1000000), true);
916+
} catch(e) {
917+
console.log('Failed to set video offset');
918+
}
919+
} else { // Add a marker to graph window
914920
markerTime = currentBlackboxTime;
915921
$(".graph-time-marker").val(formatTime(0));
916-
setMarker(!hasMarker);
917-
invalidateGraph();
918922
}
923+
setMarker(!hasMarker);
924+
invalidateGraph();
919925
e.preventDefault();
920926
break;
921927
// Add my shortcuts
@@ -941,16 +947,12 @@ function BlackboxLogViewer() {
941947
}
942948
e.preventDefault();
943949
break;
944-
case 33: // pgup arrow - goto start
945-
if (!(shifted)) {
946-
logJumpStart();
947-
}
950+
case 36: // home - goto start of log
951+
logJumpStart();
948952
e.preventDefault();
949953
break;
950-
case 34: // pgdn arrow - goto end
951-
if (!(shifted)) {
952-
logJumpEnd();
953-
}
954+
case 35: // end - goto end of log
955+
logJumpEnd();
954956
e.preventDefault();
955957
break;
956958

js/tools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ function formatTime(msec, displayMsec) {
189189

190190
function stringTimetoMsec(input) {
191191
try {
192-
var matches = input.match(/([0-9]+)(\D)*([0-9]+)*\D*([0-9]+)*/);
192+
var matches = input.match(/([+-]?[0-9]+)(\D)*([0-9]+)*\D*([0-9]+)*/);
193193

194194
if(matches.length>2) { // there is a placeholder - either : or .
195195
if(matches[2] == ':'){ // time has been entered MM:SS.SSS

0 commit comments

Comments
 (0)