Class ComposerRestService
java.lang.Object
org.opencastproject.rest.AbstractJobProducerEndpoint
org.opencastproject.composer.impl.endpoint.ComposerRestService
A REST endpoint delegating functionality to the
ComposerService-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ComposerServiceThe composer serviceprotected StringThe base server URLprotected ServiceRegistryThe service registryprotected SmilServiceThe smil service -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) Callback from OSGi that is called when this service is activated.javax.ws.rs.core.Responsecomposite(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.Responseconcat(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.ResponseconvertImage(String sourceImageXml, String profileId) Converts an image to another format.javax.ws.rs.core.ResponseconvertImageSync(String sourceImageXml, String profileIds) Synchronously converts an image to another format.javax.ws.rs.core.ResponseDemuxes a track into multiple outputsjavax.ws.rs.core.ResponseEncodes a track.javax.ws.rs.core.ResponsegetProfile(String profileId) Returns the job producer that is backing this REST endpoint.Return the service registry.javax.ws.rs.core.Responseimage(String sourceTrackXml, String profileId, String times, LocalHashMap localMap) Encodes a track in a media package.javax.ws.rs.core.ResponseEncodes a track in a media package.javax.ws.rs.core.ResponseimageToVideo(String sourceAttachmentXml, String profileId, String timeString) Transforms an image attachment to a video trackjavax.ws.rs.core.ResponsemultiEncode(String sourceTrackAsXml, String profileIds) javax.ws.rs.core.Responsemux(String audioSourceTrackXml, String videoSourceTrackXml, String sourceTracksXml, String profileId) Encodes a track.javax.ws.rs.core.Responseparallelencode(String sourceTrackAsXml, String profileId) Encodes a track to multiple tracks in parallel.protected double[]parseTimeArray(String times) Parses string containing times in seconds separated by comma.javax.ws.rs.core.ResponseprocessSmil(String smilAsXml, String trackId, String mediaType, String profileIds) ProcessSmil - encode a video based on descriptions in a smil file into all format in the profileIdsvoidsetComposerService(ComposerService composerService) Sets the composer service.protected voidsetServiceRegistry(ServiceRegistry serviceRegistry) Callback from the OSGi declarative services to set the service registry.voidsetSmilService(SmilService smilService) javax.ws.rs.core.ResponseTrims a track to a new length.Methods inherited from class org.opencastproject.rest.AbstractJobProducerEndpoint
checkHeartbeat, dispatchJob
-
Field Details
-
serverUrl
The base server URL -
composerService
The composer service -
serviceRegistry
The service registry -
smilService
The smil service
-
-
Constructor Details
-
ComposerRestService
public ComposerRestService()
-
-
Method Details
-
setSmilService
-
setServiceRegistry
Callback from the OSGi declarative services to set the service registry.- Parameters:
serviceRegistry- the service registry
-
setComposerService
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 trackprofileId- 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 trackprofileId- 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 trackprofileId- the encoding profile to use for trimmingstart- the new trimming start timeduration- 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 trackvideoSourceTrackXml- The video source trackprofileId- 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 trackprofileId- The profile to use in encoding this tracktimes- one or more times in seconds separated by comma- Returns:
- A
Responsewith 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 trackprofileId- The profile to use in encoding this tracktimes- one or more times in seconds separated by comma- Returns:
- A
Responsewith 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 JSONlowerTrackXml- The lower track of the composition as XMLlowerLayoutJson- The lower layout as JSONupperTrackXml- The upper track of the composition as XMLupperLayoutJson- The upper layout as JSONwatermarkAttachmentXml- The watermark image attachment of the composition as XMLwatermarkLayoutJson- The watermark layout as JSONprofileId- The encoding profile to usebackground- The background color- Returns:
- A
Responsewith 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 XMLprofileId- The encoding profile to useoutputDimension- The output dimension as JSON- Returns:
- A
Responsewith 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 attachmentprofileId- The profile to use for encodingtimeString- the length of the resulting video track in seconds- Returns:
- A
Responsewith 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 imageprofileId- The profile to use in image conversion- Returns:
- A
Responsewith 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 trackprofileId- 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 videotrackId- - a paramGroup Id in the smil file describing a trackmediaType- - audio only, video only or bothprofileIds- - 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 imageprofileIds- The encoding profiles to use in image conversion- Returns:
- A
Responsewith the resulting image in the response body - Throws:
Exception
-
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
Returns the job producer that is backing this REST endpoint.- Specified by:
getServicein classAbstractJobProducerEndpoint- Returns:
- the job producer
- See Also:
-
getServiceRegistry
Return the service registry.- Specified by:
getServiceRegistryin classAbstractJobProducerEndpoint- See Also:
-
parseTimeArray
Parses string containing times in seconds separated by comma.- Parameters:
times- string to be parsed- Returns:
- array of times in seconds
-