From 3f1ef1b599cb5adfb6eb3aee18f23598b958c313 Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 24 Jun 2020 15:48:08 +0200 Subject: [PATCH] Cleanup --- .../android/util/video/MMediaMuxer.kt | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/net/pokeranalytics/android/util/video/MMediaMuxer.kt b/app/src/main/java/net/pokeranalytics/android/util/video/MMediaMuxer.kt index 93a9621c..8a75c24a 100644 --- a/app/src/main/java/net/pokeranalytics/android/util/video/MMediaMuxer.kt +++ b/app/src/main/java/net/pokeranalytics/android/util/video/MMediaMuxer.kt @@ -163,20 +163,14 @@ class MMediaMuxer { @Throws(IOException::class) private fun PrepareEncoder() { - val codecInfo = - selectCodec( - MIME_TYPE - ) + val codecInfo = selectCodec(MIME_TYPE) if (codecInfo == null) { Loge("Unable to find an appropriate codec for $MIME_TYPE") } Logd("found codec: " + codecInfo!!.name) val colorFormat: Int colorFormat = try { - selectColorFormat( - codecInfo, - MIME_TYPE - ) + selectColorFormat(codecInfo, MIME_TYPE) } catch (e: Exception) { CodecCapabilities.COLOR_FormatYUV420SemiPlanar } @@ -222,9 +216,7 @@ class MMediaMuxer { val TIMEOUT_USEC: Long = 5000 val inputBufIndex = mediaCodec!!.dequeueInputBuffer(TIMEOUT_USEC) val ptsUsec = - computePresentationTime(generateIndex.toLong(), - FRAME_RATE - ) + computePresentationTime(generateIndex.toLong(), FRAME_RATE) if (inputBufIndex >= 0) { val input = bitFirst!![currentIndexFrame] val inputBuffer = mediaCodec!!.getInputBuffer(inputBufIndex) @@ -391,18 +383,12 @@ class MMediaMuxer { * code. If no match is found, this throws a test failure -- the set of * formats known to the test should be expanded for new platforms. */ - private fun selectColorFormat( - codecInfo: MediaCodecInfo, - mimeType: String - ): Int { - val capabilities = codecInfo - .getCapabilitiesForType(mimeType) + private fun selectColorFormat(codecInfo: MediaCodecInfo, mimeType: String): Int { + + val capabilities = codecInfo.getCapabilitiesForType(mimeType) for (i in capabilities.colorFormats.indices) { val colorFormat = capabilities.colorFormats[i] - if (isRecognizedFormat( - colorFormat - ) - ) { + if (isRecognizedFormat(colorFormat)) { return colorFormat } }