Class ComposerRestService

java.lang.Object
org.opencastproject.rest.AbstractJobProducerEndpoint
org.opencastproject.composer.impl.endpoint.ComposerRestService

@Path("/composer/ffmpeg") public class ComposerRestService extends org.opencastproject.rest.AbstractJobProducerEndpoint
A REST endpoint delegating functionality to the ComposerService
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.opencastproject.composer.api.ComposerService
    The composer service
    protected String
    The base server URL
    protected org.opencastproject.serviceregistry.api.ServiceRegistry
    The service registry
    protected org.opencastproject.smil.api.SmilService
    The smil service
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    activate(org.osgi.service.component.ComponentContext cc)
    Callback from OSGi that is called when this service is activated.
    javax.ws.rs.core.Response
    composite(String compositeSizeJson, String lowerTrackXml, String lowerLayoutJson, String upperTrackXml, String upperLayoutJson, String watermarkAttachmentXml, String watermarkLayoutJson, String profileId, String background, String sourceAudioName)
    Compose two videos into one with an optional watermark.
    javax.ws.rs.core.Response
    concat(String sourceTracksXml, String profileId, String outputDimension, String outputFrameRate, String sameCodec)
    Concat multiple tracks having the same codec to a single track.
    javax.ws.rs.core.Response
    convertImage(String sourceImageXml, String profileId)
    Converts an image to another format.
    javax.ws.rs.core.Response
    convertImageSync(String sourceImageXml, String profileIds)
    Synchronously converts an image to another format.
    javax.ws.rs.core.Response
    demux(String sourceTrackAsXml, String profileId)
    Demuxes a track into multiple outputs
    javax.ws.rs.core.Response
    encode(String sourceTrackAsXml, String profileId)
    Encodes a track.
    javax.ws.rs.core.Response
    getProfile(String profileId)
     
    org.opencastproject.job.api.JobProducer
    org.opencastproject.serviceregistry.api.ServiceRegistry
    javax.ws.rs.core.Response
    image(String sourceTrackXml, String profileId, String times, org.opencastproject.util.LocalHashMap localMap)
    Encodes a track in a media package.
    javax.ws.rs.core.Response
    imageSync(String sourceTrackXml, String profileId, String times)
    Encodes a track in a media package.
    javax.ws.rs.core.Response
    imageToVideo(String sourceAttachmentXml, String profileId, String timeString)
    Transforms an image attachment to a video track
    org.opencastproject.composer.api.EncodingProfileList
     
    javax.ws.rs.core.Response
    multiEncode(String sourceTrackAsXml, String profileIds)
     
    javax.ws.rs.core.Response
    mux(String audioSourceTrackXml, String videoSourceTrackXml, String profileId)
    Encodes a track.
    javax.ws.rs.core.Response
    parallelencode(String sourceTrackAsXml, String profileId)
    Encodes a track to multiple tracks in parallel.
    protected double[]
    Parses string containing times in seconds separated by comma.
    javax.ws.rs.core.Response
    processSmil(String smilAsXml, String trackId, String mediaType, String profileIds)
    ProcessSmil - encode a video based on descriptions in a smil file into all format in the profileIds
    void
    setComposerService(org.opencastproject.composer.api.ComposerService composerService)
    Sets the composer service.
    protected void
    setServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry)
    Callback from the OSGi declarative services to set the service registry.
    void
    setSmilService(org.opencastproject.smil.api.SmilService smilService)
     
    javax.ws.rs.core.Response
    trim(String sourceTrackAsXml, String profileId, long start, long duration)
    Trims a track to a new length.

    Methods inherited from class org.opencastproject.rest.AbstractJobProducerEndpoint

    checkHeartbeat, dispatchJob

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • serverUrl

      protected String serverUrl
      The base server URL
    • composerService

      protected org.opencastproject.composer.api.ComposerService composerService
      The composer service
    • serviceRegistry

      protected org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry
      The service registry
    • smilService

      protected org.opencastproject.smil.api.SmilService smilService
      The smil service
  • Constructor Details

    • ComposerRestService

      public ComposerRestService()
  • Method Details

    • setSmilService

      public void setSmilService(org.opencastproject.smil.api.SmilService smilService)
    • setServiceRegistry

      protected void setServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry)
      Callback from the OSGi declarative services to set the service registry.
      Parameters:
      serviceRegistry - the service registry
    • setComposerService

      public void setComposerService(org.opencastproject.composer.api.ComposerService composerService)
      Sets the composer service.
      Parameters:
      composerService - the composer service
    • activate

      public void activate(org.osgi.service.component.ComponentContext cc)
      Callback from OSGi that is called when this service is activated.
      Parameters:
      cc - OSGi component context
    • encode

      @POST @Path("encode") @Produces("text/xml") public javax.ws.rs.core.Response encode(@FormParam("sourceTrack") String sourceTrackAsXml, @FormParam("profileId") String profileId) throws Exception
      Encodes a track.
      Parameters:
      sourceTrackAsXml - The source track
      profileId - The profile to use in encoding this track
      Returns:
      A response containing the job for this encoding job in the response body.
      Throws:
      Exception
    • parallelencode

      @POST @Path("parallelencode") @Produces("text/xml") public javax.ws.rs.core.Response parallelencode(@FormParam("sourceTrack") String sourceTrackAsXml, @FormParam("profileId") String profileId) throws Exception
      Encodes a track to multiple tracks in parallel.
      Parameters:
      sourceTrackAsXml - The source track
      profileId - The profile to use in encoding this track
      Returns:
      A response containing the job for this encoding job in the response body.
      Throws:
      Exception
    • trim

      @POST @Path("trim") @Produces("text/xml") public javax.ws.rs.core.Response trim(@FormParam("sourceTrack") String sourceTrackAsXml, @FormParam("profileId") String profileId, @FormParam("start") long start, @FormParam("duration") long duration) throws Exception
      Trims a track to a new length.
      Parameters:
      sourceTrackAsXml - The source track
      profileId - the encoding profile to use for trimming
      start - the new trimming start time
      duration - the new video duration
      Returns:
      A response containing the job for this encoding job in the response body.
      Throws:
      Exception
    • mux

      @POST @Path("mux") @Produces("text/xml") public javax.ws.rs.core.Response mux(@FormParam("audioSourceTrack") String audioSourceTrackXml, @FormParam("videoSourceTrack") String videoSourceTrackXml, @FormParam("profileId") String profileId) throws Exception
      Encodes a track.
      Parameters:
      audioSourceTrackXml - The audio source track
      videoSourceTrackXml - The video source track
      profileId - The profile to use in encoding this track
      Returns:
      A response containing the job for this encoding job in the response body.
      Throws:
      Exception
    • image

      @POST @Path("image") @Produces("text/xml") public javax.ws.rs.core.Response image(@FormParam("sourceTrack") String sourceTrackXml, @FormParam("profileId") String profileId, @FormParam("time") String times, @FormParam("properties") org.opencastproject.util.LocalHashMap localMap) throws Exception
      Encodes a track in a media package.
      Parameters:
      sourceTrackXml - The source track
      profileId - The profile to use in encoding this track
      times - one or more times in seconds separated by comma
      Returns:
      A Response with the resulting track in the response body
      Throws:
      Exception
    • imageSync

      @POST @Path("imagesync") @Produces("text/xml") public javax.ws.rs.core.Response imageSync(@FormParam("sourceTrack") String sourceTrackXml, @FormParam("profileId") String profileId, @FormParam("time") String times) throws Exception
      Encodes a track in a media package.
      Parameters:
      sourceTrackXml - The source track
      profileId - The profile to use in encoding this track
      times - one or more times in seconds separated by comma
      Returns:
      A Response with the resulting track in the response body
      Throws:
      Exception
    • composite

      @POST @Path("composite") @Produces("text/xml") public javax.ws.rs.core.Response composite(@FormParam("compositeSize") String compositeSizeJson, @FormParam("lowerTrack") String lowerTrackXml, @FormParam("lowerLayout") String lowerLayoutJson, @FormParam("upperTrack") String upperTrackXml, @FormParam("upperLayout") String upperLayoutJson, @FormParam("watermarkAttachment") String watermarkAttachmentXml, @FormParam("watermarkLayout") String watermarkLayoutJson, @FormParam("profileId") String profileId, @FormParam("background") @DefaultValue("black") String background, @FormParam("sourceAudioName") @DefaultValue("both") String sourceAudioName) throws Exception
      Compose two videos into one with an optional watermark.
      Parameters:
      compositeSizeJson - The composite track dimension as JSON
      lowerTrackXml - The lower track of the composition as XML
      lowerLayoutJson - The lower layout as JSON
      upperTrackXml - The upper track of the composition as XML
      upperLayoutJson - The upper layout as JSON
      watermarkAttachmentXml - The watermark image attachment of the composition as XML
      watermarkLayoutJson - The watermark layout as JSON
      profileId - The encoding profile to use
      background - The background color
      Returns:
      A Response with the resulting track in the response body
      Throws:
      Exception
    • concat

      @POST @Path("concat") @Produces("text/xml") public javax.ws.rs.core.Response concat(@FormParam("sourceTracks") String sourceTracksXml, @FormParam("profileId") String profileId, @FormParam("outputDimension") String outputDimension, @FormParam("outputFrameRate") String outputFrameRate, @FormParam("sameCodec") String sameCodec) throws Exception
      Concat multiple tracks having the same codec to a single track.
      Parameters:
      sourceTracksXml - an array of track to concat in order of the array as XML
      profileId - The encoding profile to use
      outputDimension - The output dimension as JSON
      Returns:
      A Response with the resulting track in the response body
      Throws:
      Exception
    • imageToVideo

      @POST @Path("imagetovideo") @Produces("text/xml") public javax.ws.rs.core.Response imageToVideo(@FormParam("sourceAttachment") String sourceAttachmentXml, @FormParam("profileId") String profileId, @FormParam("time") @DefaultValue("1") String timeString) throws Exception
      Transforms an image attachment to a video track
      Parameters:
      sourceAttachmentXml - The source image attachment
      profileId - The profile to use for encoding
      timeString - the length of the resulting video track in seconds
      Returns:
      A Response with the resulting track in the response body
      Throws:
      Exception
    • convertImage

      @POST @Path("convertimage") @Produces("text/xml") public javax.ws.rs.core.Response convertImage(@FormParam("sourceImage") String sourceImageXml, @FormParam("profileId") String profileId) throws Exception
      Converts an image to another format.
      Parameters:
      sourceImageXml - The source image
      profileId - The profile to use in image conversion
      Returns:
      A Response with the resulting image in the response body
      Throws:
      Exception
    • demux

      @POST @Path("demux") @Produces("text/xml") public javax.ws.rs.core.Response demux(@FormParam("sourceTrack") String sourceTrackAsXml, @FormParam("profileId") String profileId) throws Exception
      Demuxes a track into multiple outputs
      Parameters:
      sourceTrackAsXml - The source track
      profileId - The profile to use in encoding this track
      Returns:
      A response containing the job for this encoding job in the response body.
      Throws:
      Exception - - if it fails
    • processSmil

      @POST @Path("processsmil") @Produces("text/xml") public javax.ws.rs.core.Response processSmil(@FormParam("smilAsXml") String smilAsXml, @FormParam("trackId") String trackId, @FormParam("mediaType") String mediaType, @FormParam("profileIds") String profileIds) throws Exception
      ProcessSmil - encode a video based on descriptions in a smil file into all format in the profileIds
      Parameters:
      smilAsXml - - smil describing a list of videos and clips in them to make up one video
      trackId - - a paramGroup Id in the smil file describing a track
      mediaType - - audio only, video only or both
      profileIds - - list of encoding profile ids
      Returns:
      a job running the process
      Throws:
      Exception - if it fails
    • multiEncode

      @POST @Path("multiencode") @Produces("text/xml") public javax.ws.rs.core.Response multiEncode(@FormParam("sourceTrack") String sourceTrackAsXml, @FormParam("profileIds") String profileIds) throws Exception
      Throws:
      Exception
    • convertImageSync

      @POST @Path("convertimagesync") @Produces("text/xml") public javax.ws.rs.core.Response convertImageSync(@FormParam("sourceImage") String sourceImageXml, @FormParam("profileIds") String profileIds) throws Exception
      Synchronously converts an image to another format.
      Parameters:
      sourceImageXml - The source image
      profileIds - The encoding profiles to use in image conversion
      Returns:
      A Response with the resulting image in the response body
      Throws:
      Exception
    • listProfiles

      @GET @Path("profiles.xml") @Produces("text/xml") public org.opencastproject.composer.api.EncodingProfileList listProfiles()
    • getProfile

      @GET @Path("profile/{id}.xml") @Produces("text/xml") public javax.ws.rs.core.Response getProfile(@PathParam("id") String profileId) throws org.opencastproject.util.NotFoundException
      Throws:
      org.opencastproject.util.NotFoundException
    • getService

      public org.opencastproject.job.api.JobProducer getService()
      Specified by:
      getService in class org.opencastproject.rest.AbstractJobProducerEndpoint
      See Also:
      • AbstractJobProducerEndpoint.getService()
    • getServiceRegistry

      public org.opencastproject.serviceregistry.api.ServiceRegistry getServiceRegistry()
      Specified by:
      getServiceRegistry in class org.opencastproject.rest.AbstractJobProducerEndpoint
      See Also:
      • AbstractJobProducerEndpoint.getServiceRegistry()
    • parseTimeArray

      protected double[] parseTimeArray(String times)
      Parses string containing times in seconds separated by comma.
      Parameters:
      times - string to be parsed
      Returns:
      array of times in seconds