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 classTrack.Kindstatic classTrack.NeighborGapPolicyenum for deciding how to add gap when asking for neighborsstatic classTrack.TrackBuilderNested classes/interfaces inherited from class io.opentimeline.opentimelineio.Composition
Composition.CompositionBuilderNested classes/interfaces inherited from class io.opentimeline.opentimelineio.Composable
Composable.ComposableBuilderNested classes/interfaces inherited from class io.opentimeline.opentimelineio.SerializableObjectWithMetadata
SerializableObjectWithMetadata.SerializableObjectWithMetadataBuilder -
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedTrack()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.TimeRangegetAvailableRange(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.StringgetKind()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.TimeRangerangeOfChildAtIndex(int index, ErrorStatus errorStatus)voidsetKind(java.lang.String kind)TimeRangetrimmedRangeOfChildAtIndex(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, trimChildRangeMethods inherited from class io.opentimeline.opentimelineio.Item
getDuration, getEffects, getMarkers, getRangeInParent, getSourceRange, getTransformedTime, getTransformedTimeRange, getTrimmedRange, getTrimmedRangeInParent, getVisibleRange, isOverlapping, isVisible, setSourceRangeMethods inherited from class io.opentimeline.opentimelineio.SerializableObjectWithMetadata
getMetadata, getName, setMetadata, setNameMethods 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:ItemImplemented by child classes, available range of media.- Overrides:
getAvailableRangein 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:
getHandlesOfChildin 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:
getRangeOfAllChildrenin 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
-