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

AAF Writer: To get the edit rate, look at the first "child" not the first "clip". #518

Merged
merged 2 commits into from
May 24, 2019
Merged
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
2 changes: 1 addition & 1 deletion opentimelineio_contrib/adapters/aaf_adapter/aaf_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def __init__(self, root_file_transcriber, otio_track):
self.compositionmob = root_file_transcriber.compositionmob
self.aaf_file = root_file_transcriber.aaf_file
self.otio_track = otio_track
self.edit_rate = next(self.otio_track.each_clip()).duration().rate
self.edit_rate = next(self.otio_track.each_child()).duration().rate
self.timeline_mobslot, self.sequence = self._create_timeline_mobslot()
self.timeline_mobslot.name = self.otio_track.name

Expand Down
118 changes: 118 additions & 0 deletions opentimelineio_contrib/adapters/tests/sample_data/gaps.otio
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"OTIO_SCHEMA": "Timeline.1",
"global_start_time": null,
"metadata": {},
"name": "gaps",
"tracks": {
"OTIO_SCHEMA": "Stack.1",
"children": [
{
"OTIO_SCHEMA": "Track.1",
"children": [
{
"OTIO_SCHEMA": "Gap.1",
"effects": [],
"markers": [],
"metadata": {},
"name": "gap",
"source_range": {
"OTIO_SCHEMA": "TimeRange.1",
"duration": {
"OTIO_SCHEMA": "RationalTime.1",
"rate": 24.0,
"value": 60
},
"start_time": {
"OTIO_SCHEMA": "RationalTime.1",
"rate": 24.0,
"value": 0
}
}
}
],
"effects": [],
"kind": "Video",
"markers": [],
"metadata": {},
"name": null,
"source_range": null
},
{
"OTIO_SCHEMA": "Track.1",
"children": [
{
"OTIO_SCHEMA": "Gap.1",
"effects": [],
"markers": [],
"metadata": {},
"name": "gap",
"source_range": {
"OTIO_SCHEMA": "TimeRange.1",
"duration": {
"OTIO_SCHEMA": "RationalTime.1",
"rate": 24.0,
"value": 600
},
"start_time": {
"OTIO_SCHEMA": "RationalTime.1",
"rate": 24.0,
"value": 0
}
}
},
{
"OTIO_SCHEMA": "Gap.1",
"effects": [],
"markers": [],
"metadata": {},
"name": "gap",
"source_range": {
"OTIO_SCHEMA": "TimeRange.1",
"duration": {
"OTIO_SCHEMA": "RationalTime.1",
"rate": 24.0,
"value": 480
},
"start_time": {
"OTIO_SCHEMA": "RationalTime.1",
"rate": 24.0,
"value": 0
}
}
},
{
"OTIO_SCHEMA": "Gap.1",
"effects": [],
"markers": [],
"metadata": {},
"name": "gap",
"source_range": {
"OTIO_SCHEMA": "TimeRange.1",
"duration": {
"OTIO_SCHEMA": "RationalTime.1",
"rate": 24.0,
"value": 300
},
"start_time": {
"OTIO_SCHEMA": "RationalTime.1",
"rate": 24.0,
"value": 0
}
}
}
],
"effects": [],
"kind": "Video",
"markers": [],
"metadata": {},
"name": null,
"source_range": null
}
],
"effects": [],
"markers": [],
"metadata": {},
"name": "tracks",
"source_range": null
}
}
11 changes: 10 additions & 1 deletion opentimelineio_contrib/adapters/tests/test_aaf_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@
SAMPLE_DATA_DIR,
"multiple_top_level_mobs.aaf"
)

GAPS_OTIO_PATH = os.path.join(
SAMPLE_DATA_DIR,
"gaps.otio"
)

try:
lib_path = os.environ.get("OTIO_AAF_PYTHON_LIB")
Expand Down Expand Up @@ -807,6 +810,12 @@ def test_multiple_top_level_mobs(self):


class AAFWriterTests(unittest.TestCase):
def test_aaf_writer_gaps(self):
otio_timeline = otio.adapters.read_from_file(GAPS_OTIO_PATH)
fd, tmp_aaf_path = tempfile.mkstemp(suffix='.aaf')
otio.adapters.write_to_file(otio_timeline, tmp_aaf_path)
self._verify_aaf(tmp_aaf_path)

def test_aaf_writer_simple(self):
self._verify_aaf(SIMPLE_EXAMPLE_PATH)

Expand Down