• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.android.exoplayer2.source.dash;
17 
18 import android.os.SystemClock;
19 import androidx.annotation.Nullable;
20 import com.google.android.exoplayer2.Format;
21 import com.google.android.exoplayer2.source.chunk.ChunkSource;
22 import com.google.android.exoplayer2.source.dash.PlayerEmsgHandler.PlayerTrackEmsgHandler;
23 import com.google.android.exoplayer2.source.dash.manifest.DashManifest;
24 import com.google.android.exoplayer2.trackselection.TrackSelection;
25 import com.google.android.exoplayer2.upstream.LoaderErrorThrower;
26 import com.google.android.exoplayer2.upstream.TransferListener;
27 import java.util.List;
28 
29 /**
30  * An {@link ChunkSource} for DASH streams.
31  */
32 public interface DashChunkSource extends ChunkSource {
33 
34   /** Factory for {@link DashChunkSource}s. */
35   interface Factory {
36 
37     /**
38      * @param manifestLoaderErrorThrower Throws errors affecting loading of manifests.
39      * @param manifest The initial manifest.
40      * @param periodIndex The index of the corresponding period in the manifest.
41      * @param adaptationSetIndices The indices of the corresponding adaptation sets in the period.
42      * @param trackSelection The track selection.
43      * @param elapsedRealtimeOffsetMs If known, an estimate of the instantaneous difference between
44      *     server-side unix time and {@link SystemClock#elapsedRealtime()} in milliseconds,
45      *     specified as the server's unix time minus the local elapsed time. Or {@link
46      *     com.google.android.exoplayer2.C#TIME_UNSET} if unknown.
47      * @param enableEventMessageTrack Whether to output an event message track.
48      * @param closedCaptionFormats The {@link Format Formats} of closed caption tracks to be output.
49      * @param transferListener The transfer listener which should be informed of any data transfers.
50      *     May be null if no listener is available.
51      * @return The created {@link DashChunkSource}.
52      */
createDashChunkSource( LoaderErrorThrower manifestLoaderErrorThrower, DashManifest manifest, int periodIndex, int[] adaptationSetIndices, TrackSelection trackSelection, int type, long elapsedRealtimeOffsetMs, boolean enableEventMessageTrack, List<Format> closedCaptionFormats, @Nullable PlayerTrackEmsgHandler playerEmsgHandler, @Nullable TransferListener transferListener)53     DashChunkSource createDashChunkSource(
54         LoaderErrorThrower manifestLoaderErrorThrower,
55         DashManifest manifest,
56         int periodIndex,
57         int[] adaptationSetIndices,
58         TrackSelection trackSelection,
59         int type,
60         long elapsedRealtimeOffsetMs,
61         boolean enableEventMessageTrack,
62         List<Format> closedCaptionFormats,
63         @Nullable PlayerTrackEmsgHandler playerEmsgHandler,
64         @Nullable TransferListener transferListener);
65   }
66 
67   /**
68    * Updates the manifest.
69    *
70    * @param newManifest The new manifest.
71    */
updateManifest(DashManifest newManifest, int periodIndex)72   void updateManifest(DashManifest newManifest, int periodIndex);
73 
74   /**
75    * Updates the track selection.
76    *
77    * @param trackSelection The new track selection instance. Must be equivalent to the previous one.
78    */
updateTrackSelection(TrackSelection trackSelection)79   void updateTrackSelection(TrackSelection trackSelection);
80 }
81