Made it possible for each encoder to add its own parameters.

Added preset option for libx264.
This commit is contained in:
Leonid Nikitin 2024-03-17 20:28:35 +05:00
parent 8347e9fbb2
commit 21d4afcedb
Signed by: kor-elf
GPG Key ID: 3C0F720C170F6E1D
41 changed files with 559 additions and 254 deletions

View File

@ -7,6 +7,7 @@ import (
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/storage"
"fyne.io/fyne/v2/widget"
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/convertor/view/form_items"
encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel/encoder"
@ -22,7 +23,7 @@ type ConversionContract interface {
type Conversion struct {
app kernel.AppContract
form *widget.Form
form *form
conversionMessage *canvas.Text
fileForConversion *fileForConversion
directoryForSaving *directoryForSaving
@ -49,8 +50,7 @@ func NewConversion(app kernel.AppContract, formats encoder.ConvertorFormatsContr
overwriteOutputFiles := newOverwriteOutputFiles(app)
selectEncoder := newSelectEncoder(app, formats)
form := widget.NewForm()
form.Items = []*widget.FormItem{
items := []*widget.FormItem{
{
Text: app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "fileForConversionTitle"}),
Widget: fileForConversion.button,
@ -80,9 +80,7 @@ func NewConversion(app kernel.AppContract, formats encoder.ConvertorFormatsContr
Widget: selectEncoder.SelectEncoder,
},
}
form.SubmitText = app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
MessageID: "converterVideoFilesSubmitTitle",
})
form := newForm(app, items)
return &Conversion{
app: app,
@ -97,27 +95,41 @@ func NewConversion(app kernel.AppContract, formats encoder.ConvertorFormatsContr
}
func (c Conversion) GetContent() fyne.CanvasObject {
c.form.OnSubmit = c.submit
c.form.form.OnSubmit = c.submit
c.fileForConversion.AddChangeCallback(c.selectFileForConversion)
c.selectEncoder.AddChangeCallback(c.changeEncoder)
if c.selectEncoder.Encoder != nil {
c.selectEncoder.SelectEncoder.SetSelectedIndex(c.selectEncoder.SelectEncoder.SelectedIndex())
}
return container.NewVBox(
c.form,
c.form.form,
c.conversionMessage,
)
}
func (c Conversion) changeEncoder(encoder encoder2.EncoderContract) {
items := []*widget.FormItem{}
if form_items.Views[encoder.GetName()] != nil {
items = form_items.Views[encoder.GetName()](encoder, c.app)
}
c.form.ChangeItems(items)
}
func (c Conversion) AfterViewContent() {
c.form.Disable()
c.form.form.Disable()
}
func (c Conversion) selectFileForConversion(err error) {
c.conversionMessage.Text = ""
if err != nil {
c.form.Disable()
c.form.form.Disable()
return
}
c.form.Enable()
c.form.form.Enable()
}
func (c Conversion) submit() {
@ -144,7 +156,7 @@ func (c Conversion) submit() {
c.fileForConversion.button.Disable()
c.directoryForSaving.button.Disable()
c.form.Disable()
c.form.form.Disable()
setting := HandleConvertSetting{
FileInput: *c.fileForConversion.file,
@ -157,13 +169,13 @@ func (c Conversion) submit() {
c.enableFormConversion()
c.fileForConversion.message.Text = ""
c.form.Disable()
c.form.form.Disable()
}
func (c Conversion) enableFormConversion() {
c.fileForConversion.button.Enable()
c.directoryForSaving.button.Enable()
c.form.Enable()
c.form.form.Enable()
}
type fileForConversion struct {
@ -301,17 +313,22 @@ type selectEncoder struct {
SelectFormat *widget.Select
SelectEncoder *widget.Select
Encoder encoder2.EncoderContract
changeCallbacks map[int]func(encoder encoder2.EncoderContract)
}
func newSelectEncoder(app kernel.AppContract, formats encoder.ConvertorFormatsContract) *selectEncoder {
selectEncoder := &selectEncoder{}
selectEncoder := &selectEncoder{
changeCallbacks: map[int]func(encoder encoder2.EncoderContract){},
}
encoders := map[int]encoder2.EncoderDataContract{}
selectEncoder.SelectEncoder = widget.NewSelect([]string{}, func(s string) {
if encoders[selectEncoder.SelectEncoder.SelectedIndex()] == nil {
return
}
selectEncoder.Encoder = encoders[selectEncoder.SelectEncoder.SelectedIndex()].NewEncoder()
selectEncoderData := encoders[selectEncoder.SelectEncoder.SelectedIndex()]
selectEncoder.ChangeEncoder(selectEncoderData.NewEncoder())
})
formatSelected := ""
@ -325,8 +342,9 @@ func newSelectEncoder(app kernel.AppContract, formats encoder.ConvertorFormatsCo
return
}
encoderOptions := []string{}
encoders = format.GetEncoders()
for _, e := range encoders {
encoders = map[int]encoder2.EncoderDataContract{}
for _, e := range format.GetEncoders() {
encoders[len(encoders)] = e
encoderOptions = append(encoderOptions, app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "encoder_" + e.GetTitle()}))
}
selectEncoder.SelectEncoder.SetOptions(encoderOptions)
@ -364,11 +382,27 @@ func newSelectEncoder(app kernel.AppContract, formats encoder.ConvertorFormatsCo
}
})
selectEncoder.SelectFileType.Horizontal = true
selectEncoder.SelectFileType.Required = true
selectEncoder.SelectFileType.SetSelected(encoderGroupVideo)
return selectEncoder
}
func (e *selectEncoder) ChangeEncoder(encoder encoder2.EncoderContract) {
e.Encoder = encoder
e.eventSelectEncoder(e.Encoder)
}
func (e *selectEncoder) AddChangeCallback(callback func(encoder encoder2.EncoderContract)) {
e.changeCallbacks[len(e.changeCallbacks)] = callback
}
func (e *selectEncoder) eventSelectEncoder(encoder encoder2.EncoderContract) {
for _, changeCallback := range e.changeCallbacks {
changeCallback(encoder)
}
}
func setStringErrorStyle(text *canvas.Text) {
text.Color = color.RGBA{R: 255, G: 0, B: 0, A: 255}
text.Refresh()
@ -383,3 +417,28 @@ func showConversionMessage(conversionMessage *canvas.Text, err error) {
conversionMessage.Text = err.Error()
setStringErrorStyle(conversionMessage)
}
type form struct {
form *widget.Form
items []*widget.FormItem
}
func newForm(app kernel.AppContract, items []*widget.FormItem) *form {
f := widget.NewForm()
f.SubmitText = app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{
MessageID: "converterVideoFilesSubmitTitle",
})
f.Items = items
return &form{
form: f,
items: items,
}
}
func (f form) ChangeItems(items []*widget.FormItem) {
f.form.Items = f.items
f.form.Refresh()
f.form.Items = append(f.form.Items, items...)
f.form.Refresh()
}

View File

@ -0,0 +1,12 @@
package form_items
import (
"fyne.io/fyne/v2/widget"
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/convertor/view/form_items/libx264"
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
)
var Views = map[string]func(encoder encoder.EncoderContract, app kernel.AppContract) []*widget.FormItem{
"libx264": libx264.View,
}

View File

@ -0,0 +1,65 @@
package libx264
import (
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder/libx264"
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
"github.com/nicksnyder/go-i18n/v2/i18n"
)
func View(encoder encoder.EncoderContract, app kernel.AppContract) []*widget.FormItem {
items := []*widget.FormItem{}
items = append(items, presetParameter(encoder, app)...)
return items
}
func presetParameter(encoder encoder.EncoderContract, app kernel.AppContract) []*widget.FormItem {
parameter, err := encoder.GetParameter("preset")
if err != nil {
return nil
}
presets := map[string]string{}
presetsForSelect := []string{}
presetDefault := ""
for _, name := range libx264.Presets {
title := app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "preset_" + name})
presetsForSelect = append(presetsForSelect, title)
presets[title] = name
if name == parameter.Get() {
presetDefault = title
}
}
elementSelect := widget.NewSelect(presetsForSelect, func(s string) {
if presets[s] == "" {
return
}
parameter.Set(presets[s])
})
elementSelect.SetSelected(presetDefault)
elementSelect.Hide()
checkboxTitle := app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "parameterCheckbox"})
elementCheckbox := widget.NewCheck(checkboxTitle, func(b bool) {
if b == true {
parameter.SetEnable()
elementSelect.Show()
return
}
parameter.SetDisable()
elementSelect.Hide()
})
return []*widget.FormItem{
{
Text: app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{MessageID: "formPreset"}),
Widget: container.NewVBox(elementCheckbox, elementSelect),
},
}
}

View File

@ -2,15 +2,13 @@ package apng
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "apng"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "apng"}
return encoder2.NewEncoder("apng", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package bmp
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "bmp"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "bmp"}
return encoder2.NewEncoder("bmp", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -1,7 +1,20 @@
package encoder
import "errors"
type EncoderContract interface {
GetName() string
GetParams() []string
GetParameter(name string) (ParameterContract, error)
}
type ParameterContract interface {
GetName() string
Set(string) error
Get() string
IsEnabled() bool
SetEnable()
SetDisable()
}
type EncoderDataContract interface {
@ -77,3 +90,80 @@ func GetListFileType() []FileTypeContract {
FileType(Image),
}
}
type Encoder struct {
name string
parameters map[string]ParameterContract
getParams func(parameters map[string]ParameterContract) []string
}
func NewEncoder(name string, parameters map[string]ParameterContract, getParams func(parameters map[string]ParameterContract) []string) *Encoder {
return &Encoder{
name: name,
parameters: parameters,
getParams: getParams,
}
}
func (e *Encoder) GetName() string {
return e.name
}
func (e *Encoder) GetParams() []string {
return e.getParams(e.parameters)
}
func (e *Encoder) GetParameter(name string) (ParameterContract, error) {
if e.parameters[name] == nil {
return nil, errors.New("parameter not found")
}
return e.parameters[name], nil
}
type Parameter struct {
name string
isEnabled bool
parameter string
setParameter func(string) (string, error)
}
func NewParameter(name string, isEnabled bool, defaultParameter string, setParameter func(string) (string, error)) *Parameter {
return &Parameter{
name: name,
isEnabled: isEnabled,
parameter: defaultParameter,
setParameter: setParameter,
}
}
func (p *Parameter) GetName() string {
return p.name
}
func (p *Parameter) Set(s string) (err error) {
if p.setParameter != nil {
s, err = p.setParameter(s)
if err != nil {
return err
}
}
p.parameter = s
return nil
}
func (p *Parameter) Get() string {
return p.parameter
}
func (p *Parameter) IsEnabled() bool {
return p.isEnabled
}
func (p *Parameter) SetEnable() {
p.isEnabled = true
}
func (p *Parameter) SetDisable() {
p.isEnabled = false
}

View File

@ -2,15 +2,13 @@ package flv
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "flv"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "flv"}
return encoder2.NewEncoder("flv", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package gif
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "gif"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "gif"}
return encoder2.NewEncoder("gif", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -4,15 +4,13 @@ import (
encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
)
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "h264_nvenc"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "h264_nvenc"}
return encoder2.NewEncoder("h264_nvenc", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package libmp3lame
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:a", "libmp3lame"}
}
func (e encoder) GetParams() []string {
return []string{"-c:a", "libmp3lame"}
return encoder2.NewEncoder("libmp3lame", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package libshine
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:a", "libshine"}
}
func (e encoder) GetParams() []string {
return []string{"-c:a", "libshine"}
return encoder2.NewEncoder("libshine", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package libtwolame
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:a", "libtwolame"}
}
func (e encoder) GetParams() []string {
return []string{"-c:a", "libtwolame"}
return encoder2.NewEncoder("libtwolame", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package libvpx
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "libvpx"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "libvpx"}
return encoder2.NewEncoder("libvpx", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package libvpx_vp9
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "libvpx-vp9"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "libvpx-vp9"}
return encoder2.NewEncoder("libvpx_vp9", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package libwebp
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "libwebp"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "libwebp"}
return encoder2.NewEncoder("libwebp", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package libwebp_anim
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "libwebp_anim"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "libwebp_anim"}
return encoder2.NewEncoder("libwebp_anim", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -1,16 +1,38 @@
package libx264
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
import (
"errors"
encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
)
type encoder struct {
var Presets = []string{
"ultrafast",
"superfast",
"veryfast",
"faster",
"fast",
"medium",
"slow",
"slower",
"veryslow",
"placebo",
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{
"preset": newParameterPreset(),
}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
params := []string{"-c:v", "libx264"}
func (e encoder) GetParams() []string {
return []string{"-c:v", "libx264"}
if parameters["preset"] != nil && parameters["preset"].IsEnabled() {
params = append(params, "-preset", parameters["preset"].Get())
}
return params
}
return encoder2.NewEncoder("libx264", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {
@ -19,3 +41,16 @@ func NewData() encoder2.EncoderDataContract {
fileType := encoder2.FileType(encoder2.Video)
return encoder2.NewData(title, formats, fileType, NewEncoder)
}
func newParameterPreset() encoder2.ParameterContract {
setParameter := func(s string) (string, error) {
for _, value := range Presets {
if value == s {
return value, nil
}
}
return "", errors.New("preset not found")
}
return encoder2.NewParameter("preset", false, "medium", setParameter)
}

View File

@ -2,15 +2,13 @@ package libx265
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "libx265"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "libx265"}
return encoder2.NewEncoder("libx265", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package libxvid
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "libxvid"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "libxvid"}
return encoder2.NewEncoder("libxvid", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package mjpeg
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "mjpeg"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "mjpeg"}
return encoder2.NewEncoder("mjpeg", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package mp2
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:a", "mp2"}
}
func (e encoder) GetParams() []string {
return []string{"-c:a", "mp2"}
return encoder2.NewEncoder("mp2", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package mp2fixed
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:a", "mp2fixed"}
}
func (e encoder) GetParams() []string {
return []string{"-c:a", "mp2fixed"}
return encoder2.NewEncoder("mp2fixed", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package mpeg1video
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "mpeg1video"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "mpeg1video"}
return encoder2.NewEncoder("mpeg1video", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package mpeg2video
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "mpeg2video"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "mpeg2video"}
return encoder2.NewEncoder("mpeg2video", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package mpeg4
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "mpeg4"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "mpeg4"}
return encoder2.NewEncoder("mpeg4", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package msmpeg4
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "msmpeg4"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "msmpeg4"}
return encoder2.NewEncoder("msmpeg4", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package msmpeg4v2
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "msmpeg4v2"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "msmpeg4v2"}
return encoder2.NewEncoder("msmpeg4v2", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package msvideo1
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "msvideo1"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "msvideo1"}
return encoder2.NewEncoder("msvideo1", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package png
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "png"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "png"}
return encoder2.NewEncoder("png", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package qtrle
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "qtrle"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "qtrle"}
return encoder2.NewEncoder("qtrle", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package sgi
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "sgi"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "sgi"}
return encoder2.NewEncoder("sgi", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package tiff
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "tiff"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "tiff"}
return encoder2.NewEncoder("tiff", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package wmav1
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:a", "wmav1"}
}
func (e encoder) GetParams() []string {
return []string{"-c:a", "wmav1"}
return encoder2.NewEncoder("wmav1", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package wmav2
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:a", "wmav2"}
}
func (e encoder) GetParams() []string {
return []string{"-c:a", "wmav2"}
return encoder2.NewEncoder("wmav2", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package wmv1
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "wmv1"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "wmv1"}
return encoder2.NewEncoder("wmv1", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package wmv2
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "wmv2"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "wmv2"}
return encoder2.NewEncoder("wmv2", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -2,15 +2,13 @@ package xbm
import encoder2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/encoder"
type encoder struct {
}
func NewEncoder() encoder2.EncoderContract {
return &encoder{}
}
parameters := map[string]encoder2.ParameterContract{}
getParams := func(parameters map[string]encoder2.ParameterContract) []string {
return []string{"-c:v", "xbm"}
}
func (e encoder) GetParams() []string {
return []string{"-c:v", "xbm"}
return encoder2.NewEncoder("xbm", parameters, getParams)
}
func NewData() encoder2.EncoderDataContract {

View File

@ -266,6 +266,10 @@ other = "**FFmpeg** is a trademark of **[Fabrice Bellard](http://bellard.org/)**
hash = "sha1-96ac799e1086b31fd8f5f8d4c801829d6c853f08"
other = "File:"
[formPreset]
hash = "sha1-7759891ba1ef9f7adc70defc7ac18fbf149c1a68"
other = "Preset"
[help]
hash = "sha1-6a45cef900c668effcb2ab10da05855c1fd10f6f"
other = "Help"
@ -290,6 +294,10 @@ other = "License information"
hash = "sha1-359fff328717c05104e51a2d29f05bf1875d26b7"
other = "Licenses from other products used in the program"
[parameterCheckbox]
hash = "sha1-9e35221d454870996fd51d576249cf47d1784a3c"
other = "Enable option"
[pathToFfmpeg]
hash = "sha1-fafc50f1db0f720fe83a96cd70a9e1ad824e96b6"
other = "Path to FFmpeg:"
@ -298,6 +306,46 @@ other = "Path to FFmpeg:"
hash = "sha1-b872edc9633a2e81ef678dc46fe46a7e91732024"
other = "Path to FFprobe:"
[preset_fast]
hash = "sha1-935e1ac9d3c8ba4478326c909ba66662acb0540e"
other = "fast (slower than \"faster\", but the file will weigh less)"
[preset_faster]
hash = "sha1-98620b73c896440c39ea6ec4b9b19d41301c9a7e"
other = "faster (slower than \"veryfast\", but the file will weigh less)"
[preset_medium]
hash = "sha1-f7d1c30135c22c2f07c247075c0df103bb3c3ea5"
other = "medium (slower than \"fast\", but the file will weigh less)"
[preset_placebo]
hash = "sha1-7bcff099104bb192881139e6404981bd426b3f91"
other = "placebo (not recommended)"
[preset_slow]
hash = "sha1-681bf587275a45b48af49bb2ad8f0947919530e7"
other = "slow (slower than \"medium\", but the file will weigh less)"
[preset_slower]
hash = "sha1-d1c692ee2b7643ae2c71a48bea880327a3c6b1e3"
other = "slower (slower than \"slow\", but the file will weigh less)"
[preset_superfast]
hash = "sha1-41c39959e8f1547cc9259a5b459c4ccbf368cc23"
other = "superfast (slower than \"ultrafast\", but the file will weigh less)"
[preset_ultrafast]
hash = "sha1-dfed981573ac2046832f9a9450bc9388958753fa"
other = "ultrafast (fast, but the file will weigh a lot)"
[preset_veryfast]
hash = "sha1-370b82509887d02d7a2ef9b110df4616b16123ce"
other = "veryfast (slower than \"superfast\", but the file will weigh less)"
[preset_veryslow]
hash = "sha1-d428bfa6deea9dd5c7c1f80ceba24e123ae96d0d"
other = "veryslow (slower than \"slower\", but the file will weigh less)"
[programmLink]
hash = "sha1-18f9a3fad6aacefe1b05eed23122800b391ff5ca"
other = "Project website"
@ -315,8 +363,8 @@ hash = "sha1-4864057d626a868fa60f999bed3191d61d045ddc"
other = "Save"
[selectEncoder]
hash = "sha1-db41d1c87b2fbe561bbdcc03919d3a55360bb7d8"
other = "Converter:"
hash = "sha1-88f3670b09758a3336057520a215058d61006abd"
other = "Encoder:"
[selectFFPathTitle]
hash = "sha1-95581446a28d968ff1a027c623159a7eb08654cf"

View File

@ -266,6 +266,10 @@ other = "FFmpeg — **[FFmpeg](https://ffmpeg.org/about.html)** жобасын
hash = "sha1-96ac799e1086b31fd8f5f8d4c801829d6c853f08"
other = "Файл:"
[formPreset]
hash = "sha1-7759891ba1ef9f7adc70defc7ac18fbf149c1a68"
other = "Алдын ала орнатылған"
[help]
hash = "sha1-6a45cef900c668effcb2ab10da05855c1fd10f6f"
other = "Анықтама"
@ -290,6 +294,10 @@ other = "Лицензия туралы ақпарат"
hash = "sha1-359fff328717c05104e51a2d29f05bf1875d26b7"
other = "Бағдарламада пайдаланылатын басқа өнімдердің лицензиялары"
[parameterCheckbox]
hash = "sha1-9e35221d454870996fd51d576249cf47d1784a3c"
other = "Опцияны қосу"
[pathToFfmpeg]
hash = "sha1-fafc50f1db0f720fe83a96cd70a9e1ad824e96b6"
other = "FFmpeg жол:"
@ -298,6 +306,46 @@ other = "FFmpeg жол:"
hash = "sha1-b872edc9633a2e81ef678dc46fe46a7e91732024"
other = "FFprobe жол:"
[preset_fast]
hash = "sha1-935e1ac9d3c8ba4478326c909ba66662acb0540e"
other = "fast («faster» қарағанда баяуырақ, бірақ файлдың салмағы аз болады)"
[preset_faster]
hash = "sha1-98620b73c896440c39ea6ec4b9b19d41301c9a7e"
other = "faster («veryfast» қарағанда баяуырақ, бірақ файлдың салмағы аз болады)"
[preset_medium]
hash = "sha1-f7d1c30135c22c2f07c247075c0df103bb3c3ea5"
other = "medium («fast» қарағанда баяуырақ, бірақ файлдың салмағы аз болады)"
[preset_placebo]
hash = "sha1-7bcff099104bb192881139e6404981bd426b3f91"
other = "placebo (ұсынылмайды)"
[preset_slow]
hash = "sha1-681bf587275a45b48af49bb2ad8f0947919530e7"
other = "slow («medium» қарағанда баяуырақ, бірақ файлдың салмағы аз болады)"
[preset_slower]
hash = "sha1-d1c692ee2b7643ae2c71a48bea880327a3c6b1e3"
other = "slower («slow» қарағанда баяуырақ, бірақ файлдың салмағы аз болады)"
[preset_superfast]
hash = "sha1-41c39959e8f1547cc9259a5b459c4ccbf368cc23"
other = "superfast («ultrafast» қарағанда баяуырақ, бірақ файлдың салмағы аз болады)"
[preset_ultrafast]
hash = "sha1-dfed981573ac2046832f9a9450bc9388958753fa"
other = "ultrafast (жылдам, бірақ файлдың салмағы көп болады)"
[preset_veryfast]
hash = "sha1-370b82509887d02d7a2ef9b110df4616b16123ce"
other = "veryfast («superfast» қарағанда баяуырақ, бірақ файлдың салмағы аз болады)"
[preset_veryslow]
hash = "sha1-d428bfa6deea9dd5c7c1f80ceba24e123ae96d0d"
other = "veryslow («slower» қарағанда баяуырақ, бірақ файлдың салмағы аз болады)"
[programmLink]
hash = "sha1-18f9a3fad6aacefe1b05eed23122800b391ff5ca"
other = "Жобаның веб-сайты"
@ -315,8 +363,8 @@ hash = "sha1-4864057d626a868fa60f999bed3191d61d045ddc"
other = "Сақтау"
[selectEncoder]
hash = "sha1-db41d1c87b2fbe561bbdcc03919d3a55360bb7d8"
other = "Түрлендіргіш:"
hash = "sha1-88f3670b09758a3336057520a215058d61006abd"
other = "Кодировщик:"
[selectFFPathTitle]
hash = "sha1-95581446a28d968ff1a027c623159a7eb08654cf"

View File

@ -65,19 +65,31 @@ exit = "Выход"
ffmpegLGPL = "Это программное обеспечение использует библиотеки из проекта **FFmpeg** под **[LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)**."
ffmpegTrademark = "**FFmpeg** — торговая марка **[Fabrice Bellard](http://bellard.org/)** , создателя проекта **[FFmpeg](https://ffmpeg.org/about.html)**."
fileForConversionTitle = "Файл:"
formPreset = "Предустановка"
help = "Справка"
inProgressQueue = "Выполняется"
languageSelectionFormHead = "Переключить язык"
languageSelectionHead = "Выберите язык"
licenseLink = "Сведения о лицензии"
licenseLinkOther = "Лицензии от других продуктов, которые используются в программе"
parameterCheckbox = "Включить параметр"
pathToFfmpeg = "Путь к FFmpeg:"
pathToFfprobe = "Путь к FFprobe:"
preset_fast = "fast (медленней чем faster, но будет файл и меньше весить)"
preset_faster = "faster (медленней чем veryfast, но будет файл и меньше весить)"
preset_medium = "medium (медленней чем fast, но будет файл и меньше весить)"
preset_placebo = "placebo (не рекомендуется)"
preset_slow = "slow (медленней чем medium, но будет файл и меньше весить)"
preset_slower = "slower (медленней чем slow, но будет файл и меньше весить)"
preset_superfast = "superfast (медленней чем ultrafast, но будет файл и меньше весить)"
preset_ultrafast = "ultrafast (быстро, но файл будет много весить)"
preset_veryfast = "veryfast (медленней чем superfast, но будет файл и меньше весить)"
preset_veryslow = "veryslow (медленней чем slower, но будет файл и меньше весить)"
programmLink = "Сайт проекта"
programmVersion = "**Версия программы:** {{.Version}}"
queue = "Очередь"
save = "Сохранить"
selectEncoder = "Конвертер:"
selectEncoder = "Кодировщик:"
selectFFPathTitle = "Укажите путь к FFmpeg и к FFprobe"
selectFormat = "Расширение файла:"
settings = "Настройки"

View File

@ -26,7 +26,7 @@ func init() {
appMetadata := &fyne.AppMetadata{
ID: "net.kor-elf.projects.gui-for-ffmpeg",
Name: "GUI for FFmpeg",
Version: "0.5.0",
Version: "0.6.0",
Icon: iconResource,
}