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:
@@ -9,6 +9,8 @@ type RepositoryContract interface {
|
||||
SavePathFfmpeg(code string) (setting.Setting, error)
|
||||
GetPathFfprobe() (string, error)
|
||||
SavePathFfprobe(code string) (setting.Setting, error)
|
||||
GetPathFfplay() (string, error)
|
||||
SavePathFfplay(code string) (setting.Setting, error)
|
||||
}
|
||||
|
||||
type Repository struct {
|
||||
@@ -34,3 +36,11 @@ func (r Repository) GetPathFfprobe() (string, error) {
|
||||
func (r Repository) SavePathFfprobe(path string) (setting.Setting, error) {
|
||||
return r.settingRepository.CreateOrUpdate("ffprobe", path)
|
||||
}
|
||||
|
||||
func (r Repository) GetPathFfplay() (string, error) {
|
||||
return r.settingRepository.GetValue("ffplay")
|
||||
}
|
||||
|
||||
func (r Repository) SavePathFfplay(path string) (setting.Setting, error) {
|
||||
return r.settingRepository.CreateOrUpdate("ffplay", path)
|
||||
}
|
||||
|
@@ -18,7 +18,8 @@ type ViewContract interface {
|
||||
SelectFFPath(
|
||||
ffmpegPath string,
|
||||
ffprobePath string,
|
||||
save func(ffmpegPath string, ffprobePath string) error,
|
||||
ffplayPath string,
|
||||
save func(ffmpegPath string, ffprobePath string, ffplayPath string) error,
|
||||
cancel func(),
|
||||
donwloadFFmpeg func(progressBar *widget.ProgressBar, progressMessage *canvas.Text) error,
|
||||
)
|
||||
|
@@ -15,7 +15,8 @@ import (
|
||||
func (v View) SelectFFPath(
|
||||
currentPathFfmpeg string,
|
||||
currentPathFfprobe string,
|
||||
save func(ffmpegPath string, ffprobePath string) error,
|
||||
currentPathFfplay string,
|
||||
save func(ffmpegPath string, ffprobePath string, ffplayPath string) error,
|
||||
cancel func(),
|
||||
donwloadFFmpeg func(progressBar *widget.ProgressBar, progressMessage *canvas.Text) error,
|
||||
) {
|
||||
@@ -25,6 +26,7 @@ func (v View) SelectFFPath(
|
||||
|
||||
ffmpegPath, buttonFFmpeg, buttonFFmpegMessage := v.getButtonSelectFile(currentPathFfmpeg)
|
||||
ffprobePath, buttonFFprobe, buttonFFprobeMessage := v.getButtonSelectFile(currentPathFfprobe)
|
||||
ffplayPath, buttonFFplay, buttonFFplayMessage := v.getButtonSelectFile(currentPathFfplay)
|
||||
|
||||
link := widget.NewHyperlink("https://ffmpeg.org/download.html", &url.URL{
|
||||
Scheme: "https",
|
||||
@@ -58,6 +60,15 @@ func (v View) SelectFFPath(
|
||||
{
|
||||
Widget: container.NewHScroll(buttonFFprobeMessage),
|
||||
},
|
||||
{
|
||||
Text: v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "pathToFfplay",
|
||||
}),
|
||||
Widget: buttonFFplay,
|
||||
},
|
||||
{
|
||||
Widget: container.NewHScroll(buttonFFplayMessage),
|
||||
},
|
||||
{
|
||||
Widget: errorMessage,
|
||||
},
|
||||
@@ -66,7 +77,7 @@ func (v View) SelectFFPath(
|
||||
MessageID: "save",
|
||||
}),
|
||||
OnSubmit: func() {
|
||||
err := save(*ffmpegPath, *ffprobePath)
|
||||
err := save(*ffmpegPath, *ffprobePath, *ffplayPath)
|
||||
if err != nil {
|
||||
errorMessage.Text = err.Error()
|
||||
}
|
||||
|
Reference in New Issue
Block a user