|
@@ -251,13 +251,22 @@ class MovieEditActivity : AppCompatActivity(), DialogInterface.OnDismissListener
|
|
|
val inputSceneStatus = LinkedHashMap<Int, Int>()
|
|
|
var sceneIndex = -1
|
|
|
var sceneRepeatCount = 0
|
|
|
+ var sceneCount = 0
|
|
|
+
|
|
|
|
|
|
val movieBuilder = MovieMaker.Builder(mediaHelper)
|
|
|
movieBuilder.fps = FPS
|
|
|
movieBuilder.audioSources = generateAudioSource()
|
|
|
+
|
|
|
+ var totalFrame = 0
|
|
|
+ scene?.record?.period?.let {
|
|
|
+ totalFrame = (it/((1f / FPS) * 1000).toLong()).toInt()
|
|
|
+ }
|
|
|
+
|
|
|
generateMovieFilms()
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
.subscribe({
|
|
|
+ Log.d("Debug","progress ${sceneCount++}/$totalFrame")
|
|
|
if (it.key == sceneIndex) {
|
|
|
sceneRepeatCount++
|
|
|
} else {
|
|
@@ -298,34 +307,22 @@ class MovieEditActivity : AppCompatActivity(), DialogInterface.OnDismissListener
|
|
|
scene?.apply {
|
|
|
record?.apply {
|
|
|
var bitmap = drawScene(0)
|
|
|
+ var bitmapIndex = 0
|
|
|
var trackPosition = -1
|
|
|
- var isDrawNewScene: Boolean
|
|
|
-
|
|
|
- for (t in 0..period step ((1f / FPS.toFloat()) * 1000).toLong()) {
|
|
|
- isDrawNewScene = false
|
|
|
|
|
|
+ for (t in 0 .. period step ((1f / FPS) * 1000).toLong()) {
|
|
|
for (track in tracks) {
|
|
|
if (t >= track.time && tracks.indexOf(track) > trackPosition) {
|
|
|
- isDrawNewScene = true
|
|
|
-
|
|
|
preBitmap = bitmap
|
|
|
preBitmap?.recycle()
|
|
|
|
|
|
bitmap = drawScene(track.positionX)
|
|
|
trackPosition = tracks.indexOf(track)
|
|
|
-
|
|
|
- bitmap?.apply {
|
|
|
- it.onNext(AbstractMap.SimpleEntry(trackPosition + 1, this))
|
|
|
- Log.d("Debug", "Index: ${trackPosition + 1} Time: $t")
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
bitmap?.apply {
|
|
|
- if (!isDrawNewScene) {
|
|
|
- it.onNext(AbstractMap.SimpleEntry(trackPosition + 1, this))
|
|
|
- Log.d("Debug", "Index: ${trackPosition + 1} Time: $t")
|
|
|
- }
|
|
|
+ it.onNext(AbstractMap.SimpleEntry(bitmapIndex++, this))
|
|
|
}
|
|
|
}
|
|
|
it.onComplete()
|