I decided to rewrite the program taking into account the experience gained.
49 lines
914 B
Go
49 lines
914 B
Go
package ffmpeg
|
|
|
|
import (
|
|
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application/setting"
|
|
)
|
|
|
|
type UtilitiesContract interface {
|
|
GetFFmpeg() FFmpegContract
|
|
GetFFprobe() FFprobeContract
|
|
GetFFplay() FFplayContract
|
|
}
|
|
|
|
type utilities struct {
|
|
setting setting.SettingContract
|
|
ffmpeg FFmpegContract
|
|
ffprobe FFprobeContract
|
|
ffplay FFplayContract
|
|
}
|
|
|
|
func NewUtilities(setting setting.SettingContract) UtilitiesContract {
|
|
return &utilities{
|
|
setting: setting,
|
|
}
|
|
}
|
|
|
|
func (u *utilities) GetFFmpeg() FFmpegContract {
|
|
if u.ffmpeg == nil {
|
|
u.ffmpeg = newFFmpeg(u.setting.GetFFmpegPath())
|
|
}
|
|
|
|
return u.ffmpeg
|
|
}
|
|
|
|
func (u *utilities) GetFFprobe() FFprobeContract {
|
|
if u.ffprobe != nil {
|
|
u.ffprobe = newFFprobe(u.setting.GetFFprobePath())
|
|
}
|
|
|
|
return u.ffprobe
|
|
}
|
|
|
|
func (u *utilities) GetFFplay() FFplayContract {
|
|
if u.ffplay == nil {
|
|
u.ffplay = newFFplay(u.setting.GetFFplayPath())
|
|
}
|
|
|
|
return u.ffplay
|
|
}
|