Exemplo n.º 1
0
func NewAudioSocketCarousel(args AudioSocketArgs) mgr.Carousel {

	deps := []mgr.Carousel{
		mgr.NewLoopCarousel(
			fmt.Sprintf("%s_socket_handler", args.Name),
			&AudioSocketHandler{
				Conn: args.Conn,
			},
		),
		mgr.NewLoopCarousel(
			fmt.Sprintf("%s_encoder_handler", args.Name),
			&AudioEncoderHandler{
				Conn:            args.Conn,
				Host:            fmt.Sprintf("%s:%d", args.Host, args.Port),
				AlsaDev:         args.AlsaDev,
				InputChannels:   args.InputChannels,
				OutputChannels:  args.OutputChannels,
				SampleRate:      args.SampleRate,
				SamplesPerFrame: args.SamplesPerFrame,
			},
		),
	}

	return mgr.NewMonitorCarousel(
		fmt.Sprintf("%s_monitor", args.Name),
		&WebsocketConnectionHandler{
			Conn: args.Conn,
		},
		deps...,
	)
}
Exemplo n.º 2
0
func NewInputSocketCarousel(args InputSocketArgs) mgr.Carousel {
	vncClient := &vnc_client.InputVNCClient{
		BaseVNCClient: vnc_client.BaseVNCClient{
			Host:     args.VncHost,
			Port:     args.VncPort,
			Password: args.VncPassword,
			ScreenW:  args.ScreenState.Width,
			ScreenH:  args.ScreenState.Height,
		},
	}

	deps := []mgr.Carousel{
		mgr.NewLoopCarousel(
			fmt.Sprintf("%s_vnc_client", args.Name),
			vncClient,
		),
		mgr.NewLoopCarousel(
			fmt.Sprintf("%s_socket_handler", args.Name),
			&InputSocketHandler{
				Conn:        args.Conn,
				VncClient:   vncClient,
				ScreenState: args.ScreenState,
			},
		),
	}

	return mgr.NewMonitorCarousel(
		fmt.Sprintf("%s_monitor", args.Name),
		&InputMonitorHandler{
			Conn:      args.Conn,
			VncClient: vncClient,
		},
		deps...,
	)
}
Exemplo n.º 3
0
func NewVideoSocketCarousel(args VideoSocketArgs) mgr.Carousel {
	vncClient := &vnc_client.VideoVNCClient{
		BaseVNCClient: vnc_client.BaseVNCClient{
			Host:     args.VncHost,
			Port:     args.VncPort,
			Password: args.VncPassword,
			ScreenW:  args.ScreenState.Width,
			ScreenH:  args.ScreenState.Height,
		},
	}

	deps := []mgr.Carousel{
		mgr.NewLoopCarousel(
			fmt.Sprintf("%s_vnc_handler", args.Name),
			&VideoVNCHandler{
				VncClient:      vncClient,
				TargetFpsNum:   args.TargetFpsNum,
				TargetFpsDen:   args.TargetFpsDen,
				MaxOutputWidth: args.MaxOutputWidth,
				Conn:           args.Conn,
				ScreenState:    args.ScreenState,
			},
		),
		mgr.NewLoopCarousel(
			fmt.Sprintf("%s_socket_handler", args.Name),
			&VideoSocketHandler{
				VncClient: vncClient,
				Conn:      args.Conn,
			},
		),
		mgr.NewLoopCarousel(
			fmt.Sprintf("%s_frame_timer", args.Name),
			&VideoFrameTimer{
				VncClient:    vncClient,
				TargetFpsNum: args.TargetFpsNum,
				TargetFpsDen: args.TargetFpsDen,
			},
		),
	}

	return mgr.NewMonitorCarousel(
		fmt.Sprintf("%s_monitor", args.Name),
		&VideoMonitorHandler{
			Conn:      args.Conn,
			VncClient: vncClient,
		},
		deps...,
	)
}