• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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;
17 
18 import com.google.android.exoplayer2.C;
19 import com.google.android.exoplayer2.FormatHolder;
20 import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
21 
22 /**
23  * An empty {@link SampleStream}.
24  */
25 public final class EmptySampleStream implements SampleStream {
26 
27   @Override
isReady()28   public boolean isReady() {
29     return true;
30   }
31 
32   @Override
maybeThrowError()33   public void maybeThrowError() {
34     // Do nothing.
35   }
36 
37   @Override
readData(FormatHolder formatHolder, DecoderInputBuffer buffer, boolean formatRequired)38   public int readData(FormatHolder formatHolder, DecoderInputBuffer buffer,
39       boolean formatRequired) {
40     buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
41     return C.RESULT_BUFFER_READ;
42   }
43 
44   @Override
skipData(long positionUs)45   public int skipData(long positionUs) {
46     return 0;
47   }
48 }
49