Skip to content

Commit

Permalink
Merge pull request #123 from remotv/develop
Browse files Browse the repository at this point in the history
- Fix aspect ratio on newer devices when portrait
- Fix legacy camera orientation off by 90 degrees
  • Loading branch information
SkyeOfBreeze committed Jan 9, 2021
2 parents 59b8159 + e479b99 commit 3d2d720
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -131,13 +132,22 @@ open class FFmpegVideoProcessorAPI24 : BaseVideoProcessor(){
}

private fun getVideoInputOptions(props : StreamInfo): ArrayList<String> {
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"
)
}
Expand All @@ -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)
}
}

0 comments on commit 3d2d720

Please sign in to comment.