コード例 #1
0
ファイル: VsMediaCommand.cs プロジェクト: tdhieu/openvss
 public VsMediaCommand(HTTPRequestStruct HTTPRequest)
 {
     this.HTTPRequest = HTTPRequest;
     if (!processCommand(HTTPRequest))
     {
         throw new Exception("command can not process");
     }
 }
コード例 #2
0
ファイル: VsMediaCommand.cs プロジェクト: tmpkus/openvss
 public VsMediaCommand(HTTPRequestStruct HTTPRequest)
 {
     this.HTTPRequest = HTTPRequest;
     if (!processCommand(HTTPRequest))
     {
         throw new Exception("command can not process");
     }
 }
コード例 #3
0
        //#region Run the process
        //private string RunProcess(string Parameters)
        //{
        //    //create a process info
        //    ProcessStartInfo oInfo = new ProcessStartInfo(this._ffExe, Parameters);
        //    oInfo.UseShellExecute = false;
        //    oInfo.CreateNoWindow = true;
        //    oInfo.RedirectStandardOutput = true;
        //    oInfo.RedirectStandardError = true;

        //    //Create the output and streamreader to get the output
        //    string output = null; StreamReader srOutput = null;

        //    //try the process
        //    try
        //    {
        //        //run the process
        //        Process proc = System.Diagnostics.Process.Start(oInfo);

        //        proc.WaitForExit();

        //        //get the output
        //        srOutput = proc.StandardError;

        //        //now put it in a string
        //        output = srOutput.ReadToEnd();

        //        proc.Close();
        //    }
        //    catch (Exception)
        //    {
        //        output = string.Empty;
        //    }
        //    finally
        //    {
        //        //now, if we succeded, close out the streamreader
        //        if (srOutput != null)
        //        {
        //            srOutput.Close();
        //            srOutput.Dispose();
        //        }
        //    }
        //    return output;
        //}
        //#endregion

        public override void OnResponse(ref HTTPRequestStruct rq, ref HTTPResponseStruct rp)
        {
            throw new NotImplementedException();
        }
コード例 #4
0
ファイル: VsMediaCommand.cs プロジェクト: tdhieu/openvss
        private bool processCommand(HTTPRequestStruct HTTPRequest)
        {
            string[] httpUrl = HTTPRequest.URL.ToLower().Split('/');

            #region source type
            if ("vs-live".Equals(httpUrl[1]))
            {
                sourceType = SourceType.Live;
            }
            else if ("vs-file".Equals(httpUrl[1]))
            {
                sourceType = SourceType.File;
            }
            else
            {
                return false;
            }
            #endregion

            #region streaming type
            if ("jpeg".Equals(httpUrl[2]))
            {
                streamType = StreamType.Jpeg;
            }
            else if ("mjpg".Equals(httpUrl[2]))
            {
                streamType = StreamType.MJpeg;
            }
            else if ("file".Equals(httpUrl[2]))
            {
                streamType = StreamType.File;
            }
            else
            {
                return false;
            }
            #endregion

            #region urlSource

            if (httpUrl.Length > 3)
            {
                for (int i = 3; i < httpUrl.Length; i++)
                {
                    urlSource += httpUrl[i] + "\\";
                }
                urlSource = urlSource.Remove(urlSource.Length - 1);
            }
            else
            {
                return false;
            }
            #endregion

            #region Parameter
            try
            {
                //resolution WxH
                if (HTTPRequest.Args!=null&&HTTPRequest.Args["size"] != null)
                {
                    string[] s = HTTPRequest.Args["size"].ToString().Split('x');
                    videoSize = new Size(int.Parse(s[0]), int.Parse(s[1]));
                }
                else
                {
                    videoSize = new Size(640, 480);
                }

                //frame per sec
                if (HTTPRequest.Args != null && HTTPRequest.Args["fps"] != null)
                {
                    framRate = int.Parse(HTTPRequest.Args["fps"].ToString());
                }
                else
                {
                    framRate = 4;
                }

                //compression %
                if (HTTPRequest.Args != null && HTTPRequest.Args["quanlity"] != null)
                {
                    videoQuanlity = int.Parse(HTTPRequest.Args["quanlity"].ToString());
                }
                else
                {
                    videoQuanlity = 80;
                }
            }
            catch
            {
                return false;
                //throw Exception();
            }
            #endregion

            return true;
        }
コード例 #5
0
ファイル: HttpServer.cs プロジェクト: tmpkus/openvss
 public abstract void OnResponse(ref HTTPRequestStruct rq, ref HTTPResponseStruct rp);
コード例 #6
0
ファイル: HttpServer.cs プロジェクト: tdhieu/openvss
 public abstract void OnResponse(ref HTTPRequestStruct rq, ref HTTPResponseStruct rp);
コード例 #7
0
ファイル: VsMediaCommand.cs プロジェクト: tmpkus/openvss
        private bool processCommand(HTTPRequestStruct HTTPRequest)
        {
            string[] httpUrl = HTTPRequest.URL.ToLower().Split('/');

            #region source type
            if ("vs-live".Equals(httpUrl[1]))
            {
                sourceType = SourceType.Live;
            }
            else if ("vs-file".Equals(httpUrl[1]))
            {
                sourceType = SourceType.File;
            }
            else
            {
                return(false);
            }
            #endregion

            #region streaming type
            if ("jpeg".Equals(httpUrl[2]))
            {
                streamType = StreamType.Jpeg;
            }
            else if ("mjpg".Equals(httpUrl[2]))
            {
                streamType = StreamType.MJpeg;
            }
            else if ("file".Equals(httpUrl[2]))
            {
                streamType = StreamType.File;
            }
            else
            {
                return(false);
            }
            #endregion

            #region urlSource

            if (httpUrl.Length > 3)
            {
                for (int i = 3; i < httpUrl.Length; i++)
                {
                    urlSource += httpUrl[i] + "\\";
                }
                urlSource = urlSource.Remove(urlSource.Length - 1);
            }
            else
            {
                return(false);
            }
            #endregion

            #region Parameter
            try
            {
                //resolution WxH
                if (HTTPRequest.Args != null && HTTPRequest.Args["size"] != null)
                {
                    string[] s = HTTPRequest.Args["size"].ToString().Split('x');
                    videoSize = new Size(int.Parse(s[0]), int.Parse(s[1]));
                }
                else
                {
                    videoSize = new Size(640, 480);
                }

                //frame per sec
                if (HTTPRequest.Args != null && HTTPRequest.Args["fps"] != null)
                {
                    framRate = int.Parse(HTTPRequest.Args["fps"].ToString());
                }
                else
                {
                    framRate = 4;
                }

                //compression %
                if (HTTPRequest.Args != null && HTTPRequest.Args["quanlity"] != null)
                {
                    videoQuanlity = int.Parse(HTTPRequest.Args["quanlity"].ToString());
                }
                else
                {
                    videoQuanlity = 80;
                }
            }
            catch
            {
                return(false);
                //throw Exception();
            }
            #endregion

            return(true);
        }
コード例 #8
0
ファイル: VsMediaProxyServer.cs プロジェクト: tdhieu/openvss
        //#region Run the process
        //private string RunProcess(string Parameters)
        //{
        //    //create a process info
        //    ProcessStartInfo oInfo = new ProcessStartInfo(this._ffExe, Parameters);
        //    oInfo.UseShellExecute = false;
        //    oInfo.CreateNoWindow = true;
        //    oInfo.RedirectStandardOutput = true;
        //    oInfo.RedirectStandardError = true;

        //    //Create the output and streamreader to get the output
        //    string output = null; StreamReader srOutput = null;

        //    //try the process
        //    try
        //    {
        //        //run the process
        //        Process proc = System.Diagnostics.Process.Start(oInfo);

        //        proc.WaitForExit();

        //        //get the output
        //        srOutput = proc.StandardError;

        //        //now put it in a string
        //        output = srOutput.ReadToEnd();

        //        proc.Close();
        //    }
        //    catch (Exception)
        //    {
        //        output = string.Empty;
        //    }
        //    finally
        //    {
        //        //now, if we succeded, close out the streamreader
        //        if (srOutput != null)
        //        {
        //            srOutput.Close();
        //            srOutput.Dispose();
        //        }
        //    }
        //    return output;
        //}
        //#endregion

        public override void OnResponse(ref HTTPRequestStruct rq, ref HTTPResponseStruct rp)
        {
            throw new NotImplementedException();
        }