本文整理了Java中com.google.android.exoplayer2.Format.copyWithSubsampleOffsetUs()
方法的一些代码示例,展示了Format.copyWithSubsampleOffsetUs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Format.copyWithSubsampleOffsetUs()
方法的具体详情如下:
包路径:com.google.android.exoplayer2.Format
类名称:Format
方法名:copyWithSubsampleOffsetUs
暂无
代码示例来源:origin: google/ExoPlayer
/**
* Adjusts a {@link Format} to incorporate a sample offset into {@link Format#subsampleOffsetUs}.
*
* @param format The {@link Format} to adjust.
* @param sampleOffsetUs The offset to apply.
* @return The adjusted {@link Format}.
*/
private static Format getAdjustedSampleFormat(Format format, long sampleOffsetUs) {
if (format == null) {
return null;
}
if (sampleOffsetUs != 0 && format.subsampleOffsetUs != Format.OFFSET_SAMPLE_RELATIVE) {
format = format.copyWithSubsampleOffsetUs(format.subsampleOffsetUs + sampleOffsetUs);
}
return format;
}
代码示例来源:origin: google/ExoPlayer
private static Format adjustFormat(@Nullable Format format, long sampleOffsetUs) {
return format == null || sampleOffsetUs == 0
? format
: format.copyWithSubsampleOffsetUs(sampleOffsetUs);
}
}
代码示例来源:origin: google/ExoPlayer
Format format = formatHolder.format;
if (format.subsampleOffsetUs != Format.OFFSET_SAMPLE_RELATIVE) {
format = format.copyWithSubsampleOffsetUs(format.subsampleOffsetUs + streamOffsetUs);
formatHolder.format = format;
代码示例来源:origin: google/ExoPlayer
@Test
public void testSpliceWithSampleOffset() {
long sampleOffsetUs = 30000;
sampleQueue.setSampleOffsetUs(sampleOffsetUs);
writeTestData();
sampleQueue.splice();
// Splice should succeed, replacing the last 4 samples with the sample being written.
long spliceSampleTimeUs = SAMPLE_TIMESTAMPS[4];
writeSample(DATA, spliceSampleTimeUs, FORMAT_SPLICED, C.BUFFER_FLAG_KEY_FRAME);
assertReadTestData(null, 0, 4, sampleOffsetUs);
assertReadFormat(false, FORMAT_SPLICED.copyWithSubsampleOffsetUs(sampleOffsetUs));
assertReadSample(spliceSampleTimeUs + sampleOffsetUs, true, DATA, 0, DATA.length);
assertReadEndOfStream(false);
}
内容来源于网络,如有侵权,请联系作者删除!