You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix snapping behavior of current video position marker
Lots of text incoming, since timestamp wrangling is hell and I want to
write down my reasoning before I inevitably forget it again in two
weeks.
Before commit 5d4973a, snapping an
audio line's end time to the "current video position" indicator line
would reliably make the line end on the frame before the current video
frame (i.e. make the current video frame be the first frame where the
selected line is *not* visible any more).
Commit 5d4973a broke this, making the
behavior of snapping audio times to the "current video position"
inconsistent.
The commit in question is definitely not fully correct, ultimately just
because the entire concept of implicitly converting millisecond
timestamps to centisecond timestamps is flawed in and of itself, and
bound to always fail in sufficiently crazy edge cases. Fixing the
timestamp conversion properly would entail either working with
centisecond timestamps from the beginning, or somehow making the process
of converting timestamps aware of the context the timestamps are from
(e.g. "coming from some frame timestamp").
However, this specific issue was only *exposed* by this commit, and not
solely caused by it. Its root cause was just that the "current video
position" marker on the audio display would mark the *exact* time of the
current video frame, rather than the ideal start/end time for a line to
start/end at that video frame. This is why only snapping to the "current
video position" broke while snapping to keyframes worked fine. It's
quite possible that snapping to the "current video frame" marker was
just never thought of as a use case.
So, for now, TypesettingTools#421 can just be fixed by
making a line snapped to the "current video position" marker snap to the
middle of the frame rather than at the frame's exact start, and
5d4973a can be untangled at some later
time.
However, we would still like to *draw* the "current video position"
marker at the exact start time of the current video frame, so that one
can tell from the audio display which lines are visible at the current
video frame and which aren't.
Hence, we use the following middle-ground solution:
- Keep drawing the "current video position" marker at the exact start
time of video frames
- Do not allow snapping to the exact time of the "current video
position" marker. Instead, allow either snapping to the middle of the
previous frame, or the middle of the current frame.
- To make this behavior understandable for the user, draw a
semi-transparent rectangle behind the "current video position" marker
indicating the duration of the previous and current video frame.
FixesTypesettingTools#421.
Copy file name to clipboardExpand all lines: src/audio_marker.h
+16-2Lines changed: 16 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,8 @@ class AudioMarkerKeyframe;
28
28
classPen;
29
29
classProject;
30
30
classVideoPositionMarker;
31
+
classVideoPositionRange;
32
+
classVideoPositionSnapPoint;
31
33
classwxPen;
32
34
33
35
namespaceagi {
@@ -53,6 +55,10 @@ class AudioMarker {
53
55
/// @return The marker's position in milliseconds
54
56
virtualintGetPosition() const = 0;
55
57
58
+
/// @brief Get the marker's width
59
+
/// @return The marker's width if the marker should be a rectangle, or 0 if the marker should be drawn as a line (with the thickness specified by the style)
60
+
virtualintGetWidth() const { return0; }
61
+
56
62
/// @brief Get the marker's drawing style
57
63
/// @return A pen object describing the marker's drawing style
58
64
virtual wxPen GetStyle() const = 0;
@@ -72,9 +78,12 @@ class AudioMarkerProvider {
72
78
73
79
~AudioMarkerProvider() = default;
74
80
public:
75
-
/// @brief Return markers in a time range
81
+
/// @brief Return markers in a time range to render in audio display
0 commit comments