Пример #1
0
        public override void Start()
        {
            int pos = 0;

            ffmpeg.StarByte();
            while (Input.IsOpen | (Input.Count > 0))
            {
                byte[] temp = Input.Take(frameSize);
                pos += temp.Length;
                ffmpeg.Write(temp);

                String s;
                while ((s = ffmpeg.ErrorString()) != "")
                {
                    //    Console.Write(s);
                }
                while ((s = ffmpeg.ReadString()) != "")
                {
                    //   Console.Write(s);
                }
            }

            /*
             * Console.WriteLine("MP4 TO MP4 TO MP4 TO MP4 TO");
             * Console.WriteLine(pos.ToString());
             * Console.WriteLine(pos.ToString());
             * Console.WriteLine(pos.ToString());
             * Console.WriteLine(pos.ToString());
             */
            ffmpeg.Hatiko();
        }
Пример #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();
        }