diff --git a/etc/SampleData/MultipleRates.otio b/etc/SampleData/MultipleRates.otio new file mode 100644 index 00000000..7e403930 --- /dev/null +++ b/etc/SampleData/MultipleRates.otio @@ -0,0 +1,98 @@ +{ + "OTIO_SCHEMA": "Timeline.1", + "metadata": { + "CreationDate": "28_11_2024_09_55_18", + "Id": "JPQ93Uc503gE4nml" + }, + "name": "cineSync Play timeline", + "global_start_time": null, + "tracks": { + "OTIO_SCHEMA": "Stack.1", + "metadata": {}, + "name": "", + "source_range": null, + "effects": [], + "markers": [], + "enabled": true, + "children": [ + { + "OTIO_SCHEMA": "Track.1", + "metadata": {}, + "name": "Video", + "source_range": null, + "effects": [], + "markers": [], + "enabled": true, + "children": [ + { + "OTIO_SCHEMA": "Gap.1", + "name": "Gap", + "source_range": { + "OTIO_SCHEMA": "TimeRange.1", + "duration": { + "OTIO_SCHEMA": "RationalTime.1", + "rate": 24, + "value": 1 + }, + "start_time": { + "OTIO_SCHEMA": "RationalTime.1", + "rate": 24, + "value": 0 + } + } + }, + { + "OTIO_SCHEMA": "Gap.1", + "name": "Gap", + "source_range": { + "OTIO_SCHEMA": "TimeRange.1", + "duration": { + "OTIO_SCHEMA": "RationalTime.1", + "rate": 30, + "value": 30 + }, + "start_time": { + "OTIO_SCHEMA": "RationalTime.1", + "rate": 30, + "value": 0 + } + } + }, + { + "OTIO_SCHEMA": "Clip.2", + "metadata": {}, + "name": "videoclip5", + "source_range": { + "OTIO_SCHEMA": "TimeRange.1", + "duration": { + "OTIO_SCHEMA": "RationalTime.1", + "rate": 23.976, + "value": 232.0 + }, + "start_time": { + "OTIO_SCHEMA": "RationalTime.1", + "rate": 23.976023976023978, + "value": 0.0 + } + }, + "effects": [], + "markers": [], + "enabled": true, + "media_references": { + "DEFAULT_MEDIA": { + "OTIO_SCHEMA": "ExternalReference.1", + "metadata": {}, + "name": "", + "available_range": null, + "available_image_bounds": null, + "target_url": "PSR63_2012-06-02.mov" + } + }, + "active_media_reference_key": "DEFAULT_MEDIA" + } + ], + "kind": "Video" + } + ] + } +} \ No newline at end of file diff --git a/lib/tlTimelineUI/AudioClipItem.cpp b/lib/tlTimelineUI/AudioClipItem.cpp index 02883c98..72832321 100644 --- a/lib/tlTimelineUI/AudioClipItem.cpp +++ b/lib/tlTimelineUI/AudioClipItem.cpp @@ -271,14 +271,14 @@ namespace tl const otime::RationalTime time = otime::RationalTime( _timeRange.start_time().value() + (w > 0 ? (x / static_cast(w)) : 0) * - _timeRange.duration().value(), - _timeRange.duration().rate()). + _timeRange.duration().rescaled_to(_timeRange.start_time()).value(), + _timeRange.start_time().rate()). round(); const otime::RationalTime time2 = otime::RationalTime( _timeRange.start_time().value() + (w > 0 ? ((x + _displayOptions.waveformWidth) / static_cast(w)) : 0) * - _timeRange.duration().value(), - _timeRange.duration().rate()). + _timeRange.duration().rescaled_to(_timeRange.start_time()).value(), + _timeRange.start_time().rate()). round(); const otime::TimeRange mediaRange = timeline::toAudioMediaTime( otime::TimeRange::range_from_start_end_time(time, time2), diff --git a/lib/tlTimelineUI/VideoClipItem.cpp b/lib/tlTimelineUI/VideoClipItem.cpp index bc057f79..a8feda59 100644 --- a/lib/tlTimelineUI/VideoClipItem.cpp +++ b/lib/tlTimelineUI/VideoClipItem.cpp @@ -289,8 +289,8 @@ namespace tl const otime::RationalTime time = otime::RationalTime( _timeRange.start_time().value() + (w > 1 ? (x / static_cast(w - 1)) : 0) * - _timeRange.duration().value(), - _timeRange.duration().rate()). + _timeRange.duration().rescaled_to(_timeRange.start_time()).value(), + _timeRange.start_time().rate()). floor(); const otime::RationalTime mediaTime = timeline::toVideoMediaTime( time,