001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Thomas Roger <troger@nuxeo.com>
016 */
017
018package org.nuxeo.ecm.platform.video.service;
019
020import java.util.Collection;
021
022import org.nuxeo.ecm.core.api.DocumentModel;
023import org.nuxeo.ecm.platform.video.TranscodedVideo;
024import org.nuxeo.ecm.platform.video.Video;
025import org.nuxeo.ecm.platform.video.VideoConversionStatus;
026
027/**
028 * Service to asynchronously launch and monitor video conversions.
029 * <p>
030 *
031 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a>
032 * @since 5.5
033 */
034public interface VideoService {
035
036    /**
037     * Returns the available registered video conversions that can be run on a Video document.
038     */
039    Collection<VideoConversion> getAvailableVideoConversions();
040
041    /**
042     * Launch an asynchronously video conversion of the given {@code doc}.
043     *
044     * @param doc the video document to be converted
045     * @param conversionName the video conversion to use
046     */
047    void launchConversion(DocumentModel doc, String conversionName);
048
049    /**
050     * Launch all the registered automatic video conversions on the given {@code doc}.
051     *
052     * @param doc the video document to be converted
053     */
054    void launchAutomaticConversions(DocumentModel doc);
055
056    /**
057     * Convert the {@code originalVideo} using the given {@code conversionName}.
058     *
059     * @param originalVideo the video to convert
060     * @param conversionName the video conversion to use
061     * @return a {@code TranscodedVideo} object of the converted video.
062     */
063    TranscodedVideo convert(Video originalVideo, String conversionName);
064
065    /**
066     * Convert the {@code originalVideo} using the given {@code conversionName}.
067     *
068     * @param id unique identifier of the video conversion calling this method, used for monitoring.
069     * @param originalVideo the video to convert
070     * @param conversionName the video conversion to use
071     * @return a {@code TranscodedVideo} object for the converted video.
072     * @deprecated since 5.7.3, use the API without id
073     * @see #convert(Video, String)
074     */
075    @Deprecated
076    TranscodedVideo convert(VideoConversionId id, Video originalVideo, String conversionName);
077
078    /**
079     * Returns the status of the video conversion identified by the given {@code id}.
080     *
081     * @param id unique identifier of the video conversion
082     * @deprecated since 5.7.3, use the other API with a document
083     * @see #getProgressStatus(String, String, String)
084     */
085    @Deprecated
086    VideoConversionStatus getProgressStatus(VideoConversionId id);
087
088    /**
089     * Returns the status of the video conversion with the given conversion name on the given document.
090     *
091     * @param repositoryName
092     * @param docId
093     * @param conversionName
094     * @return
095     * @since 5.7.3
096     */
097    VideoConversionStatus getProgressStatus(String repositoryName, String docId, String conversionName);
098
099    /**
100     * @since 7.2
101     */
102    VideoConversion getVideoConversion(String conversionName);
103
104    /**
105     * @since 7.4
106     */
107    Configuration getConfiguration();
108
109}