1 /*
2 * Licensed to The Apereo Foundation under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work for additional
4 * information regarding copyright ownership.
5 *
6 *
7 * The Apereo Foundation licenses this file to you under the Educational
8 * Community License, Version 2.0 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of the License
10 * at:
11 *
12 * http://opensource.org/licenses/ecl2.txt
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 * License for the specific language governing permissions and limitations under
18 * the License.
19 *
20 */
21
22 package org.opencastproject.caption.api;
23
24 import org.opencastproject.job.api.Job;
25 import org.opencastproject.mediapackage.MediaPackageElement;
26 import org.opencastproject.mediapackage.MediaPackageException;
27
28 /**
29 * Provides captioning support. This service makes use of {@link CaptionConverter} instances that need to be registered
30 * in the OSGi registry.
31 */
32 public interface CaptionService {
33
34 String JOB_TYPE = "org.opencastproject.caption";
35
36 /**
37 * Converts captions from one format to another. Language parameter is used for those formats that store information
38 * about language.
39 *
40 * @param input
41 * MediaPackageElement containing captions
42 * @param inputFormat
43 * format of imported captions
44 * @param outputFormat
45 * format of exported captions
46 * @throws UnsupportedCaptionFormatException
47 * if there is no matching engine registered for given input or output
48 * @throws CaptionConverterException
49 * if exception occurs while converting
50 * @throws MediaPackageException
51 * if the catalog is invalid
52 */
53 Job convert(MediaPackageElement input, String inputFormat, String outputFormat)
54 throws UnsupportedCaptionFormatException, CaptionConverterException, MediaPackageException;
55
56 /**
57 * Converts captions from one format to another. Language parameter is used for those formats that store information
58 * about language.
59 *
60 * @param input
61 * MediaPackageElement containing captions
62 * @param inputFormat
63 * format of imported captions
64 * @param outputFormat
65 * format of exported captions
66 * @param language
67 * language of captions
68 * @throws UnsupportedCaptionFormatException
69 * if there is no matching engine registered for given input or output
70 * @throws CaptionConverterException
71 * if exception occurs while converting
72 * @throws MediaPackageException
73 * if the catalog is invalid
74 */
75 Job convert(MediaPackageElement input, String inputFormat, String outputFormat, String language)
76 throws UnsupportedCaptionFormatException, CaptionConverterException, MediaPackageException;
77
78 /**
79 * Returns list of languages available in captions (if such information is stored).
80 *
81 * @param input
82 * Catalog containing captions
83 * @param format
84 * captions' format
85 * @return Array of languages available in captions
86 * @throws UnsupportedCaptionFormatException
87 * if there is no matching engine registered for given input or output
88 * @throws CaptionConverterException
89 * if parser encounters exception
90 */
91 String[] getLanguageList(MediaPackageElement input, String format)
92 throws UnsupportedCaptionFormatException, CaptionConverterException;
93
94 }