playback: switch to ffmpeg extension
Switch to the FFMpeg ExoPlayer extension, which should enable support for ALAC while also retaining support for FLAC below Android 8.
This commit is contained in:
@@ -47,13 +47,13 @@ interface CachedSongsDao {
|
||||
@TypeConverters(CachedSong.Converters::class)
|
||||
data class CachedSong(
|
||||
/**
|
||||
* The ID of the [Song]'s audio file, obtained from MediaStore. Note that this ID is highly
|
||||
* The ID of the [RawSong]'s audio file, obtained from MediaStore. Note that this ID is highly
|
||||
* unstable and should only be used for accessing the audio file.
|
||||
*/
|
||||
@PrimaryKey var mediaStoreId: Long,
|
||||
/** @see RawSong.dateAdded */
|
||||
var dateAdded: Long,
|
||||
/** The latest date the [Song]'s audio file was modified, as a unix epoch timestamp. */
|
||||
/** The latest date the [RawSong]'s audio file was modified, as a unix epoch timestamp. */
|
||||
var dateModified: Long,
|
||||
/** @see RawSong.size */
|
||||
var size: Long? = null,
|
||||
|
||||
@@ -26,8 +26,6 @@ import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import javax.inject.Singleton
|
||||
import org.oxycblt.auxio.music.extractor.CacheRepository
|
||||
import org.oxycblt.auxio.music.extractor.CacheRepositoryImpl
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
|
||||
@@ -15,11 +15,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.oxycblt.auxio.music.extractor
|
||||
package org.oxycblt.auxio.music.cache
|
||||
|
||||
import javax.inject.Inject
|
||||
import org.oxycblt.auxio.music.cache.CachedSong
|
||||
import org.oxycblt.auxio.music.cache.CachedSongsDao
|
||||
import org.oxycblt.auxio.music.model.RawSong
|
||||
import org.oxycblt.auxio.util.*
|
||||
|
||||
|
||||
@@ -157,6 +157,8 @@ data class MimeType(val fromExtension: String, val fromFormat: String?) {
|
||||
MediaFormat.MIMETYPE_AUDIO_VORBIS -> R.string.cdc_vorbis
|
||||
MediaFormat.MIMETYPE_AUDIO_OPUS -> R.string.cdc_opus
|
||||
MediaFormat.MIMETYPE_AUDIO_FLAC -> R.string.cdc_flac
|
||||
// TODO: Add ALAC to this as soon as I can stop using MediaFormat for
|
||||
// extracting metadata and just use ExoPlayer.
|
||||
// We don't give a name to more unpopular formats.
|
||||
else -> -1
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.io.File
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.yield
|
||||
import org.oxycblt.auxio.music.MusicSettings
|
||||
import org.oxycblt.auxio.music.extractor.Cache
|
||||
import org.oxycblt.auxio.music.cache.Cache
|
||||
import org.oxycblt.auxio.music.metadata.Date
|
||||
import org.oxycblt.auxio.music.metadata.parseId3v2PositionField
|
||||
import org.oxycblt.auxio.music.metadata.transformPositionField
|
||||
|
||||
@@ -35,7 +35,7 @@ import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.yield
|
||||
import org.oxycblt.auxio.BuildConfig
|
||||
import org.oxycblt.auxio.music.*
|
||||
import org.oxycblt.auxio.music.extractor.*
|
||||
import org.oxycblt.auxio.music.cache.CacheRepository
|
||||
import org.oxycblt.auxio.music.metadata.TagExtractor
|
||||
import org.oxycblt.auxio.music.model.Library
|
||||
import org.oxycblt.auxio.music.model.RawSong
|
||||
|
||||
@@ -56,8 +56,10 @@ import org.oxycblt.auxio.util.logD
|
||||
*/
|
||||
@AndroidEntryPoint
|
||||
class IndexerService : Service(), Indexer.Controller, MusicSettings.Listener {
|
||||
@Inject lateinit var indexer: Indexer
|
||||
@Inject lateinit var imageLoader: ImageLoader
|
||||
@Inject lateinit var musicRepository: MusicRepository
|
||||
@Inject lateinit var indexer: Indexer
|
||||
@Inject lateinit var musicSettings: MusicSettings
|
||||
@Inject lateinit var playbackManager: PlaybackStateManager
|
||||
private val serviceJob = Job()
|
||||
private val indexScope = CoroutineScope(serviceJob + Dispatchers.IO)
|
||||
@@ -67,8 +69,6 @@ class IndexerService : Service(), Indexer.Controller, MusicSettings.Listener {
|
||||
private lateinit var observingNotification: ObservingNotification
|
||||
private lateinit var wakeLock: PowerManager.WakeLock
|
||||
private lateinit var indexerContentObserver: SystemContentObserver
|
||||
@Inject lateinit var musicSettings: MusicSettings
|
||||
@Inject lateinit var imageLoader: ImageLoader
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.google.android.exoplayer2.RenderersFactory
|
||||
import com.google.android.exoplayer2.audio.AudioAttributes
|
||||
import com.google.android.exoplayer2.audio.AudioCapabilities
|
||||
import com.google.android.exoplayer2.audio.MediaCodecAudioRenderer
|
||||
import com.google.android.exoplayer2.ext.flac.LibflacAudioRenderer
|
||||
import com.google.android.exoplayer2.ext.ffmpeg.FfmpegAudioRenderer
|
||||
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory
|
||||
import com.google.android.exoplayer2.mediacodec.MediaCodecSelector
|
||||
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory
|
||||
@@ -128,7 +128,7 @@ class PlaybackService :
|
||||
audioListener,
|
||||
AudioCapabilities.DEFAULT_AUDIO_CAPABILITIES,
|
||||
replayGainProcessor),
|
||||
LibflacAudioRenderer(handler, audioListener, replayGainProcessor))
|
||||
FfmpegAudioRenderer(handler, audioListener, replayGainProcessor))
|
||||
}
|
||||
|
||||
player =
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.annotation.AttrRes
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.util.fixDoubleRipple
|
||||
|
||||
/**
|
||||
@@ -30,8 +31,11 @@ import org.oxycblt.auxio.util.fixDoubleRipple
|
||||
*/
|
||||
open class RippleFixMaterialButton
|
||||
@JvmOverloads
|
||||
constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr: Int = 0) :
|
||||
MaterialButton(context, attrs, defStyleAttr) {
|
||||
constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
@AttrRes defStyleAttr: Int = R.attr.materialButtonStyle
|
||||
) : MaterialButton(context, attrs, defStyleAttr) {
|
||||
init {
|
||||
fixDoubleRipple()
|
||||
}
|
||||
|
||||
@@ -196,7 +196,6 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
/**
|
||||
* Set up the control bar in a [RemoteViews] layout that contains one. This is a kind of
|
||||
* "floating" drawable that sits in front of the cover and contains the controls.
|
||||
* @param context [Context] required to set up the view.
|
||||
*/
|
||||
private fun RemoteViews.setupBar(): RemoteViews {
|
||||
// Below API 31, enable a rounded bar only if round mode is enabled.
|
||||
@@ -214,7 +213,6 @@ class WidgetProvider : AppWidgetProvider() {
|
||||
/**
|
||||
* Set up the background in a [RemoteViews] layout that contains one. This is largely
|
||||
* self-explanatory, being a solid-color background that sits behind the cover and controls.
|
||||
* @param context [Context] required to set up the view.
|
||||
*/
|
||||
private fun RemoteViews.setupBackground(): RemoteViews {
|
||||
// Below API 31, enable a rounded background only if round mode is enabled.
|
||||
|
||||
Reference in New Issue
Block a user