mirror of
https://github.com/oxyroid/M3UAndroid.git
synced 2025-05-17 19:35:58 +08:00
fix: remove lite codecs.
This commit is contained in:
@ -32,25 +32,6 @@ dependencies {
|
||||
implementation(project(":lint:annotation"))
|
||||
ksp(project(":lint:processor"))
|
||||
|
||||
implementation(project(":data:codec"))
|
||||
val isTvBuild = gradle
|
||||
.startParameter
|
||||
.taskNames
|
||||
.any { ":app:tv" in it }
|
||||
if (isTvBuild) {
|
||||
implementation(project(":data:codec:rich"))
|
||||
} else {
|
||||
val richCodec = gradle
|
||||
.startParameter
|
||||
.taskNames
|
||||
.find { it.contains("richCodec", ignoreCase = true) } != null
|
||||
if (richCodec) {
|
||||
implementation(project(":data:codec:rich"))
|
||||
} else {
|
||||
implementation(project(":data:codec:lite"))
|
||||
}
|
||||
}
|
||||
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.appcompat)
|
||||
|
||||
@ -85,6 +66,9 @@ dependencies {
|
||||
implementation(libs.androidx.media3.transformer)
|
||||
implementation(libs.androidx.media3.muxer)
|
||||
|
||||
implementation(libs.nextlib.media3ext)
|
||||
implementation(libs.nextlib.mediainfo)
|
||||
|
||||
implementation(libs.androidx.work.runtime.ktx)
|
||||
implementation(libs.androidx.hilt.work)
|
||||
|
||||
|
@ -1,23 +0,0 @@
|
||||
plugins {
|
||||
alias(libs.plugins.com.android.library)
|
||||
alias(libs.plugins.org.jetbrains.kotlin.android)
|
||||
alias(libs.plugins.com.google.devtools.ksp)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.m3u.data.codec"
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.appcompat)
|
||||
|
||||
implementation(libs.androidx.media3.exoplayer)
|
||||
|
||||
// auto
|
||||
implementation(libs.auto.service.annotations)
|
||||
ksp(libs.auto.service.ksp)
|
||||
}
|
1
data/codec/lite/.gitignore
vendored
1
data/codec/lite/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/build
|
@ -1,25 +0,0 @@
|
||||
plugins {
|
||||
alias(libs.plugins.com.android.library)
|
||||
alias(libs.plugins.org.jetbrains.kotlin.android)
|
||||
alias(libs.plugins.com.google.devtools.ksp)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.m3u.data.codec.lite"
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":data:codec"))
|
||||
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.appcompat)
|
||||
|
||||
implementation(libs.androidx.media3.exoplayer)
|
||||
|
||||
implementation(libs.auto.service.annotations)
|
||||
|
||||
ksp(libs.auto.service.ksp)
|
||||
}
|
21
data/codec/lite/proguard-rules.pro
vendored
21
data/codec/lite/proguard-rules.pro
vendored
@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest>
|
||||
|
||||
</manifest>
|
@ -1,19 +0,0 @@
|
||||
package com.m3u.data.codec
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import androidx.media3.exoplayer.DefaultRenderersFactory
|
||||
import androidx.media3.exoplayer.RenderersFactory
|
||||
import com.google.auto.service.AutoService
|
||||
|
||||
@AutoService(Codecs::class)
|
||||
class LiteCodecs: Codecs {
|
||||
override fun createRenderersFactory(context: Context): RenderersFactory {
|
||||
return DefaultRenderersFactory(context).apply {
|
||||
setEnableDecoderFallback(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getThumbnail(context: Context, uri: Uri): Bitmap? = null
|
||||
}
|
21
data/codec/proguard-rules.pro
vendored
21
data/codec/proguard-rules.pro
vendored
@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
1
data/codec/rich/.gitignore
vendored
1
data/codec/rich/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/build
|
@ -1,27 +0,0 @@
|
||||
plugins {
|
||||
alias(libs.plugins.com.android.library)
|
||||
alias(libs.plugins.org.jetbrains.kotlin.android)
|
||||
alias(libs.plugins.com.google.devtools.ksp)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.m3u.data.codec.rich"
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":data:codec"))
|
||||
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.appcompat)
|
||||
|
||||
implementation(libs.androidx.media3.exoplayer)
|
||||
implementation(libs.nextlib.media3ext)
|
||||
implementation(libs.nextlib.mediainfo)
|
||||
|
||||
implementation(libs.auto.service.annotations)
|
||||
|
||||
ksp(libs.auto.service.ksp)
|
||||
}
|
21
data/codec/rich/proguard-rules.pro
vendored
21
data/codec/rich/proguard-rules.pro
vendored
@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest>
|
||||
|
||||
</manifest>
|
@ -1,18 +0,0 @@
|
||||
package com.m3u.data.codec
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import androidx.media3.exoplayer.RenderersFactory
|
||||
import java.util.ServiceLoader
|
||||
|
||||
interface Codecs {
|
||||
fun createRenderersFactory(context: Context): RenderersFactory
|
||||
fun getThumbnail(context: Context, uri: Uri): Bitmap?
|
||||
|
||||
companion object {
|
||||
fun load(): Codecs {
|
||||
return ServiceLoader.load(Codecs::class.java).first()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +1,22 @@
|
||||
package com.m3u.data.codec
|
||||
package com.m3u.data.service.internal
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import androidx.media3.exoplayer.DefaultRenderersFactory
|
||||
import androidx.media3.exoplayer.RenderersFactory
|
||||
import com.google.auto.service.AutoService
|
||||
import io.github.anilbeesetti.nextlib.media3ext.ffdecoder.NextRenderersFactory
|
||||
import io.github.anilbeesetti.nextlib.mediainfo.MediaInfoBuilder
|
||||
|
||||
@AutoService(Codecs::class)
|
||||
class RichCodec: Codecs {
|
||||
override fun createRenderersFactory(context: Context): RenderersFactory {
|
||||
object Codecs {
|
||||
fun createRenderersFactory(context: Context): RenderersFactory {
|
||||
return NextRenderersFactory(context).apply {
|
||||
setEnableDecoderFallback(true)
|
||||
setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getThumbnail(context: Context, uri: Uri): Bitmap? {
|
||||
fun getThumbnail(context: Context, uri: Uri): Bitmap? {
|
||||
val mediaInfo = MediaInfoBuilder()
|
||||
.from(context, uri)
|
||||
.build()
|
@ -59,7 +59,6 @@ import com.m3u.core.architecture.preferences.Settings
|
||||
import com.m3u.core.architecture.preferences.get
|
||||
import com.m3u.data.SSLs
|
||||
import com.m3u.data.api.OkhttpClient
|
||||
import com.m3u.data.codec.Codecs
|
||||
import com.m3u.data.database.model.Channel
|
||||
import com.m3u.data.database.model.Playlist
|
||||
import com.m3u.data.database.model.copyXtreamEpisode
|
||||
@ -81,7 +80,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.flatMapLatest
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
@ -414,7 +412,7 @@ class PlayerManagerImpl @Inject constructor(
|
||||
}
|
||||
|
||||
override suspend fun syncThumbnail(channelUrl: String): Uri? = withContext(Dispatchers.IO) {
|
||||
val thumbnail = codecs.getThumbnail(context, channelUrl.toUri()) ?: return@withContext null
|
||||
val thumbnail = Codecs.getThumbnail(context, channelUrl.toUri()) ?: return@withContext null
|
||||
val filename = UUID.randomUUID().toString() + ".jpeg"
|
||||
val file = File(thumbnailDir, filename)
|
||||
while (!file.createNewFile()) {
|
||||
@ -453,9 +451,8 @@ class PlayerManagerImpl @Inject constructor(
|
||||
addListener(this@PlayerManagerImpl)
|
||||
}
|
||||
|
||||
private val codecs: Codecs by lazy { Codecs.load() }
|
||||
private val renderersFactory: RenderersFactory by lazy {
|
||||
codecs.createRenderersFactory(context)
|
||||
Codecs.createRenderersFactory(context)
|
||||
}
|
||||
|
||||
private fun createTrackSelector(tunneling: Boolean): TrackSelector {
|
||||
|
Reference in New Issue
Block a user