Class SmilServiceImpl

java.lang.Object
org.opencastproject.smil.impl.SmilServiceImpl
All Implemented Interfaces:
SmilService

public class SmilServiceImpl extends Object implements SmilService
Implement SmilService interface.
  • Constructor Details

    • SmilServiceImpl

      public SmilServiceImpl()
  • Method Details

    • createNewSmil

      public SmilResponse createNewSmil()
      Create a new Smil.
      Specified by:
      createNewSmil in interface SmilService
      Returns:
      a new Smil
    • createNewSmil

      public SmilResponse createNewSmil(MediaPackage mediaPackage)
      Create a new Smil and store the MediaPackage Id as meta data.
      Specified by:
      createNewSmil in interface SmilService
      Parameters:
      mediaPackage -
      Returns:
      a new Smil
    • addParallel

      public SmilResponse addParallel(Smil smil) throws SmilException
      Add new par element to Smil.
      Specified by:
      addParallel in interface SmilService
      Parameters:
      smil - Smil to edit
      Returns:
      edited Smil and the new SmilMediaContainer
      Throws:
      SmilException
    • addParallel

      public SmilResponse addParallel(Smil smil, String parentId) throws SmilException
      Add new par element to Smil inside an element with given Id.
      Specified by:
      addParallel in interface SmilService
      Parameters:
      smil - Smil to edit
      parentId - element id, where to add new par element
      Returns:
      edited Smil and the new SmilMediaContainer
      Throws:
      SmilException - if there is no element with given parentId
    • addSequence

      public SmilResponse addSequence(Smil smil) throws SmilException
      Add new seq element to Smil.
      Specified by:
      addSequence in interface SmilService
      Parameters:
      smil - Smil to edit
      Returns:
      edited Smil and the new SmilMediaContainer
      Throws:
      SmilException
    • addSequence

      public SmilResponse addSequence(Smil smil, String parentId) throws SmilException
      Add new seq element to Smil inside an element with given Id.
      Specified by:
      addSequence in interface SmilService
      Parameters:
      smil - Smil to edit
      parentId - element id, where to add new seq element
      Returns:
      edited Smil and the new SmilMediaContainer
      Throws:
      SmilException - if there is no element with given parentId
    • addClip

      public SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration) throws SmilException
      Description copied from interface: SmilService
      Add a SmilMediaElement based on given track and start/duration information.
      Specified by:
      addClip in interface SmilService
      Parameters:
      smil - Smil to edit
      parentId - element id, where to add new SmilMediaElement
      track - Track to add as SmilMediaElement
      start - start position in Track in milliseconds
      duration - duration in milliseconds
      Returns:
      edited Smil, the new SmilMediaElement and generated meta data
      Throws:
      SmilException - if there is no element with the given parentId
    • addClip

      public SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration, String pgId) throws SmilException
      Add a SmilMediaElement based on given track and start/duration information.
      Specified by:
      addClip in interface SmilService
      Parameters:
      smil - Smil to edit
      parentId - element id, where to add new SmilMediaElement
      track - Track to add as SmilMediaElement
      start - start position in Track in milliseconds
      duration - duration in milliseconds
      pgId - clip should be added as a part of a previously created param group
      Returns:
      edited Smil, the new SmilMediaElement and generated meta data
      Throws:
      SmilException - if there is no element with the given parentId
    • addClips

      public SmilResponse addClips(Smil smil, String parentId, Track[] tracks, long start, long duration) throws SmilException
      Add a list of SmilMediaElements based on given tracks and start/duration information.
      Specified by:
      addClips in interface SmilService
      Parameters:
      smil - Smil to edit
      parentId - element id, where to add new SmilMediaElements
      tracks - Tracks to add as SmilMediaElements
      start - start position in Tracks in milliseconds
      duration - duration in milliseconds
      Returns:
      edited Smil, the new SmilMediaElements and tracks meta data
      Throws:
      SmilException - if there is no element with the given parentId
    • addMeta

      public SmilResponse addMeta(Smil smil, String name, String content)
      Add a meta element to Smil head.
      Specified by:
      addMeta in interface SmilService
      Parameters:
      smil - Smil to edit
      name - meta name
      content - meta content
      Returns:
      edited Smil and the new SmilMeta
    • removeSmilElement

      public SmilResponse removeSmilElement(Smil smil, String elementId)
      Remove element (identified by elementId) from Smil if exists.
      Specified by:
      removeSmilElement in interface SmilService
      Parameters:
      smil - Smil to edit
      elementId - element Id to remove
      Returns:
      edited Smil and removed SmilMediaElement if Smil contains an element with given Id
    • fromXml

      public SmilResponse fromXml(String smilXml) throws SmilException
      Returns Smil from Xml String.
      Specified by:
      fromXml in interface SmilService
      Parameters:
      smilXml - Smil document Xml as String
      Returns:
      parsed Smil
      Throws:
      SmilException - if an error occures while parsing Smil
    • fromXml

      public SmilResponse fromXml(File smilXmlFile) throws SmilException
      Returns Smil from Xml File.
      Specified by:
      fromXml in interface SmilService
      Parameters:
      smilXmlFile - Smil document Xml as File
      Returns:
      parsed Smil
      Throws:
      SmilException - if an error occures while parsing Smil