Add FFmpeg-kit Sub-Module

This commit is contained in:
shabinder 2021-08-23 23:19:22 +05:30
parent bfb0f800ad
commit 408205122a
3 changed files with 7 additions and 5 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "mosaic"] [submodule "mosaic"]
path = mosaic path = mosaic
url = https://github.com/JakeWharton/mosaic url = https://github.com/JakeWharton/mosaic
[submodule "ffmpeg-kit"]
path = ffmpeg-kit
url = https://github.com/tanersener/ffmpeg-kit

View File

@ -36,11 +36,8 @@ import com.shabinder.common.models.event.coroutines.SuspendableEvent
import com.shabinder.common.models.event.coroutines.failure import com.shabinder.common.models.event.coroutines.failure
import com.shabinder.common.models.event.coroutines.map import com.shabinder.common.models.event.coroutines.map
import com.shabinder.database.Database import com.shabinder.database.Database
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.*
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jetbrains.skija.Image import org.jetbrains.skija.Image
import org.koin.dsl.bind import org.koin.dsl.bind
import org.koin.dsl.module import org.koin.dsl.module
@ -103,7 +100,7 @@ class DesktopFileManager(
File(imageCacheDir()).deleteRecursively() File(imageCacheDir()).deleteRecursively()
} }
override suspend fun cacheImage(image: Any, path: String) { override suspend fun cacheImage(image: Any, path: String): Unit = withContext(dispatcherIO) {
try { try {
(image as? BufferedImage)?.let { (image as? BufferedImage)?.let {
ImageIO.write(it, "jpeg", File(path)) ImageIO.write(it, "jpeg", File(path))
@ -185,6 +182,7 @@ class DesktopFileManager(
} }
} }
@OptIn(DelicateCoroutinesApi::class)
@Suppress("BlockingMethodInNonBlockingContext") @Suppress("BlockingMethodInNonBlockingContext")
private suspend fun freshImage(url: String, reqWidth: Int, reqHeight: Int): ImageBitmap? { private suspend fun freshImage(url: String, reqWidth: Int, reqHeight: Int): ImageBitmap? {
return withContext(Dispatchers.IO) { return withContext(Dispatchers.IO) {

1
ffmpeg-kit Submodule

@ -0,0 +1 @@
Subproject commit 46afc3f34a91efffb3c2bc595d64e2d714d48245