diff --git a/README.md b/README.md index 5c46c75..dbb0111 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ FFmpeg Android runs on the following architectures: ``` dependencies { - implementation 'com.github.SimformSolutionsPvtLtd:SSffmpegVideoOperation:1.0.5' + implementation 'com.github.SimformSolutionsPvtLtd:SSffmpegVideoOperation:1.0.6' } ``` @@ -86,7 +86,7 @@ This is all you have to do to load the FFmpeg library. In this sample code we will run the FFmpeg -version command in background call. ```java val query:Array = "-i, input,....,...., outout" - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun statisticsProcess(statistics: Statistics) { Log.i("FFMPEG LOG : ", statistics.videoFrameNumber) } @@ -108,12 +108,12 @@ In this sample code we will run the FFmpeg -version command in background call. -#### Inbuild query example +#### In-build query example ```java val startTimeString = "00:01:00" (HH:MM:SS) val endTimeString = "00:02:00" (HH:MM:SS) -val query:Array = FFmpegQueryExtension.cutVideo(inputPath, startTimeString, endTimeString, outputPath) -CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { +val query:Array = FFmpegQueryExtension().cutVideo(inputPath, startTimeString, endTimeString, outputPath) +CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun statisticsProcess(statistics: Statistics) { Log.i("FFMPEG LOG : ", statistics.videoFrameNumber) } diff --git a/SSffmpegVideoOperation/src/main/java/com/simform/videooperations/CallBackOfQuery.kt b/SSffmpegVideoOperation/src/main/java/com/simform/videooperations/CallBackOfQuery.kt index 0c32c1e..140fa42 100644 --- a/SSffmpegVideoOperation/src/main/java/com/simform/videooperations/CallBackOfQuery.kt +++ b/SSffmpegVideoOperation/src/main/java/com/simform/videooperations/CallBackOfQuery.kt @@ -10,7 +10,7 @@ import java.util.concurrent.CyclicBarrier * Created by Ashvin Vavaliya on 22,January,2021 * Simform Solutions Pvt Ltd. */ -object CallBackOfQuery { +public class CallBackOfQuery { fun callQuery(context: AppCompatActivity, query: Array, fFmpegCallBack: FFmpegCallBack) { val gate = CyclicBarrier(2) object : Thread() { diff --git a/SSffmpegVideoOperation/src/main/java/com/simform/videooperations/Common.kt b/SSffmpegVideoOperation/src/main/java/com/simform/videooperations/Common.kt index 6cd9dce..4f9acc1 100644 --- a/SSffmpegVideoOperation/src/main/java/com/simform/videooperations/Common.kt +++ b/SSffmpegVideoOperation/src/main/java/com/simform/videooperations/Common.kt @@ -8,7 +8,6 @@ import android.text.TextUtils import androidx.appcompat.app.AppCompatActivity import com.jaiselrahman.filepicker.activity.FilePickerActivity import com.jaiselrahman.filepicker.config.Configurations -import com.simform.videooperations.FFmpegQueryExtension.FRAME_RATE import java.io.File import java.io.FileInputStream import java.io.IOException @@ -84,7 +83,7 @@ object Common { val mime = format.getString(MediaFormat.KEY_MIME) if (mime?.startsWith("video/") == true) { if (format.containsKey(MediaFormat.KEY_FRAME_RATE)) { - FRAME_RATE = format.getInteger(MediaFormat.KEY_FRAME_RATE) + FFmpegQueryExtension().FRAME_RATE = format.getInteger(MediaFormat.KEY_FRAME_RATE) } } } diff --git a/SSffmpegVideoOperation/src/main/java/com/simform/videooperations/FFmpegQueryExtension.kt b/SSffmpegVideoOperation/src/main/java/com/simform/videooperations/FFmpegQueryExtension.kt index 415d189..ba5f614 100644 --- a/SSffmpegVideoOperation/src/main/java/com/simform/videooperations/FFmpegQueryExtension.kt +++ b/SSffmpegVideoOperation/src/main/java/com/simform/videooperations/FFmpegQueryExtension.kt @@ -4,8 +4,8 @@ package com.simform.videooperations * Created by Ashvin Vavaliya on 10,December,2020 * Simform Solutions Pvt Ltd. */ -object FFmpegQueryExtension { - var FRAME_RATE: Int = 25 // Default value +public class FFmpegQueryExtension { + public var FRAME_RATE: Int = 25 // Default value /** * startTime = 00:00:00 HH:MM:SS diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d459adc..2713d37 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -17,9 +17,8 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.VideoImageEditor"> - - - + diff --git a/app/src/main/java/com/simform/videoimageeditor/BaseActivity.kt b/app/src/main/java/com/simform/videoimageeditor/BaseActivity.kt index ebf5f2c..4ed6c78 100644 --- a/app/src/main/java/com/simform/videoimageeditor/BaseActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/BaseActivity.kt @@ -8,7 +8,7 @@ import android.view.View import androidx.appcompat.app.AppCompatActivity import com.jaiselrahman.filepicker.activity.FilePickerActivity import com.jaiselrahman.filepicker.model.MediaFile -import com.simform.videoimageeditor.utils.utils.addSupportActionBar +import com.simform.videooperations.FFmpegQueryExtension import com.simform.videooperations.FileSelection /** @@ -22,11 +22,13 @@ abstract class BaseActivity(view: Int, title: Int) : AppCompatActivity(), View.O var width: Int? = 0 var mediaFiles: List? = null var retriever: MediaMetadataRetriever? = null + val utils = Utils() + val ffmpegQueryExtension = FFmpegQueryExtension() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(layoutView) - addSupportActionBar(this, toolbarTitle) + utils.addSupportActionBar(this, toolbarTitle) initialization() } diff --git a/app/src/main/java/com/simform/videoimageeditor/MainActivity.kt b/app/src/main/java/com/simform/videoimageeditor/MainActivity.kt index 13d9ac2..39905d7 100644 --- a/app/src/main/java/com/simform/videoimageeditor/MainActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/MainActivity.kt @@ -3,7 +3,6 @@ package com.simform.videoimageeditor import android.view.View import com.simform.videoimageeditor.middlewareActivity.OtherFFMPEGProcessActivity import com.simform.videoimageeditor.middlewareActivity.VideoProcessActivity -import com.simform.videoimageeditor.utils.utils.openActivity import kotlinx.android.synthetic.main.activity_main.imageGifOperation import kotlinx.android.synthetic.main.activity_main.videoOperation @@ -19,10 +18,10 @@ class MainActivity : BaseActivity(R.layout.activity_main, R.string.ffpmeg_title) override fun onClick(v: View?) { when (v?.id) { R.id.videoOperation -> { - openActivity(this, VideoProcessActivity()) + utils.openActivity(this, VideoProcessActivity()) } R.id.imageGifOperation -> { - openActivity(this, OtherFFMPEGProcessActivity()) + utils.openActivity(this, OtherFFMPEGProcessActivity()) } } } diff --git a/app/src/main/java/com/simform/videoimageeditor/utils/utils.kt b/app/src/main/java/com/simform/videoimageeditor/Utils.kt similarity index 85% rename from app/src/main/java/com/simform/videoimageeditor/utils/utils.kt rename to app/src/main/java/com/simform/videoimageeditor/Utils.kt index e087fbb..fe4e509 100644 --- a/app/src/main/java/com/simform/videoimageeditor/utils/utils.kt +++ b/app/src/main/java/com/simform/videoimageeditor/Utils.kt @@ -1,14 +1,14 @@ -package com.simform.videoimageeditor.utils +package com.simform.videoimageeditor import android.content.Context import android.content.Intent import androidx.appcompat.app.AppCompatActivity /** - * Created by Ashvin Vavaliya on 22,January,2021 + * Created by Ashvin Vavaliya on 06,July,2021 * Simform Solutions Pvt Ltd. */ -object utils { +class Utils { fun addSupportActionBar(context: AppCompatActivity, title: Int) { if (context.supportActionBar != null) { context.supportActionBar?.setDisplayHomeAsUpEnabled(true) diff --git a/app/src/main/java/com/simform/videoimageeditor/middlewareActivity/OtherFFMPEGProcessActivity.kt b/app/src/main/java/com/simform/videoimageeditor/middlewareActivity/OtherFFMPEGProcessActivity.kt index 43e5a5a..62460af 100644 --- a/app/src/main/java/com/simform/videoimageeditor/middlewareActivity/OtherFFMPEGProcessActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/middlewareActivity/OtherFFMPEGProcessActivity.kt @@ -9,7 +9,6 @@ import com.simform.videoimageeditor.otherFFMPEGProcessActivity.CompressAudioActi import com.simform.videoimageeditor.otherFFMPEGProcessActivity.CropAudioActivity import com.simform.videoimageeditor.otherFFMPEGProcessActivity.FastAndSlowAudioActivity import com.simform.videoimageeditor.otherFFMPEGProcessActivity.MergeGIFActivity -import com.simform.videoimageeditor.utils.utils.openActivity import kotlinx.android.synthetic.main.activity_other_ffmpeg_process.btnAudiosVolumeUpdate import kotlinx.android.synthetic.main.activity_other_ffmpeg_process.btnCompressAudio import kotlinx.android.synthetic.main.activity_other_ffmpeg_process.btnCutAudio @@ -31,22 +30,22 @@ class OtherFFMPEGProcessActivity : BaseActivity(R.layout.activity_other_ffmpeg_p override fun onClick(v: View?) { when (v?.id) { R.id.btnMergeGIF -> { - openActivity(this, MergeGIFActivity()) + utils.openActivity(this, MergeGIFActivity()) } R.id.btnMergeAudios -> { - openActivity(this, AudiosMergeActivity()) + utils.openActivity(this, AudiosMergeActivity()) } R.id.btnAudiosVolumeUpdate -> { - openActivity(this, ChangeAudioVolumeActivity()) + utils.openActivity(this, ChangeAudioVolumeActivity()) } R.id.btnFastAndSlowAudio -> { - openActivity(this, FastAndSlowAudioActivity()) + utils.openActivity(this, FastAndSlowAudioActivity()) } R.id.btnCutAudio -> { - openActivity(this, CropAudioActivity()) + utils.openActivity(this, CropAudioActivity()) } R.id.btnCompressAudio -> { - openActivity(this, CompressAudioActivity()) + utils.openActivity(this, CompressAudioActivity()) } } } diff --git a/app/src/main/java/com/simform/videoimageeditor/middlewareActivity/VideoProcessActivity.kt b/app/src/main/java/com/simform/videoimageeditor/middlewareActivity/VideoProcessActivity.kt index 5d6fea5..a265433 100644 --- a/app/src/main/java/com/simform/videoimageeditor/middlewareActivity/VideoProcessActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/middlewareActivity/VideoProcessActivity.kt @@ -3,7 +3,6 @@ package com.simform.videoimageeditor.middlewareActivity import android.view.View import com.simform.videoimageeditor.BaseActivity import com.simform.videoimageeditor.R -import com.simform.videoimageeditor.utils.utils.openActivity import com.simform.videoimageeditor.videoProcessActivity.* import kotlinx.android.synthetic.main.activity_video_process.* @@ -38,61 +37,61 @@ class VideoProcessActivity : BaseActivity(R.layout.activity_video_process, R.str override fun onClick(v: View?) { when (v?.id) { R.id.btnCutVideo -> { - openActivity(this, CutVideoUsingTimeActivity()) + utils.openActivity(this, CutVideoUsingTimeActivity()) } R.id.btnImageToVideo -> { - openActivity(this, ImageToVideoConvertActivity()) + utils.openActivity(this, ImageToVideoConvertActivity()) } R.id.btnAddWaterMarkOnVideo -> { - openActivity(this, AddWaterMarkOnVideoActivity()) + utils.openActivity(this, AddWaterMarkOnVideoActivity()) } R.id.btnCombineImageVideo -> { - openActivity(this, CombineImageAndVideoActivity()) + utils.openActivity(this, CombineImageAndVideoActivity()) } R.id.btnCombineImages -> { - openActivity(this, CombineImagesActivity()) + utils.openActivity(this, CombineImagesActivity()) } R.id.btnCombineVideos -> { - openActivity(this, CombineVideosActivity()) + utils.openActivity(this, CombineVideosActivity()) } R.id.btnCompressVideo -> { - openActivity(this, CompressVideoActivity()) + utils.openActivity(this, CompressVideoActivity()) } R.id.btnExtractVideo -> { - openActivity(this, ExtractImagesActivity()) + utils.openActivity(this, ExtractImagesActivity()) } R.id.btnExtractAudio -> { - openActivity(this, ExtractAudioActivity()) + utils.openActivity(this, ExtractAudioActivity()) } R.id.btnMotion -> { - openActivity(this, FastAndSlowVideoMotionActivity()) + utils.openActivity(this, FastAndSlowVideoMotionActivity()) } R.id.btnReverseVideo -> { - openActivity(this, ReverseVideoActivity()) + utils.openActivity(this, ReverseVideoActivity()) } R.id.btnFadeInFadeOutVideo -> { - openActivity(this, VideoFadeInFadeOutActivity()) + utils.openActivity(this, VideoFadeInFadeOutActivity()) } R.id.btnVideoConvertIntoGIF -> { - openActivity(this, VideoToGifActivity()) + utils.openActivity(this, VideoToGifActivity()) } R.id.btnVideoRotateFlip -> { - openActivity(this, VideoRotateFlipActivity()) + utils.openActivity(this, VideoRotateFlipActivity()) } R.id.btnMergeVideoAndAudio -> { - openActivity(this, MergeAudioVideoActivity()) + utils.openActivity(this, MergeAudioVideoActivity()) } R.id.btnAddTextOnVideo -> { - openActivity(this, AddTextOnVideoActivity()) + utils.openActivity(this, AddTextOnVideoActivity()) } R.id.btnRemoveAudioFromVideo -> { - openActivity(this, RemoveAudioFromVideoActivity()) + utils.openActivity(this, RemoveAudioFromVideoActivity()) } R.id.btnMergeImageAndAudio -> { - openActivity(this, MergeImageAndMP3Activity()) + utils.openActivity(this, MergeImageAndMP3Activity()) } R.id.btnSetAspectRatio -> { - openActivity(this, AspectRatioActivity()) + utils.openActivity(this, AspectRatioActivity()) } } } diff --git a/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/AudiosMergeActivity.kt b/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/AudiosMergeActivity.kt index 2f4e7e7..cde772d 100644 --- a/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/AudiosMergeActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/AudiosMergeActivity.kt @@ -55,9 +55,9 @@ class AudiosMergeActivity : BaseActivity(R.layout.activity_audios_merge, R.strin pathsList.add(paths) } - val query = FFmpegQueryExtension.mergeAudios(pathsList, DURATION_FIRST, outputPath) + val query = ffmpegQueryExtension.mergeAudios(pathsList, DURATION_FIRST, outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/ChangeAudioVolumeActivity.kt b/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/ChangeAudioVolumeActivity.kt index e5367fc..c12a6dc 100644 --- a/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/ChangeAudioVolumeActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/ChangeAudioVolumeActivity.kt @@ -44,8 +44,8 @@ class ChangeAudioVolumeActivity : BaseActivity(R.layout.activity_change_audio_va private fun mergeAudioProcess() { val outputPath = Common.getFilePath(this, Common.MP3) - val query = FFmpegQueryExtension.audioVolumeUpdate(tvInputPathAudio.text.toString(), volume = 0.1f, outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + val query = ffmpegQueryExtension.audioVolumeUpdate(tvInputPathAudio.text.toString(), volume = 0.1f, output = outputPath) + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/CompressAudioActivity.kt b/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/CompressAudioActivity.kt index a24f675..dff41cb 100644 --- a/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/CompressAudioActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/CompressAudioActivity.kt @@ -45,8 +45,8 @@ class CompressAudioActivity : BaseActivity(R.layout.activity_compress_audio, R.s private fun compressAudioProcess() { val outputPath = Common.getFilePath(this, Common.MP3) - val query = FFmpegQueryExtension.compressAudio(inputAudioPath = tvInputPathAudio.text.toString(), bitrate = BITRATE_128, output = outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + val query = ffmpegQueryExtension.compressAudio(inputAudioPath = tvInputPathAudio.text.toString(), bitrate = BITRATE_128, output = outputPath) + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/CropAudioActivity.kt b/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/CropAudioActivity.kt index a0094e1..825455b 100644 --- a/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/CropAudioActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/CropAudioActivity.kt @@ -146,8 +146,8 @@ class CropAudioActivity : BaseActivity(R.layout.activity_crop_audio, R.string.cr @SuppressLint("SetTextI18n") private fun cutProcess() { val outputPath = Common.getFilePath(this, Common.MP3) - val query = FFmpegQueryExtension.cutAudio(tvInputPath.text.toString(), startTimeString, endTimeString, outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + val query = ffmpegQueryExtension.cutAudio(tvInputPath.text.toString(), startTimeString, endTimeString, outputPath) + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/FastAndSlowAudioActivity.kt b/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/FastAndSlowAudioActivity.kt index 4d0699a..cb42b2e 100644 --- a/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/FastAndSlowAudioActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/FastAndSlowAudioActivity.kt @@ -49,8 +49,8 @@ class FastAndSlowAudioActivity : BaseActivity(R.layout.activity_fast_and_slow_au if (!motionType.isChecked) { atempo = 0.5 } - val query = FFmpegQueryExtension.audioMotion(tvInputPathAudio.text.toString(), outputPath, atempo) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + val query = ffmpegQueryExtension.audioMotion(tvInputPathAudio.text.toString(), outputPath, atempo) + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/MergeGIFActivity.kt b/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/MergeGIFActivity.kt index ffe6b93..585ef7b 100644 --- a/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/MergeGIFActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/otherFFMPEGProcessActivity/MergeGIFActivity.kt @@ -107,9 +107,9 @@ class MergeGIFActivity : BaseActivity(R.layout.activity_merge_gif, R.string.merg val heightScale = height?.let { height -> (edtYScale.text.toString().toFloat().times(height)).div(100) } - val query = FFmpegQueryExtension.mergeGIF(pathsList, xPos, yPos, widthScale, heightScale, outputPath) + val query = ffmpegQueryExtension.mergeGIF(pathsList, xPos, yPos, widthScale, heightScale, outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/AddTextOnVideoActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/AddTextOnVideoActivity.kt index 3f74c66..038b651 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/AddTextOnVideoActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/AddTextOnVideoActivity.kt @@ -74,8 +74,8 @@ class AddTextOnVideoActivity : BaseActivity(R.layout.activity_add_text_on_video, (edtYPos.text.toString().toFloat().times(it)).div(100) } val fontPath = getFileFromAssets(this, "little_lord.ttf").absolutePath - val query = FFmpegQueryExtension.addTextOnVideo(tvInputPathVideo.text.toString(), edtText.text.toString(), xPos, yPos, fontPath = fontPath, true, 28, "red", outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + val query = ffmpegQueryExtension.addTextOnVideo(tvInputPathVideo.text.toString(), edtText.text.toString(), xPos, yPos, fontPath = fontPath, isTextBackgroundDisplay = true, fontSize = 28, fontcolor = "red", output = outputPath) + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/AddWaterMarkOnVideoActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/AddWaterMarkOnVideoActivity.kt index 0d8ba5b..5cf0388 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/AddWaterMarkOnVideoActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/AddWaterMarkOnVideoActivity.kt @@ -14,7 +14,6 @@ import com.simform.videooperations.Common.VIDEO import com.simform.videooperations.Common.getFilePath import com.simform.videooperations.Common.selectFile import com.simform.videooperations.FFmpegCallBack -import com.simform.videooperations.FFmpegQueryExtension.addVideoWaterMark import com.simform.videooperations.LogMessage import java.util.concurrent.CompletableFuture.runAsync import kotlinx.android.synthetic.main.activity_add_water_mark_on_video.btnAdd @@ -110,8 +109,8 @@ class AddWaterMarkOnVideoActivity : BaseActivity(R.layout.activity_add_water_mar val yPos = height?.let { (edtYPos.text.toString().toFloat().times(it)).div(100) } - val query = addVideoWaterMark(tvInputPathVideo.text.toString(), tvInputPathImage.text.toString(), xPos, yPos, outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + val query = ffmpegQueryExtension.addVideoWaterMark(tvInputPathVideo.text.toString(), tvInputPathImage.text.toString(), xPos, yPos, outputPath) + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/AspectRatioActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/AspectRatioActivity.kt index 75fd6e3..c3cc63c 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/AspectRatioActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/AspectRatioActivity.kt @@ -46,9 +46,9 @@ class AspectRatioActivity : BaseActivity(R.layout.activity_aspect_ratio, R.strin private fun applyRatioProcess() { val outputPath = Common.getFilePath(this, Common.VIDEO) - val query = FFmpegQueryExtension.applyRatio(tvInputPathVideo.text.toString(), RATIO_1, outputPath) + val query = ffmpegQueryExtension.applyRatio(tvInputPathVideo.text.toString(), RATIO_1, outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CombineImageAndVideoActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CombineImageAndVideoActivity.kt index 7f63f64..3d2bb53 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CombineImageAndVideoActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CombineImageAndVideoActivity.kt @@ -11,7 +11,6 @@ import com.simform.videoimageeditor.R import com.simform.videooperations.CallBackOfQuery import com.simform.videooperations.Common import com.simform.videooperations.FFmpegCallBack -import com.simform.videooperations.FFmpegQueryExtension.combineImagesAndVideos import com.simform.videooperations.LogMessage import com.simform.videooperations.Paths import java.util.concurrent.CompletableFuture.runAsync @@ -91,7 +90,7 @@ class CombineImageAndVideoActivity : BaseActivity(R.layout.activity_merge_image_ } } - fun combineImageAndVideoProcess() { + private fun combineImageAndVideoProcess() { val outputPath = Common.getFilePath(this, Common.VIDEO) val paths = ArrayList() @@ -106,9 +105,9 @@ class CombineImageAndVideoActivity : BaseActivity(R.layout.activity_merge_image_ paths.add(videoPaths1) paths.add(videoPaths2) - val query = combineImagesAndVideos(paths, width, height, edtSecond.text.toString(), outputPath) + val query = ffmpegQueryExtension.combineImagesAndVideos(paths, width, height, edtSecond.text.toString(), outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CombineImagesActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CombineImagesActivity.kt index ef13c6e..e08179f 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CombineImagesActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CombineImagesActivity.kt @@ -89,9 +89,9 @@ class CombineImagesActivity : BaseActivity(R.layout.activity_combine_images, R.s pathsList.add(paths) } - val query = FFmpegQueryExtension.combineImagesAndVideos(pathsList, 640, 480, edtSecond.text.toString(), outputPath) + val query = ffmpegQueryExtension.combineImagesAndVideos(pathsList, 640, 480, edtSecond.text.toString(), outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CombineVideosActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CombineVideosActivity.kt index 4b6d9f4..faf6913 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CombineVideosActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CombineVideosActivity.kt @@ -97,13 +97,13 @@ class CombineVideosActivity : BaseActivity(R.layout.activity_combine_videos, R.s pathsList.add(paths) } - val query = FFmpegQueryExtension.combineVideos( + val query = ffmpegQueryExtension.combineVideos( pathsList, width, height, outputPath ) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CompressVideoActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CompressVideoActivity.kt index c64b150..8eaca0f 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CompressVideoActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CompressVideoActivity.kt @@ -72,8 +72,8 @@ class CompressVideoActivity : BaseActivity(R.layout.activity_compress_video, R.s private fun compressProcess() { val outputPath = Common.getFilePath(this, Common.VIDEO) - val query = FFmpegQueryExtension.compressor(tvInputPathVideo.text.toString(), width, height, outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + val query = ffmpegQueryExtension.compressor(tvInputPathVideo.text.toString(), width, height, outputPath) + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CutVideoUsingTimeActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CutVideoUsingTimeActivity.kt index 8131cf8..ee3287c 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CutVideoUsingTimeActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/CutVideoUsingTimeActivity.kt @@ -15,7 +15,6 @@ import com.simform.videooperations.Common.TIME_FORMAT import com.simform.videooperations.Common.VIDEO_FILE_REQUEST_CODE import com.simform.videooperations.Common.stringForTime import com.simform.videooperations.FFmpegCallBack -import com.simform.videooperations.FFmpegQueryExtension.cutVideo import com.simform.videooperations.LogMessage import java.text.ParseException import java.text.SimpleDateFormat @@ -150,8 +149,8 @@ class CutVideoUsingTimeActivity : BaseActivity(R.layout.activity_cut_video_using @SuppressLint("SetTextI18n") private fun cutProcess() { val outputPath = Common.getFilePath(this, Common.VIDEO) - val query = cutVideo(tvInputPath.text.toString(), startTimeString, endTimeString, outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + val query = ffmpegQueryExtension.cutVideo(tvInputPath.text.toString(), startTimeString, endTimeString, outputPath) + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ExtractAudioActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ExtractAudioActivity.kt index 4f6edca..a0622f1 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ExtractAudioActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ExtractAudioActivity.kt @@ -44,9 +44,9 @@ class ExtractAudioActivity : BaseActivity(R.layout.activity_extract_audio, R.str private fun extractProcess() { val outputPath = Common.getFilePath(this, Common.MP3) - val query = FFmpegQueryExtension.extractAudio(tvInputPathVideo.text.toString(), outputPath) + val query = ffmpegQueryExtension.extractAudio(tvInputPathVideo.text.toString(), outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ExtractImagesActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ExtractImagesActivity.kt index 3659c68..a60e6a8 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ExtractImagesActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ExtractImagesActivity.kt @@ -61,9 +61,9 @@ class ExtractImagesActivity : BaseActivity(R.layout.activity_extract_images, R.s @SuppressLint("SetTextI18n") private fun extractProcess() { val outputPath = Common.getFilePath(this, Common.IMAGE) - val query = FFmpegQueryExtension.extractImages(tvInputPathVideo.text.toString(), outputPath, spaceOfFrame = 4f) + val query = ffmpegQueryExtension.extractImages(tvInputPathVideo.text.toString(), outputPath, spaceOfFrame = 4f) var totalFramesExtracted = 0 - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun statisticsProcess(statistics: Statistics) { totalFramesExtracted = statistics.videoFrameNumber tvOutputPath.text = "Frames : ${statistics.videoFrameNumber}" diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/FastAndSlowVideoMotionActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/FastAndSlowVideoMotionActivity.kt index 970c96d..aad6e28 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/FastAndSlowVideoMotionActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/FastAndSlowVideoMotionActivity.kt @@ -51,8 +51,8 @@ class FastAndSlowVideoMotionActivity : BaseActivity(R.layout.activity_fast_and_s setpts = 2.0 atempo = 0.5 } - val query = FFmpegQueryExtension.videoMotion(tvInputPathVideo.text.toString(), outputPath, setpts, atempo) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + val query = ffmpegQueryExtension.videoMotion(tvInputPathVideo.text.toString(), outputPath, setpts, atempo) + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ImageToVideoConvertActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ImageToVideoConvertActivity.kt index 1e0192a..475fd9d 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ImageToVideoConvertActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ImageToVideoConvertActivity.kt @@ -66,9 +66,9 @@ class ImageToVideoConvertActivity : BaseActivity(R.layout.activity_image_to_vide private fun createVideo() { val outputPath = Common.getFilePath(this, Common.VIDEO) val size: ISize = SizeOfImage(tvInputPath.text.toString()) - val query = FFmpegQueryExtension.imageToVideo(tvInputPath.text.toString(), outputPath, edtSecond.text.toString().toInt(), size.width(), size.height()) + val query = ffmpegQueryExtension.imageToVideo(tvInputPath.text.toString(), outputPath, edtSecond.text.toString().toInt(), size.width(), size.height()) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/MergeAudioVideoActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/MergeAudioVideoActivity.kt index 1eb93c7..6eeab0d 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/MergeAudioVideoActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/MergeAudioVideoActivity.kt @@ -54,9 +54,9 @@ class MergeAudioVideoActivity : BaseActivity(R.layout.activity_merge_audio_video private fun mergeProcess() { val outputPath = Common.getFilePath(this, Common.VIDEO) - val query = FFmpegQueryExtension.mergeAudioVideo(tvInputPathVideo.text.toString(), tvInputPathAudio.text.toString(), outputPath) + val query = ffmpegQueryExtension.mergeAudioVideo(tvInputPathVideo.text.toString(), tvInputPathAudio.text.toString(), outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/MergeImageAndMP3Activity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/MergeImageAndMP3Activity.kt index 1dfa765..c99d832 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/MergeImageAndMP3Activity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/MergeImageAndMP3Activity.kt @@ -54,9 +54,9 @@ class MergeImageAndMP3Activity : BaseActivity(R.layout.activity_merge_image_and_ private fun mergeProcess() { val outputPath = Common.getFilePath(this, Common.VIDEO) - val query = FFmpegQueryExtension.mergeImageAndAudio(tvInputPathImage.text.toString(), tvInputPathAudio.text.toString(), outputPath) + val query = ffmpegQueryExtension.mergeImageAndAudio(tvInputPathImage.text.toString(), tvInputPathAudio.text.toString(), outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/RemoveAudioFromVideoActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/RemoveAudioFromVideoActivity.kt index fffb9df..ec4362e 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/RemoveAudioFromVideoActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/RemoveAudioFromVideoActivity.kt @@ -45,9 +45,9 @@ class RemoveAudioFromVideoActivity : BaseActivity(R.layout.activity_remove_audio private fun removeAudioProcess() { val outputPath = Common.getFilePath(this, Common.VIDEO) - val query = FFmpegQueryExtension.removeAudioFromVideo(tvInputPathVideo.text.toString(), outputPath) + val query = ffmpegQueryExtension.removeAudioFromVideo(tvInputPathVideo.text.toString(), outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ReverseVideoActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ReverseVideoActivity.kt index e80b873..978fc64 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ReverseVideoActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/ReverseVideoActivity.kt @@ -45,9 +45,9 @@ class ReverseVideoActivity : BaseActivity(R.layout.activity_reverse, R.string.re private fun reverseProcess() { val outputPath = Common.getFilePath(this, Common.VIDEO) - val query = FFmpegQueryExtension.videoReverse(tvInputPathVideo.text.toString(), isWithAudioSwitch.isChecked, outputPath) + val query = ffmpegQueryExtension.videoReverse(tvInputPathVideo.text.toString(), isWithAudioSwitch.isChecked, outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/VideoFadeInFadeOutActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/VideoFadeInFadeOutActivity.kt index df6b854..ebe0289 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/VideoFadeInFadeOutActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/VideoFadeInFadeOutActivity.kt @@ -49,9 +49,9 @@ class VideoFadeInFadeOutActivity : BaseActivity(R.layout.activity_video_fade_in_ private fun fadeInFadeOutProcess() { val outputPath = Common.getFilePath(this, Common.VIDEO) - val query = FFmpegQueryExtension.videoFadeInFadeOut(tvInputPathVideo.text.toString(), selectedVideoDurationInSecond, fadeInEndSeconds = 3, fadeOutStartSeconds = 3, outputPath) + val query = ffmpegQueryExtension.videoFadeInFadeOut(tvInputPathVideo.text.toString(), selectedVideoDurationInSecond, fadeInEndSeconds = 3, fadeOutStartSeconds = 3, output = outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/VideoRotateFlipActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/VideoRotateFlipActivity.kt index 197a069..c509909 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/VideoRotateFlipActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/VideoRotateFlipActivity.kt @@ -80,12 +80,12 @@ class VideoRotateFlipActivity : BaseActivity(R.layout.activity_video_rotate_flip private fun rotateProcess(degree: Int, isRotate: Boolean) { val outputPath = Common.getFilePath(this, Common.VIDEO) val query = if (isRotate) { - FFmpegQueryExtension.rotateVideo(tvInputPathVideo.text.toString(), degree, outputPath) + ffmpegQueryExtension.rotateVideo(tvInputPathVideo.text.toString(), degree, outputPath) } else { - FFmpegQueryExtension.flipVideo(tvInputPathVideo.text.toString(), degree, outputPath) + ffmpegQueryExtension.flipVideo(tvInputPathVideo.text.toString(), degree, outputPath) } - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text } diff --git a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/VideoToGifActivity.kt b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/VideoToGifActivity.kt index d4ac46e..8ec50a2 100644 --- a/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/VideoToGifActivity.kt +++ b/app/src/main/java/com/simform/videoimageeditor/videoProcessActivity/VideoToGifActivity.kt @@ -46,9 +46,9 @@ class VideoToGifActivity : BaseActivity(R.layout.activity_video_to_gif, R.string private fun convertProcess() { val outputPath = Common.getFilePath(this, Common.GIF) - val query = FFmpegQueryExtension.convertVideoToGIF(tvInputPathVideo.text.toString(), outputPath) + val query = ffmpegQueryExtension.convertVideoToGIF(tvInputPathVideo.text.toString(), outputPath) - CallBackOfQuery.callQuery(this, query, object : FFmpegCallBack { + CallBackOfQuery().callQuery(this, query, object : FFmpegCallBack { override fun process(logMessage: LogMessage) { tvOutputPath.text = logMessage.text }