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(FileVersion fileVersion)
035                    throws Exception {
036    
037                    return getVideoProcessor().getPreviewAsStream(fileVersion);
038            }
039    
040            public static InputStream getPreviewAsStream(
041                            FileVersion fileVersion, String type)
042                    throws Exception {
043    
044                    return getVideoProcessor().getPreviewAsStream(fileVersion, type);
045            }
046    
047            public static long getPreviewFileSize(FileVersion fileVersion)
048                    throws Exception {
049    
050                    return getVideoProcessor().getPreviewFileSize(fileVersion);
051            }
052    
053            public static long getPreviewFileSize(FileVersion fileVersion, String type)
054                    throws Exception {
055    
056                    return getVideoProcessor().getPreviewFileSize(fileVersion, type);
057            }
058    
059            public static InputStream getThumbnailAsStream(
060                            FileVersion fileVersion, int thumbnailIndex)
061                    throws Exception {
062    
063                    return getVideoProcessor().getThumbnailAsStream(
064                            fileVersion, thumbnailIndex);
065            }
066    
067            public static long getThumbnailFileSize(
068                            FileVersion fileVersion, int thumbnailIndex)
069                    throws Exception {
070    
071                    return getVideoProcessor().getThumbnailFileSize(
072                            fileVersion, thumbnailIndex);
073            }
074    
075            public static Set<String> getVideoMimeTypes() {
076    
077                    return getVideoProcessor().getVideoMimeTypes();
078            }
079    
080            public static VideoProcessor getVideoProcessor() {
081                    return _videoProcessor;
082            }
083    
084            public static boolean hasVideo(FileVersion fileVersion) {
085                    return getVideoProcessor().hasVideo(fileVersion);
086            }
087    
088            public static boolean isSupported(String mimeType) {
089                    return getVideoProcessor().isSupported(mimeType);
090            }
091    
092            public static boolean isVideoSupported(FileVersion fileVersion) {
093                    return getVideoProcessor().isVideoSupported(fileVersion);
094            }
095    
096            public static boolean isVideoSupported(String mimeType) {
097                    return getVideoProcessor().isVideoSupported(mimeType);
098            }
099    
100            public static void trigger(FileVersion fileVersion) {
101                    getVideoProcessor().trigger(fileVersion);
102            }
103    
104            public void setVideoProcessor(VideoProcessor videoProcessor) {
105                    _videoProcessor = videoProcessor;
106            }
107    
108            private static VideoProcessor _videoProcessor;
109    
110    }