Java Code Examples for com.google.android.exoplayer2.util.TimestampAdjuster#adjustTsTimestamp()
The following examples show how to use
com.google.android.exoplayer2.util.TimestampAdjuster#adjustTsTimestamp() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpliceInsertCommand.java From MediaSDK with Apache License 2.0 | 4 votes |
static SpliceInsertCommand parseFromSection(ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) { long spliceEventId = sectionData.readUnsignedInt(); // splice_event_cancel_indicator(1), reserved(7). boolean spliceEventCancelIndicator = (sectionData.readUnsignedByte() & 0x80) != 0; boolean outOfNetworkIndicator = false; boolean programSpliceFlag = false; boolean spliceImmediateFlag = false; long programSplicePts = C.TIME_UNSET; List<ComponentSplice> componentSplices = Collections.emptyList(); int uniqueProgramId = 0; int availNum = 0; int availsExpected = 0; boolean autoReturn = false; long breakDurationUs = C.TIME_UNSET; if (!spliceEventCancelIndicator) { int headerByte = sectionData.readUnsignedByte(); outOfNetworkIndicator = (headerByte & 0x80) != 0; programSpliceFlag = (headerByte & 0x40) != 0; boolean durationFlag = (headerByte & 0x20) != 0; spliceImmediateFlag = (headerByte & 0x10) != 0; if (programSpliceFlag && !spliceImmediateFlag) { programSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment); } if (!programSpliceFlag) { int componentCount = sectionData.readUnsignedByte(); componentSplices = new ArrayList<>(componentCount); for (int i = 0; i < componentCount; i++) { int componentTag = sectionData.readUnsignedByte(); long componentSplicePts = C.TIME_UNSET; if (!spliceImmediateFlag) { componentSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment); } componentSplices.add(new ComponentSplice(componentTag, componentSplicePts, timestampAdjuster.adjustTsTimestamp(componentSplicePts))); } } if (durationFlag) { long firstByte = sectionData.readUnsignedByte(); autoReturn = (firstByte & 0x80) != 0; long breakDuration90khz = ((firstByte & 0x01) << 32) | sectionData.readUnsignedInt(); breakDurationUs = breakDuration90khz * 1000 / 90; } uniqueProgramId = sectionData.readUnsignedShort(); availNum = sectionData.readUnsignedByte(); availsExpected = sectionData.readUnsignedByte(); } return new SpliceInsertCommand(spliceEventId, spliceEventCancelIndicator, outOfNetworkIndicator, programSpliceFlag, spliceImmediateFlag, programSplicePts, timestampAdjuster.adjustTsTimestamp(programSplicePts), componentSplices, autoReturn, breakDurationUs, uniqueProgramId, availNum, availsExpected); }
Example 2
Source File: TimeSignalCommand.java From MediaSDK with Apache License 2.0 | 4 votes |
static TimeSignalCommand parseFromSection(ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) { long ptsTime = parseSpliceTime(sectionData, ptsAdjustment); long playbackPositionUs = timestampAdjuster.adjustTsTimestamp(ptsTime); return new TimeSignalCommand(ptsTime, playbackPositionUs); }
Example 3
Source File: SpliceInsertCommand.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
static SpliceInsertCommand parseFromSection(ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) { long spliceEventId = sectionData.readUnsignedInt(); // splice_event_cancel_indicator(1), reserved(7). boolean spliceEventCancelIndicator = (sectionData.readUnsignedByte() & 0x80) != 0; boolean outOfNetworkIndicator = false; boolean programSpliceFlag = false; boolean spliceImmediateFlag = false; long programSplicePts = C.TIME_UNSET; List<ComponentSplice> componentSplices = Collections.emptyList(); int uniqueProgramId = 0; int availNum = 0; int availsExpected = 0; boolean autoReturn = false; long breakDurationUs = C.TIME_UNSET; if (!spliceEventCancelIndicator) { int headerByte = sectionData.readUnsignedByte(); outOfNetworkIndicator = (headerByte & 0x80) != 0; programSpliceFlag = (headerByte & 0x40) != 0; boolean durationFlag = (headerByte & 0x20) != 0; spliceImmediateFlag = (headerByte & 0x10) != 0; if (programSpliceFlag && !spliceImmediateFlag) { programSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment); } if (!programSpliceFlag) { int componentCount = sectionData.readUnsignedByte(); componentSplices = new ArrayList<>(componentCount); for (int i = 0; i < componentCount; i++) { int componentTag = sectionData.readUnsignedByte(); long componentSplicePts = C.TIME_UNSET; if (!spliceImmediateFlag) { componentSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment); } componentSplices.add(new ComponentSplice(componentTag, componentSplicePts, timestampAdjuster.adjustTsTimestamp(componentSplicePts))); } } if (durationFlag) { long firstByte = sectionData.readUnsignedByte(); autoReturn = (firstByte & 0x80) != 0; long breakDuration90khz = ((firstByte & 0x01) << 32) | sectionData.readUnsignedInt(); breakDurationUs = breakDuration90khz * 1000 / 90; } uniqueProgramId = sectionData.readUnsignedShort(); availNum = sectionData.readUnsignedByte(); availsExpected = sectionData.readUnsignedByte(); } return new SpliceInsertCommand(spliceEventId, spliceEventCancelIndicator, outOfNetworkIndicator, programSpliceFlag, spliceImmediateFlag, programSplicePts, timestampAdjuster.adjustTsTimestamp(programSplicePts), componentSplices, autoReturn, breakDurationUs, uniqueProgramId, availNum, availsExpected); }
Example 4
Source File: TimeSignalCommand.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
static TimeSignalCommand parseFromSection(ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) { long ptsTime = parseSpliceTime(sectionData, ptsAdjustment); long playbackPositionUs = timestampAdjuster.adjustTsTimestamp(ptsTime); return new TimeSignalCommand(ptsTime, playbackPositionUs); }
Example 5
Source File: SpliceInsertCommand.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
static SpliceInsertCommand parseFromSection(ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) { long spliceEventId = sectionData.readUnsignedInt(); // splice_event_cancel_indicator(1), reserved(7). boolean spliceEventCancelIndicator = (sectionData.readUnsignedByte() & 0x80) != 0; boolean outOfNetworkIndicator = false; boolean programSpliceFlag = false; boolean spliceImmediateFlag = false; long programSplicePts = C.TIME_UNSET; List<ComponentSplice> componentSplices = Collections.emptyList(); int uniqueProgramId = 0; int availNum = 0; int availsExpected = 0; boolean autoReturn = false; long breakDurationUs = C.TIME_UNSET; if (!spliceEventCancelIndicator) { int headerByte = sectionData.readUnsignedByte(); outOfNetworkIndicator = (headerByte & 0x80) != 0; programSpliceFlag = (headerByte & 0x40) != 0; boolean durationFlag = (headerByte & 0x20) != 0; spliceImmediateFlag = (headerByte & 0x10) != 0; if (programSpliceFlag && !spliceImmediateFlag) { programSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment); } if (!programSpliceFlag) { int componentCount = sectionData.readUnsignedByte(); componentSplices = new ArrayList<>(componentCount); for (int i = 0; i < componentCount; i++) { int componentTag = sectionData.readUnsignedByte(); long componentSplicePts = C.TIME_UNSET; if (!spliceImmediateFlag) { componentSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment); } componentSplices.add(new ComponentSplice(componentTag, componentSplicePts, timestampAdjuster.adjustTsTimestamp(componentSplicePts))); } } if (durationFlag) { long firstByte = sectionData.readUnsignedByte(); autoReturn = (firstByte & 0x80) != 0; long breakDuration90khz = ((firstByte & 0x01) << 32) | sectionData.readUnsignedInt(); breakDurationUs = breakDuration90khz * 1000 / 90; } uniqueProgramId = sectionData.readUnsignedShort(); availNum = sectionData.readUnsignedByte(); availsExpected = sectionData.readUnsignedByte(); } return new SpliceInsertCommand(spliceEventId, spliceEventCancelIndicator, outOfNetworkIndicator, programSpliceFlag, spliceImmediateFlag, programSplicePts, timestampAdjuster.adjustTsTimestamp(programSplicePts), componentSplices, autoReturn, breakDurationUs, uniqueProgramId, availNum, availsExpected); }
Example 6
Source File: TimeSignalCommand.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
static TimeSignalCommand parseFromSection(ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) { long ptsTime = parseSpliceTime(sectionData, ptsAdjustment); long playbackPositionUs = timestampAdjuster.adjustTsTimestamp(ptsTime); return new TimeSignalCommand(ptsTime, playbackPositionUs); }
Example 7
Source File: SpliceInsertCommand.java From K-Sonic with MIT License | 4 votes |
static SpliceInsertCommand parseFromSection(ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) { long spliceEventId = sectionData.readUnsignedInt(); // splice_event_cancel_indicator(1), reserved(7). boolean spliceEventCancelIndicator = (sectionData.readUnsignedByte() & 0x80) != 0; boolean outOfNetworkIndicator = false; boolean programSpliceFlag = false; boolean spliceImmediateFlag = false; long programSplicePts = C.TIME_UNSET; List<ComponentSplice> componentSplices = Collections.emptyList(); int uniqueProgramId = 0; int availNum = 0; int availsExpected = 0; boolean autoReturn = false; long duration = C.TIME_UNSET; if (!spliceEventCancelIndicator) { int headerByte = sectionData.readUnsignedByte(); outOfNetworkIndicator = (headerByte & 0x80) != 0; programSpliceFlag = (headerByte & 0x40) != 0; boolean durationFlag = (headerByte & 0x20) != 0; spliceImmediateFlag = (headerByte & 0x10) != 0; if (programSpliceFlag && !spliceImmediateFlag) { programSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment); } if (!programSpliceFlag) { int componentCount = sectionData.readUnsignedByte(); componentSplices = new ArrayList<>(componentCount); for (int i = 0; i < componentCount; i++) { int componentTag = sectionData.readUnsignedByte(); long componentSplicePts = C.TIME_UNSET; if (!spliceImmediateFlag) { componentSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment); } componentSplices.add(new ComponentSplice(componentTag, componentSplicePts, timestampAdjuster.adjustTsTimestamp(componentSplicePts))); } } if (durationFlag) { long firstByte = sectionData.readUnsignedByte(); autoReturn = (firstByte & 0x80) != 0; duration = ((firstByte & 0x01) << 32) | sectionData.readUnsignedInt(); } uniqueProgramId = sectionData.readUnsignedShort(); availNum = sectionData.readUnsignedByte(); availsExpected = sectionData.readUnsignedByte(); } return new SpliceInsertCommand(spliceEventId, spliceEventCancelIndicator, outOfNetworkIndicator, programSpliceFlag, spliceImmediateFlag, programSplicePts, timestampAdjuster.adjustTsTimestamp(programSplicePts), componentSplices, autoReturn, duration, uniqueProgramId, availNum, availsExpected); }
Example 8
Source File: TimeSignalCommand.java From K-Sonic with MIT License | 4 votes |
static TimeSignalCommand parseFromSection(ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) { long ptsTime = parseSpliceTime(sectionData, ptsAdjustment); long playbackPositionUs = timestampAdjuster.adjustTsTimestamp(ptsTime); return new TimeSignalCommand(ptsTime, playbackPositionUs); }
Example 9
Source File: SpliceInsertCommand.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
static SpliceInsertCommand parseFromSection(ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) { long spliceEventId = sectionData.readUnsignedInt(); // splice_event_cancel_indicator(1), reserved(7). boolean spliceEventCancelIndicator = (sectionData.readUnsignedByte() & 0x80) != 0; boolean outOfNetworkIndicator = false; boolean programSpliceFlag = false; boolean spliceImmediateFlag = false; long programSplicePts = C.TIME_UNSET; List<ComponentSplice> componentSplices = Collections.emptyList(); int uniqueProgramId = 0; int availNum = 0; int availsExpected = 0; boolean autoReturn = false; long breakDurationUs = C.TIME_UNSET; if (!spliceEventCancelIndicator) { int headerByte = sectionData.readUnsignedByte(); outOfNetworkIndicator = (headerByte & 0x80) != 0; programSpliceFlag = (headerByte & 0x40) != 0; boolean durationFlag = (headerByte & 0x20) != 0; spliceImmediateFlag = (headerByte & 0x10) != 0; if (programSpliceFlag && !spliceImmediateFlag) { programSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment); } if (!programSpliceFlag) { int componentCount = sectionData.readUnsignedByte(); componentSplices = new ArrayList<>(componentCount); for (int i = 0; i < componentCount; i++) { int componentTag = sectionData.readUnsignedByte(); long componentSplicePts = C.TIME_UNSET; if (!spliceImmediateFlag) { componentSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment); } componentSplices.add(new ComponentSplice(componentTag, componentSplicePts, timestampAdjuster.adjustTsTimestamp(componentSplicePts))); } } if (durationFlag) { long firstByte = sectionData.readUnsignedByte(); autoReturn = (firstByte & 0x80) != 0; long breakDuration90khz = ((firstByte & 0x01) << 32) | sectionData.readUnsignedInt(); breakDurationUs = breakDuration90khz * 1000 / 90; } uniqueProgramId = sectionData.readUnsignedShort(); availNum = sectionData.readUnsignedByte(); availsExpected = sectionData.readUnsignedByte(); } return new SpliceInsertCommand(spliceEventId, spliceEventCancelIndicator, outOfNetworkIndicator, programSpliceFlag, spliceImmediateFlag, programSplicePts, timestampAdjuster.adjustTsTimestamp(programSplicePts), componentSplices, autoReturn, breakDurationUs, uniqueProgramId, availNum, availsExpected); }
Example 10
Source File: TimeSignalCommand.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
static TimeSignalCommand parseFromSection(ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) { long ptsTime = parseSpliceTime(sectionData, ptsAdjustment); long playbackPositionUs = timestampAdjuster.adjustTsTimestamp(ptsTime); return new TimeSignalCommand(ptsTime, playbackPositionUs); }
Example 11
Source File: SpliceInsertCommand.java From Telegram with GNU General Public License v2.0 | 4 votes |
static SpliceInsertCommand parseFromSection(ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) { long spliceEventId = sectionData.readUnsignedInt(); // splice_event_cancel_indicator(1), reserved(7). boolean spliceEventCancelIndicator = (sectionData.readUnsignedByte() & 0x80) != 0; boolean outOfNetworkIndicator = false; boolean programSpliceFlag = false; boolean spliceImmediateFlag = false; long programSplicePts = C.TIME_UNSET; List<ComponentSplice> componentSplices = Collections.emptyList(); int uniqueProgramId = 0; int availNum = 0; int availsExpected = 0; boolean autoReturn = false; long breakDurationUs = C.TIME_UNSET; if (!spliceEventCancelIndicator) { int headerByte = sectionData.readUnsignedByte(); outOfNetworkIndicator = (headerByte & 0x80) != 0; programSpliceFlag = (headerByte & 0x40) != 0; boolean durationFlag = (headerByte & 0x20) != 0; spliceImmediateFlag = (headerByte & 0x10) != 0; if (programSpliceFlag && !spliceImmediateFlag) { programSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment); } if (!programSpliceFlag) { int componentCount = sectionData.readUnsignedByte(); componentSplices = new ArrayList<>(componentCount); for (int i = 0; i < componentCount; i++) { int componentTag = sectionData.readUnsignedByte(); long componentSplicePts = C.TIME_UNSET; if (!spliceImmediateFlag) { componentSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment); } componentSplices.add(new ComponentSplice(componentTag, componentSplicePts, timestampAdjuster.adjustTsTimestamp(componentSplicePts))); } } if (durationFlag) { long firstByte = sectionData.readUnsignedByte(); autoReturn = (firstByte & 0x80) != 0; long breakDuration90khz = ((firstByte & 0x01) << 32) | sectionData.readUnsignedInt(); breakDurationUs = breakDuration90khz * 1000 / 90; } uniqueProgramId = sectionData.readUnsignedShort(); availNum = sectionData.readUnsignedByte(); availsExpected = sectionData.readUnsignedByte(); } return new SpliceInsertCommand(spliceEventId, spliceEventCancelIndicator, outOfNetworkIndicator, programSpliceFlag, spliceImmediateFlag, programSplicePts, timestampAdjuster.adjustTsTimestamp(programSplicePts), componentSplices, autoReturn, breakDurationUs, uniqueProgramId, availNum, availsExpected); }
Example 12
Source File: TimeSignalCommand.java From Telegram with GNU General Public License v2.0 | 4 votes |
static TimeSignalCommand parseFromSection(ParsableByteArray sectionData, long ptsAdjustment, TimestampAdjuster timestampAdjuster) { long ptsTime = parseSpliceTime(sectionData, ptsAdjustment); long playbackPositionUs = timestampAdjuster.adjustTsTimestamp(ptsTime); return new TimeSignalCommand(ptsTime, playbackPositionUs); }