diff --git a/cmd/mxl-player/main.go b/cmd/mxl-player/main.go index b17e103..d578858 100644 --- a/cmd/mxl-player/main.go +++ b/cmd/mxl-player/main.go @@ -59,7 +59,7 @@ type appArgs struct { func printCliHelp(fs *pflag.FlagSet) { fmt.Printf("%s %s\n", APP_NAME, APP_VER) - fmt.Println("Usage: mxl-player -d (-v | -a ) [--max-attempts ] [-f] [-h]") + fmt.Println("Usage: mxl-player [-d ] [-v ] [-a ] [options]") fmt.Println(" [-g ] [-p ] [--verbose]") fmt.Println(" or: mxl-player [--list-playback] [--list-gpu]") fmt.Println(" or: mxl-player (and set everything in GUI)") @@ -68,13 +68,20 @@ func printCliHelp(fs *pflag.FlagSet) { } func printUsage(w io.Writer) { - fmt.Fprintln(w, "Usage: mxl-player -d (-v | -a ) [-f] [-h]") + fmt.Fprintln(w, "Usage: mxl-player [-d ] [-v ] [-a ] [options]") fmt.Fprintln(w, "Try 'mxl-player -h' for more information.") } func checkMXLargs(args appArgs) { + if args.VideoFlowId == "" && args.AudioFlowId == "" { + return + } + if args.Domain == "" { - fmt.Fprintln(os.Stderr, "You should provide valid MXL domain and UUID of at least one flow") + fmt.Fprintln( + os.Stderr, + "You must provide a domain when a feed UUID is configured", + ) printUsage(os.Stderr) os.Exit(2) } @@ -86,11 +93,6 @@ func checkMXLargs(args appArgs) { printUsage(os.Stderr) os.Exit(2) } - if args.VideoFlowId == "" && args.AudioFlowId == "" { - fmt.Fprintln(os.Stderr, "You must provide at least 1 MXL flow UUID") - printUsage(os.Stderr) - os.Exit(2) - } } func main() { @@ -146,7 +148,7 @@ func main() { checkMXLargs(args) } // path selection - useVideoSlot := args.VideoFlowId != "" && args.AudioFlowId == "" + useVideoSlot := args.AudioFlowId == "" runtime.LockOSThread() if err := sdl.Load(); err != nil { @@ -300,7 +302,7 @@ func main() { syncSrc.Width(), syncSrc.Height(), aChans, audioBatch) case args.VideoFlowId != "": // VideoSlot owns opening and closing the video reader. - default: + case args.AudioFlowId != "": audioSrc, err = source.OpenAudio(args.Domain, args.AudioFlowId) if err != nil { log.Fatalf("audio source: %v", err) @@ -320,6 +322,8 @@ func main() { } sdl.ResumeAudioStreamDevice(audioStream) fmt.Printf("audio: %dch %d/%d Hz\n", aChans, audioSrc.Rate().Num, audioSrc.Rate().Den) + default: + // No configured feeds. Renderer and GUI use the placeholder. } defer func() { @@ -385,7 +389,7 @@ func main() { audioStr string = args.AudioFlowId showStats bool = true ) - videoActive := useVideoSlot + videoActive := args.VideoFlowId != "" ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -529,7 +533,7 @@ func main() { playback.FeedConfig{ Domain: args.Domain, UUID: args.VideoFlowId, - Active: true, + Active: args.VideoFlowId != "", }, videoCommands, ) diff --git a/imgui.ini b/imgui.ini index 6eddbff..e9bc32f 100644 --- a/imgui.ini +++ b/imgui.ini @@ -14,7 +14,7 @@ Size=200,200 Collapsed=0 [Window][Connection] -Pos=202,343 +Pos=74,351 Size=799,226 Collapsed=0