Ejemplo n.º 1
0
 internal static extern int PublishWinCaptureVideo(MEETINGMANAGE_WinCaptureVideoParam param,
                                                   bool isNeedCallBackMedia, IntPtr ctx);
Ejemplo n.º 2
0
        internal static MEETINGMANAGE_WinCaptureVideoParam ToWinCaptureStruct(this PublishVideoModel model)
        {
            MEETINGMANAGE_WinCaptureVideoParam publishCameraParam = new MEETINGMANAGE_WinCaptureVideoParam();

            try
            {
                //视频采集参数
                MEETINGMANAGEVideoCapParam videoCapParam = new MEETINGMANAGEVideoCapParam()
                {
                    left         = model.VideoSendModel.CaptureModel.Left,
                    right        = model.VideoSendModel.CaptureModel.Right,
                    top          = model.VideoSendModel.CaptureModel.Top,
                    bottom       = model.VideoSendModel.CaptureModel.Bottom,
                    fps          = model.VideoSendModel.CaptureModel.Fps,
                    capWinHandle = model.VideoSendModel.CaptureModel.CapWinHandle,
                    colorSpace   =
                        (MEETINGMANAGE_VideoColorSpace)model.VideoSendModel.CaptureModel.VideoColorSpace,
                };

                publishCameraParam.sParam.vsParam.capParam = Marshal.AllocHGlobal(Marshal.SizeOf(videoCapParam));

                Marshal.StructureToPtr(videoCapParam, publishCameraParam.sParam.vsParam.capParam, true);

                publishCameraParam.sParam.vsParam.fillMode =
                    (MEETINGMANAGE_DisplayFillMode)model.VideoSendModel.DisplayFillMode;
                publishCameraParam.sParam.vsParam.displayWindow = model.VideoSendModel.DisplayWindow; //本地预览的窗口句柄

                //视频编码参数
                publishCameraParam.sParam.vsParam.encParam = IntPtr.Zero;

                MEETINGMANAGEVideoEncParam videoEncParam = new MEETINGMANAGEVideoEncParam()
                {
                    bitrate = model.VideoSendModel.EncodeModel.Bitrate,
                    fps     = model.VideoSendModel.EncodeModel.Fps,
                    width   = model.VideoSendModel.EncodeModel.Width,
                    height  = model.VideoSendModel.EncodeModel.Height,
                    level   =
                        (MEETINGMANAGEVideoCodecLevel)model.VideoSendModel.EncodeModel.VideoCodeLevel,
                    codecID =
                        (MEETINGMANAGEVideoCodecID)model.VideoSendModel.EncodeModel.VideoCodeId,
                    codecType =
                        (MEETINGMANAGEVideoCodecType)model.VideoSendModel.EncodeModel.VideoCodeType,
                };

                publishCameraParam.sParam.vsParam.encParam = Marshal.AllocHGlobal(Marshal.SizeOf(videoEncParam));

                Marshal.StructureToPtr(videoEncParam, publishCameraParam.sParam.vsParam.encParam, true);


                publishCameraParam.sParam.sourceType = (MEETINGMANAGESourceType)model.VideoSendModel.SourceType;
                publishCameraParam.sParam.sourceName = model.VideoSendModel.SourceName; //摄像头名称

                //媒体类型
                publishCameraParam.mediaType = (MEETINGMANAGE_MediaType)model.MediaType;

                //媒体流类型
                publishCameraParam.sType = (MEETINGMANAGE_StreamType)model.StreamType;

                publishCameraParam.avSynGroupID     = model.AvSyncGroupId;
                publishCameraParam.sParam.extraInfo = model.VideoSendModel.ExtraInfo;

                publishCameraParam.transParam.checkRetransSendCount = model.VideoTransModel.CheckRetransSendCount;
                publishCameraParam.transParam.checkSendCount        = model.VideoTransModel.CheckSendCount;
                publishCameraParam.transParam.dataResendCount       = model.VideoTransModel.DataResendCount;
                publishCameraParam.transParam.dataRetransSendCount  = model.VideoTransModel.DataRetransSendCount;
                publishCameraParam.transParam.dataSendCount         = model.VideoTransModel.DataSendCount;
                publishCameraParam.transParam.delayTimeWinsize      = model.VideoTransModel.DelayTimeWinsize;
                publishCameraParam.transParam.fecCheckCount         = model.VideoTransModel.FecCheckCount;
                publishCameraParam.transParam.fecDataCount          = model.VideoTransModel.FecDataCount;
            }
            catch (Exception e)
            {
                throw new Exception($"本地桌面视频流结构转换失败。{e.Message}");
            }

            return(publishCameraParam);
        }