@@ -64,9 +64,17 @@ def parse_args():
6464 input_parser = subparsers .add_parser ("input" )
6565 input_parser .add_argument (
6666 "action" ,
67- choices = ["list" , "show" , "get" , "set" ],
67+ choices = [
68+ "list" ,
69+ "show" ,
70+ "get" ,
71+ "set" ,
72+ "mute" ,
73+ "unmute" ,
74+ "toggle-mute" ,
75+ ],
6876 default = "show" ,
69- help = "list/show/get/set" ,
77+ help = "list/show/get/set/mute/unmute/toggle-mute " ,
7078 )
7179 input_parser .add_argument ("INPUT" , nargs = "?" , help = "Input name" )
7280 input_parser .add_argument ("PROPERTY" , nargs = "?" , help = "Property name" )
@@ -240,6 +248,22 @@ def set_input_setting(cl, input, key, value):
240248 return cl .set_input_settings (input , {key : value }, overlay = True )
241249
242250
251+ def get_mute_state (cl , input ):
252+ return cl .get_input_mute (input ).input_muted
253+
254+
255+ def mute_input (cl , input ):
256+ cl .set_input_mute (input , True )
257+
258+
259+ def unmute_input (cl , input ):
260+ cl .set_input_mute (input , False )
261+
262+
263+ def toggle_mute_input (cl , input ):
264+ cl .toggle_input_mute (input )
265+
266+
243267def get_filters (cl , input ):
244268 return cl .get_source_filter_list (input ).filters
245269
@@ -390,10 +414,15 @@ def main():
390414 table = Table (title = "Inputs" )
391415 table .add_column ("Kind" )
392416 table .add_column ("Name" )
417+ table .add_column ("Muted" )
393418 for input in data :
394419 kind = input .get ("inputKind" )
395420 name = input .get ("inputName" )
396- table .add_row (kind , name )
421+ mute_state = ""
422+ # FIXME The inputKind whitelist here is probably incomplete
423+ if kind in ["ffmpeg_source" ] or "capture" in kind :
424+ mute_state = "🔇" if get_mute_state (cl , name ) else ""
425+ table .add_row (kind , name , mute_state )
397426 console .print (table )
398427 elif args .action == "show" or args .action == "get" :
399428 data = get_input_settings (cl , args .INPUT )
@@ -410,6 +439,18 @@ def main():
410439 )
411440 LOGGER .debug (res )
412441
442+ elif args .action == "mute" :
443+ res = mute_input (cl , args .INPUT )
444+ LOGGER .debug (res )
445+
446+ elif args .action == "unmute" :
447+ res = unmute_input (cl , args .INPUT )
448+ LOGGER .debug (res )
449+
450+ elif args .action == "toggle-mute" :
451+ res = toggle_mute_input (cl , args .INPUT )
452+ LOGGER .debug (res )
453+
413454 elif cmd == "filter" :
414455 if args .action == "list" :
415456 data = get_filters (cl , args .INPUT )
0 commit comments