Wails v2 + Vue3 + Go project with: - Encode/Remux/Subtitle burn with hardware acceleration - Real-time progress with ffmpeg stderr parsing (\r delimiter handling) - Task queue with cancel support - Per-task log viewer with color-coded output - Custom frameless window with resize support - Dark/light theme toggle - Hardware encoder detection (NVENC/QSV/AMF)
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
package task
|
|
|
|
import (
|
|
"ffmpeg-gui/internal/ffmpeg"
|
|
"time"
|
|
)
|
|
|
|
// Type represents the type of a task.
|
|
type Type string
|
|
|
|
const (
|
|
TypeRemux Type = "remux"
|
|
TypeEncode Type = "encode"
|
|
TypeBurn Type = "burn_subtitle"
|
|
)
|
|
|
|
// Status represents the current state of a task.
|
|
type Status string
|
|
|
|
const (
|
|
StatusPending Status = "pending"
|
|
StatusRunning Status = "running"
|
|
StatusDone Status = "done"
|
|
StatusFailed Status = "failed"
|
|
StatusCanceled Status = "canceled"
|
|
)
|
|
|
|
// Task represents a single ffmpeg job.
|
|
type Task struct {
|
|
ID string `json:"id"`
|
|
Type Type `json:"type"`
|
|
InputFile string `json:"inputFile"`
|
|
OutputFile string `json:"outputFile"`
|
|
Status Status `json:"status"`
|
|
Progress ffmpeg.Progress `json:"progress"`
|
|
Encode ffmpeg.EncodeSettings `json:"encode,omitempty"`
|
|
Remux ffmpeg.RemuxSettings `json:"remux,omitempty"`
|
|
Subtitle ffmpeg.SubtitleSettings `json:"subtitle,omitempty"`
|
|
Args []string `json:"-"`
|
|
Logs []string `json:"-"`
|
|
Error string `json:"error,omitempty"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
CompletedAt *time.Time `json:"completedAt,omitempty"`
|
|
Cancel func() `json:"-"`
|
|
}
|