Skip to content

Commit

Permalink
CodecDiscovery: get codec form given profile
Browse files Browse the repository at this point in the history
credit phh for the contribution
  • Loading branch information
courville committed Dec 10, 2024
1 parent 774e6c6 commit ecccbc2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,34 @@ private static boolean isCodecTypeSupported(String codecType, boolean allowSwCod
return false;
}

private static String getCodecForProfile(String mimeType, int profile) {
log.debug("getCodecForProfile: mimeType={} profile={}", mimeType, profile);
if (Build.VERSION.SDK_INT < 27) return null;
MediaCodecList codecList = new MediaCodecList(MediaCodecList.ALL_CODECS);
MediaCodecInfo[] codecInfos = codecList.getCodecInfos();
for (MediaCodecInfo codecInfo : codecInfos) {
// Ignore encoders
if (codecInfo.isEncoder()) {
continue;
}

if (isCodecInfoSupported(codecInfo, mimeType, false)) {
MediaCodecInfo.CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(mimeType);
if (capabilities != null) {
if (capabilities.profileLevels != null) {
for (MediaCodecInfo.CodecProfileLevel level : capabilities.profileLevels) {
log.debug("getCodecForProfile: profile={}, level={}", level.profile, level.level);
if (level.profile == profile) {
return codecInfo.getName();
}
}
}
}
}
}
return null;
}

public static boolean isSwCodec(MediaCodecInfo codecInfo) {
if (Build.VERSION.SDK_INT >= 29) {
return codecInfo.isSoftwareOnly();
Expand Down Expand Up @@ -111,4 +139,4 @@ private static boolean isCodecInfoSupported(MediaCodecInfo codecInfo, String cod
return false;
}

}
}
1 change: 1 addition & 0 deletions src/noamazon/play/release-notes/en-US/internal.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- add pgs subtitles support
- support subtitles position SSA tags
- select proper dolby vision codec depending on profile
- upgrade to dav1d 1.5.0
- fix performance during video scanning using trakt
- add locale setting in nova for devices with restricted language support
Expand Down

0 comments on commit ecccbc2

Please sign in to comment.