Class TimelinePreviewsServiceImpl
java.lang.Object
org.opencastproject.job.api.AbstractJobProducer
org.opencastproject.timelinepreviews.ffmpeg.TimelinePreviewsServiceImpl
- All Implemented Interfaces:
JobProducer,TimelinePreviewsService,org.osgi.service.cm.ManagedService
public class TimelinePreviewsServiceImpl
extends AbstractJobProducer
implements 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 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 SecurityServiceThe security serviceprotected ServiceRegistryReference to the receipt servicestatic final StringThe key to look for in the service configuration file to override the DEFAULT_TIMELINEPREVIEWS_JOB_LOADprotected UserDirectoryServiceThe user directory serviceprotected 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) OSGI activate method.protected AttachmentcreatePreviewsFFmpeg(Track track, double seconds, int width, int height, int tileX, int tileY, double duration) Executes the FFmpeg command to generate a timeline previews imagecreateTimelinePreviewImages(Track track, int imageCount) Takes the given track and returns the job that can be used to generate timeline preview images.protected AttachmentgeneratePreviewImages(Job job, 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 OrganizationDirectoryServiceReturns a reference to the organization directory service.protected SecurityServiceReturns a reference to the security serviceprotected ServiceRegistryReturns a reference to the service registry.protected UserDirectoryServiceReturns a reference to the user directory serviceprotected StringAsks the overriding class to process the arguments using the given operation.voidsetOrganizationDirectoryService(OrganizationDirectoryService organizationDirectory) Sets a reference to the organization directory service.voidsetSecurityService(SecurityService securityService) Callback for setting the security service.protected voidsetServiceRegistry(ServiceRegistry serviceRegistry) Sets the receipt servicevoidsetUserDirectoryService(UserDirectoryService userDirectoryService) Callback for setting the user directory service.protected voidsetWorkspace(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
Reference to the receipt service -
workspace
The workspace to use when retrieving remote media files -
securityService
The security service -
userDirectoryService
The user directory service -
organizationDirectoryService
The 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) Description copied from class:AbstractJobProducerOSGI activate method.- Overrides:
activatein classAbstractJobProducer- Parameters:
cc- OSGI component context
-
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 Job createTimelinePreviewImages(Track track, int imageCount) throws TimelinePreviewsException, MediaPackageException Description copied from interface:TimelinePreviewsServiceTakes the given track and returns the job that can be used to generate timeline preview images.- Specified by:
createTimelinePreviewImagesin interfaceTimelinePreviewsService- Parameters:
track- track to generate preview images forimageCount- number of preview images that will be generated- Returns:
- the job that can generate the preview images
- Throws:
TimelinePreviewsException- if the timeline preview images could not be generatedMediaPackageException- if the track is invalid
-
generatePreviewImages
protected Attachment generatePreviewImages(Job job, Track track, int imageCount) throws TimelinePreviewsException, 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:
TimelinePreviewsExceptionMediaPackageException
-
process
Asks the overriding class to process the arguments using the given operation. The result will be added to the associated job as the payload.- Specified by:
processin classAbstractJobProducer- Parameters:
job- the job to process- Returns:
- the operation result
- Throws:
Exception- See Also:
-
createPreviewsFFmpeg
protected Attachment createPreviewsFFmpeg(Track track, double seconds, int width, int height, int tileX, int tileY, double duration) throws 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:
TimelinePreviewsException
-
setWorkspace
Sets the workspace- Parameters:
workspace- an instance of the workspace
-
setServiceRegistry
Sets the receipt service- Parameters:
serviceRegistry- the service registry
-
getServiceRegistry
Returns a reference to the service registry.- Specified by:
getServiceRegistryin classAbstractJobProducer- Returns:
- the service registry
- See Also:
-
setSecurityService
Callback for setting the security service.- Parameters:
securityService- the securityService to set
-
setUserDirectoryService
Callback for setting the user directory service.- Parameters:
userDirectoryService- the userDirectoryService to set
-
setOrganizationDirectoryService
Sets a reference to the organization directory service.- Parameters:
organizationDirectory- the organization directory
-
getSecurityService
Returns a reference to the security service- Specified by:
getSecurityServicein classAbstractJobProducer- Returns:
- the security service
- See Also:
-
getUserDirectoryService
Returns a reference to the user directory service- Specified by:
getUserDirectoryServicein classAbstractJobProducer- Returns:
- the user directory service
- See Also:
-
getOrganizationDirectoryService
Returns a reference to the organization directory service.- Specified by:
getOrganizationDirectoryServicein classAbstractJobProducer- Returns:
- the organization directory service
- See Also:
-