Skip to content

Commit

Permalink
Fix for thumbnails with different rates
Browse files Browse the repository at this point in the history
  • Loading branch information
darbyjohnston committed Nov 28, 2024
1 parent c1939d1 commit 87da909
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 6 deletions.
98 changes: 98 additions & 0 deletions etc/SampleData/MultipleRates.otio
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
}
8 changes: 4 additions & 4 deletions lib/tlTimelineUI/AudioClipItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,14 @@ namespace tl
const otime::RationalTime time = otime::RationalTime(
_timeRange.start_time().value() +
(w > 0 ? (x / static_cast<double>(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<double>(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),
Expand Down
4 changes: 2 additions & 2 deletions lib/tlTimelineUI/VideoClipItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ namespace tl
const otime::RationalTime time = otime::RationalTime(
_timeRange.start_time().value() +
(w > 1 ? (x / static_cast<double>(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,
Expand Down

0 comments on commit 87da909

Please sign in to comment.