View Javadoc
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.mediapackage;
24  
25  import org.opencastproject.mediapackage.track.TrackImpl;
26  
27  import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
28  
29  /**
30   * This interface describes methods and fields for audio and video tracks as part of a media package.
31   */
32  @XmlJavaTypeAdapter(TrackImpl.Adapter.class)
33  public interface Track extends MediaPackageElement {
34  
35    /**
36     * Media package element type.
37     */
38    Type TYPE = Type.Track;
39  
40    /**
41     * @return the streams that make up the track. Tracks consist of at least one stream.
42     */
43    Stream[] getStreams();
44  
45    /**
46     * Returns <code>true</code> if the track features an audio stream.
47     *
48     * @return <code>true</code> if the track has an audio stream
49     */
50    boolean hasAudio();
51  
52    /**
53     * Returns <code>true</code> if the track features a video stream.
54     *
55     * @return <code>true</code> if the track has a video stream
56     */
57    boolean hasVideo();
58  
59    /**
60     * Returns <code>true</code> if the track features a subtitle stream.
61     *
62     * @return <code>true</code> if the track has a subtitle stream
63     */
64    boolean hasSubtitle();
65  
66    /**
67     * Returns the track duration in milliseconds or <code>null</code> if the duration is not available.
68     *
69     * @return the track duration
70     */
71    Long getDuration();
72  
73    /**
74     * Returns the track's description with details about framerate, codecs etc.
75     *
76     * @return the track description.
77     */
78    String getDescription();
79  
80    /**
81     * Returns <code>true</code> if the track is a live track.
82     *
83     * @return true if live track; false otherwise
84     */
85    boolean isLive();
86  
87    /**
88     * Returns <code>true</code> if the track is a master playlist (play this over other tracks).
89     *
90     * @return true if it is a master playlist track; false otherwise
91     */
92    Boolean isMaster();
93  
94    /**
95     * @return true if master playlist value is not null
96     */
97    boolean hasMaster();
98  
99    /**
100    * Sets master - it is an adaptive playlist
101    *
102    * @param master
103    *          if true
104    */
105   void setMaster(Boolean master);
106 
107   /**
108    * Returns logical name of the file which persists in spite of file name changes
109    * @return logical name
110    */
111   String getLogicalName();
112 
113   /**
114    * Sets logical name of the file which persists in spite of file name changes to maintain referential integrity in the
115    * case of adaptive playlists
116    *
117    * @param name
118    *          as relative to manifest
119    */
120   void setLogicalName(String name);
121 }