Skip to content

Commit

Permalink
🎨 添加ffmpeg解码
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoxieyoulei committed Jun 3, 2024
1 parent b187be4 commit c79869d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 29 deletions.
1 change: 1 addition & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 0 additions & 27 deletions .idea/deploymentTargetSelector.xml

This file was deleted.

6 changes: 6 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ android {
vectorDrawables {
useSupportLibrary = true
}

ndk {
abiFilters.addAll(listOf("armeabi-v7a", "arm64-v8a", "x86_64"))
}
}

buildTypes {
Expand Down Expand Up @@ -108,6 +112,8 @@ dependencies {
// 二维码
implementation(libs.qrose)

implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar"))))

testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
Expand Down
Binary file added app/libs/lib-decoder-ffmpeg-release.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import java.io.File
abstract class FileCacheRepository(
private val fileName: String,
) {
protected fun getCacheFile() = File(AppGlobal.cacheDir, fileName)
private fun getCacheFile() = File(AppGlobal.cacheDir, fileName)

private suspend fun getCacheData(): String? = withContext(Dispatchers.IO) {
val file = getCacheFile()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import androidx.media3.common.util.Util
import androidx.media3.datasource.DefaultDataSource
import androidx.media3.datasource.DefaultHttpDataSource
import androidx.media3.exoplayer.DecoderReuseEvaluation
import androidx.media3.exoplayer.DefaultRenderersFactory
import androidx.media3.exoplayer.DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.exoplayer.analytics.AnalyticsListener
import androidx.media3.exoplayer.hls.HlsMediaSource
Expand All @@ -22,10 +24,14 @@ import androidx.media3.exoplayer.util.EventLogger
import top.yogiczy.mytv.data.utils.Constants
import androidx.media3.common.PlaybackException as Media3PlaybackException

@UnstableApi
class LeanbackMedia3VideoPlayer(
private val context: Context,
) : LeanbackVideoPlayer() {
private val videoPlayer = ExoPlayer.Builder(context).build().apply {
private val videoPlayer = ExoPlayer.Builder(
context,
DefaultRenderersFactory(context).setExtensionRendererMode(EXTENSION_RENDERER_MODE_ON)
).build().apply {
playWhenReady = true
}

Expand Down

0 comments on commit c79869d

Please sign in to comment.