diff --git a/app/build.gradle b/app/build.gradle index a415288..a516997 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -34,8 +34,8 @@ android { applicationId "tv.remo.android.controller" minSdkVersion 16 targetSdkVersion 28 - versionCode 18 - versionName "0.19.0" + versionCode 19 + versionName "0.19.1" multiDexEnabled true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/streaming/src/main/java/org/btelman/controlsdk/streaming/utils/FFmpegUtil.kt b/streaming/src/main/java/org/btelman/controlsdk/streaming/utils/FFmpegUtil.kt index 9fc90ba..590af3c 100644 --- a/streaming/src/main/java/org/btelman/controlsdk/streaming/utils/FFmpegUtil.kt +++ b/streaming/src/main/java/org/btelman/controlsdk/streaming/utils/FFmpegUtil.kt @@ -74,8 +74,8 @@ object FFmpegUtil { FFmpegRunner.startProcess(builder, UUID.fromString(uuid)) } - fun getFilterOptions(props : StreamInfo) : String{ - var rotationOption = props.orientation.ordinal-1 //leave blank + fun getFilterOptions(props : StreamInfo, offset : Int = 0) : String{ + var rotationOption = props.orientation.ordinal+offset //leave blank if(rotationOption < 0) rotationOption = 3 val filterList = ArrayList() diff --git a/streaming/src/main/java/org/btelman/controlsdk/streaming/video/processors/FFmpegVideoProcessorAPI24.kt b/streaming/src/main/java/org/btelman/controlsdk/streaming/video/processors/FFmpegVideoProcessorAPI24.kt index b49cb67..c3edab9 100644 --- a/streaming/src/main/java/org/btelman/controlsdk/streaming/video/processors/FFmpegVideoProcessorAPI24.kt +++ b/streaming/src/main/java/org/btelman/controlsdk/streaming/video/processors/FFmpegVideoProcessorAPI24.kt @@ -6,6 +6,7 @@ import com.arthenica.mobileffmpeg.Config import com.arthenica.mobileffmpeg.ExecuteCallback import com.arthenica.mobileffmpeg.FFmpeg import org.btelman.controlsdk.enums.ComponentStatus +import org.btelman.controlsdk.streaming.enums.Orientation import org.btelman.controlsdk.streaming.models.ImageDataPacket import org.btelman.controlsdk.streaming.models.StreamInfo import org.btelman.controlsdk.streaming.utils.FFmpegUtil @@ -131,13 +132,22 @@ open class FFmpegVideoProcessorAPI24 : BaseVideoProcessor(){ } private fun getVideoInputOptions(props : StreamInfo): ArrayList { + val videoSize = when(props.orientation){ + //Portrait orientations, flip resolutions + Orientation.DIR_0 -> "${props.height}x${props.width}" + Orientation.DIR_180 -> "${props.height}x${props.width}" + + //Landscape orientations, standard resolutions + Orientation.DIR_90 -> "${props.width}x${props.height}" + Orientation.DIR_270 -> "${props.width}x${props.height}" + } return arrayListOf( "-f android_camera", "-input_queue_size 10", - "-video_size ${props.width}x${props.height}", + "-video_size $videoSize", "-i 0:0", "-camera_index ${props.deviceInfo.getCameraId()}", - "-s ${props.width}x${props.height}", + "-s $videoSize", "-r 25" ) } @@ -154,6 +164,6 @@ open class FFmpegVideoProcessorAPI24 : BaseVideoProcessor(){ } protected open fun getFilterOptions(props : StreamInfo): String { - return FFmpegUtil.getFilterOptions(props) + return FFmpegUtil.getFilterOptions(props, offset = -1) } } \ No newline at end of file