Class ComposerRestService

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

@Path("/composer/ffmpeg") public class ComposerRestService extends AbstractJobProducerEndpoint
A REST endpoint delegating functionality to the ComposerService
  • Field Details

    • serverUrl

      protected String serverUrl
      The base server URL
    • composerService

      protected ComposerService composerService
      The composer service
    • serviceRegistry

      protected ServiceRegistry serviceRegistry
      The service registry
    • smilService

      protected SmilService smilService
      The smil service
  • Constructor Details

    • ComposerRestService

      public ComposerRestService()
  • Method Details

    • setSmilService

      public void setSmilService(SmilService smilService)
    • setServiceRegistry

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

      public void setComposerService(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("sourceTracks") String sourceTracksXml, @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") 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 EncodingProfileList listProfiles()
    • getProfile

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

      public JobProducer getService()
      Returns the job producer that is backing this REST endpoint.
      Specified by:
      getService in class AbstractJobProducerEndpoint
      Returns:
      the job producer
      See Also:
    • getServiceRegistry

      public ServiceRegistry getServiceRegistry()
      Return the service registry.
      Specified by:
      getServiceRegistry in class AbstractJobProducerEndpoint
      See Also:
    • 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