use of org.geotoolkit.wps.xml.v200.Format in project ExoPlayer by google.
the class TrackGroupArrayTest method roundTripViaBundle_ofTrackGroupArray_yieldsEqualInstance.
@Test
public void roundTripViaBundle_ofTrackGroupArray_yieldsEqualInstance() {
Format.Builder formatBuilder = new Format.Builder();
Format format1 = formatBuilder.setSampleMimeType(MimeTypes.VIDEO_H264).build();
Format format2 = formatBuilder.setSampleMimeType(MimeTypes.AUDIO_AAC).build();
Format format3 = formatBuilder.setSampleMimeType(MimeTypes.VIDEO_H264).build();
TrackGroup trackGroup1 = new TrackGroup(format1, format2);
TrackGroup trackGroup2 = new TrackGroup(format3);
TrackGroupArray trackGroupArrayToBundle = new TrackGroupArray(trackGroup1, trackGroup2);
TrackGroupArray trackGroupArrayFromBundle = TrackGroupArray.CREATOR.fromBundle(trackGroupArrayToBundle.toBundle());
assertThat(trackGroupArrayFromBundle).isEqualTo(trackGroupArrayToBundle);
}
use of org.geotoolkit.wps.xml.v200.Format in project ExoPlayer by google.
the class MediaMetricsListener method onVideoSizeChanged.
@Override
public void onVideoSizeChanged(EventTime eventTime, VideoSize videoSize) {
@Nullable PendingFormatUpdate pendingVideoFormat = this.pendingVideoFormat;
if (pendingVideoFormat != null && pendingVideoFormat.format.height == Format.NO_VALUE) {
Format formatWithHeightAndWidth = pendingVideoFormat.format.buildUpon().setWidth(videoSize.width).setHeight(videoSize.height).build();
this.pendingVideoFormat = new PendingFormatUpdate(formatWithHeightAndWidth, pendingVideoFormat.selectionReason, pendingVideoFormat.sessionId);
}
}
use of org.geotoolkit.wps.xml.v200.Format in project ExoPlayer by google.
the class DecoderAudioRenderer method onInputFormatChanged.
private void onInputFormatChanged(FormatHolder formatHolder) throws ExoPlaybackException {
Format newFormat = Assertions.checkNotNull(formatHolder.format);
setSourceDrmSession(formatHolder.drmSession);
Format oldFormat = inputFormat;
inputFormat = newFormat;
encoderDelay = newFormat.encoderDelay;
encoderPadding = newFormat.encoderPadding;
if (decoder == null) {
maybeInitDecoder();
eventDispatcher.inputFormatChanged(inputFormat, /* decoderReuseEvaluation= */
null);
return;
}
DecoderReuseEvaluation evaluation;
if (sourceDrmSession != decoderDrmSession) {
evaluation = new DecoderReuseEvaluation(decoder.getName(), oldFormat, newFormat, REUSE_RESULT_NO, DISCARD_REASON_DRM_SESSION_CHANGED);
} else {
evaluation = canReuseDecoder(decoder.getName(), oldFormat, newFormat);
}
if (evaluation.result == REUSE_RESULT_NO) {
if (decoderReceivedBuffers) {
// Signal end of stream and wait for any final output buffers before re-initialization.
decoderReinitializationState = REINITIALIZATION_STATE_SIGNAL_END_OF_STREAM;
} else {
// There aren't any final output buffers, so release the decoder immediately.
releaseDecoder();
maybeInitDecoder();
audioTrackNeedsConfigure = true;
}
}
eventDispatcher.inputFormatChanged(inputFormat, evaluation);
}
use of org.geotoolkit.wps.xml.v200.Format in project ExoPlayer by google.
the class MediaCodecAudioRenderer method onOutputFormatChanged.
@Override
protected void onOutputFormatChanged(Format format, @Nullable MediaFormat mediaFormat) throws ExoPlaybackException {
Format audioSinkInputFormat;
@Nullable int[] channelMap = null;
if (decryptOnlyCodecFormat != null) {
// Direct playback with a codec for decryption.
audioSinkInputFormat = decryptOnlyCodecFormat;
} else if (getCodec() == null) {
// Direct playback with codec bypass.
audioSinkInputFormat = format;
} else {
@C.PcmEncoding int pcmEncoding;
if (MimeTypes.AUDIO_RAW.equals(format.sampleMimeType)) {
// For PCM streams, the encoder passes through int samples despite set to float mode.
pcmEncoding = format.pcmEncoding;
} else if (Util.SDK_INT >= 24 && mediaFormat.containsKey(MediaFormat.KEY_PCM_ENCODING)) {
pcmEncoding = mediaFormat.getInteger(MediaFormat.KEY_PCM_ENCODING);
} else if (mediaFormat.containsKey(VIVO_BITS_PER_SAMPLE_KEY)) {
pcmEncoding = Util.getPcmEncoding(mediaFormat.getInteger(VIVO_BITS_PER_SAMPLE_KEY));
} else {
// If the format is anything other than PCM then we assume that the audio decoder will
// output 16-bit PCM.
pcmEncoding = C.ENCODING_PCM_16BIT;
}
audioSinkInputFormat = new Format.Builder().setSampleMimeType(MimeTypes.AUDIO_RAW).setPcmEncoding(pcmEncoding).setEncoderDelay(format.encoderDelay).setEncoderPadding(format.encoderPadding).setChannelCount(mediaFormat.getInteger(MediaFormat.KEY_CHANNEL_COUNT)).setSampleRate(mediaFormat.getInteger(MediaFormat.KEY_SAMPLE_RATE)).build();
if (codecNeedsDiscardChannelsWorkaround && audioSinkInputFormat.channelCount == 6 && format.channelCount < 6) {
channelMap = new int[format.channelCount];
for (int i = 0; i < format.channelCount; i++) {
channelMap[i] = i;
}
}
}
try {
audioSink.configure(audioSinkInputFormat, /* specifiedBufferSize= */
0, channelMap);
} catch (AudioSink.ConfigurationException e) {
throw createRendererException(e, e.format, PlaybackException.ERROR_CODE_AUDIO_TRACK_INIT_FAILED);
}
}
use of org.geotoolkit.wps.xml.v200.Format in project ExoPlayer by google.
the class MediaFormatUtilTest method createMediaFormatFromFormat_withPcmEncoding_setsCustomPcmEncodingEntry.
@Test
public void createMediaFormatFromFormat_withPcmEncoding_setsCustomPcmEncodingEntry() {
Format format = new Format.Builder().setPcmEncoding(C.ENCODING_PCM_16BIT_BIG_ENDIAN).build();
MediaFormat mediaFormat = MediaFormatUtil.createMediaFormatFromFormat(format);
assertThat(mediaFormat.getInteger(MediaFormatUtil.KEY_PCM_ENCODING_EXTENDED)).isEqualTo(C.ENCODING_PCM_16BIT_BIG_ENDIAN);
assertThat(mediaFormat.containsKey(MediaFormat.KEY_PCM_ENCODING)).isFalse();
}
Aggregations