Skip to content

Commit

Permalink
Log Sync using Measure Mode
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Gary Keeble committed Apr 24, 2016
1 parent 808767f commit 0dfb098
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ <h4>Log sync</h4>
<span class="glyphicon glyphicon-step-forward"></span>
</button>
</div>
<input type="text" class="form-control video-offset" value="+0.0" size="5">
<input type="text" class="form-control video-offset" value="+0.0" size="7">
</div>
</div>
</li>
Expand Down
32 changes: 17 additions & 15 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,16 @@ function BlackboxLogViewer() {
}
}

function setVideoOffset(offset) {
function setVideoOffset(offset, withoutRefresh) { // optionally prevent the graph refresh until later
videoOffset = offset;

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

invalidateGraph();
if (wihtoutRefresh) invalidateGraph();
}

function isInteger(value) {
Expand Down Expand Up @@ -909,13 +909,19 @@ function BlackboxLogViewer() {
}
e.preventDefault();
break;
case "M".charCodeAt(0):
if (!(shifted)) {
case "M".charCodeAt(0):
if (e.altKey && hasMarker && hasVideo && hasLog) { // adjust the video sync offset and remove marker
try{
setVideoOffset(videoOffset + (stringTimetoMsec($(".graph-time-marker").val()) / 1000000), true);
} catch(e) {
console.log('Failed to set video offset');
}
} else { // Add a marker to graph window
markerTime = currentBlackboxTime;
$(".graph-time-marker").val(formatTime(0));
setMarker(!hasMarker);
invalidateGraph();
}
setMarker(!hasMarker);
invalidateGraph();
e.preventDefault();
break;
// Add my shortcuts
Expand All @@ -941,16 +947,12 @@ function BlackboxLogViewer() {
}
e.preventDefault();
break;
case 33: // pgup arrow - goto start
if (!(shifted)) {
logJumpStart();
}
case 36: // home - goto start of log
logJumpStart();
e.preventDefault();
break;
case 34: // pgdn arrow - goto end
if (!(shifted)) {
logJumpEnd();
}
case 35: // end - goto end of log
logJumpEnd();
e.preventDefault();
break;

Expand Down
2 changes: 1 addition & 1 deletion js/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function formatTime(msec, displayMsec) {

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

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

0 comments on commit 0dfb098

Please sign in to comment.