Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDL CMX 3600 Adapter: Fix Source Out calculation when a TimeWarp retiming effect is present #1459

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/py-opentimelineio/opentimelineio/adapters/cmx_3600.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,9 +985,11 @@ def __init__(
line.source_in.rate
)
elif timing_effect.effect_name == "LinearTimeWarp":
value = clip.trimmed_range().duration.value / timing_effect.time_scalar
line.source_out = (
line.source_in + opentime.RationalTime(value, rate))
value = (
clip.trimmed_range().duration.value * timing_effect.time_scalar
- 1
)
line.source_out = line.source_in + opentime.RationalTime(value, rate)

range_in_timeline = clip.transformed_time_range(
clip.trimmed_range(),
Expand Down
4 changes: 4 additions & 0 deletions tests/sample_data/source_out_timewarp.edl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TITLE: SOURCE_OUT_TIMEWARP
FCM: NON-DROP FRAME
000001 B113RPTW V C 00:32:02:06 00:32:06:19 01:34:53:09 01:34:57:13
M2 B113RPTW 026.4 00:32:02:06
12 changes: 12 additions & 0 deletions tests/test_cmx_3600_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
MULTIPLE_TARGET_AUDIO_PATH = os.path.join(SAMPLE_DATA_DIR, "multi_audio.edl")
TRANSITION_DURATION_TEST = os.path.join(SAMPLE_DATA_DIR, "transition_duration.edl")
ENABLED_TEST = os.path.join(SAMPLE_DATA_DIR, "enabled.otio")
SOURCE_OUT_TIMEWARP_TEST = os.path.join(SAMPLE_DATA_DIR, "source_out_timewarp.edl")


class EDLAdapterTest(unittest.TestCase, otio_test_utils.OTIOAssertions):
Expand Down Expand Up @@ -1252,6 +1253,17 @@ def test_enabled(self):

self.assertMultiLineEqual(result, expected)

def test_source_out_timewarp(self):
tl = otio.adapters.read_from_file(SOURCE_OUT_TIMEWARP_TEST)
result = otio.adapters.write_to_string(tl, adapter_name="cmx_3600")
expected = r'''TITLE: SOURCE_OUT_TIMEWARP

001 B113RPTW V C 00:32:02:06 00:32:06:19 01:34:53:09 01:34:57:13
M2 000001 26.4 00:32:02:06
* FROM CLIP NAME: 000001
'''
self.assertMultiLineEqual(result, expected)


if __name__ == "__main__":
unittest.main()