Example #1
0
 public VsMediaCommand(HTTPRequestStruct HTTPRequest)
 {
     this.HTTPRequest = HTTPRequest;
     if (!processCommand(HTTPRequest))
     {
         throw new Exception("command can not process");
     }
 }
Example #2
0
 public VsMediaCommand(HTTPRequestStruct HTTPRequest)
 {
     this.HTTPRequest = HTTPRequest;
     if (!processCommand(HTTPRequest))
     {
         throw new Exception("command can not process");
     }
 }
Example #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();
        }
Example #4
0
        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;
        }
Example #5
0
 public abstract void OnResponse(ref HTTPRequestStruct rq, ref HTTPResponseStruct rp);
Example #6
0
 public abstract void OnResponse(ref HTTPRequestStruct rq, ref HTTPResponseStruct rp);
Example #7
0
        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);
        }
Example #8
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();
        }