Class TrackImpl
java.lang.Object
org.opencastproject.mediapackage.AbstractMediaPackageElement
org.opencastproject.mediapackage.track.TrackImpl
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<MediaPackageElement>,ManifestContributor,MediaPackageElement,Track
This class is the base implementation for a media track, which itself is part of a media package, representing e. g.
the speaker video or the slide presentation movie.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumNested classes/interfaces inherited from interface org.opencastproject.mediapackage.MediaPackageElement
MediaPackageElement.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<AudioStream> protected LongThe duration in millisecondsprotected booleanprotected Stringprotected Booleanprotected List<SubtitleStream> protected TrackImpl.StreamingProtocolprotected List<VideoStream> Fields inherited from class org.opencastproject.mediapackage.AbstractMediaPackageElement
checksum, description, elementType, flavor, id, mediaPackage, mimeType, reference, size, tags, uri -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStream(AbstractStreamImpl stream) Add a stream to the track.static TrackImplCreates a new track from the given url.getAudio()This implementation returns the track's mime type.Returns the track duration in milliseconds ornullif the duration is not available.Returns logical name of the file which persists in spite of file name changesStream[]getVideo()booleanhasAudio()Returnstrueif the track features an audio stream.booleanbooleanReturnstrueif the track features a subtitle stream.booleanhasVideo()Returnstrueif the track features a video stream.booleanisLive()Returnstrueif the track is a live track.isMaster()Returnstrueif the track is a master playlist (play this over other tracks).voidsetAudio(List<AudioStream> audio) voidsetDuration(Long duration) Sets the track's duration in milliseconds.voidsetLive(boolean isLive) voidsetLogicalName(String name) Sets logical name of the file which persists in spite of file name changes to maintain referential integrity in the case of adaptive playlistsvoidSets master - it is an adaptive playlistvoidsetSubtitle(List<SubtitleStream> subtitle) voidsetTransport(TrackImpl.StreamingProtocol transport) voidsetVideo(List<VideoStream> video) toManifest(Document document, MediaPackageSerializer serializer) This method returns an XML serialization of the object to be stored in the media package manifest.Methods inherited from class org.opencastproject.mediapackage.AbstractMediaPackageElement
addTag, clearReference, clearTags, clone, compareTo, containsTag, containsTag, equals, generateIdentifier, getChecksum, getElementDescription, getElementType, getFlavor, getIdentifier, getMediaPackage, getMimeType, getReference, getSize, getTags, getURI, hashCode, referTo, referTo, removeTag, setChecksum, setElementDescription, setFlavor, setIdentifier, setMimeType, setReference, setSize, setTags, setURI, toString, verifyMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.opencastproject.mediapackage.MediaPackageElement
addTag, clearReference, clearTags, clone, containsTag, containsTag, generateIdentifier, getChecksum, getElementDescription, getElementType, getFlavor, getIdentifier, getMediaPackage, getMimeType, getReference, getSize, getTags, getURI, referTo, referTo, removeTag, setChecksum, setElementDescription, setFlavor, setIdentifier, setMimeType, setReference, setSize, setTags, setURI, verify
-
Field Details
-
duration
The duration in milliseconds -
audio
-
video
-
subtitle
-
transport
-
live
protected boolean live -
master
-
logicalname
-
-
Constructor Details
-
TrackImpl
public TrackImpl()Needed by JAXB
-
-
Method Details
-
fromURI
Creates a new track from the given url.- Parameters:
uri- the track location- Returns:
- the track
-
setDuration
Sets the track's duration in milliseconds.- Parameters:
duration- the duration
-
getDuration
Description copied from interface:TrackReturns the track duration in milliseconds ornullif the duration is not available.- Specified by:
getDurationin interfaceTrack- Returns:
- the track duration
- See Also:
-
getStreams
- Specified by:
getStreamsin interfaceTrack- Returns:
- the streams that make up the track. Tracks consist of at least one stream.
-
addStream
Add a stream to the track. -
hasAudio
public boolean hasAudio()Returnstrueif the track features an audio stream. -
hasVideo
public boolean hasVideo()Returnstrueif the track features a video stream. -
hasSubtitle
public boolean hasSubtitle()Returnstrueif the track features a subtitle stream.- Specified by:
hasSubtitlein interfaceTrack- Returns:
trueif the track has a subtitle stream- See Also:
-
getAudio
-
setAudio
-
getVideo
-
setVideo
-
getSubtitle
-
setSubtitle
-
setLive
public void setLive(boolean isLive) -
isLive
public boolean isLive()Description copied from interface:TrackReturnstrueif the track is a live track. -
isMaster
Description copied from interface:TrackReturnstrueif the track is a master playlist (play this over other tracks). -
setMaster
Description copied from interface:TrackSets master - it is an adaptive playlist -
hasMaster
public boolean hasMaster() -
toManifest
public Node toManifest(Document document, MediaPackageSerializer serializer) throws MediaPackageException Description copied from interface:ManifestContributorThis method returns an XML serialization of the object to be stored in the media package manifest. It should be possible to reconstruct the object from this data.For creating
MediaPackageElements from a manifest, please useMediaPackageElementBuilder.elementFromManifest(org.w3c.dom.Node, MediaPackageSerializer). All other objects shall provide their own implementation specific reconstruction mechanism.- Specified by:
toManifestin interfaceManifestContributor- Overrides:
toManifestin classAbstractMediaPackageElement- Parameters:
document- the parentserializer- the media package serializer- Returns:
- the object's xml representation
- Throws:
MediaPackageException- if the mediapackage can't be serialized- See Also:
-
getDescription
This implementation returns the track's mime type.- Specified by:
getDescriptionin interfaceTrack- Returns:
- the track description.
- See Also:
-
setTransport
-
getTransport
-
getLogicalName
Description copied from interface:TrackReturns logical name of the file which persists in spite of file name changes- Specified by:
getLogicalNamein interfaceTrack- Returns:
- logical name
-
setLogicalName
Description copied from interface:TrackSets logical name of the file which persists in spite of file name changes to maintain referential integrity in the case of adaptive playlists- Specified by:
setLogicalNamein interfaceTrack- Parameters:
name- as relative to manifest
-