Class ComposerServiceImpl
java.lang.Object
org.opencastproject.job.api.AbstractJobProducer
org.opencastproject.composer.impl.ComposerServiceImpl
- All Implemented Interfaces:
org.opencastproject.composer.api.ComposerService,org.opencastproject.job.api.JobProducer,org.osgi.service.cm.ManagedService
public class ComposerServiceImpl
extends org.opencastproject.job.api.AbstractJobProducer
implements org.opencastproject.composer.api.ComposerService, org.osgi.service.cm.ManagedService
FFMPEG based implementation of the composer service api.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatThe maximum job load allowed for operations that use multiple profile (ProcessSmil, MultiEncode)static final intstatic final floatstatic final intstatic final floatdefault transition duration for process_smil in secondsstatic final floatThe default factor used to multiply the sum of encoding profiles load job for ProcessSmilstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringConfiguration for process-smil transition durationFields inherited from class org.opencastproject.job.api.AbstractJobProducer
ACCEPT_JOB_LOADS_EXCEEDING_PROPERTY, acceptJobLoadsExeedingMaxLoad, DEFAULT_ACCEPT_JOB_LOADS_EXCEEDING, executor, jobTypeFields inherited from interface org.opencastproject.composer.api.ComposerService
AUDIO_ONLY, BOTH, JOB_TYPE, LOWER, UPPER, VIDEO_ONLY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) OSGi callback on component activation.org.opencastproject.job.api.Jobcomposite(org.opencastproject.composer.layout.Dimension compositeTrackSize, org.opencastproject.util.data.Option<org.opencastproject.composer.api.LaidOutElement<org.opencastproject.mediapackage.Track>> upperTrack, org.opencastproject.composer.api.LaidOutElement<org.opencastproject.mediapackage.Track> lowerTrack, org.opencastproject.util.data.Option<org.opencastproject.composer.api.LaidOutElement<org.opencastproject.mediapackage.Attachment>> watermark, String profileId, String background, String sourceAudioName) org.opencastproject.job.api.Jobconcat(String profileId, org.opencastproject.composer.layout.Dimension outputDimension, boolean sameCodec, org.opencastproject.mediapackage.Track... tracks) org.opencastproject.job.api.Jobconcat(String profileId, org.opencastproject.composer.layout.Dimension outputDimension, float outputFrameRate, boolean sameCodec, org.opencastproject.mediapackage.Track... tracks) org.opencastproject.job.api.JobconvertImage(org.opencastproject.mediapackage.Attachment image, String... profileIds) List<org.opencastproject.mediapackage.Attachment> convertImageSync(org.opencastproject.mediapackage.Attachment image, String... profileIds) voidOSGi callback on component deactivation.org.opencastproject.job.api.Joborg.opencastproject.job.api.Jobprotected org.opencastproject.security.api.OrganizationDirectoryServiceorg.opencastproject.composer.api.EncodingProfilegetProfile(String profileId) protected org.opencastproject.security.api.SecurityServiceprotected org.opencastproject.serviceregistry.api.ServiceRegistryprotected org.opencastproject.security.api.UserDirectoryServiceprotected voidhlsFixReference(long id, List<File> outputs) protected voidhlsSetReference(org.opencastproject.mediapackage.Track track) org.opencastproject.job.api.Joborg.opencastproject.job.api.Jobimage(org.opencastproject.mediapackage.Track sourceTrack, String profileId, Map<String, String> properties) List<org.opencastproject.mediapackage.Attachment> org.opencastproject.job.api.JobimageToVideo(org.opencastproject.mediapackage.Attachment sourceImageAttachment, String profileId, double time) protected org.opencastproject.mediapackage.Trackprotected List<org.opencastproject.mediapackage.Track> protected List<org.opencastproject.mediapackage.Track> org.opencastproject.composer.api.EncodingProfile[]voidOSGI callback when the configuration is updated.protected List<org.opencastproject.mediapackage.Track> multiEncode(org.opencastproject.job.api.Job job, org.opencastproject.mediapackage.Track track, List<String> profileIds) A single encoding process that produces multiple outputs from a single track(s) using a list of encoding profiles.org.opencastproject.job.api.JobmultiEncode(org.opencastproject.mediapackage.Track sourceTrack, List<String> profileIds) org.opencastproject.job.api.Jobmux(org.opencastproject.mediapackage.Track videoTrack, org.opencastproject.mediapackage.Track audioTrack, String profileId) org.opencastproject.job.api.JobparallelEncode(org.opencastproject.mediapackage.Track sourceTrack, String profileId) protected Stringprocess(org.opencastproject.job.api.Job job) protected List<org.opencastproject.mediapackage.Track> processSmil(org.opencastproject.job.api.Job job, org.opencastproject.smil.entity.api.Smil smil, String trackParamGroupId, String mediaType, List<String> encodingProfiles) Splice segments given by smil document for the given track to the new one.org.opencastproject.job.api.JobprocessSmil(org.opencastproject.smil.entity.api.Smil smil, String trackparamId, String mediaType, List<String> profileIds) ProcessSmil processes editing of one source group (which may contain multiple source tracks) to one set of outputs (to one or more encoding profiles).voidsetEncodingProfileReadinessIndicator(org.opencastproject.util.ReadinessIndicator unused) protected voidsetMediaInspectionService(org.opencastproject.inspection.api.MediaInspectionService mediaInspectionService) Sets the media inspection servicevoidsetOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectory) Sets a reference to the organization directory service.protected voidsetProfileScanner(EncodingProfileScanner scanner) Sets the profile scanner.voidsetSecurityService(org.opencastproject.security.api.SecurityService securityService) Callback for setting the security service.protected voidsetServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry) Sets the service registryvoidsetSmilService(org.opencastproject.smil.api.SmilService smilService) voidsetUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService) Callback for setting the user directory service.protected voidsetWorkspace(org.opencastproject.workspace.api.Workspace workspace) Sets the workspaceorg.opencastproject.job.api.Jobtrim(org.opencastproject.mediapackage.Track sourceTrack, String profileId, long start, long duration) voidupdated(Dictionary<String, ?> properties) Methods inherited from class org.opencastproject.job.api.AbstractJobProducer
acceptJob, countJobs, finallyUpdateJob, getJobType, incident, isReadyToAccept, isReadyToAcceptJobs
-
Field Details
-
PROCESS_SMIL_CLIP_TRANSITION_DURATION
Configuration for process-smil transition duration- See Also:
-
DEFAULT_PROCESS_SMIL_CLIP_TRANSITION_DURATION
public static final float DEFAULT_PROCESS_SMIL_CLIP_TRANSITION_DURATIONdefault transition duration for process_smil in seconds- See Also:
-
DEFAULT_JOB_LOAD_MAX_MULTIPLE_PROFILES
public static final float DEFAULT_JOB_LOAD_MAX_MULTIPLE_PROFILESThe maximum job load allowed for operations that use multiple profile (ProcessSmil, MultiEncode)- See Also:
-
DEFAULT_PROCESS_SMIL_JOB_LOAD_FACTOR
public static final float DEFAULT_PROCESS_SMIL_JOB_LOAD_FACTORThe default factor used to multiply the sum of encoding profiles load job for ProcessSmil- See Also:
-
DEFAULT_MULTI_ENCODE_JOB_LOAD_FACTOR
public static final float DEFAULT_MULTI_ENCODE_JOB_LOAD_FACTOR- See Also:
-
JOB_LOAD_MAX_MULTIPLE_PROFILES
- See Also:
-
JOB_LOAD_FACTOR_PROCESS_SMIL
- See Also:
-
JOB_LOAD_FACTOR_MULTI_ENCODE
- See Also:
-
DEFAULT_MULTI_ENCODE_TRIM_MILLISECONDS
public static final int DEFAULT_MULTI_ENCODE_TRIM_MILLISECONDS- See Also:
-
MULTI_ENCODE_TRIM_MILLISECONDS
- See Also:
-
DEFAULT_MULTI_ENCODE_FADE_MILLISECONDS
public static final int DEFAULT_MULTI_ENCODE_FADE_MILLISECONDS- See Also:
-
MULTI_ENCODE_FADE_MILLISECONDS
- See Also:
-
-
Constructor Details
-
ComposerServiceImpl
public ComposerServiceImpl()Creates a new composer service instance.
-
-
Method Details
-
activate
public void activate(org.osgi.service.component.ComponentContext cc) OSGi callback on component activation.- Overrides:
activatein classorg.opencastproject.job.api.AbstractJobProducer- Parameters:
cc- the component context
-
deactivate
public void deactivate()OSGi callback on component deactivation. -
encode
public org.opencastproject.job.api.Job encode(org.opencastproject.mediapackage.Track sourceTrack, String profileId) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
encodein interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException- See Also:
-
parallelEncode
public org.opencastproject.job.api.Job parallelEncode(org.opencastproject.mediapackage.Track sourceTrack, String profileId) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
parallelEncodein interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException- See Also:
-
trim
public org.opencastproject.job.api.Job trim(org.opencastproject.mediapackage.Track sourceTrack, String profileId, long start, long duration) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
trimin interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException- See Also:
-
mux
public org.opencastproject.job.api.Job mux(org.opencastproject.mediapackage.Track videoTrack, org.opencastproject.mediapackage.Track audioTrack, String profileId) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
muxin interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException- See Also:
-
composite
public org.opencastproject.job.api.Job composite(org.opencastproject.composer.layout.Dimension compositeTrackSize, org.opencastproject.util.data.Option<org.opencastproject.composer.api.LaidOutElement<org.opencastproject.mediapackage.Track>> upperTrack, org.opencastproject.composer.api.LaidOutElement<org.opencastproject.mediapackage.Track> lowerTrack, org.opencastproject.util.data.Option<org.opencastproject.composer.api.LaidOutElement<org.opencastproject.mediapackage.Attachment>> watermark, String profileId, String background, String sourceAudioName) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
compositein interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException
-
concat
public org.opencastproject.job.api.Job concat(String profileId, org.opencastproject.composer.layout.Dimension outputDimension, boolean sameCodec, org.opencastproject.mediapackage.Track... tracks) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
concatin interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException
-
concat
public org.opencastproject.job.api.Job concat(String profileId, org.opencastproject.composer.layout.Dimension outputDimension, float outputFrameRate, boolean sameCodec, org.opencastproject.mediapackage.Track... tracks) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
concatin interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException
-
imageToVideo
public org.opencastproject.job.api.Job imageToVideo(org.opencastproject.mediapackage.Attachment sourceImageAttachment, String profileId, double time) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
imageToVideoin interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException
-
image
public org.opencastproject.job.api.Job image(org.opencastproject.mediapackage.Track sourceTrack, String profileId, double... times) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
imagein interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException- See Also:
-
imageSync
public List<org.opencastproject.mediapackage.Attachment> imageSync(org.opencastproject.mediapackage.Track sourceTrack, String profileId, double... time) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
imageSyncin interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException
-
image
public org.opencastproject.job.api.Job image(org.opencastproject.mediapackage.Track sourceTrack, String profileId, Map<String, String> properties) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException- Specified by:
imagein interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException
-
convertImage
public org.opencastproject.job.api.Job convertImage(org.opencastproject.mediapackage.Attachment image, String... profileIds) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
convertImagein interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException- See Also:
-
convertImageSync
public List<org.opencastproject.mediapackage.Attachment> convertImageSync(org.opencastproject.mediapackage.Attachment image, String... profileIds) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
convertImageSyncin interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException- See Also:
-
process
protected String process(org.opencastproject.job.api.Job job) throws org.opencastproject.serviceregistry.api.ServiceRegistryException - Specified by:
processin classorg.opencastproject.job.api.AbstractJobProducer- Throws:
org.opencastproject.serviceregistry.api.ServiceRegistryException- See Also:
-
listProfiles
public org.opencastproject.composer.api.EncodingProfile[] listProfiles()- Specified by:
listProfilesin interfaceorg.opencastproject.composer.api.ComposerService- See Also:
-
getProfile
- Specified by:
getProfilein interfaceorg.opencastproject.composer.api.ComposerService- See Also:
-
inspect
protected List<org.opencastproject.mediapackage.Track> inspect(org.opencastproject.job.api.Job job, List<URI> uris, List<List<String>> tags) throws org.opencastproject.composer.api.EncoderException - Throws:
org.opencastproject.composer.api.EncoderException
-
inspect
protected List<org.opencastproject.mediapackage.Track> inspect(org.opencastproject.job.api.Job job, List<URI> uris) throws org.opencastproject.composer.api.EncoderException - Throws:
org.opencastproject.composer.api.EncoderException
-
inspect
protected org.opencastproject.mediapackage.Track inspect(org.opencastproject.job.api.Job job, URI workspaceURI) throws org.opencastproject.composer.api.EncoderException - Throws:
org.opencastproject.composer.api.EncoderException
-
hlsFixReference
- Throws:
IOException
-
hlsSetReference
- Throws:
IOException
-
setMediaInspectionService
protected void setMediaInspectionService(org.opencastproject.inspection.api.MediaInspectionService mediaInspectionService) Sets the media inspection service- Parameters:
mediaInspectionService- an instance of the media inspection service
-
setWorkspace
protected void setWorkspace(org.opencastproject.workspace.api.Workspace workspace) Sets the workspace- Parameters:
workspace- an instance of the workspace
-
setServiceRegistry
protected void setServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry) Sets the service registry- Parameters:
serviceRegistry- the service registry
-
getServiceRegistry
protected org.opencastproject.serviceregistry.api.ServiceRegistry getServiceRegistry()- Specified by:
getServiceRegistryin classorg.opencastproject.job.api.AbstractJobProducer- See Also:
-
setProfileScanner
Sets the profile scanner.- Parameters:
scanner- the profile scanner
-
setSecurityService
public void setSecurityService(org.opencastproject.security.api.SecurityService securityService) Callback for setting the security service.- Parameters:
securityService- the securityService to set
-
setUserDirectoryService
public void setUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService) Callback for setting the user directory service.- Parameters:
userDirectoryService- the userDirectoryService to set
-
setOrganizationDirectoryService
public void setOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectory) Sets a reference to the organization directory service.- Parameters:
organizationDirectory- the organization directory
-
getSecurityService
protected org.opencastproject.security.api.SecurityService getSecurityService()- Specified by:
getSecurityServicein classorg.opencastproject.job.api.AbstractJobProducer- See Also:
-
setSmilService
public void setSmilService(org.opencastproject.smil.api.SmilService smilService) -
getUserDirectoryService
protected org.opencastproject.security.api.UserDirectoryService getUserDirectoryService()- Specified by:
getUserDirectoryServicein classorg.opencastproject.job.api.AbstractJobProducer- See Also:
-
getOrganizationDirectoryService
protected org.opencastproject.security.api.OrganizationDirectoryService getOrganizationDirectoryService()- Specified by:
getOrganizationDirectoryServicein classorg.opencastproject.job.api.AbstractJobProducer- See Also:
-
setEncodingProfileReadinessIndicator
public void setEncodingProfileReadinessIndicator(org.opencastproject.util.ReadinessIndicator unused) -
demux
public org.opencastproject.job.api.Job demux(org.opencastproject.mediapackage.Track sourceTrack, String profileId) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
demuxin interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException
-
modified
OSGI callback when the configuration is updated. This method is only here to prevent the configuration admin service from calling the service deactivate and activate methods for a config update. It does not have to do anything as the updates are handled by updated().- Throws:
org.osgi.service.cm.ConfigurationException
-
updated
public void updated(Dictionary<String, ?> properties) throws org.osgi.service.cm.ConfigurationException- Specified by:
updatedin interfaceorg.osgi.service.cm.ManagedService- Throws:
org.osgi.service.cm.ConfigurationException
-
processSmil
public org.opencastproject.job.api.Job processSmil(org.opencastproject.smil.entity.api.Smil smil, String trackparamId, String mediaType, List<String> profileIds) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException ProcessSmil processes editing of one source group (which may contain multiple source tracks) to one set of outputs (to one or more encoding profiles). Note that the source tracks are expected to have the same dimensions.- Specified by:
processSmilin interfaceorg.opencastproject.composer.api.ComposerService- Parameters:
smil- - smil containing with video names and clip sections from themtrackparamId- - group idmediaType- - VIDEO_ONLY, AUDIO_ONLY, or "" if neither is trueprofileIds- - list of encoding profile Ids- Returns:
- Compose Job
- Throws:
org.opencastproject.composer.api.EncoderException- - if encoding failsorg.opencastproject.mediapackage.MediaPackageException- - if missing files or bad mp
-
processSmil
protected List<org.opencastproject.mediapackage.Track> processSmil(org.opencastproject.job.api.Job job, org.opencastproject.smil.entity.api.Smil smil, String trackParamGroupId, String mediaType, List<String> encodingProfiles) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException, URISyntaxException Splice segments given by smil document for the given track to the new one. This function reads the smil file and reduce them to arguments to send to the encoder- Parameters:
job- processing jobsmil- smil document with media segments descriptiontrackParamGroupId- source track groupmediaType- VIDEO_ONLY or AUDIO_ONLY or "" if it has bothencodingProfiles- - profiles- Returns:
- serialized array of processed tracks
- Throws:
org.opencastproject.composer.api.EncoderException- if an error occurredorg.opencastproject.mediapackage.MediaPackageException- - bad MediapackageURISyntaxException
-
multiEncode
public org.opencastproject.job.api.Job multiEncode(org.opencastproject.mediapackage.Track sourceTrack, List<String> profileIds) throws org.opencastproject.composer.api.EncoderException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
multiEncodein interfaceorg.opencastproject.composer.api.ComposerService- Throws:
org.opencastproject.composer.api.EncoderExceptionorg.opencastproject.mediapackage.MediaPackageException
-
multiEncode
protected List<org.opencastproject.mediapackage.Track> multiEncode(org.opencastproject.job.api.Job job, org.opencastproject.mediapackage.Track track, List<String> profileIds) throws org.opencastproject.composer.api.EncoderException, IllegalArgumentException A single encoding process that produces multiple outputs from a single track(s) using a list of encoding profiles. Each output can be tagged by the profile name. This supports adaptive bitrate outputs.- Parameters:
job- - encoding jobtrack- - source trackprofileIds- - list of encoding profile Ids, can include one adaptive profile- Returns:
- encoded files
- Throws:
org.opencastproject.composer.api.EncoderException- - if can't encodeIllegalArgumentException- - if missing arguments
-