SubtitleInputBuffer.java 1.2 KB
Newer Older
O
olly 已提交
1
/*
O
olly 已提交
2
 * Copyright (C) 2016 The Android Open Source Project
O
olly 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
O
olly 已提交
16
package com.google.android.exoplayer2.text;
O
olly 已提交
17

O
olly 已提交
18
import com.google.android.exoplayer2.DecoderInputBuffer;
O
olly 已提交
19 20

/**
C
cdrolle 已提交
21
 * An input buffer for a subtitle parser.
O
olly 已提交
22
 */
C
cdrolle 已提交
23 24
public final class SubtitleInputBuffer extends DecoderInputBuffer
    implements Comparable<SubtitleInputBuffer> {
O
olly 已提交
25 26 27 28

  public long subsampleOffsetUs;

  public SubtitleInputBuffer() {
29
    super(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_NORMAL);
O
olly 已提交
30 31
  }

C
cdrolle 已提交
32 33 34 35 36 37 38 39 40
  @Override
  public int compareTo(SubtitleInputBuffer other) {
    long delta = timeUs - other.timeUs;
    if (delta == 0) {
      return 0;
    }
    return delta > 0 ? 1 : -1;
  }

O
olly 已提交
41
}