001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Thomas Roger <troger@nuxeo.com>
018 */
019
020package org.nuxeo.ecm.platform.video.service;
021
022import java.util.Collection;
023
024import org.nuxeo.ecm.core.api.DocumentModel;
025import org.nuxeo.ecm.platform.video.TranscodedVideo;
026import org.nuxeo.ecm.platform.video.Video;
027import org.nuxeo.ecm.platform.video.VideoConversionStatus;
028
029/**
030 * Service to asynchronously launch and monitor video conversions.
031 * <p>
032 *
033 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a>
034 * @since 5.5
035 */
036public interface VideoService {
037
038    /**
039     * Returns the available registered video conversions that can be run on a Video document.
040     */
041    Collection<VideoConversion> getAvailableVideoConversions();
042
043    /**
044     * Launch an asynchronously video conversion of the given {@code doc}.
045     *
046     * @param doc the video document to be converted
047     * @param conversionName the video conversion to use
048     */
049    void launchConversion(DocumentModel doc, String conversionName);
050
051    /**
052     * Launch all the registered automatic video conversions on the given {@code doc}.
053     *
054     * @param doc the video document to be converted
055     */
056    void launchAutomaticConversions(DocumentModel doc);
057
058    /**
059     * Convert the {@code originalVideo} using the given {@code conversionName}.
060     *
061     * @param originalVideo the video to convert
062     * @param conversionName the video conversion to use
063     * @return a {@code TranscodedVideo} object of the converted video.
064     */
065    TranscodedVideo convert(Video originalVideo, String conversionName);
066
067    /**
068     * Convert the {@code originalVideo} using the given {@code conversionName}.
069     *
070     * @param id unique identifier of the video conversion calling this method, used for monitoring.
071     * @param originalVideo the video to convert
072     * @param conversionName the video conversion to use
073     * @return a {@code TranscodedVideo} object for the converted video.
074     * @deprecated since 5.7.3, use the API without id
075     * @see #convert(Video, String)
076     */
077    @Deprecated
078    TranscodedVideo convert(VideoConversionId id, Video originalVideo, String conversionName);
079
080    /**
081     * Returns the status of the video conversion identified by the given {@code id}.
082     *
083     * @param id unique identifier of the video conversion
084     * @deprecated since 5.7.3, use the other API with a document
085     * @see #getProgressStatus(String, String, String)
086     */
087    @Deprecated
088    VideoConversionStatus getProgressStatus(VideoConversionId id);
089
090    /**
091     * Returns the status of the video conversion with the given conversion name on the given document.
092     *
093     * @param repositoryName
094     * @param docId
095     * @param conversionName
096     * @return
097     * @since 5.7.3
098     */
099    VideoConversionStatus getProgressStatus(String repositoryName, String docId, String conversionName);
100
101    /**
102     * @since 7.2
103     */
104    VideoConversion getVideoConversion(String conversionName);
105
106    /**
107     * @since 7.4
108     */
109    Configuration getConfiguration();
110
111}