private void btnUpdateVideoParam_Click(object sender, RoutedEventArgs e) { DoAction(() => { if (_paramInited) { var param = new VideoOutParam(); param.Width = ((int)SystemParameters.PrimaryScreenWidth / 4) * 4; param.Height = ((int)SystemParameters.PrimaryScreenHeight / 4) * 4; param.Fps = 6; param.BitRate = 800000; param.Codec = VideoOutCodec.OpenH264; param.HardEncode = true; param.QosAutoChangeRatio = true; if (ApiProvider.Default.UpdateVideoOutParam(param)) { var text = $"video.width:{param.Width}{Environment.NewLine}"; text += $"video.height:{param.Height}{Environment.NewLine}"; text += $"video.fps:{param.Fps}{Environment.NewLine}"; text += $"video.bitRate:{param.BitRate}{Environment.NewLine}"; text += $"video.codec:{param.Codec}{Environment.NewLine}"; text += $"video.hardEncode:{param.HardEncode}{Environment.NewLine}"; text += $"video.autoRatio:{param.QosAutoChangeRatio}{Environment.NewLine}"; MessageBox.Show(text, "NewParam"); } } }); }
/// <summary> /// 修改视频输出参数,必须在未推流状态下执行 /// </summary> /// <param name="param">新的视频输出参数</param> /// <returns>修改成功返回true,失败返回false</returns> public bool UpdateVideoOutParam(VideoOutParam param) { ThrowIfServiceException(); return(Api.UpdateVideoOutParam(Service, ref param)); }
internal static extern bool UpdateVideoOutParam(IntPtr service, ref VideoOutParam param);