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
23 package org.opencastproject.inspection.ffmpeg.api;
24
25
26 import org.opencastproject.util.MimeType;
27
28 import java.util.ArrayList;
29 import java.util.List;
30
31 /**
32 * Encapsulates technical metadata of media containers, usually media files.
33 * <p>
34 * Each property may return null, which means that it could not be determined.
35 */
36 public class MediaContainerMetadata extends TemporalMetadata {
37
38 private List<VideoStreamMetadata> vMetadata = new ArrayList<>();
39 private List<AudioStreamMetadata> aMetadata = new ArrayList<>();
40 private List<SubtitleStreamMetadata> sMetadata = new ArrayList<>();
41
42 private String fileName;
43 private String fileExtension;
44 private Boolean interleaved;
45 private MimeType mimeType;
46 private Boolean adaptiveMaster;
47
48 /**
49 * Returns metadata for all contained video streams.
50 *
51 * @return the metadata or an empty list
52 */
53 public List<VideoStreamMetadata> getVideoStreamMetadata() {
54 return vMetadata;
55 }
56
57 /**
58 * Returns metadata for all contained audio streams.
59 *
60 * @return the metadata or an empty list
61 */
62 public List<AudioStreamMetadata> getAudioStreamMetadata() {
63 return aMetadata;
64 }
65
66 /**
67 * Returns metadata for all contained subtitle streams.
68 *
69 * @return the metadata or an empty list
70 */
71 public List<SubtitleStreamMetadata> getSubtitleStreamMetadata() {
72 return sMetadata;
73 }
74
75 /**
76 * Checks if any video metadata is present.
77 */
78 public boolean hasVideoStreamMetadata() {
79 return vMetadata.size() > 0;
80 }
81
82 /**
83 * Checks if any audio metadata is present.
84 */
85 public boolean hasAudioStreamMetadata() {
86 return aMetadata.size() > 0;
87 }
88
89 /**
90 * Checks if any subtitle metadata is present.
91 */
92 public boolean hasSubtitleStreamMetadata() {
93 return sMetadata.size() > 0;
94 }
95
96 // --------------------------------------------------------------------------------------------
97
98 /**
99 * Returns the file name, e.g. <code>metropolis.mov</code>
100 */
101 public String getFileName() {
102 return fileName;
103 }
104
105 public void setFileName(String fileName) {
106 this.fileName = fileName;
107 }
108
109 /**
110 * Returns the file extension, e.g. <code>mov</code>
111 */
112 public String getFileExtension() {
113 return fileExtension;
114 }
115
116 public void setFileExtension(String fileExtension) {
117 this.fileExtension = fileExtension;
118 }
119
120 /**
121 * Checks if contained audio and video streams are multiplexed.
122 */
123 public Boolean isInterleaved() {
124 return interleaved;
125 }
126
127 public void setInterleaved(Boolean interleaved) {
128 this.interleaved = interleaved;
129 }
130
131 /**
132 * Returns the mimeType of the file
133 *
134 * @return mimetype
135 */
136 public MimeType getMimeType() {
137 return mimeType;
138 }
139
140 public void setMimeType(MimeType mimeType) {
141 this.mimeType = mimeType;
142 }
143
144 /**
145 * Looks for adaptive master file
146 *
147 * @return true if this is an adaptiveMaster file
148 */
149 public Boolean getAdaptiveMaster() {
150 return adaptiveMaster;
151 }
152
153 public void setAdaptiveMaster(Boolean adaptiveMaster) {
154 this.adaptiveMaster = adaptiveMaster;
155 }
156
157 }