Skip to content

Commit 4c8e2a5

Browse files
author
Krzysztof Nawrot
authored
Merge pull request #27 from Parseus/dev
Dev -> master: version 2.5.0
2 parents b9a489e + 252af8b commit 4c8e2a5

51 files changed

Lines changed: 663 additions & 289 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.idea/gradle.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
plugins {
22
id 'com.android.application'
33
id 'org.jetbrains.kotlin.android'
4-
id 'com.google.devtools.ksp' version '1.7.20-1.0.6'
4+
id 'com.google.devtools.ksp' version '1.8.22-1.0.11'
55
}
66

77
android {
88
namespace 'com.parseus.codecinfo'
9-
compileSdkVersion 33
9+
compileSdkVersion 34
1010
defaultConfig {
1111
applicationId "com.parseus.codecinfo"
1212
minSdkVersion 16
13-
targetSdkVersion 33
14-
versionCode 22
15-
versionName "2.4.0"
13+
targetSdkVersion 34
14+
versionCode 23
15+
versionName "2.5.0"
1616
resConfigs 'en'
1717

1818
vectorDrawables.useSupportLibrary = true
@@ -67,15 +67,16 @@ android {
6767
targetCompatibility JavaVersion.VERSION_11
6868
}
6969

70-
kotlinOptions {
71-
jvmTarget = "11"
70+
kotlin {
71+
jvmToolchain(11)
7272
}
7373
packagingOptions {
7474
jniLibs {
7575
excludes += ['kotlin/**']
7676
}
7777
resources {
78-
excludes += ['kotlin/**', '**/*.kotlin_metadata', 'META-INF/*.kotlin_module', 'META-INF/*.version']
78+
excludes += ['kotlin/**', '**/*.kotlin_metadata', 'META-INF/*.kotlin_module',
79+
'META-INF/*.version']
7980
}
8081
}
8182

@@ -111,18 +112,16 @@ configurations {
111112
}
112113

113114
dependencies {
114-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
115+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
115116

116-
implementation 'androidx.appcompat:appcompat:1.7.0-alpha01'
117-
implementation "androidx.core:core-ktx:1.9.0"
117+
implementation 'androidx.appcompat:appcompat:1.7.0-alpha02'
118+
implementation "androidx.core:core-ktx:1.12.0-alpha05"
118119
implementation 'androidx.preference:preference-ktx:1.2.0'
119120

120121
implementation "com.squareup.leakcanary:plumber-android:$leakCanary_version"
121122
implementation "com.squareup.moshi:moshi:$moshi_version"
122123
ksp "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
123-
implementation "com.squareup.okio:okio:3.2.0"
124-
125-
implementation 'me.saket:better-link-movement-method:2.2.0'
124+
implementation "com.squareup.okio:okio:3.3.0"
126125

127126
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanary_version"
128127
standardMobileDebugImplementation 'androidx.multidex:multidex:2.0.1'
@@ -134,14 +133,16 @@ dependencies {
134133
standardMobileImplementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3'
135134

136135
mobileImplementation 'androidx.constraintlayout:constraintlayout:2.1.4'
137-
mobileImplementation 'androidx.core:core-splashscreen:1.0.0'
136+
mobileImplementation 'androidx.core:core-splashscreen:1.0.1'
138137
mobileImplementation 'androidx.palette:palette-ktx:1.0.0'
139-
mobileImplementation 'androidx.webkit:webkit:1.5.0'
138+
mobileImplementation 'androidx.webkit:webkit:1.7.0'
140139
mobileImplementation 'com.github.KieronQuinn:MonetCompat:0.4.1'
141140
mobileImplementation 'com.github.marcoscgdev:Licenser:2.0.0'
142-
mobileImplementation 'com.google.android.material:material:1.8.0-alpha02'
141+
mobileImplementation 'com.google.android.material:material:1.10.0-alpha04'
143142

144143
nonFreeMobileImplementation fileTree(include: ['*.jar'], dir: 'libs')
145-
nonFreeMobileImplementation 'com.google.android.play:app-update-ktx:2.0.0'
146-
nonFreeMobileImplementation 'com.google.android.play:review-ktx:2.0.0'
144+
nonFreeMobileImplementation 'com.google.android.play:app-update:2.1.0'
145+
nonFreeMobileImplementation 'com.google.android.play:app-update-ktx:2.1.0'
146+
nonFreeMobileImplementation 'com.google.android.play:review:2.0.1'
147+
nonFreeMobileImplementation 'com.google.android.play:review-ktx:2.0.1'
147148
}

app/src/main/java/com/parseus/codecinfo/data/codecinfo/CodecSimpleInfo.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ data class CodecSimpleInfo(val id: Long,
44
val codecId: String,
55
val codecName: String,
66
val isAudio: Boolean,
7-
val isEncoder: Boolean) {
7+
val isEncoder: Boolean,
8+
val isHardwareAccelereated: Boolean) {
89

910
override fun toString(): String {
1011
return "$codecId ($codecName)"

app/src/main/java/com/parseus/codecinfo/data/codecinfo/CodecUtils.kt

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import android.os.Build.VERSION.SDK_INT
1313
import android.util.Range
1414
import androidx.annotation.RequiresApi
1515
import androidx.annotation.StringRes
16+
import androidx.core.text.HtmlCompat
1617
import androidx.preference.PreferenceManager
1718
import com.parseus.codecinfo.*
1819
import com.parseus.codecinfo.data.DetailsProperty
@@ -21,7 +22,6 @@ import com.parseus.codecinfo.data.codecinfo.profilelevels.*
2122
import com.parseus.codecinfo.data.codecinfo.profilelevels.VP9Levels.*
2223
import com.parseus.codecinfo.utils.*
2324
import java.util.*
24-
import kotlin.collections.ArrayList
2525
import kotlin.math.min
2626

2727
// Source:
@@ -83,6 +83,16 @@ private val framerateClasses = arrayOf(
8383
"8K"
8484
)
8585

86+
private val knownVendorLowLatencyOptions = listOf(
87+
// https://cs.android.com/android/platform/superproject/+/master:hardware/qcom/sdm845/media/mm-video-v4l2/vidc/vdec/src/omx_vdec_extensions.hpp
88+
"vendor.qti-ext-dec-low-latency.enable",
89+
// https://developer.huawei.com/consumer/cn/forum/topic/0202325564295980115
90+
"vendor.hisi-ext-low-latency-video-dec.video-scene-for-low-latency-req",
91+
"vendor.rtc-ext-dec-low-latency.enable",
92+
// https://github.com/codewalkerster/android_vendor_amlogic_common_prebuilt_libstagefrighthw/commit/41fefc4e035c476d58491324a5fe7666bfc2989e
93+
"vendor.low-latency.enable"
94+
)
95+
8696
private var mediaCodecInfos: Array<MediaCodecInfo> = emptyArray()
8797

8898
val audioCodecList: MutableList<CodecSimpleInfo> = mutableListOf()
@@ -174,7 +184,7 @@ fun getSimpleCodecInfoList(context: Context, isAudio: Boolean): MutableList<Code
174184

175185
if (isAudio == isAudioCodec) {
176186
val codecSimpleInfo = CodecSimpleInfo((codecIndex * 100 + index).toLong(), codecId, mediaCodecInfo.name,
177-
isAudioCodec, mediaCodecInfo.isEncoder)
187+
isAudioCodec, mediaCodecInfo.isEncoder, isHardwareAccelerated(mediaCodecInfo))
178188
if (codecSimpleInfoList.find {
179189
it.codecId == codecSimpleInfo.codecId
180190
&& it.codecName == codecSimpleInfo.codecName
@@ -238,7 +248,7 @@ fun getDetailedCodecInfo(context: Context, codecId: String, codecName: String):
238248
isSoftwareOnly(mediaCodecInfo).toString()))
239249

240250
if (!isEncoder && SDK_INT >= 30) {
241-
propertyList.addFeature(context, capabilities, FEATURE_LowLatency, R.string.low_latency)
251+
addLowLatencyFeatureIfSupported(context, codecName, capabilities, propertyList)
242252
}
243253

244254
propertyList.add(DetailsProperty(propertyList.size.toLong(), context.getString(R.string.codec_provider),
@@ -317,6 +327,19 @@ fun getDetailedCodecInfo(context: Context, codecId: String, codecName: String):
317327
handleQualityRange(encoderCapabilities, defaultMediaFormat, propertyList, context)
318328
}
319329

330+
if (SDK_INT >= 31) {
331+
try {
332+
val codec = MediaCodec.createByCodecName(codecName)
333+
val vendorParams = codec.supportedVendorParameters
334+
if (vendorParams.isNotEmpty()) {
335+
propertyList.add(
336+
DetailsProperty(propertyList.size.toLong(),
337+
context.getString(R.string.vendor_parameters), vendorParams.joinToString("\n")))
338+
}
339+
codec.release()
340+
} catch (_: Throwable) {}
341+
}
342+
320343
val profileString = if (codecId.contains("mp4a-latm") || codecId.contains("wma")) {
321344
context.getString(R.string.profiles)
322345
} else {
@@ -330,6 +353,32 @@ fun getDetailedCodecInfo(context: Context, codecId: String, codecName: String):
330353
return propertyList
331354
}
332355

356+
@RequiresApi(30)
357+
private fun addLowLatencyFeatureIfSupported(context: Context,
358+
codecName: String,
359+
capabilities: MediaCodecInfo.CodecCapabilities,
360+
propertyList: MutableList<DetailsProperty>) {
361+
if (capabilities.isFeatureSupported(FEATURE_LowLatency)) {
362+
propertyList.addFeature(context, capabilities, FEATURE_LowLatency, R.string.low_latency)
363+
} else if (SDK_INT >= 31) {
364+
var codec: MediaCodec? = null
365+
try {
366+
codec = MediaCodec.createByCodecName(codecName)
367+
val vendorLowLatencyKey = codec.supportedVendorParameters.find { it in knownVendorLowLatencyOptions }
368+
val featureString = if (vendorLowLatencyKey != null) {
369+
HtmlCompat.fromHtml(context.getString(R.string.feature_low_latency_vendor_supported, vendorLowLatencyKey),
370+
HtmlCompat.FROM_HTML_MODE_LEGACY).toString()
371+
} else {
372+
false.toString()
373+
}
374+
propertyList.add(DetailsProperty(propertyList.size.toLong(), context.getString(R.string.low_latency), featureString))
375+
} catch (_: Exception) {}
376+
finally {
377+
codec?.release()
378+
}
379+
}
380+
}
381+
333382
@RequiresApi(21)
334383
private fun handleQualityRange(encoderCapabilities: MediaCodecInfo.EncoderCapabilities,
335384
defaultMediaFormat: MediaFormat,
@@ -565,6 +614,7 @@ private fun adjustMaxInputChannelCount(codecId: String, codecName: String, maxCh
565614
// The maximum channel count looks incorrect. Adjust it to an assumed default.
566615
return when (codecId) {
567616
"audio/ac3" -> 6
617+
"audio/ac4" -> 24
568618
// Source: http://www.voiceage.com/AMR-WBplus.html
569619
"audio/amr-wb-plus" -> 2
570620
"audio/dts" -> 8
@@ -778,6 +828,10 @@ private fun getProfileLevels(context: Context, codecId: String, codecName: Strin
778828
codecId.contains("mp4a-latm") -> {
779829
profile = AACProfiles.from(it.profile)
780830
}
831+
codecId.contains("ac4") -> {
832+
profile = AC4Profiles.from(it.profile)
833+
level = AC4Levels.from(it.level)
834+
}
781835
codecId.contains("av01") -> {
782836
profile = AV1Profiles.from(it.profile)
783837
level = AV1Levels.from(it.level)
@@ -801,6 +855,12 @@ private fun getProfileLevels(context: Context, codecId: String, codecName: Strin
801855
profile = DolbyVisionProfiles.from(it.profile)
802856
level = DolbyVisionLevels.from(it.level)
803857
}
858+
codecId.contains("vnd.dts.hd") -> {
859+
profile = DTSHDProfiles.from(it.profile)
860+
}
861+
codecId.contains("vnd.dts.uhd") -> {
862+
profile = DTSUHDProfiles.from(it.profile)
863+
}
804864
(codecId.contains("3gpp") && !codecName.contains("mpeg4", true))
805865
|| codecId.contains("sorenson") || codecId.contains("flv") -> {
806866
profile = H263Profiles.from(it.profile)

app/src/main/java/com/parseus/codecinfo/data/codecinfo/colorformats/StandardColorFormat.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ enum class StandardColorFormat(val value: Int) {
8282
COLOR_Format32bitABGR2101010(0x7F00AAA2),
8383
COLOR_Format64bitABGRFloat(0x7F000F16),
8484

85+
// https://android.googlesource.com/platform/frameworks/native/+/refs/heads/master/headers/media_plugin/media/openmax/OMX_IVCommon.h
8586
COLOR_QCOM_FormatYUV420SemiPlanar (0x7FA30C00),
87+
COLOR_QCOM_FormatYUV420PackedSemiPlanar64x32Tile2m8ka(0x7FA30C03),
88+
COLOR_QCOM_FormatYUV420PackedSemiPlanar32m(0x7FA30C04),
89+
COLOR_SEC_FormatNV12Tiled(0x7FC00002),
8690
COLOR_TI_FormatYUV420PackedSemiPlanar(0x7F000100),
8791

8892
// Other
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@file:Suppress("unused")
2+
3+
package com.parseus.codecinfo.data.codecinfo.profilelevels
4+
5+
enum class AC4Profiles(val value: Int) {
6+
7+
AC4Profile00(0x101),
8+
AC4Profile10(0x201),
9+
AC4Profile11(0x202),
10+
AC4Profile21(0x402),
11+
AC4Profile22(0x404),
12+
AC4ProfileMax(0x7FFFFFFF);
13+
14+
companion object {
15+
fun from(findValue: Int): String? = values().find { it.value == findValue }?.name
16+
}
17+
18+
}
19+
20+
enum class AC4Levels(val value: Int) {
21+
22+
AC4Level0(0x1),
23+
AC4Level1(0x2),
24+
AC4Level2(0x4),
25+
AC4Level3(0x8),
26+
AC4Level4(0x10),
27+
AC4LevelMax(0x7FFFFFFF);
28+
29+
companion object {
30+
fun from(findValue: Int): String? = values().find { it.value == findValue }?.name
31+
}
32+
33+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@file:Suppress("unused")
2+
3+
package com.parseus.codecinfo.data.codecinfo.profilelevels
4+
5+
@Suppress("EnumEntryName")
6+
enum class DTSHDProfiles(val value: Int) {
7+
8+
DTS_HDProfileHRA(0x1),
9+
DTS_HDProfileLBR(0x2),
10+
DTS_HDProfileMA(0x4),
11+
DTS_HDProfileMax(0x7FFFFFFF);
12+
13+
companion object {
14+
fun from(findValue: Int): String? = values().find { it.value == findValue }?.name
15+
}
16+
17+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@file:Suppress("unused")
2+
3+
package com.parseus.codecinfo.data.codecinfo.profilelevels
4+
5+
@Suppress("EnumEntryName")
6+
enum class DTSUHDProfiles(val value: Int) {
7+
8+
DTS_UHDProfileP1(0x1),
9+
DTS_UHDProfileP2(0x2),
10+
DTS_UDHProfileMax(0x7FFFFFFF);
11+
12+
companion object {
13+
fun from(findValue: Int): String? = values().find { it.value == findValue }?.name
14+
}
15+
16+
}

0 commit comments

Comments
 (0)