mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add webcam resolution + to config.
This commit is contained in:
parent
dc33aa37bc
commit
8b6a2ed6d6
@ -129,6 +129,8 @@ func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCt
|
|||||||
"! decodebin " +
|
"! decodebin " +
|
||||||
"! videoconvert " +
|
"! videoconvert " +
|
||||||
"! videorate " +
|
"! videorate " +
|
||||||
|
"! videoscale " +
|
||||||
|
fmt.Sprintf("! video/x-raw,width=%d,height=%d ", config.WebcamWidth, config.WebcamHeight) +
|
||||||
"! identity drop-allocation=true " +
|
"! identity drop-allocation=true " +
|
||||||
fmt.Sprintf("! v4l2sink sync=false device=%s", config.WebcamDevice),
|
fmt.Sprintf("! v4l2sink sync=false device=%s", config.WebcamDevice),
|
||||||
// TODO: Test this pipeline.
|
// TODO: Test this pipeline.
|
||||||
@ -138,6 +140,8 @@ func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCt
|
|||||||
"! decodebin " +
|
"! decodebin " +
|
||||||
"! videoconvert " +
|
"! videoconvert " +
|
||||||
"! videorate " +
|
"! videorate " +
|
||||||
|
"! videoscale " +
|
||||||
|
fmt.Sprintf("! video/x-raw,width=%d,height=%d ", config.WebcamWidth, config.WebcamHeight) +
|
||||||
"! identity drop-allocation=true " +
|
"! identity drop-allocation=true " +
|
||||||
fmt.Sprintf("! v4l2sink sync=false device=%s", config.WebcamDevice),
|
fmt.Sprintf("! v4l2sink sync=false device=%s", config.WebcamDevice),
|
||||||
// TODO: Test this pipeline.
|
// TODO: Test this pipeline.
|
||||||
@ -147,6 +151,8 @@ func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCt
|
|||||||
"! decodebin " +
|
"! decodebin " +
|
||||||
"! videoconvert " +
|
"! videoconvert " +
|
||||||
"! videorate " +
|
"! videorate " +
|
||||||
|
"! videoscale " +
|
||||||
|
fmt.Sprintf("! video/x-raw,width=%d,height=%d ", config.WebcamWidth, config.WebcamHeight) +
|
||||||
"! identity drop-allocation=true " +
|
"! identity drop-allocation=true " +
|
||||||
fmt.Sprintf("! v4l2sink sync=false device=%s", config.WebcamDevice),
|
fmt.Sprintf("! v4l2sink sync=false device=%s", config.WebcamDevice),
|
||||||
}, "webcam"),
|
}, "webcam"),
|
||||||
|
@ -36,6 +36,8 @@ type Capture struct {
|
|||||||
|
|
||||||
WebcamEnabled bool
|
WebcamEnabled bool
|
||||||
WebcamDevice string
|
WebcamDevice string
|
||||||
|
WebcamWidth int
|
||||||
|
WebcamHeight int
|
||||||
|
|
||||||
MicrophoneEnabled bool
|
MicrophoneEnabled bool
|
||||||
MicrophoneDevice string
|
MicrophoneDevice string
|
||||||
@ -130,6 +132,16 @@ func (Capture) Init(cmd *cobra.Command) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd.PersistentFlags().Int("capture.webcam.width", 1280, "webcam stream width")
|
||||||
|
if err := viper.BindPFlag("capture.webcam.width", cmd.PersistentFlags().Lookup("capture.webcam.width")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.PersistentFlags().Int("capture.webcam.height", 720, "webcam stream height")
|
||||||
|
if err := viper.BindPFlag("capture.webcam.height", cmd.PersistentFlags().Lookup("capture.webcam.height")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// microphone
|
// microphone
|
||||||
cmd.PersistentFlags().Bool("capture.microphone.enabled", true, "enable microphone stream")
|
cmd.PersistentFlags().Bool("capture.microphone.enabled", true, "enable microphone stream")
|
||||||
if err := viper.BindPFlag("capture.microphone.enabled", cmd.PersistentFlags().Lookup("capture.microphone.enabled")); err != nil {
|
if err := viper.BindPFlag("capture.microphone.enabled", cmd.PersistentFlags().Lookup("capture.microphone.enabled")); err != nil {
|
||||||
@ -209,6 +221,8 @@ func (s *Capture) Set() {
|
|||||||
// webcam
|
// webcam
|
||||||
s.WebcamEnabled = viper.GetBool("capture.webcam.enabled")
|
s.WebcamEnabled = viper.GetBool("capture.webcam.enabled")
|
||||||
s.WebcamDevice = viper.GetString("capture.webcam.device")
|
s.WebcamDevice = viper.GetString("capture.webcam.device")
|
||||||
|
s.WebcamWidth = viper.GetInt("capture.webcam.width")
|
||||||
|
s.WebcamHeight = viper.GetInt("capture.webcam.height")
|
||||||
|
|
||||||
// microphone
|
// microphone
|
||||||
s.MicrophoneEnabled = viper.GetBool("capture.microphone.enabled")
|
s.MicrophoneEnabled = viper.GetBool("capture.microphone.enabled")
|
||||||
|
Loading…
Reference in New Issue
Block a user