Example usage for com.liferay.portal.kernel.util PropsKeys XUGGLER_FFPRESET

List of usage examples for com.liferay.portal.kernel.util PropsKeys XUGGLER_FFPRESET

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util PropsKeys XUGGLER_FFPRESET.

Prototype

String XUGGLER_FFPRESET

To view the source code for com.liferay.portal.kernel.util PropsKeys XUGGLER_FFPRESET.

Click Source Link

Usage

From source file:com.liferay.portlet.documentlibrary.util.VideoProcessorImpl.java

License:Open Source License

private void _generateVideoXuggler(FileVersion fileVersion, File srcFile, File destFile, String containerType)
        throws Exception {

    if (!_isGeneratePreview(fileVersion, containerType)) {
        return;/*from   www .j  a v  a2  s. com*/
    }

    StopWatch stopWatch = null;

    if (_log.isInfoEnabled()) {
        stopWatch = new StopWatch();

        stopWatch.start();
    }

    if (PropsValues.DL_FILE_ENTRY_PREVIEW_FORK_PROCESS_ENABLED) {
        ProcessCallable<String> processCallable = new LiferayVideoProcessCallable(ServerDetector.getServerId(),
                PropsUtil.get(PropsKeys.LIFERAY_HOME), Log4JUtil.getCustomLogSettings(),
                srcFile.getCanonicalPath(), destFile.getCanonicalPath(), FileUtil.createTempFileName(),
                PropsUtil.getProperties(PropsKeys.DL_FILE_ENTRY_PREVIEW_VIDEO, false),
                PropsUtil.getProperties(PropsKeys.XUGGLER_FFPRESET, true));

        ProcessExecutor.execute(processCallable, ClassPathUtil.getPortalClassPath());
    } else {
        LiferayConverter liferayConverter = new LiferayVideoConverter(srcFile.getCanonicalPath(),
                destFile.getCanonicalPath(), FileUtil.createTempFileName(),
                PropsUtil.getProperties(PropsKeys.DL_FILE_ENTRY_PREVIEW_VIDEO, false),
                PropsUtil.getProperties(PropsKeys.XUGGLER_FFPRESET, true));

        liferayConverter.convert();
    }

    addFileToStore(fileVersion.getCompanyId(), PREVIEW_PATH, getPreviewFilePath(fileVersion, containerType),
            destFile);

    if (_log.isInfoEnabled()) {
        _log.info("Xuggler generated a " + containerType + " preview video for " + fileVersion.getTitle()
                + " in " + stopWatch);
    }
}