Add FFplay support to the application

Integrated FFplay functionality across the application. This includes support for setting up the FFplay path and invoking FFplay for media playback.
This commit is contained in:
kor-elf committed 2025-05-19 22:49:09 +05:00
1 parent a831d56d93
commit 306383449a
17 files changed
+244 -24

No files matched your search

+29 -3
View File
@@ -16,6 +16,7 @@ type ConvertorHandlerContract interface {
FfPathSelection()
GetFfmpegVersion() (string, error)
GetFfprobeVersion() (string, error)
GetFfplayVersion() (string, error)
}
type ConvertorHandler struct {
@@ -53,13 +54,14 @@ func (h ConvertorHandler) MainConvertor() {
h.convertorView.Main(conversion)
return
}
h.convertorView.SelectFFPath("", "", h.saveSettingFFPath, nil, h.downloadFFmpeg)
h.convertorView.SelectFFPath("", "", "", h.saveSettingFFPath, nil, h.downloadFFmpeg)
}
func (h ConvertorHandler) FfPathSelection() {
ffmpeg, _ := h.convertorRepository.GetPathFfmpeg()
ffprobe, _ := h.convertorRepository.GetPathFfprobe()
h.convertorView.SelectFFPath(ffmpeg, ffprobe, h.saveSettingFFPath, h.MainConvertor, h.downloadFFmpeg)
ffplay, _ := h.convertorRepository.GetPathFfplay()
h.convertorView.SelectFFPath(ffmpeg, ffprobe, ffplay, h.saveSettingFFPath, h.MainConvertor, h.downloadFFmpeg)
}
func (h ConvertorHandler) GetFfmpegVersion() (string, error) {
@@ -70,6 +72,10 @@ func (h ConvertorHandler) GetFfprobeVersion() (string, error) {
return h.app.GetConvertorService().GetFFprobeVersion()
}
func (h ConvertorHandler) GetFfplayVersion() (string, error) {
return h.app.GetConvertorService().GetFFplayVersion()
}
func (h ConvertorHandler) runConvert(setting view.HandleConvertSetting) {
h.app.GetQueue().Add(&kernel.ConvertSetting{
VideoFileInput: setting.FileInput,
@@ -98,15 +104,21 @@ func (h ConvertorHandler) checkingFFPathUtilities() bool {
if ffprobeChecking == false {
continue
}
ffplayChecking, _ := h.app.GetConvertorService().ChangeFFplayPath(item.FFplay)
if ffplayChecking == false {
continue
}
_, _ = h.convertorRepository.SavePathFfmpeg(item.FFmpeg)
_, _ = h.convertorRepository.SavePathFfprobe(item.FFprobe)
_, _ = h.convertorRepository.SavePathFfplay(item.FFplay)
return true
}
return false
}
func (h ConvertorHandler) saveSettingFFPath(ffmpegPath string, ffprobePath string) error {
func (h ConvertorHandler) saveSettingFFPath(ffmpegPath string, ffprobePath string, ffplayPath string) error {
ffmpegChecking, _ := h.app.GetConvertorService().ChangeFFmpegPath(ffmpegPath)
if ffmpegChecking == false {
errorText := h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
@@ -123,8 +135,17 @@ func (h ConvertorHandler) saveSettingFFPath(ffmpegPath string, ffprobePath strin
return errors.New(errorText)
}
ffplayChecking, _ := h.app.GetConvertorService().ChangeFFplayPath(ffplayPath)
if ffplayChecking == false {
errorText := h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
MessageID: "errorFFplay",
})
return errors.New(errorText)
}
_, _ = h.convertorRepository.SavePathFfmpeg(ffmpegPath)
_, _ = h.convertorRepository.SavePathFfprobe(ffprobePath)
_, _ = h.convertorRepository.SavePathFfplay(ffplayPath)
h.MainConvertor()
@@ -142,5 +163,10 @@ func (h ConvertorHandler) checkingFFPath() bool {
return false
}
_, err = h.app.GetConvertorService().GetFFplayVersion()
if err != nil {
return false
}
return true
}
+1 -1
View File
@@ -10,7 +10,7 @@ import (
)
func getPathsToFF() []kernel.FFPathUtilities {
return []kernel.FFPathUtilities{{"ffmpeg/bin/ffmpeg", "ffmpeg/bin/ffprobe"}, {"ffmpeg", "ffprobe"}}
return []kernel.FFPathUtilities{{FFmpeg: "ffmpeg/bin/ffmpeg", FFprobe: "ffmpeg/bin/ffprobe", FFplay: "ffmpeg/bin/ffplay"}, {FFmpeg: "ffmpeg", FFprobe: "ffprobe", FFplay: "ffplay"}}
}
func (h ConvertorHandler) downloadFFmpeg(progressBar *widget.ProgressBar, progressMessage *canvas.Text) (err error) {
+12 -2
View File
@@ -19,7 +19,7 @@ import (
)
func getPathsToFF() []kernel.FFPathUtilities {
return []kernel.FFPathUtilities{{"ffmpeg/bin/ffmpeg", "ffmpeg/bin/ffprobe"}, {"ffmpeg", "ffprobe"}}
return []kernel.FFPathUtilities{{FFmpeg: "ffmpeg/bin/ffmpeg", FFprobe: "ffmpeg/bin/ffprobe", FFplay: "ffmpeg/bin/ffplay"}, {FFmpeg: "ffmpeg", FFprobe: "ffprobe", FFplay: "ffplay"}}
}
func (h ConvertorHandler) downloadFFmpeg(progressBar *widget.ProgressBar, progressMessage *canvas.Text) (err error) {
@@ -60,7 +60,11 @@ func (h ConvertorHandler) downloadFFmpeg(progressBar *widget.ProgressBar, progre
progressMessage.Refresh()
})
err = h.saveSettingFFPath("ffmpeg/ffmpeg-master-latest-linux64-gpl/bin/ffmpeg", "ffmpeg/ffmpeg-master-latest-linux64-gpl/bin/ffprobe")
err = h.saveSettingFFPath(
"ffmpeg/ffmpeg-master-latest-linux64-gpl/bin/ffmpeg",
"ffmpeg/ffmpeg-master-latest-linux64-gpl/bin/ffprobe",
"ffmpeg/ffmpeg-master-latest-linux64-gpl/bin/ffplay",
)
if err != nil {
return err
}
@@ -217,6 +221,12 @@ func unTarXz(fileTar string, directory string, progressBar *widget.ProgressBar)
return err
}
ffplayPath := filepath.Join(directory, "ffmpeg-master-latest-linux64-gpl", "bin", "ffplay")
err = os.Chmod(ffplayPath, 0755)
if err != nil {
return err
}
return nil
}
+6 -2
View File
@@ -19,7 +19,7 @@ import (
)
func getPathsToFF() []kernel.FFPathUtilities {
return []kernel.FFPathUtilities{{"ffmpeg\\bin\\ffmpeg.exe", "ffmpeg\\bin\\ffprobe.exe"}}
return []kernel.FFPathUtilities{{FFmpeg: "ffmpeg\\bin\\ffmpeg.exe", FFprobe: "ffmpeg\\bin\\ffprobe.exe", FFplay: "ffmpeg\\bin\\ffplay.exe"}}
}
func (h ConvertorHandler) downloadFFmpeg(progressBar *widget.ProgressBar, progressMessage *canvas.Text) (err error) {
@@ -59,7 +59,11 @@ func (h ConvertorHandler) downloadFFmpeg(progressBar *widget.ProgressBar, progre
fyne.Do(func() {
progressMessage.Refresh()
})
err = h.saveSettingFFPath("ffmpeg/ffmpeg-master-latest-win64-gpl/bin/ffmpeg.exe", "ffmpeg/ffmpeg-master-latest-win64-gpl/bin/ffprobe.exe")
err = h.saveSettingFFPath(
"ffmpeg/ffmpeg-master-latest-win64-gpl/bin/ffmpeg.exe",
"ffmpeg/ffmpeg-master-latest-win64-gpl/bin/ffprobe.exe",
"ffmpeg/ffmpeg-master-latest-win64-gpl/bin/ffplay.exe",
)
if err != nil {
return err
}
+7 -1
View File
@@ -117,8 +117,14 @@ func (h MenuHandler) openAbout() {
MessageID: "errorFFprobeVersion",
})
}
ffplay, err := h.convertorHandler.GetFfplayVersion()
if err != nil {
ffplay = h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
MessageID: "errorFFplayVersion",
})
}
h.menuView.About(ffmpeg, ffprobe)
h.menuView.About(ffmpeg, ffprobe, ffplay)
}
func (h MenuHandler) openGratitude() {