Class TimelinePreviewsServiceImpl
java.lang.Object
org.opencastproject.job.api.AbstractJobProducer
org.opencastproject.timelinepreviews.ffmpeg.TimelinePreviewsServiceImpl
- All Implemented Interfaces:
org.opencastproject.job.api.JobProducer,org.opencastproject.timelinepreviews.api.TimelinePreviewsService,org.osgi.service.cm.ManagedService
public class TimelinePreviewsServiceImpl
extends org.opencastproject.job.api.AbstractJobProducer
implements org.opencastproject.timelinepreviews.api.TimelinePreviewsService, org.osgi.service.cm.ManagedService
Media analysis plugin that takes a video stream and generates preview images that can be shown on the timeline.
This will be done using FFmpeg.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumList of available operations on jobs -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringPath to the executablestatic final StringResulting collection in the working file repositorystatic final StringDefault value for the mimetype of the generated imagestatic final StringDefault value for the format of the output image filestatic final intDefault value for the horizontal resolutionstatic final intDefault value for the vertical resolutionstatic final floatThe default job load of a timeline previews jobstatic final StringThe key to look for in the service configuration file to override the DEFAULT_FFMPEG_BINARYstatic final StringThe default path to the FFmpeg binaryprotected static final org.slf4j.LoggerThe logging facilityprotected StringThe mimetype that will be set for the generated Attachment containing the timeline previews imagestatic final StringName of the constant used to retrieve the mimetypestatic final StringName of the constant used to retrieve the output file formatstatic final StringName of the constant used to retrieve the horizontal resolutionstatic final StringName of the constant used to retrieve the vertical resolutionprotected org.opencastproject.security.api.OrganizationDirectoryServiceThe organization directory serviceprotected StringThe file format of the generated preview images fileprotected intThe horizontal resolution of a single preview imageprotected intThe vertical resolution of a single preview imageprotected org.opencastproject.security.api.SecurityServiceThe security serviceprotected org.opencastproject.serviceregistry.api.ServiceRegistryReference to the receipt servicestatic final StringThe key to look for in the service configuration file to override the DEFAULT_TIMELINEPREVIEWS_JOB_LOADprotected org.opencastproject.security.api.UserDirectoryServiceThe user directory serviceprotected org.opencastproject.workspace.api.WorkspaceThe workspace to use when retrieving remote media filesFields 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.timelinepreviews.api.TimelinePreviewsService
JOB_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of the timeline previews service. -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) protected org.opencastproject.mediapackage.AttachmentcreatePreviewsFFmpeg(org.opencastproject.mediapackage.Track track, double seconds, int width, int height, int tileX, int tileY, double duration) Executes the FFmpeg command to generate a timeline previews imageorg.opencastproject.job.api.JobcreateTimelinePreviewImages(org.opencastproject.mediapackage.Track track, int imageCount) protected org.opencastproject.mediapackage.AttachmentgeneratePreviewImages(org.opencastproject.job.api.Job job, org.opencastproject.mediapackage.Track track, int imageCount) Starts generation of timeline preview images for the given video track and returns an attachment containing one image that contains all the timeline preview images.protected org.opencastproject.security.api.OrganizationDirectoryServiceprotected org.opencastproject.security.api.SecurityServiceprotected org.opencastproject.serviceregistry.api.ServiceRegistryprotected org.opencastproject.security.api.UserDirectoryServiceprotected Stringprocess(org.opencastproject.job.api.Job job) voidsetOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectory) Sets a reference to the organization directory service.voidsetSecurityService(org.opencastproject.security.api.SecurityService securityService) Callback for setting the security service.protected voidsetServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry) Sets the receipt servicevoidsetUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService) Callback for setting the user directory service.protected voidsetWorkspace(org.opencastproject.workspace.api.Workspace workspace) Sets the workspacevoidupdated(Dictionary<String, ?> properties) Methods inherited from class org.opencastproject.job.api.AbstractJobProducer
acceptJob, countJobs, finallyUpdateJob, getJobType, incident, isReadyToAccept, isReadyToAcceptJobs
-
Field Details
-
COLLECTION_ID
Resulting collection in the working file repository- See Also:
-
binary
Path to the executable -
FFMPEG_BINARY_CONFIG
The key to look for in the service configuration file to override the DEFAULT_FFMPEG_BINARY- See Also:
-
FFMPEG_BINARY_DEFAULT
The default path to the FFmpeg binary- See Also:
-
OPT_RESOLUTION_X
Name of the constant used to retrieve the horizontal resolution- See Also:
-
DEFAULT_RESOLUTION_X
public static final int DEFAULT_RESOLUTION_XDefault value for the horizontal resolution- See Also:
-
OPT_RESOLUTION_Y
Name of the constant used to retrieve the vertical resolution- See Also:
-
DEFAULT_RESOLUTION_Y
public static final int DEFAULT_RESOLUTION_YDefault value for the vertical resolution- See Also:
-
OPT_OUTPUT_FORMAT
Name of the constant used to retrieve the output file format- See Also:
-
DEFAULT_OUTPUT_FORMAT
Default value for the format of the output image file- See Also:
-
OPT_MIMETYPE
Name of the constant used to retrieve the mimetype- See Also:
-
DEFAULT_MIMETYPE
Default value for the mimetype of the generated image- See Also:
-
DEFAULT_TIMELINEPREVIEWS_JOB_LOAD
public static final float DEFAULT_TIMELINEPREVIEWS_JOB_LOADThe default job load of a timeline previews job- See Also:
-
TIMELINEPREVIEWS_JOB_LOAD_KEY
The key to look for in the service configuration file to override the DEFAULT_TIMELINEPREVIEWS_JOB_LOAD- See Also:
-
logger
protected static final org.slf4j.Logger loggerThe logging facility -
resolutionX
protected int resolutionXThe horizontal resolution of a single preview image -
resolutionY
protected int resolutionYThe vertical resolution of a single preview image -
outputFormat
The file format of the generated preview images file -
mimetype
The mimetype that will be set for the generated Attachment containing the timeline previews image -
serviceRegistry
protected org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistryReference to the receipt service -
workspace
protected org.opencastproject.workspace.api.Workspace workspaceThe workspace to use when retrieving remote media files -
securityService
protected org.opencastproject.security.api.SecurityService securityServiceThe security service -
userDirectoryService
protected org.opencastproject.security.api.UserDirectoryService userDirectoryServiceThe user directory service -
organizationDirectoryService
protected org.opencastproject.security.api.OrganizationDirectoryService organizationDirectoryServiceThe organization directory service
-
-
Constructor Details
-
TimelinePreviewsServiceImpl
public TimelinePreviewsServiceImpl()Creates a new instance of the timeline previews service.
-
-
Method Details
-
activate
public void activate(org.osgi.service.component.ComponentContext cc) - Overrides:
activatein classorg.opencastproject.job.api.AbstractJobProducer
-
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- See Also:
-
createTimelinePreviewImages
public org.opencastproject.job.api.Job createTimelinePreviewImages(org.opencastproject.mediapackage.Track track, int imageCount) throws org.opencastproject.timelinepreviews.api.TimelinePreviewsException, org.opencastproject.mediapackage.MediaPackageException - Specified by:
createTimelinePreviewImagesin interfaceorg.opencastproject.timelinepreviews.api.TimelinePreviewsService- Throws:
org.opencastproject.timelinepreviews.api.TimelinePreviewsExceptionorg.opencastproject.mediapackage.MediaPackageException
-
generatePreviewImages
protected org.opencastproject.mediapackage.Attachment generatePreviewImages(org.opencastproject.job.api.Job job, org.opencastproject.mediapackage.Track track, int imageCount) throws org.opencastproject.timelinepreviews.api.TimelinePreviewsException, org.opencastproject.mediapackage.MediaPackageException Starts generation of timeline preview images for the given video track and returns an attachment containing one image that contains all the timeline preview images.- Parameters:
job-track- the element to analyzeimageCount- number of preview images that will be generated- Returns:
- an attachment containing the resulting timeline previews image
- Throws:
org.opencastproject.timelinepreviews.api.TimelinePreviewsExceptionorg.opencastproject.mediapackage.MediaPackageException
-
process
- Specified by:
processin classorg.opencastproject.job.api.AbstractJobProducer- Throws:
Exception- See Also:
-
createPreviewsFFmpeg
protected org.opencastproject.mediapackage.Attachment createPreviewsFFmpeg(org.opencastproject.mediapackage.Track track, double seconds, int width, int height, int tileX, int tileY, double duration) throws org.opencastproject.timelinepreviews.api.TimelinePreviewsException Executes the FFmpeg command to generate a timeline previews image- Parameters:
track- the track to generate the timeline previews image forseconds- the length of a segment that one preview image should representwidth- the width of a single preview imageheight- the height of a single preview imagetileX- the horizontal number of preview images that are stored in the timeline previews imagetileY- the vertical number of preview images that are stored in the timeline previews imageduration- the duration for which preview images should be generated- Returns:
- an attachment containing the timeline previews image
- Throws:
org.opencastproject.timelinepreviews.api.TimelinePreviewsException
-
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 receipt service- Parameters:
serviceRegistry- the service registry
-
getServiceRegistry
protected org.opencastproject.serviceregistry.api.ServiceRegistry getServiceRegistry()- Specified by:
getServiceRegistryin classorg.opencastproject.job.api.AbstractJobProducer- See Also:
-
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:
-
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:
-