Add initial implementations for encoder handling and conversion logic
Introduce encoder modules for various codecs and formats (e.g., h264_nvenc, libx264, libmp3lame). Add `Convertor` logic to retrieve supported formats via FFmpeg utilities and manage encoders for audio, video, and image processing.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package ffmpeg
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fyne.io/fyne/v2/lang"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/utils"
|
||||
@@ -10,6 +11,7 @@ import (
|
||||
|
||||
type FFmpegContract interface {
|
||||
GetPath() string
|
||||
GetEncoders(scanner func(scanner *bufio.Reader)) error
|
||||
}
|
||||
|
||||
type ffmpeg struct {
|
||||
@@ -38,6 +40,26 @@ func (f *ffmpeg) GetPath() string {
|
||||
return f.path
|
||||
}
|
||||
|
||||
func (f *ffmpeg) GetEncoders(scanner func(scanner *bufio.Reader)) error {
|
||||
cmd := exec.Command(f.path, "-encoders")
|
||||
utils.PrepareBackgroundCommand(cmd)
|
||||
|
||||
stdOut, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = cmd.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
scannerErr := bufio.NewReader(stdOut)
|
||||
scanner(scannerErr)
|
||||
|
||||
return cmd.Wait()
|
||||
}
|
||||
|
||||
func checkFFmpegPath(path string) (bool, error) {
|
||||
cmd := exec.Command(path, "-version")
|
||||
utils.PrepareBackgroundCommand(cmd)
|
||||
|
Reference in New Issue
Block a user