Class TrackImpl

java.lang.Object
org.opencastproject.mediapackage.AbstractMediaPackageElement
org.opencastproject.mediapackage.track.TrackImpl
All Implemented Interfaces:
Serializable, Cloneable, Comparable<MediaPackageElement>, ManifestContributor, MediaPackageElement, Track

public class TrackImpl extends AbstractMediaPackageElement implements 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:
  • Field Details

  • Constructor Details

    • TrackImpl

      public TrackImpl()
      Needed by JAXB
  • Method Details

    • fromURI

      public static TrackImpl fromURI(URI uri)
      Creates a new track from the given url.
      Parameters:
      uri - the track location
      Returns:
      the track
    • setDuration

      public void setDuration(Long duration)
      Sets the track's duration in milliseconds.
      Parameters:
      duration - the duration
    • getDuration

      public Long getDuration()
      Description copied from interface: Track
      Returns the track duration in milliseconds or null if the duration is not available.
      Specified by:
      getDuration in interface Track
      Returns:
      the track duration
      See Also:
    • getStreams

      public Stream[] getStreams()
      Specified by:
      getStreams in interface Track
      Returns:
      the streams that make up the track. Tracks consist of at least one stream.
    • addStream

      public void addStream(AbstractStreamImpl stream)
      Add a stream to the track.
    • hasAudio

      public boolean hasAudio()
      Returns true if the track features an audio stream.
      Specified by:
      hasAudio in interface Track
      Returns:
      true if the track has an audio stream
      See Also:
    • hasVideo

      public boolean hasVideo()
      Returns true if the track features a video stream.
      Specified by:
      hasVideo in interface Track
      Returns:
      true if the track has a video stream
      See Also:
    • hasSubtitle

      public boolean hasSubtitle()
      Returns true if the track features a subtitle stream.
      Specified by:
      hasSubtitle in interface Track
      Returns:
      true if the track has a subtitle stream
      See Also:
    • getAudio

      public List<AudioStream> getAudio()
    • setAudio

      public void setAudio(List<AudioStream> audio)
    • getVideo

      public List<VideoStream> getVideo()
    • setVideo

      public void setVideo(List<VideoStream> video)
    • getSubtitle

      public List<SubtitleStream> getSubtitle()
    • setSubtitle

      public void setSubtitle(List<SubtitleStream> subtitle)
    • setLive

      public void setLive(boolean isLive)
    • isLive

      public boolean isLive()
      Description copied from interface: Track
      Returns true if the track is a live track.
      Specified by:
      isLive in interface Track
      Returns:
      true if live track; false otherwise
      See Also:
    • isMaster

      public Boolean isMaster()
      Description copied from interface: Track
      Returns true if the track is a master playlist (play this over other tracks).
      Specified by:
      isMaster in interface Track
      Returns:
      true if it is a master adaptive playlist/manifest
    • setMaster

      public void setMaster(Boolean master)
      Description copied from interface: Track
      Sets master - it is an adaptive playlist
      Specified by:
      setMaster in interface Track
      Parameters:
      master - if true
    • hasMaster

      public boolean hasMaster()
      Specified by:
      hasMaster in interface Track
      Returns:
      true if master playlist value is not null
    • toManifest

      public Node toManifest(Document document, MediaPackageSerializer serializer) throws MediaPackageException
      Description copied from interface: ManifestContributor
      This 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 use MediaPackageElementBuilder.elementFromManifest(org.w3c.dom.Node, MediaPackageSerializer). All other objects shall provide their own implementation specific reconstruction mechanism.

      Specified by:
      toManifest in interface ManifestContributor
      Overrides:
      toManifest in class AbstractMediaPackageElement
      Parameters:
      document - the parent
      serializer - the media package serializer
      Returns:
      the object's xml representation
      Throws:
      MediaPackageException - if the mediapackage can't be serialized
      See Also:
    • getDescription

      public String getDescription()
      This implementation returns the track's mime type.
      Specified by:
      getDescription in interface Track
      Returns:
      the track description.
      See Also:
    • setTransport

      public void setTransport(TrackImpl.StreamingProtocol transport)
    • getTransport

      public TrackImpl.StreamingProtocol getTransport()
    • getLogicalName

      public String getLogicalName()
      Description copied from interface: Track
      Returns logical name of the file which persists in spite of file name changes
      Specified by:
      getLogicalName in interface Track
      Returns:
      logical name
    • setLogicalName

      public void setLogicalName(String name)
      Description copied from interface: Track
      Sets 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:
      setLogicalName in interface Track
      Parameters:
      name - as relative to manifest