mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add setter method to child data holder of abstract concatenated timeline.
Prevents that we forget to set variables. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=159939180
This commit is contained in:
parent
499f9370a2
commit
6cde8335ff
3 changed files with 21 additions and 9 deletions
|
|
@ -28,7 +28,7 @@ import com.google.android.exoplayer2.Timeline;
|
||||||
/**
|
/**
|
||||||
* Meta data of a child timeline.
|
* Meta data of a child timeline.
|
||||||
*/
|
*/
|
||||||
protected static class ChildDataHolder {
|
protected static final class ChildDataHolder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Child timeline.
|
* Child timeline.
|
||||||
|
|
@ -50,6 +50,22 @@ import com.google.android.exoplayer2.Timeline;
|
||||||
*/
|
*/
|
||||||
public Object uid;
|
public Object uid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set child holder data.
|
||||||
|
*
|
||||||
|
* @param timeline Child timeline.
|
||||||
|
* @param firstPeriodIndexInChild First period index belonging to the child timeline.
|
||||||
|
* @param firstWindowIndexInChild First window index belonging to the child timeline.
|
||||||
|
* @param uid UID of child timeline.
|
||||||
|
*/
|
||||||
|
public void setData(Timeline timeline, int firstPeriodIndexInChild, int firstWindowIndexInChild,
|
||||||
|
Object uid) {
|
||||||
|
this.timeline = timeline;
|
||||||
|
this.firstPeriodIndexInChild = firstPeriodIndexInChild;
|
||||||
|
this.firstWindowIndexInChild = firstWindowIndexInChild;
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ChildDataHolder childDataHolder;
|
private final ChildDataHolder childDataHolder;
|
||||||
|
|
|
||||||
|
|
@ -231,10 +231,8 @@ public final class ConcatenatingMediaSource implements MediaSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getChildDataByChildIndex(int childIndex, ChildDataHolder childData) {
|
private void getChildDataByChildIndex(int childIndex, ChildDataHolder childData) {
|
||||||
childData.timeline = timelines[childIndex];
|
childData.setData(timelines[childIndex], getFirstPeriodIndexInChild(childIndex),
|
||||||
childData.firstPeriodIndexInChild = getFirstPeriodIndexInChild(childIndex);
|
getFirstWindowIndexInChild(childIndex), childIndex);
|
||||||
childData.firstWindowIndexInChild = getFirstWindowIndexInChild(childIndex);
|
|
||||||
childData.uid = childIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getChildIndexByPeriodIndex(int periodIndex) {
|
private int getChildIndexByPeriodIndex(int periodIndex) {
|
||||||
|
|
|
||||||
|
|
@ -141,10 +141,8 @@ public final class LoopingMediaSource implements MediaSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getChildDataByChildIndex(int childIndex, ChildDataHolder childData) {
|
private void getChildDataByChildIndex(int childIndex, ChildDataHolder childData) {
|
||||||
childData.timeline = childTimeline;
|
childData.setData(childTimeline, childIndex * childPeriodCount, childIndex * childWindowCount,
|
||||||
childData.firstPeriodIndexInChild = childIndex * childPeriodCount;
|
childIndex);
|
||||||
childData.firstWindowIndexInChild = childIndex * childWindowCount;
|
|
||||||
childData.uid = childIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue