forked from gustaavik/wails-sveltekit-ts-tw-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp_ffmpeg.go
More file actions
45 lines (37 loc) · 1.27 KB
/
app_ffmpeg.go
File metadata and controls
45 lines (37 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//go:build !appstore
package main
import (
"converzen/internal/logger"
"converzen/internal/services"
"converzen/pkg/ffmpeg"
)
// ffmpegInstance holds the FFmpeg instance for non-App Store builds
var ffmpegInstance *ffmpeg.FFmpeg
// initVideoConverter initializes the video converter for non-App Store builds (using FFmpeg)
func (a *App) initVideoConverter(log *logger.Logger) services.Converter {
// Initialize FFmpeg
ffmpegInstance = ffmpeg.New(a.config.FFmpegPath, log)
if ffmpegInstance.IsAvailable() {
if version, err := ffmpegInstance.GetVersion(); err == nil {
log.Info("app", "FFmpeg version: %s", version)
}
} else {
log.Warn("app", "FFmpeg not found - video conversion will not work")
}
return services.NewVideoConverter(ffmpegInstance, log)
}
// isFFmpegAvailable returns whether FFmpeg is available (for non-App Store builds)
func (a *App) isFFmpegAvailable() bool {
return ffmpegInstance != nil && ffmpegInstance.IsAvailable()
}
// getConverterBackend returns the name of the converter backend
func (a *App) getConverterBackend() string {
return "ffmpeg"
}
// getConverterVersion returns the version of the converter backend
func (a *App) getConverterVersion() (string, error) {
if ffmpegInstance != nil {
return ffmpegInstance.GetVersion()
}
return "", nil
}