mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Add ffmpeg audio decoding
This commit is contained in:
parent
7bfcf25df4
commit
8ebf5185a3
2 changed files with 28 additions and 18 deletions
|
@ -159,6 +159,8 @@ dependencies {
|
||||||
implementation("com.google.android.exoplayer:extension-cast:2.18.2")
|
implementation("com.google.android.exoplayer:extension-cast:2.18.2")
|
||||||
implementation("com.google.android.exoplayer:extension-mediasession:2.18.2")
|
implementation("com.google.android.exoplayer:extension-mediasession:2.18.2")
|
||||||
implementation("com.google.android.exoplayer:extension-okhttp:2.18.2")
|
implementation("com.google.android.exoplayer:extension-okhttp:2.18.2")
|
||||||
|
// Use the Jellyfin ffmpeg extension for easy ffmpeg audio decoding in exoplayer. Thank you Jellyfin <3
|
||||||
|
implementation("org.jellyfin.exoplayer:exoplayer-ffmpeg-extension:2.18.2+1")
|
||||||
|
|
||||||
//implementation("com.google.android.exoplayer:extension-leanback:2.14.0")
|
//implementation("com.google.android.exoplayer:extension-leanback:2.14.0")
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,11 @@ import android.widget.FrameLayout
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import com.google.android.exoplayer2.*
|
import com.google.android.exoplayer2.*
|
||||||
import com.google.android.exoplayer2.C.*
|
import com.google.android.exoplayer2.C.*
|
||||||
|
import com.google.android.exoplayer2.DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON
|
||||||
|
import com.google.android.exoplayer2.DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER
|
||||||
import com.google.android.exoplayer2.database.StandaloneDatabaseProvider
|
import com.google.android.exoplayer2.database.StandaloneDatabaseProvider
|
||||||
import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSource
|
import com.google.android.exoplayer2.ext.okhttp.OkHttpDataSource
|
||||||
|
import com.google.android.exoplayer2.mediacodec.MediaCodecSelector
|
||||||
import com.google.android.exoplayer2.source.*
|
import com.google.android.exoplayer2.source.*
|
||||||
import com.google.android.exoplayer2.text.TextRenderer
|
import com.google.android.exoplayer2.text.TextRenderer
|
||||||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector
|
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector
|
||||||
|
@ -538,7 +541,8 @@ class CS3IPlayer : IPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do no include empty referer, if the provider wants those they can use the header map.
|
// Do no include empty referer, if the provider wants those they can use the header map.
|
||||||
val refererMap = if (link.referer.isBlank()) emptyMap() else mapOf("referer" to link.referer)
|
val refererMap =
|
||||||
|
if (link.referer.isBlank()) emptyMap() else mapOf("referer" to link.referer)
|
||||||
val headers = mapOf(
|
val headers = mapOf(
|
||||||
"accept" to "*/*",
|
"accept" to "*/*",
|
||||||
"sec-ch-ua" to "\"Chromium\";v=\"91\", \" Not;A Brand\";v=\"99\"",
|
"sec-ch-ua" to "\"Chromium\";v=\"91\", \" Not;A Brand\";v=\"99\"",
|
||||||
|
@ -669,7 +673,11 @@ class CS3IPlayer : IPlayer {
|
||||||
val exoPlayerBuilder =
|
val exoPlayerBuilder =
|
||||||
ExoPlayer.Builder(context)
|
ExoPlayer.Builder(context)
|
||||||
.setRenderersFactory { eventHandler, videoRendererEventListener, audioRendererEventListener, textRendererOutput, metadataRendererOutput ->
|
.setRenderersFactory { eventHandler, videoRendererEventListener, audioRendererEventListener, textRendererOutput, metadataRendererOutput ->
|
||||||
DefaultRenderersFactory(context).createRenderers(
|
DefaultRenderersFactory(context).apply {
|
||||||
|
setEnableDecoderFallback(true)
|
||||||
|
// Enable Ffmpeg extension
|
||||||
|
setExtensionRendererMode(EXTENSION_RENDERER_MODE_ON)
|
||||||
|
}.createRenderers(
|
||||||
eventHandler,
|
eventHandler,
|
||||||
videoRendererEventListener,
|
videoRendererEventListener,
|
||||||
audioRendererEventListener,
|
audioRendererEventListener,
|
||||||
|
|
Loading…
Reference in a new issue