forked from hardcoresushi/DroidFS
Fix rotation when rebinding camera use cases
This commit is contained in:
parent
ad19b9e645
commit
9fc981fee8
@ -77,6 +77,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private lateinit var sensorOrientationListener: SensorOrientationListener
|
private lateinit var sensorOrientationListener: SensorOrientationListener
|
||||||
|
private var currentRotation = 0
|
||||||
private var previousOrientation: Float = 0f
|
private var previousOrientation: Float = 0f
|
||||||
private lateinit var orientedIcons: List<ImageView>
|
private lateinit var orientedIcons: List<ImageView>
|
||||||
private lateinit var encryptedVolume: EncryptedVolume
|
private lateinit var encryptedVolume: EncryptedVolume
|
||||||
@ -390,6 +391,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
|
|||||||
}
|
}
|
||||||
supportedSizes
|
supportedSizes
|
||||||
}.build())
|
}.build())
|
||||||
|
.setTargetRotation(currentRotation)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +403,9 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
|
|||||||
recorderBuilder.setQualitySelector(QualitySelector.from(qualities!![currentQualityIndex]))
|
recorderBuilder.setQualitySelector(QualitySelector.from(qualities!![currentQualityIndex]))
|
||||||
}
|
}
|
||||||
videoRecorder = recorderBuilder.build()
|
videoRecorder = recorderBuilder.build()
|
||||||
videoCapture = VideoCapture.withOutput(videoRecorder!!)
|
videoCapture = VideoCapture.withOutput(videoRecorder!!).apply {
|
||||||
|
targetRotation = currentRotation
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun rebindUseCases(): UseCase {
|
private fun rebindUseCases(): UseCase {
|
||||||
@ -598,6 +602,7 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener {
|
|||||||
previousOrientation = realOrientation
|
previousOrientation = realOrientation
|
||||||
imageCapture?.targetRotation = newOrientation
|
imageCapture?.targetRotation = newOrientation
|
||||||
videoCapture?.targetRotation = newOrientation
|
videoCapture?.targetRotation = newOrientation
|
||||||
|
currentRotation = newOrientation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +154,7 @@ JNIEXPORT void JNICALL
|
|||||||
Java_sushi_hardcore_droidfs_video_1recording_FFmpegMuxer_release(JNIEnv *env, jobject thiz, jlong format_context) {
|
Java_sushi_hardcore_droidfs_video_1recording_FFmpegMuxer_release(JNIEnv *env, jobject thiz, jlong format_context) {
|
||||||
AVFormatContext* fc = (AVFormatContext *) format_context;
|
AVFormatContext* fc = (AVFormatContext *) format_context;
|
||||||
av_free(fc->pb->buffer);
|
av_free(fc->pb->buffer);
|
||||||
|
(*env)->DeleteGlobalRef(env, ((struct Muxer*)fc->pb->opaque)->thiz);
|
||||||
free(fc->pb->opaque);
|
free(fc->pb->opaque);
|
||||||
avio_context_free(&fc->pb);
|
avio_context_free(&fc->pb);
|
||||||
avformat_free_context(fc);
|
avformat_free_context(fc);
|
||||||
|
Loading…
Reference in New Issue
Block a user