Beispiel #1
0
        /// <summary>
        /// 開始音視頻數據捕捉
        /// 返回1正常
        /// </summary>
        /// <param name="pusherHandle">EasyPusher_Create返回值</param>
        /// <param name="eSourceType">推送數據源</param>
        /// <param name="hCapWnd">預覽句柄</param>
        /// <param name="encodeType">编码类型</param>
        /// <param name="szDataType">推送數據類型</param>
        /// <param name="nBitRate">比特率</param>
        /// <returns></returns>
        public static int EasyScreenLive_StartCapture(IntPtr pusherHandle, SOURCE_TYPE eSourceType, string szURL, IntPtr hCapWnd, EncoderType encodeType, string szDataType = "RGB24", int nWidth = 1280, int nHeight = 720, int nBitRate = 2048, bool bTranscode = false, ENCODE_MODE encMode = 0)
        {
            //注意:第五个参数是音频采集,0:采集,-1:不采集,没有音频输入一定要赋值-1
            var ret = EasyScreenLive_StartCapture(pusherHandle, eSourceType, szURL, 0, -1, hCapWnd, encodeType, nVideoWidth: nWidth, nVideoHeight: nHeight, nBitRate: nBitRate, szDataType: szDataType, bTransCode: bTranscode, encodeMode: encMode);

            return(ret);
        }
Beispiel #2
0
        private void btnCapture_Click(object sender, EventArgs e)
        {
            isInit = pusherPtr != IntPtr.Zero;

            //pusherSubPtr = CapturePusher.CapturePusherSDK.EasyScreenLive_Create();

            if (!isInit)
            {
                return;
            }
            if (!isCapture)
            {
                EncoderType encodeType  = (EncoderType)Enum.Parse(typeof(EncoderType), this.comboBox1.Text);
                SOURCE_TYPE captureType = this.CaptureType.Text == "屏幕采集" ? SOURCE_TYPE.SOURCE_SCREEN_CAPTURE : SOURCE_TYPE.SOURCE_RTSP_STREAM;
                string      szDataType  = captureType == SOURCE_TYPE.SOURCE_LOCAL_CAMERA ? "YUY2" : "RGB24";
                int         captureRet  = 0;
                ENCODE_MODE encMode     = ENCODE_MODE.H264;
                captureRet = CapturePusher.CapturePusherSDK.EasyScreenLive_StartCapture(pusherPtr, captureType, "rtsp://192.168.0.101:8004/12345", this.panel1.Handle /*IntPtr.Zero*/, encodeType, szDataType, 1280, 720, 1024, false, encMode);

                isCapture = captureRet >= 0;

                if (isCapture)
                {
                    btnCapture.Text = "Stop";
                }
                Log(string.Format("開啓{0}{1}", this.CaptureType.Text, isCapture ? "成功" : "失敗"));
            }
            else
            {
                if (pusherPtr != IntPtr.Zero)
                {
                    if (isPusherRtsp)
                    {
                        CapturePusher.CapturePusherSDK.EasyScreenLive_StopPush(pusherPtr, PUSH_TYPE.PUSH_RTSP);
                        this.button1.Text = "RTSP Push";
                        isPusherRtsp      = false;
                    }
                    if (isPusherRtmp)
                    {
                        CapturePusher.CapturePusherSDK.EasyScreenLive_StopPush(pusherPtr, PUSH_TYPE.PUSH_RTMP);
                        this.button2.Text = "RTMP Push";
                        isPusherRtsp      = false;
                    }
                    if (isServerOpen)
                    {
                        CapturePusher.CapturePusherSDK.EasyScreenLive_StopServer(pusherPtr, serverId0);
                        CapturePusher.CapturePusherSDK.EasyScreenLive_StopServer(pusherPtr, serverId1);
                        CapturePusher.CapturePusherSDK.EasyScreenLive_StopServer(pusherPtr, serverId2);
                        this.btnStop.Text = "RTSP Server";
                        isServerOpen      = false;
                    }
                    CapturePusher.CapturePusherSDK.EasyScreenLive_StopCapture(pusherPtr);
                }

                isCapture = false;

                Log("停止采集");
                btnCapture.Text = "Capture";
            }
        }
Beispiel #3
0
 /// <summary>
 /// Class:Source
 /// 完整构造体
 /// </summary>
 /// <param name="name"></param>
 /// <param name="s_type"></param>
 /// <param name="s_s_type"></param>
 /// <param name="instant"></param>
 /// <param name="duration"></param>
 /// <param name="damage"></param>
 /// <param name="damage_continue"></param>
 public Source(Role role, String name, SOURCE_TYPE s_type, SOURCE_SUB_TYPE s_s_type, bool instant, UInt16 duration, double damage, double damage_continue)
 {
     this.Target           = role;
     this.SOURCE_NAME      = name;
     this.TYPE_MAIN        = s_type;
     this.TYPE_SUB         = s_s_type;
     this.INSTANT_DAMAGE   = instant;
     this.DURATION         = duration;
     this.dDAMAGE          = damage;
     this.dDAMAGE_CONTINUE = damage_continue;
 }
Beispiel #4
0
        public WonkaBizSource(string psSourceId, string psAPIWebUrl, string psAPIWebMethod, string psAPIWebParam, RetrieveDataMethod poRetrievalDelegate)
        {
            this.SourceId     = psSourceId;
            this.TypeOfSource = SOURCE_TYPE.SRC_TYPE_API;

            this.SenderAddress = this.Password = this.ContractAddress = this.ContractABI = string.Empty;
            this.SqlServer     = this.SqlDatabase = this.SqlUsername = this.SqlPassword = this.SqlQueryOrProcedure = string.Empty;

            this.APIWebUrl    = psAPIWebUrl;
            this.APIWebMethod = psAPIWebMethod;
            this.APIWebParam  = psAPIWebParam;

            this.MethodName          = this.SetterMethodName = string.Empty;
            this.RetrievalDelegate   = poRetrievalDelegate;
            this.CustomOpRuleBuilder = null;
        }
Beispiel #5
0
        public WonkaBizSource(string psSourceId, string psSenderAddr, string psPwd, string psContractAddr, string psABI, WonkaBizRulesXmlReader.ExecuteCustomOperator poCustomOpDelegate, string psCustomOpMethodName)
        {
            this.SourceId     = psSourceId;
            this.TypeOfSource = SOURCE_TYPE.SRC_TYPE_CONTRACT;

            this.SenderAddress   = psSenderAddr;
            this.Password        = psPwd;
            this.ContractAddress = psContractAddr;
            this.ContractABI     = psABI;

            this.APIServerAddress = string.Empty;
            this.APIServerPort    = -1;
			this.SqlServer        = this.SqlDatabase = this.SqlUsername = this.SqlPassword = this.SqlQueryOrProcedure = string.Empty;

            this.CustomOpDelegate    = poCustomOpDelegate;
            this.CustomOpMethodName  = psCustomOpMethodName;
            this.CustomOpRuleBuilder = null;
        }
Beispiel #6
0
		public WonkaBizSource(string psSourceId, string psSenderAddr, string psPwd, string psContractAddr, string psABI, string psMethodName, string psSetterMethodName, RetrieveDataMethod poRetrievalDelegate)
        {
            this.SourceId     = psSourceId;
            this.TypeOfSource = SOURCE_TYPE.SRC_TYPE_CONTRACT;

            this.SenderAddress   = psSenderAddr;
            this.Password        = psPwd;
            this.ContractAddress = psContractAddr;
            this.ContractABI     = psABI;

            this.APIServerAddress = string.Empty;
            this.APIServerPort    = -1;
			this.SqlServer        = this.SqlDatabase = this.SqlUsername = this.SqlPassword = this.SqlQueryOrProcedure = string.Empty;

            this.MethodName          = psMethodName;
            this.SetterMethodName    = psSetterMethodName;
            this.RetrievalDelegate   = poRetrievalDelegate;
            this.CustomOpRuleBuilder = null;
        }
Beispiel #7
0
        public WonkaBizSource(string psSourceId, string psSqlServer, string psDatabase, string psUsername, string psPassword, string psQueryOrProcedure, RetrieveDataMethod poRetrievalDelegate)
        {
            this.SourceId     = psSourceId;
            this.TypeOfSource = SOURCE_TYPE.SRC_TYPE_STORED_PROCEDURE;

            this.SenderAddress = this.Password = this.ContractAddress = this.ContractABI = string.Empty;

            this.APIServerAddress = string.Empty;
            this.APIServerPort    = -1;
            this.MethodName        = this.SetterMethodName = string.Empty;

			this.SqlServer   = psSqlServer;
			this.SqlDatabase = psDatabase;
			this.SqlUsername = psUsername;
			this.SqlPassword = psPassword;

            this.SqlQueryOrProcedure = psQueryOrProcedure;

            this.RetrievalDelegate   = poRetrievalDelegate;
            this.CustomOpRuleBuilder = null;
        }
Beispiel #8
0
 private static extern int EasyScreenLive_StartCapture(IntPtr pusherHandle, SOURCE_TYPE eSourceType, string szURL, int nCamId, int nAudioId, IntPtr hCapWnd, EncoderType encodeType,
                                                       int nVideoWidth = 1280, int nVideoHeight = 720, int nFps      = 30, int nBitRate = 1024, string szDataType = "RGB24", //VIDEO PARAM
                                                       int nSampleRate = 44100, int nChannel    = 2, bool bTransCode = false, ENCODE_MODE encodeMode = 0);
        /// <summary>
        /// 開始音視頻數據捕捉
        /// 返回1正常
        /// </summary>
        /// <param name="pusherHandle">EasyPusher_Create返回值</param>
        /// <param name="eSourceType">推送數據源</param>
        /// <param name="hCapWnd">預覽句柄</param>
        /// <param name="encodeType">编码类型</param>
        /// <param name="szDataType">推送數據類型</param>
        /// <param name="nBitRate">比特率</param>
        /// <returns></returns>
        public static int EasyScreenLive_StartCapture(IntPtr pusherHandle, SOURCE_TYPE eSourceType, string szURL, IntPtr hCapWnd, EncoderType encodeType, string szDataType = "RGB24", int nWidth = 1280, int nHeight = 720, int nBitRate = 2048, bool bTranscode = true)
        {
            var ret = EasyScreenLive_StartCapture(pusherHandle, eSourceType, szURL, 0, 0, hCapWnd, encodeType, nVideoWidth: nWidth, nVideoHeight: nHeight, nBitRate: nBitRate, szDataType: szDataType, bTransCode: bTranscode);

            return(ret);
        }
Beispiel #10
0
 /// <summary>
 /// Class:Source
 /// 用于增益Buff
 /// </summary>
 /// <param name="role"></param>
 /// <param name="name"></param>
 /// <param name="s_type"></param>
 /// <param name="s_s_type"></param>
 /// <param name="duration"></param>
 public Source(Role role, String name, SOURCE_TYPE s_type, SOURCE_SUB_TYPE s_s_type, UInt16 duration)
     : this(role, name, s_type, s_s_type, true, duration, 0, 0)
 {
 }
Beispiel #11
0
        private void btnCapture_Click(object sender, EventArgs e)
        {
            pusherPtr = CapturePusher.CapturePusherSDK.EasyScreenLive_Create();
            isInit    = pusherPtr != IntPtr.Zero;

            //pusherSubPtr = CapturePusher.CapturePusherSDK.EasyScreenLive_Create();

            if (!isInit)
            {
                return;
            }
            if (!isCapture)
            {
                EncoderType encodeType  = (EncoderType)Enum.Parse(typeof(EncoderType), this.comboBox1.Text);
                SOURCE_TYPE captureType = this.CaptureType.Text == "屏幕采集" ? SOURCE_TYPE.SOURCE_SCREEN_CAPTURE : SOURCE_TYPE.SOURCE_RTSP_STREAM;
                string      szDataType  = captureType == SOURCE_TYPE.SOURCE_LOCAL_CAMERA ? "YUY2" : "RGB24";
                int         captureRet  = 0;
                captureRet = CapturePusher.CapturePusherSDK.EasyScreenLive_StartCapture(pusherPtr, captureType, "rtsp://127.0.0.1:8554/channel=0", /*this.panel1.Handle*/ IntPtr.Zero, encodeType, szDataType, 960, 540, 1024, false);
                if (pusherSubPtr != IntPtr.Zero)
                {
                    captureRet = CapturePusher.CapturePusherSDK.EasyScreenLive_StartCapture(pusherSubPtr, captureType, "rtsp://127.0.0.1:8554/channel=0", this.panel1.Handle, encodeType, szDataType, 960, 540, 1024, true);
                }
                isCapture = captureRet >= 0;

                if (isCapture)
                {
                    btnCapture.Text = "Stop";
                }
                Log(string.Format("開啓{0}{1}", this.CaptureType.Text, isCapture ? "成功" : "失敗"));
            }
            else
            {
                if (pusherPtr != IntPtr.Zero)
                {
                    if (isPusherRtsp)
                    {
                        CapturePusher.CapturePusherSDK.EasyScreenLive_StopPush(pusherPtr, PUSH_TYPE.PUSH_RTSP);
                        this.button1.Text = "RTSP Push";
                    }
                    if (isPusherRtmp)
                    {
                        CapturePusher.CapturePusherSDK.EasyScreenLive_StopPush(pusherPtr, PUSH_TYPE.PUSH_RTMP);
                        this.button2.Text = "RTMP Push";
                    }
                    if (isServerOpen)
                    {
                        CapturePusher.CapturePusherSDK.EasyScreenLive_StopServer(pusherPtr);
                        this.btnStop.Text = "RTSP Server";
                    }
                    CapturePusher.CapturePusherSDK.EasyScreenLive_StopCapture(pusherPtr);
                    if (isInit)
                    {
                        CapturePusher.CapturePusherSDK.EasyScreenLive_Release(pusherPtr);
                    }
                }

                if (pusherSubPtr != IntPtr.Zero)
                {
                    if (isPusherRtsp)
                    {
                        CapturePusher.CapturePusherSDK.EasyScreenLive_StopPush(pusherSubPtr, PUSH_TYPE.PUSH_RTSP);
                        this.button1.Text = "RTSP Push";
                    }
                    if (isPusherRtmp)
                    {
                        CapturePusher.CapturePusherSDK.EasyScreenLive_StopPush(pusherSubPtr, PUSH_TYPE.PUSH_RTMP);
                        this.button2.Text = "RTMP Push";
                    }
                    if (isServerOpen)
                    {
                        CapturePusher.CapturePusherSDK.EasyScreenLive_StopServer(pusherSubPtr);
                        this.btnStop.Text = "RTSP Server";
                    }
                    CapturePusher.CapturePusherSDK.EasyScreenLive_StopCapture(pusherSubPtr);
                    if (isInit)
                    {
                        CapturePusher.CapturePusherSDK.EasyScreenLive_Release(pusherSubPtr);
                    }
                }
                isCapture = false;

                Log("停止采集");
                btnCapture.Text = "Capture";
            }
        }