001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.documentlibrary.util;
016    
017    import com.liferay.portal.kernel.repository.model.FileVersion;
018    
019    import java.io.InputStream;
020    
021    import java.util.Set;
022    
023    /**
024     * @author Sergio González
025     */
026    public class VideoProcessorUtil {
027    
028            public static void generateVideo(FileVersion fileVersion)
029                    throws Exception {
030    
031                    getVideoProcessor().generateVideo(fileVersion);
032            }
033    
034            public static InputStream getPreviewAsStream(
035                            FileVersion fileVersion, String type)
036                    throws Exception {
037    
038                    return getVideoProcessor().getPreviewAsStream(fileVersion, type);
039            }
040    
041            public static long getPreviewFileSize(FileVersion fileVersion, String type)
042                    throws Exception {
043    
044                    return getVideoProcessor().getPreviewFileSize(fileVersion, type);
045            }
046    
047            public static InputStream getThumbnailAsStream(
048                            FileVersion fileVersion, int index)
049                    throws Exception {
050    
051                    return getVideoProcessor().getThumbnailAsStream(fileVersion, index);
052            }
053    
054            public static long getThumbnailFileSize(FileVersion fileVersion, int index)
055                    throws Exception {
056    
057                    return getVideoProcessor().getThumbnailFileSize(fileVersion, index);
058            }
059    
060            public static Set<String> getVideoMimeTypes() {
061    
062                    return getVideoProcessor().getVideoMimeTypes();
063            }
064    
065            public static VideoProcessor getVideoProcessor() {
066                    return _videoProcessor;
067            }
068    
069            public static boolean hasVideo(FileVersion fileVersion) {
070                    return getVideoProcessor().hasVideo(fileVersion);
071            }
072    
073            public static boolean isSupported(String mimeType) {
074                    return getVideoProcessor().isSupported(mimeType);
075            }
076    
077            public static boolean isVideoSupported(FileVersion fileVersion) {
078                    return getVideoProcessor().isVideoSupported(fileVersion);
079            }
080    
081            public static boolean isVideoSupported(String mimeType) {
082                    return getVideoProcessor().isVideoSupported(mimeType);
083            }
084    
085            public static void trigger(FileVersion fileVersion) {
086                    getVideoProcessor().trigger(fileVersion);
087            }
088    
089            public void setVideoProcessor(VideoProcessor videoProcessor) {
090                    _videoProcessor = videoProcessor;
091            }
092    
093            private static VideoProcessor _videoProcessor;
094    
095    }