use of android.media.MediaCodecInfo.CodecCapabilities in project robolectric by robolectric.
the class MediaCodecInfoBuilderTest method canCreateVideoDecoderCapabilities.
@Test
@Config(minSdk = Q)
public void canCreateVideoDecoderCapabilities() {
CodecCapabilities codecCapabilities = MediaCodecInfoBuilder.CodecCapabilitiesBuilder.newBuilder().setMediaFormat(VP9_MEDIA_FORMAT).setProfileLevels(VP9_PROFILE_LEVELS).setColorFormats(VP9_COLOR_FORMATS).build();
assertThat(codecCapabilities.getMimeType()).isEqualTo(MIMETYPE_VIDEO_VP9);
assertThat(codecCapabilities.getAudioCapabilities()).isNull();
assertThat(codecCapabilities.getVideoCapabilities()).isNotNull();
assertThat(codecCapabilities.getEncoderCapabilities()).isNull();
assertThat(codecCapabilities.isFeatureSupported(CodecCapabilities.FEATURE_SecurePlayback)).isTrue();
assertThat(codecCapabilities.isFeatureSupported(CodecCapabilities.FEATURE_MultipleFrames)).isTrue();
assertThat(codecCapabilities.isFeatureSupported(CodecCapabilities.FEATURE_DynamicTimestamp)).isFalse();
assertThat(codecCapabilities.profileLevels).hasLength(VP9_PROFILE_LEVELS.length);
assertThat(codecCapabilities.profileLevels).isEqualTo(VP9_PROFILE_LEVELS);
assertThat(codecCapabilities.colorFormats).hasLength(VP9_COLOR_FORMATS.length);
assertThat(codecCapabilities.colorFormats).isEqualTo(VP9_COLOR_FORMATS);
}
use of android.media.MediaCodecInfo.CodecCapabilities in project robolectric by robolectric.
the class MediaCodecInfoBuilderTest method canCreateMediaCodecInfoForEncoder.
@Test
@Config(minSdk = Q)
public void canCreateMediaCodecInfoForEncoder() {
CodecCapabilities codecCapabilities = MediaCodecInfoBuilder.CodecCapabilitiesBuilder.newBuilder().setMediaFormat(AAC_MEDIA_FORMAT).setIsEncoder(true).setProfileLevels(AAC_PROFILE_LEVELS).build();
MediaCodecInfo mediaCodecInfo = MediaCodecInfoBuilder.newBuilder().setName(AAC_ENCODER_NAME).setIsEncoder(true).setIsVendor(true).setCapabilities(codecCapabilities).build();
assertThat(mediaCodecInfo.getName()).isEqualTo(AAC_ENCODER_NAME);
assertThat(mediaCodecInfo.isEncoder()).isTrue();
assertThat(mediaCodecInfo.isVendor()).isTrue();
assertThat(mediaCodecInfo.isSoftwareOnly()).isFalse();
assertThat(mediaCodecInfo.isHardwareAccelerated()).isFalse();
assertThat(mediaCodecInfo.getSupportedTypes()).asList().containsExactly(MIMETYPE_AUDIO_AAC);
assertThat(mediaCodecInfo.getCapabilitiesForType(MIMETYPE_AUDIO_AAC)).isNotNull();
}
use of android.media.MediaCodecInfo.CodecCapabilities in project robolectric by robolectric.
the class MediaCodecInfoBuilderTest method canCreateVideoEncoderCapabilities.
@Test
@Config(minSdk = Q)
public void canCreateVideoEncoderCapabilities() {
CodecCapabilities codecCapabilities = MediaCodecInfoBuilder.CodecCapabilitiesBuilder.newBuilder().setMediaFormat(AVC_MEDIA_FORMAT).setIsEncoder(true).setProfileLevels(AVC_PROFILE_LEVELS).setColorFormats(AVC_COLOR_FORMATS).build();
assertThat(codecCapabilities.getMimeType()).isEqualTo(MIMETYPE_VIDEO_AVC);
assertThat(codecCapabilities.getAudioCapabilities()).isNull();
assertThat(codecCapabilities.getVideoCapabilities()).isNotNull();
assertThat(codecCapabilities.getEncoderCapabilities()).isNotNull();
assertThat(codecCapabilities.isFeatureSupported(CodecCapabilities.FEATURE_IntraRefresh)).isTrue();
assertThat(codecCapabilities.isFeatureSupported(CodecCapabilities.FEATURE_MultipleFrames)).isFalse();
assertThat(codecCapabilities.profileLevels).hasLength(AVC_PROFILE_LEVELS.length);
assertThat(codecCapabilities.profileLevels).isEqualTo(AVC_PROFILE_LEVELS);
assertThat(codecCapabilities.colorFormats).hasLength(AVC_COLOR_FORMATS.length);
assertThat(codecCapabilities.colorFormats).isEqualTo(AVC_COLOR_FORMATS);
}
use of android.media.MediaCodecInfo.CodecCapabilities in project robolectric by robolectric.
the class MediaCodecInfoBuilderTest method mediaCodecInfo_preQ.
@Test
@Config(minSdk = LOLLIPOP)
public void mediaCodecInfo_preQ() {
if (RuntimeEnvironment.getApiLevel() <= M) {
MediaCodecList.getCodecCount();
}
CodecCapabilities codecCapabilities = MediaCodecInfoBuilder.CodecCapabilitiesBuilder.newBuilder().setMediaFormat(AAC_MEDIA_FORMAT).setIsEncoder(true).setProfileLevels(AAC_PROFILE_LEVELS).build();
MediaCodecInfo mediaCodecInfo = MediaCodecInfoBuilder.newBuilder().setName(AAC_ENCODER_NAME).setIsEncoder(true).setCapabilities(codecCapabilities).build();
assertThat(mediaCodecInfo.getName()).isEqualTo(AAC_ENCODER_NAME);
assertThat(mediaCodecInfo.isEncoder()).isTrue();
assertThat(mediaCodecInfo.getSupportedTypes()).asList().containsExactly(MIMETYPE_AUDIO_AAC);
assertThat(mediaCodecInfo.getCapabilitiesForType(MIMETYPE_AUDIO_AAC)).isNotNull();
}
use of android.media.MediaCodecInfo.CodecCapabilities in project ExoPlayer by google.
the class EnumerateDecodersTest method logDecoderInfos.
private void logDecoderInfos(String mimeType, boolean secure, boolean tunneling) throws DecoderQueryException {
List<MediaCodecInfo> mediaCodecInfos = MediaCodecUtil.getDecoderInfos(mimeType, secure, tunneling);
for (MediaCodecInfo mediaCodecInfo : mediaCodecInfos) {
CodecCapabilities capabilities = mediaCodecInfo.capabilities;
metricsLogger.logMetric("capabilities_" + mediaCodecInfo.name, codecCapabilitiesToString(mimeType, capabilities));
}
}
Aggregations