From 6e8b148c81caf0dbc1bdd6750033d4f42612ed75 Mon Sep 17 00:00:00 2001 From: Leonid Nikitin Date: Sat, 7 Jun 2025 23:43:32 +0500 Subject: [PATCH] Made it so that you can play files through FFplay. --- internal/ffmpeg/ffplay.go | 8 ++++++++ internal/ffmpeg/utilities.go | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/internal/ffmpeg/ffplay.go b/internal/ffmpeg/ffplay.go index 6fdf209..c888842 100644 --- a/internal/ffmpeg/ffplay.go +++ b/internal/ffmpeg/ffplay.go @@ -10,6 +10,7 @@ import ( type FFplayContract interface { GetPath() string + Play(file *File) error } type ffplay struct { @@ -38,6 +39,13 @@ func (f *ffplay) GetPath() string { return f.path } +func (f *ffplay) Play(file *File) error { + args := []string{file.Path} + cmd := exec.Command(f.GetPath(), args...) + + return cmd.Run() +} + func checkFFplayPath(path string) (bool, error) { cmd := exec.Command(path, "-version") utils.PrepareBackgroundCommand(cmd) diff --git a/internal/ffmpeg/utilities.go b/internal/ffmpeg/utilities.go index c8c6428..5c7c891 100644 --- a/internal/ffmpeg/utilities.go +++ b/internal/ffmpeg/utilities.go @@ -4,8 +4,22 @@ import ( "errors" "fyne.io/fyne/v2/lang" "git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application/setting" + "git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg/encoder" ) +type File struct { + Path string + Name string + Ext string +} + +type ConvertSetting struct { + VideoFileInput File + VideoFileOut File + OverwriteOutputFiles bool + Encoder encoder.EncoderContract +} + type UtilitiesContract interface { UtilityCheck() bool