Skip to content

Commit e65b60d

Browse files
committed
Refactoring
1 parent c1a7591 commit e65b60d

File tree

4 files changed

+120
-5
lines changed

4 files changed

+120
-5
lines changed

data/Transition.otio

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"value": 0
7575
}
7676
},
77-
"target_url": "Counter.2.png"
77+
"target_url": "ColorBars.png"
7878
},
7979
"source_range": {
8080
"OTIO_SCHEMA": "TimeRange.1",
@@ -89,7 +89,7 @@
8989
"value": 5
9090
}
9191
},
92-
"name": "Counter 2"
92+
"name": "Color Bars"
9393
}
9494
],
9595
"kind": "Video",

data/Transition2.otio

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"OTIO_SCHEMA": "Timeline.1",
3+
"metadata": {},
4+
"name": "Transition",
5+
"tracks": {
6+
"OTIO_SCHEMA": "Stack.1",
7+
"children": [
8+
{
9+
"OTIO_SCHEMA": "Track.1",
10+
"children": [
11+
{
12+
"OTIO_SCHEMA": "Clip.1",
13+
"media_reference": {
14+
"OTIO_SCHEMA": "ExternalReference.1",
15+
"available_range": {
16+
"OTIO_SCHEMA": "TimeRange.1",
17+
"duration": {
18+
"OTIO_SCHEMA": "RationalTime.1",
19+
"rate": 24,
20+
"value": 15
21+
},
22+
"start_time": {
23+
"OTIO_SCHEMA": "RationalTime.1",
24+
"rate": 24,
25+
"value": 0
26+
}
27+
},
28+
"target_url": "Counter.0.png"
29+
},
30+
"effects": [
31+
{
32+
"OTIO_SCHEMA": "InvertEffect.1",
33+
"effect_name": ""
34+
}
35+
],
36+
"source_range": {
37+
"OTIO_SCHEMA": "TimeRange.1",
38+
"duration": {
39+
"OTIO_SCHEMA": "RationalTime.1",
40+
"rate": 24,
41+
"value": 10
42+
},
43+
"start_time": {
44+
"OTIO_SCHEMA": "RationalTime.1",
45+
"rate": 24,
46+
"value": 0
47+
}
48+
},
49+
"name": "Counter"
50+
},
51+
{
52+
"OTIO_SCHEMA": "Transition.1",
53+
"name": "Dissolve",
54+
"transition_type": "SMPTE_Dissolve",
55+
"in_offset": {
56+
"OTIO_SCHEMA": "RationalTime.1",
57+
"rate": 24,
58+
"value": 5
59+
},
60+
"out_offset": {
61+
"OTIO_SCHEMA": "RationalTime.1",
62+
"rate": 24,
63+
"value": 5
64+
}
65+
},
66+
{
67+
"OTIO_SCHEMA": "Clip.1",
68+
"media_reference": {
69+
"OTIO_SCHEMA": "ExternalReference.1",
70+
"available_range": {
71+
"OTIO_SCHEMA": "TimeRange.1",
72+
"duration": {
73+
"OTIO_SCHEMA": "RationalTime.1",
74+
"rate": 24,
75+
"value": 15
76+
},
77+
"start_time": {
78+
"OTIO_SCHEMA": "RationalTime.1",
79+
"rate": 24,
80+
"value": 0
81+
}
82+
},
83+
"target_url": "ColorBars.png"
84+
},
85+
"effects": [
86+
{
87+
"OTIO_SCHEMA": "InvertEffect.1",
88+
"effect_name": ""
89+
}
90+
],
91+
"source_range": {
92+
"OTIO_SCHEMA": "TimeRange.1",
93+
"duration": {
94+
"OTIO_SCHEMA": "RationalTime.1",
95+
"rate": 24,
96+
"value": 10
97+
},
98+
"start_time": {
99+
"OTIO_SCHEMA": "RationalTime.1",
100+
"rate": 24,
101+
"value": 5
102+
}
103+
},
104+
"name": "Color Bars"
105+
}
106+
],
107+
"kind": "Video",
108+
"name": "Video"
109+
}
110+
],
111+
"name": "Stack"
112+
}
113+
}

lib/toucan/TimelineTraverse.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace toucan
2323
_path(path),
2424
_timeline(timeline)
2525
{
26-
// The first clip sets the timeline resolution.
26+
// Get the image size from the first clip.
2727
for (auto clip : _timeline->find_clips())
2828
{
2929
if (auto externalRef = dynamic_cast<OTIO_NS::ExternalReference*>(clip->media_reference()))
@@ -140,6 +140,7 @@ namespace toucan
140140
}
141141
}
142142

143+
// Handle transitions.
143144
if (op)
144145
{
145146
if (auto prevTransition = dynamic_cast<OTIO_NS::Transition*>(prevComposable(i.value)))
@@ -178,7 +179,7 @@ namespace toucan
178179
}
179180
}
180181

181-
// Composite.
182+
// Composite over the previous track.
182183
std::vector<std::shared_ptr<IImageOp> > ops;
183184
if (op)
184185
{
@@ -234,7 +235,7 @@ namespace toucan
234235
out = std::make_shared<FillOp>(FillData{ _size });
235236
}
236237

237-
// Create the effects.
238+
// Get the effects.
238239
for (const auto& effect : item->effects())
239240
{
240241
if (auto iEffect = dynamic_cast<IEffect*>(effect.value))

tests/TimelineTraverseTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace toucan
2323
"Patterns",
2424
"Text",
2525
"Transition",
26+
"Transition2",
2627
"Transforms"
2728
};
2829
for (const auto& otioFile : otioFiles)

0 commit comments

Comments
 (0)