CLI parse args, step 1
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
|||||||
|
|
||||||
vk "github.com/christerso/vulkan-go/vk"
|
vk "github.com/christerso/vulkan-go/vk"
|
||||||
"github.com/qvest-digital/go-mxl/mxl"
|
"github.com/qvest-digital/go-mxl/mxl"
|
||||||
|
pflag "github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -24,9 +25,65 @@ const (
|
|||||||
WIN_HEIGHT int32 = 720
|
WIN_HEIGHT int32 = 720
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CliArgs struct {
|
||||||
|
ShowHelp bool
|
||||||
|
Domain string
|
||||||
|
VideoFlowId string
|
||||||
|
AudioFlowId string
|
||||||
|
IsFullscreen bool
|
||||||
|
PlaybackId uint32
|
||||||
|
GpuId uint32
|
||||||
|
IsVerbose bool
|
||||||
|
ListAudio bool
|
||||||
|
ListGPU bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func printCliHelp(fs *pflag.FlagSet) {
|
||||||
|
fmt.Printf("%s %s\n", APP_NAME, APP_VER)
|
||||||
|
fmt.Println("Usage: mxl-player -d <domain> (-v <uuid> | -a <uuid>) [-f] [-h]...")
|
||||||
|
fmt.Println(" [-g <gpu-id>] [-p <playback-id>] [--verbose]")
|
||||||
|
fmt.Println(" or: mxl-player [--list-playback] [--list-gpu]")
|
||||||
|
fmt.Println(" or: mxl-player (and set everything in GUI)")
|
||||||
|
fmt.Println()
|
||||||
|
fs.PrintDefaults()
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// CLI args TODO:
|
||||||
|
// help + sample of good usage
|
||||||
|
// domain (-d, --domain)
|
||||||
|
// video flow UUID (-v, --video)
|
||||||
|
// audio flow UUID (-a, --audio)
|
||||||
|
// list-audio for list audio playback devices (-la, --list-playback)
|
||||||
|
// list-video fpr list video playback devices (-lg, --list-gpu)
|
||||||
|
// gpu-id for GPU selection (-p, --playback-id)
|
||||||
|
// playback-id for playback id selection (-g, --gpu-id)
|
||||||
|
// verbose flag, which turn on logs (-vb,--verbose)
|
||||||
|
//
|
||||||
// video: 5fbec3b1-1b0f-417d-9059-8b94a47197ed
|
// video: 5fbec3b1-1b0f-417d-9059-8b94a47197ed
|
||||||
// audio: 5fbec3b1-1b0f-417d-9059-8b94a47197ec
|
// audio: 5fbec3b1-1b0f-417d-9059-8b94a47197ec
|
||||||
|
|
||||||
|
var args CliArgs
|
||||||
|
flagSet := pflag.NewFlagSet(APP_NAME, pflag.ExitOnError)
|
||||||
|
flagSet.BoolVarP(&args.ShowHelp, "help", "h", false, "Show help message and exit")
|
||||||
|
flagSet.StringVarP(&args.Domain, "domain", "d", "", "MXL domain directory")
|
||||||
|
flagSet.StringVarP(&args.VideoFlowId, "video", "v", "", "Video flow UUID")
|
||||||
|
flagSet.StringVarP(&args.AudioFlowId, "audio", "a", "", "Audio flow UUID")
|
||||||
|
flagSet.BoolVarP(&args.IsFullscreen, "fullscreen", "f", false, "Run app in fullscreen mode")
|
||||||
|
flagSet.Uint32VarP(&args.GpuId, "gpu-id", "g", 0, "GPU id")
|
||||||
|
flagSet.Uint32VarP(&args.PlaybackId, "playback-id", "p", 0, "Playback audio device id")
|
||||||
|
flagSet.BoolVar(&args.IsVerbose, "verbose", false, "Verbose output")
|
||||||
|
flagSet.BoolVar(&args.ListAudio, "list-playback", false, "List audio playback devices and exit")
|
||||||
|
flagSet.BoolVar(&args.ListGPU, "list-gpu", false, "List GPU's and exit")
|
||||||
|
pflag.Parse()
|
||||||
|
|
||||||
|
if args.Domain == "" || args.ShowHelp {
|
||||||
|
// TODO. Fix after polishing GUI
|
||||||
|
// Cause required/optional will be changed
|
||||||
|
printCliHelp(flagSet)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
|
||||||
var videoFlowId, audioFlowId string
|
var videoFlowId, audioFlowId string
|
||||||
mxlDomain := flag.String("d", "/dev/shm/mxl", "MXL domain")
|
mxlDomain := flag.String("d", "/dev/shm/mxl", "MXL domain")
|
||||||
mxlVideoFlowID := flag.String("v", videoFlowId, "MXL video flow UUID")
|
mxlVideoFlowID := flag.String("v", videoFlowId, "MXL video flow UUID")
|
||||||
|
|||||||
@@ -5,4 +5,10 @@
|
|||||||
- hotkeys on keyDown, especially toggle keys. Way to recreate: press F and hold
|
- hotkeys on keyDown, especially toggle keys. Way to recreate: press F and hold
|
||||||
|
|
||||||
## TODO:
|
## TODO:
|
||||||
|
- CLI option to run fullscreen
|
||||||
|
- fabrics bridge reader. Step by step. Start with local
|
||||||
|
- basic UI: stats, fields for domain, flow ids, label, etc.
|
||||||
|
- snapshot
|
||||||
|
- waveform, vectorscope
|
||||||
|
- some image, when audio only
|
||||||
- q for quit
|
- q for quit
|
||||||
|
|||||||
@@ -8,3 +8,5 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require github.com/qvest-digital/go-mxl v1.1.0-rc.1
|
require github.com/qvest-digital/go-mxl v1.1.0-rc.1
|
||||||
|
|
||||||
|
require github.com/spf13/pflag v1.0.10 // indirect
|
||||||
|
|||||||
@@ -4,3 +4,5 @@ github.com/ebitengine/purego v0.10.2 h1:W809HbnvzAxgdm+aOvlSekrM16wGCdT/e76+9tS7
|
|||||||
github.com/ebitengine/purego v0.10.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
github.com/ebitengine/purego v0.10.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
||||||
github.com/qvest-digital/go-mxl v1.1.0-rc.1 h1:CUg29Q5c/JA6pqyA5gP3vu7JBr8lRXbOOxC+r0W572s=
|
github.com/qvest-digital/go-mxl v1.1.0-rc.1 h1:CUg29Q5c/JA6pqyA5gP3vu7JBr8lRXbOOxC+r0W572s=
|
||||||
github.com/qvest-digital/go-mxl v1.1.0-rc.1/go.mod h1:cYzyT+S/AONytsKr/DozzFQP2OrNrg/JsQOSjvwn+Rk=
|
github.com/qvest-digital/go-mxl v1.1.0-rc.1/go.mod h1:cYzyT+S/AONytsKr/DozzFQP2OrNrg/JsQOSjvwn+Rk=
|
||||||
|
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
|
||||||
|
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
|||||||
Reference in New Issue
Block a user