Package io.opentimeline.opentimelineio
Class Track
java.lang.Object
- All Implemented Interfaces:
java.lang.AutoCloseable
public class Track extends Composition
A class that holds a list of Composables.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Track.Kind
static class
Track.NeighborGapPolicy
enum for deciding how to add gap when asking for neighborsstatic class
Track.TrackBuilder
Nested classes/interfaces inherited from class io.opentimeline.opentimelineio.Composition
Composition.CompositionBuilder
Nested classes/interfaces inherited from class io.opentimeline.opentimelineio.Composable
Composable.ComposableBuilder
Nested classes/interfaces inherited from class io.opentimeline.opentimelineio.SerializableObjectWithMetadata
SerializableObjectWithMetadata.SerializableObjectWithMetadataBuilder
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
Track()
Track(Track.TrackBuilder builder)
Track(java.lang.String name, TimeRange sourceRange, java.lang.String kind, AnyDictionary metadata)
-
Method Summary
Modifier and Type Method Description java.util.stream.Stream<Clip>
eachClip(TimeRange searchRange, boolean shallowSearch, ErrorStatus errorStatus)
Return a flat Stream of each clip, limited to the search_range.java.util.stream.Stream<Clip>
eachClip(TimeRange searchRange, ErrorStatus errorStatus)
Return a flat Stream of each clip, limited to the search_range.TimeRange
getAvailableRange(ErrorStatus errorStatus)
Implemented by child classes, available range of media.Pair<RationalTime,RationalTime>
getHandlesOfChild(Composable child, ErrorStatus errorStatus)
If media beyond the ends of this child are visible due to adjacent Transitions (only applicable in a Track) then this will return the head and tail offsets as a tuple of RationalTime objects.java.lang.String
getKind()
Pair<Composable,Composable>
getNeighborsOf(Composable item, ErrorStatus errorStatus)
Pair<Composable,Composable>
getNeighborsOf(Composable item, ErrorStatus errorStatus, Track.NeighborGapPolicy neighborGapPolicy)
Returns the neighbors of the item as a Pair, (previous, next).java.util.HashMap<Composable,TimeRange>
getRangeOfAllChildren(ErrorStatus errorStatus)
Return a HashMap mapping children to their range in this track.TimeRange
rangeOfChildAtIndex(int index, ErrorStatus errorStatus)
void
setKind(java.lang.String kind)
TimeRange
trimmedRangeOfChildAtIndex(int index, ErrorStatus errorStatus)
Methods inherited from class io.opentimeline.opentimelineio.Composition
appendChild, clearChildren, eachChild, eachChild, eachChild, getChildAtTime, getChildAtTime, getChildren, getCompositionKind, getRangeOfChild, getRangeOfChildAtIndex, getTrimmedRangeOfChild, getTrimmedRangeOfChildAtIndex, hasChild, insertChild, isParentOf, removeChild, setChild, setChildren, toString, trimChildRange
Methods inherited from class io.opentimeline.opentimelineio.Item
getDuration, getEffects, getMarkers, getRangeInParent, getSourceRange, getTransformedTime, getTransformedTimeRange, getTrimmedRange, getTrimmedRangeInParent, getVisibleRange, isOverlapping, isVisible, setSourceRange
Methods inherited from class io.opentimeline.opentimelineio.SerializableObjectWithMetadata
getMetadata, getName, setMetadata, setName
Methods inherited from class io.opentimeline.opentimelineio.SerializableObject
clone, currentRefCount, dynamicFields, equals, fromJSONFile, fromJSONString, isEquivalentTo, isUnknownSchema, schemaName, schemaVersion, toJSONFile, toJSONFile, toJSONString, toJSONString
-
Constructor Details
-
Track
protected Track() -
Track
public Track(java.lang.String name, TimeRange sourceRange, java.lang.String kind, AnyDictionary metadata) -
Track
-
-
Method Details
-
getKind
public java.lang.String getKind() -
setKind
public void setKind(java.lang.String kind) -
rangeOfChildAtIndex
-
trimmedRangeOfChildAtIndex
-
getAvailableRange
Description copied from class:Item
Implemented by child classes, available range of media.- Overrides:
getAvailableRange
in classItem
- Parameters:
errorStatus
- errorStatus to report in case this is not implemented in a sub-class.- Returns:
- available range of media
-
getHandlesOfChild
public Pair<RationalTime,RationalTime> getHandlesOfChild(Composable child, ErrorStatus errorStatus)If media beyond the ends of this child are visible due to adjacent Transitions (only applicable in a Track) then this will return the head and tail offsets as a tuple of RationalTime objects. If no handles are present on either side, then None is returned instead of a RationalTime.- Overrides:
getHandlesOfChild
in classComposition
- Parameters:
child
- child Composable to get handleserrorStatus
- errorStatus to report error while fetching handles- Returns:
- head and tail offsets as a Pair of RationalTime objects
-
getNeighborsOf
-
getNeighborsOf
public Pair<Composable,Composable> getNeighborsOf(Composable item, ErrorStatus errorStatus, Track.NeighborGapPolicy neighborGapPolicy)Returns the neighbors of the item as a Pair, (previous, next). Can optionally fill in gaps when transitions have no gaps next to them. with neighborGapPolicy == NeighborGapPolicy.never: [A, B, C] :: getNeighborsOf(B) -> (A, C) [A, B, C] :: getNeighborsOf(A) -> (null, B) [A, B, C] :: getNeighborsOf(C) -> (B, null) [A] :: getNeighborsOf(A) -> (null, null) with neighborGapPolicy == NeighborGapPolicy.around_transitions: (assuming A and C are transitions) [A, B, C] :: getNeighborsOf(B) -> (A, C) [A, B, C] :: getNeighborsOf(A) -> (Gap, B) [A, B, C] :: getNeighborsOf(C) -> (B, Gap) [A] :: getNeighborsOf(A) -> (Gap, Gap)- Parameters:
item
- Composable whose neighbors are to be fetchederrorStatus
- errorStatus to report error while fetching neighborsneighborGapPolicy
- optionally fill in gaps when transitions have no gaps next to them? [never, around_transitions]- Returns:
- neighbors of the item as a Pair
-
getRangeOfAllChildren
Return a HashMap mapping children to their range in this track.- Overrides:
getRangeOfAllChildren
in classComposition
- Parameters:
errorStatus
- errorStatus to report any error while fetching ranges- Returns:
- a HashMap mapping children to their range in this track.
-
eachClip
public java.util.stream.Stream<Clip> eachClip(TimeRange searchRange, boolean shallowSearch, ErrorStatus errorStatus)Return a flat Stream of each clip, limited to the search_range.- Parameters:
searchRange
- TimeRange to search inshallowSearch
- should the algorithm recurse into compositions or not?errorStatus
- errorStatus to report any error while iterating- Returns:
- a Stream of all clips in the timeline (in the searchRange) in the order they are found
-
eachClip
Return a flat Stream of each clip, limited to the search_range. This recurses into compositions.- Parameters:
searchRange
- TimeRange to search inerrorStatus
- errorStatus to report any error while iterating- Returns:
- a Stream of all clips in the timeline (in the searchRange) in the order they are found
-