Ticket #256 (new Feature)

Opened 13 months ago

Last modified 3 months ago

Tap operator

Reported by: danderson Owned by: admin
Priority: 1 Milestone:
Component: Liquidsoap Version:
Keywords: Cc:
Mac OSX: yes Linux: yes
NetBSD: yes Other Operating System: yes
FreeBSD: yes

Description

It would be really nice to have a 'tap' operator (to continue the analogy with sources and sinks). A tap is an operator whose availability is configurable over the telnet interface. When turned off, the source becomes unavailable (and stops pulling from the upstream source). When turned on, the operator becomes available and acts as an identity (no change to the stream).

The telnet interface can be as simple as:

tap_id.on tap_id.off tap_id.state

Change History

Changed 13 months ago by mrpingouin

You can achieve that using the mix() operator. It mixes several sources, you can interactively turn it on/off. I'm not sure how it behaves when it has no enabled input: Is it unavailable, or does it stream silence? I'm also not sure how it behaves wrt to tracks: does it preserve track limits.

I suggest that you try it and tell us what doesn't fit your needs. Then we'll see if we adapt mix() or do something new.

(Speaking of design, I'm never sure if I like the current monolithic mix(), or if I would prefer to break it into simpler pieces. The same holds for all outputs and several other operators. When I'm unsure, I choose the statu quo.)

If you like hacks you can also build you tap using a switch with a predicate that checks a mutable variable (interactive.string) and install server commands for changing that string. That would probably be fully satisfying, right? If you like that solution, close the ticket and feel free to define tap() in the utils.liq.

There is definitely more than one way to do it..

Note: See TracTickets for help on using tickets.