Exemplo n.º 1
0
        public override void Start()
        {
            ffmpeg.StarByte();
            String s;

            //debug
            // int i = 0;

            byte[] temp;
            while (true)
            {
                if (token.token)
                {
                    break;
                }

                while ((s = ffmpeg.ErrorString()) != "")
                {
                    //   Console.WriteLine(s);
                }

                if (ffmpeg.IsRunning)
                {
                    temp = ffmpeg.Read();
                    if (temp == null)
                    {
                        continue;
                    }
                }
                else
                {
                    temp = ffmpeg.Read();
                    if (temp == null)
                    {
                        break;
                    }
                }
                //debug
                //   i += temp.Length;

                Output.Add(temp);
            }
            //debug

            Output.Complete();
            ffmpeg.Terminate();
        }
Exemplo n.º 2
0
        public override void Start()
        {
            ffmpeg.StarByte();
            youtube.StarByte();
            Boolean youtubeStillRun;
            String  s;
            //debug
            int i = 0;

            byte[] temp;
            bool   youtubeClosed = false;

            while (true)
            {
                if (token.token)
                {
                    break;
                }

                while ((s = ffmpeg.ErrorString()) != "")
                {
                    Console.WriteLine(s);
                }
                while ((s = youtube.ErrorString()) != "")
                {
                    Console.WriteLine(s);
                }

                while (ffmpeg.ReadCount > 0)
                {
                    temp = ffmpeg.Read();
                    if (temp != null)
                    {
                        Output.Add(temp);
                    }
                }

                while ((youtube.ReadCount > 0) & (ffmpeg.WriteCount < 2))
                {
                    temp = youtube.Read();
                    if (temp != null)
                    {
                        ffmpeg.Write(temp);
                    }
                    //    i += temp.Length;
                    //    Console.WriteLine(i);
                }

                if ((!youtubeClosed)
                    & (!youtube.IsRunning)
                    & (youtube.ReadCount == 0)
                    & ffmpeg.WriteCount == 0
                    & ffmpeg.ReadCount == 0)
                {
                    ffmpeg.Hatiko();
                    youtubeClosed = true;
                }

                if (youtubeClosed & (!ffmpeg.IsRunning) & (ffmpeg.ReadCount == 0))
                {
                    break;
                }
            }
            //debug

            Output.Complete();

            youtube.Terminate();
        }