AcademySoftwareFoundation / OpenTimelineIO

Open Source API and interchange format for editorial timeline information.
http://opentimeline.io
Apache License 2.0
1.4k stars 276 forks source link

Add implementation of to_nearest_timecode #1717

Closed vade closed 2 months ago

vade commented 3 months ago

Add implementation of to_nearest_timecode which makes approximate conversion of timecode from a rate using the closest valid time code rate.

This is intended to fix various downstream adaptor hiccups where source material might be variable frame rate, or close but not quite an exact SMPTE timecode.

Link the Issue(s) this Pull Request is related to.

https://github.com/AcademySoftwareFoundation/OpenTimelineIO/issues/830

Summarize your change.

This PR does not directly fix the FCP_XML adaptor, but rather isolates changes to OTIO core and exposes a to_nearest_timecode with the same method signature as to_timecode.

This is intended to act as a entry point for changes to other adaptors if deemed a valid approach

Reference associated tests.

No new tests just yet.

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 19.04762% with 17 lines in your changes are missing coverage. Please review.

Project coverage is 79.89%. Comparing base (2b9c3a4) to head (1207631). Report is 1 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1717/graphs/tree.svg?width=650&height=150&src=pr&token=mfnfUB4h7u&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation)](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1717?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) ```diff @@ Coverage Diff @@ ## main #1717 +/- ## ========================================== - Coverage 79.95% 79.89% -0.06% ========================================== Files 197 197 Lines 21879 21900 +21 Branches 4342 4351 +9 ========================================== + Hits 17494 17498 +4 - Misses 2252 2269 +17 Partials 2133 2133 ``` | [Flag](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1717/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) | Coverage Δ | | |---|---|---| | [py-unittests](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1717/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) | `79.89% <19.04%> (-0.06%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1717?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) | Coverage Δ | | |---|---|---| | [src/opentime/rationalTime.h](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1717?src=pr&el=tree&filepath=src%2Fopentime%2FrationalTime.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-c3JjL29wZW50aW1lL3JhdGlvbmFsVGltZS5o) | `93.61% <ø> (ø)` | | | [src/py-opentimelineio/opentimelineio/opentime.py](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1717?src=pr&el=tree&filepath=src%2Fpy-opentimelineio%2Fopentimelineio%2Fopentime.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-c3JjL3B5LW9wZW50aW1lbGluZWlvL29wZW50aW1lbGluZWlvL29wZW50aW1lLnB5) | `95.00% <50.00%> (-5.00%)` | :arrow_down: | | [src/opentime/rationalTime.cpp](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1717?src=pr&el=tree&filepath=src%2Fopentime%2FrationalTime.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-c3JjL29wZW50aW1lL3JhdGlvbmFsVGltZS5jcHA=) | `61.96% <0.00%> (-2.01%)` | :arrow_down: | | [...lineio/opentime-bindings/opentime\_rationalTime.cpp](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1717?src=pr&el=tree&filepath=src%2Fpy-opentimelineio%2Fopentime-bindings%2Fopentime_rationalTime.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation#diff-c3JjL3B5LW9wZW50aW1lbGluZWlvL29wZW50aW1lLWJpbmRpbmdzL29wZW50aW1lX3JhdGlvbmFsVGltZS5jcHA=) | `55.26% <27.27%> (-2.99%)` | :arrow_down: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1717?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1717?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation). Last update [2b9c3a4...1207631](https://app.codecov.io/gh/AcademySoftwareFoundation/OpenTimelineIO/pull/1717?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=AcademySoftwareFoundation).
vade commented 3 months ago

Thanks for your patience. DCO Sign off passed. I'll try to keep that in mind in the future!