github.com/noriah/catnip@v1.8.5/input/ffmpeg/pulse.go (about)

     1  package ffmpeg
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/noriah/catnip/input"
     7  	"github.com/noriah/catnip/input/parec"
     8  )
     9  
    10  func init() {
    11  	input.RegisterBackend("ffmpeg-pulse", Pulse{})
    12  }
    13  
    14  // Pulse is the pulse input for FFmpeg.
    15  type Pulse struct {
    16  	parec.Backend
    17  }
    18  
    19  func (p Pulse) Start(cfg input.SessionConfig) (input.Session, error) {
    20  	dv, ok := cfg.Device.(parec.PulseDevice)
    21  	if !ok {
    22  		return nil, fmt.Errorf("invalid device type %T", cfg.Device)
    23  	}
    24  
    25  	return NewSession(dv, cfg)
    26  }