OpenTimelineIO / otio-aaf-adapter

OpenTimelineIO Advanced Authoring Format (AAF) Adapter
Apache License 2.0
15 stars 6 forks source link

Support nested audio dissolve #21

Closed markreidvfx closed 3 months ago

markreidvfx commented 1 year ago

This fixes an odd structure I've found in a few timelines generated from Media Composer. It's a Transition inside an OperationGroup

weird_operation_group

It just ends up becoming a dissolve on the end of a audio clip. image

I'm not entirely sure how Media Composer creates this structure, but I've run into on a few timelines. Without the the fix the adapter raise this exception:

  File "d:/dev/otio-aaf-adapter/src/otio_aaf_adapter\adapters\advanced_authoring_format.py", line 1574, in read_from_file
    result = _transcribe(mobs_to_transcribe, parents=list(), edit_rate=None)
  File "d:/dev/otio-aaf-adapter/src/otio_aaf_adapter\adapters\advanced_authoring_format.py", line 821, in _transcribe
    result.append(_transcribe(child, parents + [item], edit_rate, indent + 2))
  File "d:/dev/otio-aaf-adapter/src/otio_aaf_adapter\adapters\advanced_authoring_format.py", line 413, in _transcribe
    track = _transcribe(slot, parents + [item], edit_rate, indent + 2)
  File "d:/dev/otio-aaf-adapter/src/otio_aaf_adapter\adapters\advanced_authoring_format.py", line 639, in _transcribe
    child = _transcribe(item.segment, parents + [item], edit_rate, indent + 2)
  File "d:/dev/otio-aaf-adapter/src/otio_aaf_adapter\adapters\advanced_authoring_format.py", line 631, in _transcribe
    result = _transcribe_operation_group(item, parents, metadata,
  File "d:/dev/otio-aaf-adapter/src/otio_aaf_adapter\adapters\advanced_authoring_format.py", line 1148, in _transcribe_operation_group
    child = _transcribe(segment, parents + [item], edit_rate, indent)
  File "d:/dev/otio-aaf-adapter/src/otio_aaf_adapter\adapters\advanced_authoring_format.py", line 625, in _transcribe
    child = _transcribe(component, parents + [item], edit_rate, indent + 2)
  File "d:/dev/otio-aaf-adapter/src/otio_aaf_adapter\adapters\advanced_authoring_format.py", line 621, in _transcribe
    metadata["PhysicalTrackNumber"] = list(parent.slots).index(item) + 1
AttributeError: 'Sequence' object has no attribute 'slots'

The fix is to only set PhysicalTrackNumber if the parent is a MobSlot

codecov-commenter commented 1 year ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 90.17%. Comparing base (74298e1) to head (9dce4c3). Report is 4 commits behind head on main.

:exclamation: Current head 9dce4c3 differs from pull request most recent head 8c50ef1. Consider uploading reports for the commit 8c50ef1 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #21 +/- ## ========================================== + Coverage 90.12% 90.17% +0.04% ========================================== Files 3 3 Lines 1124 1109 -15 ========================================== - Hits 1013 1000 -13 + Misses 111 109 -2 ``` | [Flag](https://app.codecov.io/gh/OpenTimelineIO/otio-aaf-adapter/pull/21/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=OpenTimelineIO) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/OpenTimelineIO/otio-aaf-adapter/pull/21/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=OpenTimelineIO) | `90.17% <100.00%> (+0.04%)` | :arrow_up: | 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=OpenTimelineIO#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

roger-sacilotto commented 10 months ago

FYI, this structure is the result of a track effect that applies pan to the original audio timeline sequence, thus the nesting.

markreidvfx commented 3 months ago

I rebased this on top of the current main. It will cleanly merge now