예제 #1
0
        /// <summary>
        /// The set encoder.
        /// </summary>
        /// <param name="encoder">
        /// The encoder.
        /// </param>
        public void SetEncoder(VideoEncoder encoder)
        {
            // Cache the existing string so it can be reused if the user changes the encoder back.
            if (!string.IsNullOrEmpty(this.AdvancedOptionsString))
            {
                this.cachedOptions[CurrentVideoEncoder] = this.AdvancedOptionsString;
            }

            this.CurrentVideoEncoder = encoder;

            // Set the option from the cached version if we have one.
            string advacnedOptionsString;
            if (cachedOptions.TryGetValue(encoder, out advacnedOptionsString)
                && !string.IsNullOrEmpty(advacnedOptionsString))
            {
                this.AdvancedOptionsString = advacnedOptionsString;
            }
            else
            {
                this.AdvancedOptionsString = this.Preset != null && this.Preset.Task != null
                                             && !string.IsNullOrEmpty(this.Preset.Task.AdvancedEncoderOptions)
                                                 ? this.Preset.Task.AdvancedEncoderOptions
                                                 : string.Empty;
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            var orderProcessor = new OrderProcessor(new ShippingCalculator());

            var order = new Order
            {
                DatePlaced = DateTime.Now,
                TotalPrice = 100f
            };

            //orderProcessor.Process(order);


            // In the program, we pass in a concrete implementation of the ILogger interface
            var migrator = new DbMigrator(new ConsoleLogger());

            migrator.Migrate();

            var dbMigrator = new DbMigrator(new FileLogger("C:/Users/cecd304/me/info.txt"));

            dbMigrator.Migrate();

            Console.Clear();

            var encoder = new VideoEncoder();

            encoder.RegisterNotificationChannel(new MailNotificationChannel());
            encoder.RegisterNotificationChannel(new SmsNotificationChannel());

            encoder.Encode(new Video());
        }
        /** Add default audio track with default configuration */
        public void AddVideoTrack(VideoEncoder encoder, Android.Hardware.CameraFacing camera, VideoQuality videoQuality, bool flash)
        {
            IStream stream = null;

            VideoQuality.Merge(videoQuality, defaultVideoQuality);
            switch (encoder)
            {
            case VideoEncoder.H263:
                stream = new H263Stream(camera);
                break;

            case VideoEncoder.H264:
                throw new NotImplementedException();
                //break;
            }
            if (stream != null)
            {
                //Log.d(TAG,"Quality is: "+videoQuality.resX+"x"+videoQuality.resY+"px "+videoQuality.frameRate+"fps, "+videoQuality.bitRate+"bps");
                ((VideoStream)stream).SetVideoQuality(videoQuality);
                ((VideoStream)stream).SetPreviewDisplay(surfaceHolder);
                ((VideoStream)stream).SetFlashState(flash);
                stream.SetDestination(destination, videoPort);
                tracks.Add(new Track(stream, Track.VIDEO));
            }
            else
            {
                //do something here
            }
        }
예제 #4
0
        /// <summary>
        /// Get the Video Encoder for a given string
        /// </summary>
        /// <param name="encoder">
        /// The encoder name
        /// </param>
        /// <returns>
        /// VideoEncoder enum object
        /// </returns>
        public static string GetVideoEncoder(VideoEncoder encoder)
        {
            switch (encoder)
            {
            case VideoEncoder.FFMpeg:
                return("mpeg4");

            case VideoEncoder.FFMpeg2:
                return("mpeg2");

            case VideoEncoder.X264:
                return("x264");

            case VideoEncoder.QuickSync:
                return("qsv_h264");

            case VideoEncoder.Theora:
                return("theora");

            case VideoEncoder.X265:
                return("x265");

            case VideoEncoder.VP8:
                return("VP8");

            default:
                return("x264");
            }
        }
예제 #5
0
 static void Main(string[] args)
 {
     {
         var person1 = new Person();
         var person2 = new StructPerson();
         System.Console.WriteLine(person1.ToString());
         person1.Print();
         var person3 = person1;
         person1.Age = 26;// class is ref type, person1/3 are the same
         person3.Print();
         System.Console.WriteLine(person2.ToString());
         person2.Print();
         var person4 = person2;
         person2.Age = 26;
         person4.Print();// struct is value type, person2/4 are not the same
     }
     {
         var video = new Video()
         {
             Name = "Magan_suck_my_cock.mp4"
         };
         var video_encoder   = new VideoEncoder();
         var message_sender  = new MessageSender();
         var message_sender2 = new MessageSender();
         video_encoder.VideoEncoded += message_sender.OnVideoEncoded;
         video_encoder.VideoEncoded += message_sender2.OnVideoEncoded;
         video_encoder.Encode(video); // 看来是一个个发的, event系统并不意味着多线程
     }
 }
예제 #6
0
 public void EncodeUsingCommandLine(VideoEncoder encoder, string sourceFilePath, string targetFilePath)
 {
     if (!string.IsNullOrEmpty(sourceFilePath) && File.Exists(sourceFilePath))
     {
         encoder.Encode(sourceFilePath, targetFilePath);
     }
 }
예제 #7
0
        /// <summary>
        /// Convert a Quality Value to a position value for the Video Quality slider
        /// </summary>
        /// <param name="videoEncoder">The selected video encoder</param>
        /// <param name="value">The Quality value</param>
        /// <returns>The position on the video quality slider</returns>
        private static int QualityToSliderValue(VideoEncoder videoEncoder, double?value)
        {
            if (!value.HasValue)
            {
                // Default to a sensible level.
                return(20);
            }

            int sliderValue = 0;

            switch (videoEncoder)
            {
            case VideoEncoder.FFMpeg:
            case VideoEncoder.FFMpeg2:
                sliderValue = 32 - (int)value;
                break;

            case VideoEncoder.X264:
                double cqStep = UserSettingService.GetUserSetting <double>(ASUserSettingConstants.X264Step);
                sliderValue = (int)((51.0 / cqStep) - (value / cqStep));
                break;

            case VideoEncoder.Theora:
                sliderValue = (int)value;
                break;
            }

            return(sliderValue);
        }
예제 #8
0
 static void Main(string[] args)
 {
     var encoder = new VideoEncoder();
     encoder.RegisterNotificationChannel(new MailNotificationChannel());
     encoder.RegisterNotificationChannel(new SmsNotificationChannel());
     encoder.Encode(new Video());
 }
예제 #9
0
        public void videoencoder_encode()
        {
            //VideoEncoder *ve = new VideoEncoder(L"C:\\Users\\user\\Dropbox\\Cloud\\GitHub\\MusicianHelper\\TEST\\Images\\paper-stained-3-texture.bmp", L"C:\\Users\\user\\Dropbox\\Cloud\\GitHub\\MusicianHelper\\TEST\\Audio\\sorry_dave.wav", L"output.wmv", vs);
            //VideoEncoder *ve = new VideoEncoder(L"C:\\Users\\chpink\\Home\\sandbox\\MusicianHelper\\TEST\\Images\\paper-stained-3-texture.bmp", L"C:\\Users\\chpink\\Home\\sandbox\\MusicianHelper\\TEST\\Audio\\sorry_dave.wav", L"output.wmv", vs);

            //const string imageFilePath = "C:\\Users\\chpink\\Home\\sandbox\\MusicianHelper\\TEST\\Images\\paper-stained-3-texture.bmp";
            //const string audioFilePath = "C:\\Users\\chpink\\Home\\sandbox\\MusicianHelper\\TEST\\Audio\\sorry_dave.wav";
            const string imageFilePath   = "C:\\Users\\user\\Dropbox\\Cloud\\GitHub\\MusicianHelper\\TEST\\test.bmp";
            const string audioFilePath   = "C:\\Users\\user\\Dropbox\\Cloud\\GitHub\\MusicianHelper\\TEST\\sorry_dave.wav";
            const string videoOutputPath = "output.wmv";

            if (File.Exists(videoOutputPath))
            {
                File.Delete(videoOutputPath);
            }

            var encoder = new VideoEncoder();

            encoder.ImageFilePath   = imageFilePath;
            encoder.AudioFilePath   = audioFilePath;
            encoder.VideoOutputPath = videoOutputPath;

            encoder.Encode();

            Assert.True(File.Exists(videoOutputPath));

            var fi = new FileInfo(videoOutputPath);

            Assert.NotEqual(0, fi.Length);
        }
예제 #10
0
        static void Main(string[] args)
        {
            IFactoryCreate factor = new Factory {
                Factory1 = "Tovarna 1"
            };
            Factory factory = new Factory();

            factory.CreateFactory += Factory_CreateFactory;

            factory.NameOfDelegate(factor);



            Video video = new Video()
            {
                NameOfVideo = "Johny Depp", Title = "Film"
            };

            Mail mail = new Mail()
            {
                MailType = "Email service"
            };
            Message message = new Message()
            {
                MessageType = "Post mail"
            };
            MessageService messageService = new MessageService(message);
            MailService    mailService    = new MailService(mail);
            VideoEncoder   encoder        = new VideoEncoder(video);

            encoder.OnVideoDemand += messageService.Encoded;
            encoder.OnVideoDemand += mailService.SendMail;
            encoder.OnVideoDemand += mailService.DisplayTerms;
            encoder.Encode(video);
        }
예제 #11
0
        /// <summary>
        /// 视频捕捉前事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void VC_VideoCapturerBefore(object sender, VideoCapturedEventArgs e)
        {
            Console.WriteLine("bmiColors:" + e.BITMAPINFO.bmiColors.ToString());
            Console.WriteLine("biSize:" + e.BITMAPINFO.bmiHeader.biSize.ToString() + " biSizeImage:" + e.BITMAPINFO.bmiHeader.biSizeImage.ToString()
                              + " biBitCount:" + e.BITMAPINFO.bmiHeader.biBitCount.ToString() + " biWidth:" + e.BITMAPINFO.bmiHeader.biWidth.ToString()
                              + " biHeight:" + e.BITMAPINFO.bmiHeader.biHeight.ToString()
                              + " biClrUsed:" + e.BITMAPINFO.bmiHeader.biClrUsed.ToString() + "  biClrImportant:" + e.BITMAPINFO.bmiHeader.biClrImportant.ToString()
                              + " biXPelsPerMeter:" + e.BITMAPINFO.bmiHeader.biXPelsPerMeter.ToString() + " biYPelsPerMeter:" + e.BITMAPINFO.bmiHeader.biYPelsPerMeter.ToString()
                              + " biPlanes:" + e.BITMAPINFO.bmiHeader.biPlanes.ToString() + " biCompression:" + e.BITMAPINFO.bmiHeader.biCompression.ToString());
            if (VE == null)
            {
                VE = new VideoEncoder(e.BITMAPINFO, true); //根据摄像头采集数据的格式,创建新的视频编码器
            }
            if (VR == null)
            {
                VR = new VideoRender(this.cRemote);
                VR.IniVideoRender(e.BITMAPINFO.bmiHeader);
            }

            if (VD == null)
            {
                VD = new VideoEncoder(e.BITMAPINFO, false); //初始化解码器
            }
            //防止丢包,发送三次本地视频图像头信息给对方,以便对方解码器正确解码
            //    AVcommunication1.SendBITMAPINFOHEADER(e.BITMAPINFO.bmiHeader);//发送本地视频图像头信息给对方,以便对方解码器正确解码
            //    System.Threading.Thread.Sleep(300);
            //    AVcommunication1.SendBITMAPINFOHEADER(e.BITMAPINFO.bmiHeader);//发送本地视频图像头信息给对方,以便对方解码器正确解码
            //    System.Threading.Thread.Sleep(300);
            //    AVcommunication1.SendBITMAPINFOHEADER(e.BITMAPINFO.bmiHeader);//发送本地视频图像头信息给对方,以便对方解码器正确解码
        }
예제 #12
0
        public void Call()
        {
            var video = new Video {
                Title = "Video 1"
            };
            var videoEncoder   = new VideoEncoder();   //publisher
            var mailService    = new MailService();    //subscriber
            var messageService = new MessageService(); //subscriber

            //Without any EventArgs
            videoEncoder.VideoEncoded += mailService.OnVideoEncoded; //Now we are not doing OnVideoEncoded() as we're not calling the method, just used the name
            //which means this is a reference/pointer to that method. Hence VideoEncoded event behind the scenes is a list of pointers to methods
            videoEncoder.VideoEncoded += messageService.OnVideoEncoded;
            videoEncoder.VideoEncoded += null;
            // Hence we added subscribers to the event before calling/starting Encode
            videoEncoder.Encode(video);

            //Sending EventArgs to the subscribers
            var videoEncoderWithArgs = new SendingEventArgs.VideoEncoder();

            videoEncoderWithArgs.VideoEncoded += mailService.OnVideoEncoded;
            videoEncoderWithArgs.Encode(video);

            //Calling directly via delegate
            VideoEncoder.VideoEncodedEventHandler videoEncodedEventHandler = mailService.OnVideoEncoded;
            videoEncodedEventHandler += messageService.OnVideoEncoded;
            videoEncodedEventHandler  = null; //Delegates can be assigned null directly which is not what we want
            videoEncoder.Encode(video, videoEncodedEventHandler);
        }
예제 #13
0
        static void Main(string[] args)
        {
            //DbMigrator migrator = new DbMigrator(new Logger());
            //Installer installer = new Installer(new Logger());

            //migrator.Notify();
            //installer.Notify();

            //var orderProcessor = new OrderProcessor(new ShippingCalculator());
            //var order = new Order() {DatePlaced = DateTime.Now, TotalPrice = 100f};
            //orderProcessor.Process(order);


            //var dbMigrator = new DbMigrator(new ConsoleLogger());
            //dbMigrator.Migrate();

            //var dbMigrator2 = new DbMigrator(new FileLogger("C:\\LogMessage\\FileLogger.txt"));
            //dbMigrator2.Migrate();

            var videoEncoder = new VideoEncoder();

            videoEncoder.RegisterNotificationChannel(new MailNotificationChannel());
            videoEncoder.RegisterNotificationChannel(new SmsNotificationChannel());


            videoEncoder.Encode(new Video());
        }
        public void videoencoder_encode()
        {
            //VideoEncoder *ve = new VideoEncoder(L"C:\\Users\\user\\Dropbox\\Cloud\\GitHub\\MusicianHelper\\TEST\\Images\\paper-stained-3-texture.bmp", L"C:\\Users\\user\\Dropbox\\Cloud\\GitHub\\MusicianHelper\\TEST\\Audio\\sorry_dave.wav", L"output.wmv", vs);
            //VideoEncoder *ve = new VideoEncoder(L"C:\\Users\\chpink\\Home\\sandbox\\MusicianHelper\\TEST\\Images\\paper-stained-3-texture.bmp", L"C:\\Users\\chpink\\Home\\sandbox\\MusicianHelper\\TEST\\Audio\\sorry_dave.wav", L"output.wmv", vs);

            //const string imageFilePath = "C:\\Users\\chpink\\Home\\sandbox\\MusicianHelper\\TEST\\Images\\paper-stained-3-texture.bmp";
            //const string audioFilePath = "C:\\Users\\chpink\\Home\\sandbox\\MusicianHelper\\TEST\\Audio\\sorry_dave.wav";
            const string imageFilePath = "C:\\Users\\user\\Dropbox\\Cloud\\GitHub\\MusicianHelper\\TEST\\test.bmp";
            const string audioFilePath = "C:\\Users\\user\\Dropbox\\Cloud\\GitHub\\MusicianHelper\\TEST\\sorry_dave.wav";
            const string videoOutputPath = "output.wmv";

            if (File.Exists(videoOutputPath))
                File.Delete(videoOutputPath);

            var encoder = new VideoEncoder();
            encoder.ImageFilePath = imageFilePath;
            encoder.AudioFilePath = audioFilePath;
            encoder.VideoOutputPath = videoOutputPath;

            encoder.Encode();

            Assert.True(File.Exists(videoOutputPath));

            var fi = new FileInfo(videoOutputPath);

            Assert.NotEqual(0, fi.Length);
        }
예제 #15
0
        void StartEncoder()
        {
            if (!videoEncoder.IsEmpty)
            {
                videoEncoder.Dispose();
            }

            videoEncoder = new VideoEncoder(this);
            videoEncoder.HandleVideoFrame      += HandleEncoderFrame;
            videoEncoder.HandleEncode          += OnEncodeDone;
            videoEncoder.HandleBitstreamBuffer += HandleBitstreamBuffer;

            frameTimeStampQueue.Clear();

            videoEncoder.HandleInitialize += OnInitializedEncoder;
            var error = videoEncoder.Initialize(
                frameFormat, frameSize, videoProfile, 2000000,
                HardwareAcceleration.Withfallback);

            if (error != PPError.OkCompletionpending)
            {
                LogError(error, "Cannot initialize encoder");
                return;
            }
        }
예제 #16
0
        /// <summary>
        /// Convert a Quality Value to a position value for the Video Quality slider
        /// </summary>
        /// <param name="videoEncoder">The selected video encoder</param>
        /// <param name="value">The Quality value</param>
        /// <returns>The position on the video quality slider</returns>
        private static int QualityToSliderValue(VideoEncoder videoEncoder, double?value)
        {
            if (!value.HasValue)
            {
                // Default to a sensible level.
                return(20);
            }

            int sliderValue = 0;

            switch (videoEncoder)
            {
            case VideoEncoder.FFMpeg:
                sliderValue = 32 - (int)value;
                break;

            case VideoEncoder.X264:
                double cqStep = Properties.Settings.Default.x264cqstep;
                sliderValue = (int)((51.0 / cqStep) - (value / cqStep));
                break;

            case VideoEncoder.Theora:
                sliderValue = (int)value;
                break;
            }

            return(sliderValue);
        }
예제 #17
0
        static void Main(string[] args)
        {
            //reason for using interfaecs:
            //Testability- when we unit testing a class we must isolate it (remove all dependancies to another classes)
            var orderProcessor = new OrderProcessor(new ShippingCalculator()); // this is a dependancy but in the main mthod so i'ts fine.
            var order          = new Order {
                DatePlaced = DateTime.Now, TotalPrice = 100f
            };

            orderProcessor.Process(order);

            //Extensibility - we create new classes insted of changing the code in one class
            var dbMigrator = new DbMigrator(new ConsoleLogger());

            dbMigrator.Migrate();
            var dbMigratoB = new DbMigrator(new FileLogger(@"c:\logging\log.txt"));

            dbMigratoB.Migrate();


            //polymphism:
            var encoder = new VideoEncoder();

            encoder.RegisterNotificationChannel(new MailNotificationChannel());
            encoder.RegisterNotificationChannel(new SmsNotificationChannel());
            encoder.Encode(new Video());
        }
예제 #18
0
        static void UsePolymorphism()
        {
            var encoder = new VideoEncoder();

            encoder.RegisterNotificationChannel(new MailNotificationChannel());
            encoder.RegisterNotificationChannel(new SMSNotificationChannel());
            encoder.Encode(new Video());
        }
예제 #19
0
        public void InterfacesAndPolymorphism()
        {
            var encoder = new VideoEncoder();

            encoder.RegisterNotificationChannel(new MailNotificationChannel());
            encoder.RegisterNotificationChannel(new SmsNotificationChannel());
            encoder.Encode(new Video());
        }
예제 #20
0
        public static void Demo()
        {
            var encoder = new VideoEncoder();

            encoder.RegisterNotificationChannel(new MailNotificationChannel());
            encoder.RegisterNotificationChannel(new SmsNotificationChannel());
            encoder.Encode(new Video());
        }
        public void videoencoder_get_set_videooutputpath()
        {
            const string expected = "Test set string";

            var obj = new VideoEncoder { VideoOutputPath = expected };

            Assert.Equal(expected, obj.VideoOutputPath);
        }
        public void videoencoder_get_set_imagefilepath()
        {
            const string expected = "Test set string";

            var obj = new VideoEncoder {ImageFilePath = expected};

            Assert.Equal(expected, obj.ImageFilePath);
        }
예제 #23
0
 /// <summary>
 /// The set encoder.
 /// </summary>
 /// <param name="encoder">
 /// The encoder.
 /// </param>
 public void SetEncoder(VideoEncoder encoder)
 {
     this.DisplayX264Options = encoder == VideoEncoder.X264;
     if (encoder == VideoEncoder.Theora)
     {
         this.DisplayX264Options = null;
     }
 }
예제 #24
0
        static void Main(string[] args)
        {
            var encoder = new VideoEncoder();

            encoder.RegisterNotificationChannel(new MailNotificationChannel());
            encoder.RegisterNotificationChannel(new SmsNotificationChannel());
            encoder.Encode(new Video());
        }
예제 #25
0
        static void Main(string[] args)
        {
            Console.WriteLine("Ffmpeg Interop Test Console");

            FfmpegInit.Initialise();

            VideoEncoder vp8Encoder = new VideoEncoder(FFmpeg.AutoGen.AVCodecID.AV_CODEC_ID_VP8, FRAME_WIDTH, FRAME_HEIGHT, FRAMES_PER_SECOND);

            int linesz = ffmpeg.av_image_get_linesize(AVPixelFormat.AV_PIX_FMT_YUV420P, FRAME_WIDTH, 0);

            AVFrame *frame = ffmpeg.av_frame_alloc();

            frame->format = (int)AVPixelFormat.AV_PIX_FMT_YUV420P;
            frame->width  = FRAME_WIDTH;
            frame->height = FRAME_HEIGHT;
            frame->pts    = 0;

            ffmpeg.av_frame_get_buffer(frame, 0).ThrowExceptionIfError();
            ffmpeg.av_frame_make_writable(frame).ThrowExceptionIfError();

            for (int y = 0; y < FRAME_HEIGHT; y++)
            {
                for (int x = 0; x < FRAME_WIDTH; x++)
                {
                    frame->data[0][y * frame->linesize[0] + x] = (byte)(x + y + 1 * 3);
                }
            }

            for (int y = 0; y < FRAME_HEIGHT / 2; y++)
            {
                for (int x = 0; x < FRAME_WIDTH / 2; x++)
                {
                    frame->data[1][y * frame->linesize[1] + x] = (byte)(128 + y + 2);
                    frame->data[2][y * frame->linesize[2] + x] = (byte)(64 + y + 5);
                }
            }

            byte[] encoded = vp8Encoder.Encode(frame);

            if (encoded == null)
            {
                Console.WriteLine("Video encode failed.");
            }
            else
            {
                Console.WriteLine($"Video encode succeeded, encoded frame size {encoded.Length}.");
            }

            //var videoFrameConverter = new VideoFrameConverter(
            //    new Size(frameWidth, frameHeight),
            //    AVPixelFormat.AV_PIX_FMT_RGB24,
            //    new Size(frameWidth, frameHeight),
            //    AVPixelFormat.AV_PIX_FMT_YUV420P);

            //Console.WriteLine($"VP8 decoder successfully initialised {vp8Decoder.GetDecoderName()}.");

            ffmpeg.av_frame_free(&frame);
        }
예제 #26
0
        public VideoEncoderShould()
        {
            var video = new Video
            {
                Name = videoName
            };

            sut = new VideoEncoder(video);
        }
예제 #27
0
        public ActionResult Create(CourseAssets courseassets, HttpPostedFileBase file, int Courseid)
        {
            var          guidFileName = string.Empty;
            var          videoSize    = string.Empty;
            var          loggedUserID = string.Empty;
            var          tmpGuid      = string.Empty;
            VideoEncoder objEncoder;

            if (ModelState.IsValid)
            {
                courseassets.CourseID = Courseid;
                try
                {
                    loggedUserID        = Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString();
                    courseassets.userID = Convert.ToInt32(loggedUserID);
                }
                catch (Exception ex)
                {
                    courseassets.userID = 0;
                }

                if (file != null)
                {
                    if (file.ContentLength > 0)
                    {
                        objEncoder = new VideoEncoder();
                        var fileInfoObj = new FileInfo(file.FileName);
                        tmpGuid      = Guid.NewGuid().ToString().ToUpper();
                        guidFileName = tmpGuid + fileInfoObj.Extension.ToLower();
                        videoSize    = file.ContentLength.ToString();
                        var path = Path.Combine(Server.MapPath("~/tempVideoFiles/"), guidFileName);
                        if (!Directory.Exists(Server.MapPath("~/tempVideoFiles/")))
                        {
                            Directory.CreateDirectory(Server.MapPath("~/tempVideoFiles/"));
                        }
                        file.SaveAs(path);
                        if (!Directory.Exists(Server.MapPath("~/VideoFiles/")))
                        {
                            Directory.CreateDirectory(Server.MapPath("~/VideoFiles/"));
                        }
                        objEncoder.EncodeVideo(guidFileName, file.FileName);
                        if (System.IO.File.Exists(path))
                        {
                            System.IO.File.Delete(path);
                        }
                    }
                    courseassets.AssetGUid = tmpGuid;
                    courseassets.AssetSize = Convert.ToInt32(videoSize);
                }

                db.CourseAssets.Add(courseassets);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(courseassets));
        }
 public void Setup()
 {
     this.publisher   = new VideoEncoder {
     };
     this.subscriber1 = new MailService {
     };
     this.subscriber2 = new TextService {
     };
 }
예제 #29
0
        public static bool IsH264(VideoEncoder encoder)
        {
            if (encoder == VideoEncoder.X264 || encoder == VideoEncoder.X264_10 || encoder == VideoEncoder.QuickSync || encoder == VideoEncoder.NvencH264)
            {
                return(true);
            }

            return(false);
        }
예제 #30
0
 public void EncodeUsingCommandLine(VideoEncoder encoder, string sourceFilePath, string targetFilePath)
 {
     if (!string.IsNullOrEmpty(sourceFilePath) && File.Exists(sourceFilePath))
     {
         OnEncodingProgressChanged(-1);
         encoder.Encode(sourceFilePath, targetFilePath);
         OnEncodingProgressChanged(100);
     }
 }
예제 #31
0
 public EncoderProgramForm(VideoEncoder encoder)
 {
     this.encoder = encoder;
     InitializeComponent();
     txtName.Text      = encoder.Name ?? "";
     txtPath.Text      = encoder.Path ?? "";
     txtArguments.Text = encoder.Args ?? "";
     txtExtension.Text = encoder.OutputExtension ?? "";
 }
예제 #32
0
        public void videoencoder_get_set_audiofilepath()
        {
            const string expected = "Test set string";

            var obj = new VideoEncoder {
                AudioFilePath = expected
            };

            Assert.Equal(expected, obj.AudioFilePath);
        }
예제 #33
0
        private void AddVideoEncoder(VideoEncoder encoder)
        {
            ListViewItem lvi = new ListViewItem(encoder.Name ?? "");

            lvi.Tag = encoder;
            lvi.SubItems.Add(encoder.Path ?? "");
            lvi.SubItems.Add(encoder.Args ?? "");
            lvi.SubItems.Add(encoder.OutputExtension ?? "");
            lvEncoders.Items.Add(lvi);
        }
예제 #34
0
        public void videoencoder_get_set_videooutputpath()
        {
            const string expected = "Test set string";

            var obj = new VideoEncoder {
                VideoOutputPath = expected
            };

            Assert.Equal(expected, obj.VideoOutputPath);
        }
예제 #35
0
        /// <summary>
        /// The handle encoder change.
        /// </summary>
        /// <param name="selectedEncoder">
        /// The selected encoder.
        /// </param>
        private void HandleEncoderChange(VideoEncoder selectedEncoder)
        {
            if (selectedEncoder != VideoEncoder.X264)
            {
                this.UseAdvancedTab = false;
            }

            HBVideoEncoder encoder = HandBrakeEncoderHelpers.VideoEncoders.FirstOrDefault(s => s.ShortName == EnumHelper<VideoEncoder>.GetShortName(selectedEncoder));
            if (encoder != null)
            {
                // Setup Profile
                this.VideoProfiles.Clear();
                if (encoder.Profiles != null)
                {
                    foreach (var item in encoder.Profiles)
                    {
                        this.VideoProfiles.Add(new VideoProfile(item, item));
                    }
                    this.VideoProfile = this.VideoProfiles.FirstOrDefault();
                }
                else
                {
                    this.VideoProfile = null;
                }

                // Setup Tune
                this.VideoTunes.Clear();
                if (encoder.Tunes != null)
                {
                    this.VideoTunes.Add(VideoTune.None);
                    foreach (var item in encoder.Tunes)
                    {
                        if (item != VideoTune.FastDecode.ShortName)
                        {
                            this.VideoTunes.Add(new VideoTune(item, item));
                        }
                    }
                    this.FastDecode = false;
                    this.VideoTune = VideoTune.None;
                }
                else
                {
                    this.FastDecode = false;
                    this.VideoTune = VideoTune.None;
                }

                // Setup Levels
                this.VideoLevels.Clear();
                if (encoder.Levels != null)
                {
                    foreach (var item in encoder.Levels)
                    {
                        this.VideoLevels.Add(new VideoLevel(item, item));
                    }

                    this.VideoLevel = this.VideoLevels.FirstOrDefault();
                }
                else
                {
                    this.VideoLevel = VideoLevel.Auto;
                }

                // Setup Presets.
                this.VideoPresets.Clear();
                if (encoder.Presets != null)
                {
                    foreach (var item in encoder.Presets)
                    {
                        this.VideoPresets.Add(new VideoPreset(item, item));
                    }

                    this.VideoPresetMaxValue = encoder.Presets.Count - 1;
                    int middlePreset = (int)Math.Round((decimal)(this.VideoPresetMaxValue / 2), 0);
                    this.VideoPresetValue = middlePreset;
                }
                else
                {
                    this.VideoPreset = null;
                }
            }

            // Tell the Advanced Panel off the change
            IAdvancedViewModel advancedViewModel = IoC.Get<IAdvancedViewModel>();
            advancedViewModel.SetEncoder(this.Task.VideoEncoder);

            // Update the Quality Slider. Make sure the bounds are up to date with the users settings.
            this.SetQualitySliderBounds();

            // Update control display
            this.UseAdvancedTab = selectedEncoder != VideoEncoder.QuickSync && this.UseAdvancedTab;
            this.DisplayOptimiseOptions = this.SelectedVideoEncoder == VideoEncoder.X264 || this.SelectedVideoEncoder == VideoEncoder.X265 || this.SelectedVideoEncoder == VideoEncoder.QuickSync;
            this.DisplayNonQSVControls = this.SelectedVideoEncoder != VideoEncoder.QuickSync;
            this.DisplayTurboFirstPass = selectedEncoder == VideoEncoder.X264;
            this.DisplayTuneControls = SelectedVideoEncoder == VideoEncoder.X264 || SelectedVideoEncoder == VideoEncoder.X265;
            this.DisplayLevelControl = SelectedVideoEncoder == VideoEncoder.X264;

            // Refresh Display
            this.NotifyOfPropertyChange(() => this.Rfqp);
            this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
            this.NotifyOfPropertyChange(() => this.HighQualityLabel);

            // Handle some quicksync specific options.
            if (selectedEncoder == VideoEncoder.QuickSync)
            {
                this.IsConstantFramerate = true;
                this.TwoPass = false;
                this.TurboFirstPass = false;
                this.Task.Framerate = null;
                this.NotifyOfPropertyChange(() => SelectedFramerate);
                this.UseAdvancedTab = false;
            }
        }
 public void Dispose()
 {
     EndSave();
     Thread.Sleep(1);
     try
     {
         saber.Abort();
     }
     catch { }
     Thread.Sleep(1);
     if (srm != null)
     {
         try
         {
             srm.Close();
         }
         catch { }
     }
     saber = null;
     srm = null;
     if (source != null)
     {
         try
         {
             source.DataUpdated -= source_DataUpdated;
         }
         catch { }
         source = null;
     }
 }
예제 #37
0
 /// <summary>
 /// Set the currently selected encoder.
 /// </summary>
 /// <param name="encoder">
 /// The Video Encoder.
 /// </param>
 public void SetEncoder(VideoEncoder encoder)
 {
     if (encoder == VideoEncoder.X264)
     {
         this.DisplayX264Options = true;
     }
     else
     {
         this.x264Preset = x264Preset.None;
         this.x264Profile = x264Profile.None;
         this.x264Tune = x264Tune.None;
         this.DisplayX264Options = false;
     }
 }
		/** Set the default video encoder, it will be used by addVideoTrack() */
		public static void SetDefaultVideoEncoder(VideoEncoder encoder) {
			defaultVideoEncoder = encoder;
		}
예제 #39
0
 /// <summary>
 /// The set encoder.
 /// </summary>
 /// <param name="encoder">
 /// The encoder.
 /// </param>
 public void SetEncoder(VideoEncoder encoder)
 {
     this.DisplayX264Options = encoder == VideoEncoder.X264;
     if (encoder == VideoEncoder.Theora)
     {
         this.DisplayX264Options = null;
     }
 }
예제 #40
0
        /// <summary>
        /// Set the currently selected encoder.
        /// </summary>
        /// <param name="encoder">
        /// The Video Encoder.
        /// </param>
        public void SetEncoder(VideoEncoder encoder)
        {
            this.DisplayH264Options = encoder == VideoEncoder.X264 || encoder == VideoEncoder.QuickSync;
            this.DisplayX264Options = encoder == VideoEncoder.X264;
            this.DisplayQSVOptions = encoder == VideoEncoder.QuickSync;
            this.DisplayX265Options = encoder == VideoEncoder.X265;

            if (encoder == VideoEncoder.QuickSync)
            {
                this.UseAdvancedTab = false;
            }
        }
        /// <summary>
        /// The set encoder.
        /// </summary>
        /// <param name="encoder">
        /// The encoder.
        /// </param>
        public void SetEncoder(VideoEncoder encoder)
        {
            // Cache the existing string so it can be reused if the user changes the encoder back.
            if (!string.IsNullOrEmpty(this.AdvancedOptionsString))
            {
                this.cachedOptions[CurrentVideoEncoder] = this.AdvancedOptionsString;
            }

            this.CurrentVideoEncoder = encoder;

            // Set the option from the cached version if we have one.
            string advacnedOptionsString;
            if (cachedOptions.TryGetValue(encoder, out advacnedOptionsString)
                && !string.IsNullOrEmpty(advacnedOptionsString))
            {
                this.AdvancedOptionsString = advacnedOptionsString;
            }
            else
            {
                this.AdvancedOptionsString = this.Preset != null && this.Preset.Task != null
                                             && !string.IsNullOrEmpty(this.Preset.Task.AdvancedEncoderOptions)
                                                 ? this.Preset.Task.AdvancedEncoderOptions
                                                 : string.Empty;
            }
        }
예제 #42
0
        /// <summary>
        /// Reads all static xbox information that will remain constant throughout a session.
        /// </summary>
        private void GetXboxInformation()
        {
            // xbox video encoder type
            if (CallAddressEx(Kernel.HalReadSMBusValue, null, true, SMBusDevices.VideoEncoderXcalibur, VideoEncoderCommand.Detect, 0, scratchBuffer) == 0) videoEncoderType = VideoEncoder.Xcalibur;
            else if (CallAddressEx(Kernel.HalReadSMBusValue, null, true, SMBusDevices.VideoEncoderConnexant, VideoEncoderCommand.Detect, 0, scratchBuffer) == 0) videoEncoderType = VideoEncoder.Connexant;
            else if (CallAddressEx(Kernel.HalReadSMBusValue, null, true, SMBusDevices.VideoEncoderFocus, VideoEncoderCommand.Detect, 0, scratchBuffer) == 0) videoEncoderType = VideoEncoder.Focus;
            else videoEncoderType = VideoEncoder.Unknown;

            // xbox version info
            CallAddressEx(Kernel.HalReadSMBusValue, null, false, SMBusDevices.PIC, PICCommand.Version, 0, scratchBuffer);
            CallAddressEx(Kernel.HalReadSMBusValue, null, false, SMBusDevices.PIC, PICCommand.Version, 0, scratchBuffer + 1);
            CallAddressEx(Kernel.HalReadSMBusValue, null, false, SMBusDevices.PIC, PICCommand.Version, 0, scratchBuffer + 2);
            string code = ASCIIEncoding.ASCII.GetString(GetMemory(scratchBuffer, 3));
            switch (code)
            {
                case "01D":
                case "D01":
                case "1D0":
                case "0D1": version = "Xbox Development Kit"; break;
                case "P01": version = "Xbox v1.0"; break;
                case "P05": version = "Xbox v1.1"; break;
                case "P11":
                case "1P1":
                case "11P":
                    if (videoEncoderType == VideoEncoder.Focus) version = "1.4";
                    else version = "Xbox v1.2/1.3"; break;
                case "P2L": version = "Xbox v1.6"; break;
                case "B11":
                case "DBG": version = "Xbox Debug Kit"; break;   // green

                default: version = code + ": Unknown Xbox"; break;
            }

            // processor information
            SetMemory(ScriptBufferAddress, Util.StringToHexBytes("B8010000000FA2A300000100B80000DB02C21000"));
            SendCommand("crashdump");
            uint eax = GetUInt32(0x10000);
            processorInformation.Stepping = eax & 0xf;
            processorInformation.Model = (eax >> 4) & 0xf;
            processorInformation.Family = (eax >> 8) & 0xf;
            if (processorInformation.Model == 11) cpuFrequency = "1.48 GHz"; // DreamX console
            else if (processorInformation.Model == 8 && processorInformation.Stepping == 6) cpuFrequency = "1.00 GHz";   // Intel Pentium III Coppermine
            else cpuFrequency = "733.33 MHz";

            // hardware info
            uint ver = GetUInt32(Kernel.HardwareInfo);
            string vstr = Convert.ToString(ver, 16).PadLeft(8, '0');
            string vstr2 = Util.HexBytesToString(GetMemory(Kernel.HardwareInfo + 4, 2)).Insert(2, " ");
            hardwareInfo = vstr + " " + vstr2;

            macAddress = BitConverter.ToString(eeprom, 0x40, 6).Replace('-', ':');

            serialNumber = Convert.ToUInt64(ASCIIEncoding.ASCII.GetString(eeprom, 0x34, 12));
            lanKey = GetMemory(Kernel.XboxLANKey, 16);
            signatureKey = GetMemory(Kernel.XboxSignatureKey, 16);
            eepromKey = GetMemory(Kernel.XboxEEPROMKey, 16);
            hardDriveKey = GetMemory(Kernel.XboxHDKey, 16);

            byte[] hdModelInfo = GetMemory(Kernel.HalDiskModelNumber, 40);
            uint unk1 = BitConverter.ToUInt32(hdModelInfo, 0);
            uint index = BitConverter.ToUInt32(hdModelInfo, 4);
            hardDriveModel = ASCIIEncoding.ASCII.GetString(hdModelInfo, 8, 32).Trim().Replace("\0", "");

            byte[] hdSerialInfo = GetMemory(Kernel.HalDiskSerialNumber, 32);
            unk1 = BitConverter.ToUInt32(hdSerialInfo, 0);
            index = BitConverter.ToUInt32(hdSerialInfo, 4);
            hardDriveSerial = ASCIIEncoding.ASCII.GetString(hdSerialInfo, 8, 16).Trim().Replace("\0", "");

            alternateSignatureKeys = new byte[16][];
            byte[] keyData = GetMemory(Kernel.XboxAlternateSignatureKeys, 256);
            for (int i = 0; i < 16; i++)
            {
                alternateSignatureKeys[i] = new byte[16];
                Buffer.BlockCopy(keyData, i * 16, alternateSignatureKeys[i], 0, 16);
            }

            StringBuilder krnlStr = new StringBuilder();
            byte[] krnlVersion = GetMemory(Kernel.XboxKrnlVersion, 8);
            krnlStr.AppendFormat("{0}.{1}.{2}.{3}",
                BitConverter.ToUInt16(krnlVersion, 0),
                BitConverter.ToUInt16(krnlVersion, 2),
                BitConverter.ToUInt16(krnlVersion, 4),
                BitConverter.ToUInt16(krnlVersion, 6)
                );
            kernelVersion = new Version(krnlStr.ToString());

            SendCommand("modules");
            modules = new List<ModuleInfo>();
            string line = ReceiveSocketLine();
            while (line[0] != '.')
            {
                ModuleInfo module = new ModuleInfo();
                module.Sections = new List<ModuleSection>();
                List<object> info = Util.ExtractResponseInformation(line);
                module.Name = (string)info[0];
                module.BaseAddress = (uint)info[1];
                module.Size = (uint)info[2];
                module.Checksum = (uint)info[3];

                module.TimeStamp = Util.TimeStampToUniversalDateTime((uint)info[4]);
                modules.Add(module);
                line = ReceiveSocketLine();
            }
            foreach (ModuleInfo module in modules)
            {
                SendCommand("modsections name={0}", module.Name);
                line = ReceiveSocketLine();
                while (line[0] != '.')
                {
                    ModuleSection modSection = new ModuleSection();
                    List<object> info = Util.ExtractResponseInformation(line);
                    modSection.Name = (string)info[0];
                    modSection.Base = (uint)info[1];
                    modSection.Size = (uint)info[2];
                    modSection.Index = (uint)info[3];
                    modSection.Flags = (uint)info[4];
                    module.Sections.Add(modSection);
                    line = ReceiveSocketLine();
                }
            }
            string hex = SendCommand("altaddr").Message.Substring(7);
            titleIP = new IPAddress(Util.StringToHexBytes(hex));

            linkStatus = (LinkStatus)CallAddressEx(Kernel.PhyGetLinkState, null, true, 0);

            // Attempt to load title/game info. Will throw exception if we are in Debug Dash
            try
            {
                getTitleInformation();
            }
            catch { }
        }
 /// <summary>
 /// The set encoder.
 /// </summary>
 /// <param name="encoder">
 /// The encoder.
 /// </param>
 public void SetEncoder(VideoEncoder encoder)
 {
     this.X264ViewModel.SetEncoder(encoder);
     this.ShowX264Panel = encoder == VideoEncoder.X264 || encoder == VideoEncoder.X264_10;
 }
 public NativeMediaFoundationVideoProcessingService()
 {
     _ve = new VideoEncoder();
 }
예제 #45
0
        /// <summary>
        /// The set encoder.
        /// </summary>
        /// <param name="encoder">
        /// The encoder.
        /// </param>
        public void SetEncoder(VideoEncoder encoder)
        {
            this.EncoderOptionsViewModel.SetEncoder(encoder);
            this.X264ViewModel.SetEncoder(encoder);

            if (encoder == VideoEncoder.X264)
            {
                this.ShowX264Panel = true;
                this.ShowSimplePanel = false;
            }
            else
            {
                this.ShowX264Panel = false;
                this.ShowSimplePanel = true;
            }
        }
		/** Add default audio track with default configuration */
		public void AddVideoTrack(VideoEncoder encoder,Android.Hardware.CameraFacing camera, VideoQuality videoQuality, bool flash) {
			IStream stream = null;
			VideoQuality.Merge(videoQuality,defaultVideoQuality);
			switch (encoder) {
				case VideoEncoder.H263:
					stream = new H263Stream(camera);
					break;
				case VideoEncoder.H264:
					throw new NotImplementedException();
					//break;
			}
			if (stream != null) {
				//Log.d(TAG,"Quality is: "+videoQuality.resX+"x"+videoQuality.resY+"px "+videoQuality.frameRate+"fps, "+videoQuality.bitRate+"bps");
				((VideoStream) stream).SetVideoQuality(videoQuality);
				((VideoStream) stream).SetPreviewDisplay(surfaceHolder);
				((VideoStream) stream).SetFlashState(flash);
				stream.SetDestination(destination, videoPort);
				tracks.Add(new Track(stream,Track.VIDEO));
			}
			else{
				//do something here
			}
		}
            private void aviSaverbg(object file)
            {
                try
                {

                    string filename = file.ToString();
                    pubicQueue.Clear();
                    imageQueue.Clear();
                    bool wassaving = false;
                    while (true)
                    {
                        Thread.Sleep(100);
                        while (pubicQueue.Count < 1 && saving == true)
                        {
                            Thread.Sleep(50);
                        }
                        while (pubicQueue.Count > 0)
                        {
                            lock (pubicQueue)
                            {
                                imageQueue.Enqueue(pubicQueue.Dequeue());
                            }
                        }
                        Thread.Sleep(50);

                        if (saving == true)
                        {
                            if (srm == null)
                                srm = new VideoEncoder(filename, FPS);
                            Thread.Sleep(50);
                            while (imageQueue.Count > 0)
                            {
                                srm.Add(imageQueue.Dequeue());
                            }
                            wassaving = true;
                        }
                        else
                        {
                            if (wassaving)
                                break;
                            //Debug.WriteLine("Trimming with #" + imageQueue.Count + " objects to FPS of "+FPS);
                            while (imageQueue.Count > (FPS * 2.0))//We can have two seconds of stuff
                            {
                                imageQueue.Dequeue();
                            }
                        }
                        Thread.Sleep(75);
                    }

                    Thread.Sleep(2500);//Wait for a few extra frames, perhapes the ones now!
                    capture = false;

                    //close out
                    while (pubicQueue.Count > 0)
                    {
                        lock (pubicQueue)
                        {
                            imageQueue.Enqueue(pubicQueue.Dequeue());
                        }
                    }
                    if (srm != null)
                    {
                        while (imageQueue.Count > 0)
                        {
                            srm.Add(imageQueue.Dequeue());
                        }
                    }
                }
                finally
                {
                    try
                    {
                        srm.Close();
                    }
                    catch { }
                }
            }
        /// <summary>
        /// The set encoder.
        /// </summary>
        /// <param name="encoder">
        /// The encoder.
        /// </param>
        public void SetEncoder(VideoEncoder encoder)
        {
            // If we are switching from x264, cache it's settings.
            if (this.DisplayX264Options.HasValue && this.DisplayX264Options.Value )
            {
                this.optionsCache = this.AdvancedOptionsString;
            }

            // UI Set for new encoder.
            if (encoder == VideoEncoder.X264)
            {
                this.AdvancedOptionsString = optionsCache;
                this.DisplayX264Options = true;
            }
            else if (encoder == VideoEncoder.Theora)
            {
                this.AdvancedOptionsString = string.Empty;
                this.DisplayX264Options = null;
            }
            else
            {
                this.AdvancedOptionsString = string.Empty;
                this.DisplayX264Options = false;
            }
        }
예제 #49
0
파일: Converters.cs 프로젝트: rdp/HandBrake
 /// <summary>
 /// Get the Video Encoder for a given string
 /// </summary>
 /// <param name="encoder">
 /// The encoder name
 /// </param>
 /// <returns>
 /// VideoEncoder enum object
 /// </returns>
 public static string GetVideoEncoder(VideoEncoder encoder)
 {
     switch (encoder)
     {
         case VideoEncoder.FFMpeg:
             return "ffmpeg";
         case VideoEncoder.FFMpeg2:
             return "ffmpeg2";
         case VideoEncoder.X264:
             return "x264";
         case VideoEncoder.Theora:
             return "theora";
         default:
             return "x264";
     }
 }
예제 #50
0
        /// <summary>
        /// Convert a Quality Value to a position value for the Video Quality slider
        /// </summary>
        /// <param name="videoEncoder">The selected video encoder</param>
        /// <param name="value">The Quality value</param>
        /// <returns>The position on the video quality slider</returns>
        private static int QualityToSliderValue(VideoEncoder videoEncoder, double? value)
        {
            if (!value.HasValue)
            {
                // Default to a sensible level.
                return 20;
            }

            int sliderValue = 0;
            switch (videoEncoder)
            {
                case VideoEncoder.FFMpeg:
                    sliderValue = 32 - (int)value;
                    break;
                case VideoEncoder.X264:
                    double cqStep = Properties.Settings.Default.x264cqstep;
                    sliderValue = (int)((51.0 / cqStep) - (value / cqStep));
                    break;
                case VideoEncoder.Theora:
                    sliderValue = (int)value;
                    break;
            }

            return sliderValue;
        }
예제 #51
0
파일: Xbox.cs 프로젝트: CodeAsm/open-sauce
        private void Initialize(string xboxIP)
        {
            // establish debug session
            connection = new TcpClient();
            connection.SendTimeout = 250;
            connection.ReceiveTimeout = 250;
            connection.ReceiveBufferSize = 0x100000 * 3;    // todo: check on this
            connection.SendBufferSize = 0x100000 * 3;
            connection.NoDelay = true;
            connection.Connect(xboxIP, 731);
            connected = Ping(100);  // make sure it is successful
            if (connected)
            {
                // make sure they are using the current xbdm.dll v7887
                debugMonitorVersion = new Version(SendCommand("dmversion").Message);
                if (DebugMonitorVersion != new Version("1.00.7887.1"))
                {
                    Disconnect();   // unsafe to proceed, so disconnect...
                    throw new ApiException("Must use our hacked xbdm.dll v1.00.7887.1 before connecting");
                }

                // check correct module entrypoint
                SendCommand("modules");
                modules = new List<ModuleInfo>();
                string line = ReceiveSocketLine();
                while (line[0] != '.')
                {
                    ModuleInfo module = new ModuleInfo();
                    module.Sections = new List<ModuleSection>();
                    var info = Util.ExtractResponseInformation(line);
                    module.Name = (string)info[0];
                    module.BaseAddress = Convert.ToUInt32(info[1]);

                    if (module.Name == "xbdm.dll" && module.BaseAddress != 0xB0000000)
                        throw new Exception("You seem to be most likely running the Complex v4627 Debug Bios.  YeloDebug is not compatible with this bios.");

                    module.Size = (uint)info[2];
                    module.Checksum = (uint)info[3];

                    module.TimeStamp = Util.TimeStampToUniversalDateTime((uint)info[4]);
                    modules.Add(module);
                    line = ReceiveSocketLine();
                }
                foreach (ModuleInfo module in modules)
                {
                    SendCommand("modsections name=\"{0}\"", module.Name);
                    List<string> response = ReceiveMultilineResponseList();
                    foreach (string r in response)
                    {
                        ModuleSection modSection = new ModuleSection();
                        var info = Util.ExtractResponseInformation(r);
                        modSection.Name = (string)info[0];
                        modSection.Base = Convert.ToUInt32(info[1]);
                        modSection.Size = Convert.ToUInt32(info[2]);
                        modSection.Index = Convert.ToUInt32(info[3]);
                        modSection.Flags = Convert.ToUInt32(info[4]);
                        module.Sections.Add(modSection);
                    }
                }

                // register our notification session
                if (notificationSessionEnabled)
                    RegisterNotificationSession(notificationPort);

                // must have for our shitty setmem hack to work ;P
                CreateFile("E:\\fUkM$DeVs", FileMode.Create);

                //initialize main components - order specific!!!
                MemoryStream = new XboxMemoryStream(this);
                MemoryStream.SafeMode = true;
                MemoryReader = new BinaryReader(MemoryStream);
                MemoryWriter = new BinaryWriter(MemoryStream);
                kernel = new XboxKernel(this);
                History = new XboxHistory(this);
                Gamepad = new XboxGamepad(this);
                eeprom = ReadEEPROM();

                // get xbox production information
                ProductionInfo pInfo = new ProductionInfo();
                string serial = ASCIIEncoding.ASCII.GetString(eeprom, 0x34, 12);
                switch (serial[11])
                {
                    case '2': pInfo.Country = "Mexico"; break;
                    case '3': pInfo.Country = "Hungary"; break;
                    case '5': pInfo.Country = "China"; break;
                    case '6': pInfo.Country = "Taiwan"; break;
                    default: pInfo.Country = "Unknown"; break;
                }
                pInfo.LineNumber = Convert.ToUInt32(serial.Substring(0, 1));
                pInfo.Week = Convert.ToUInt32(serial.Substring(8, 2));
                pInfo.Year = Convert.ToUInt32("200" + serial[7]);
                productionInfo = pInfo;

                // xbox video encoder type
                if (CallAddressEx(Kernel.HalReadSMBusValue, null, true, SMCDevices.VideoEncoderXcalibur, VideoEncoderCommand.Detect, 0, History.ScratchBuffer) == 0) videoEncoderType = VideoEncoder.Xcalibur;
                else if (CallAddressEx(Kernel.HalReadSMBusValue, null, true, SMCDevices.VideoEncoderConnexant, VideoEncoderCommand.Detect, 0, History.ScratchBuffer) == 0) videoEncoderType = VideoEncoder.Connexant;
                else if (CallAddressEx(Kernel.HalReadSMBusValue, null, true, SMCDevices.VideoEncoderFocus, VideoEncoderCommand.Detect, 0, History.ScratchBuffer) == 0) videoEncoderType = VideoEncoder.Focus;
                else videoEncoderType = VideoEncoder.Unknown;

                // processor information
                SetMemory(XboxHistory.ScriptBufferAddress, Util.HexStringToBytes("B8010000000FA2A300000100B80000DB02C21000"));
                SendCommand("crashdump");
                uint eax = GetUInt32(0x10000);
                processor.Stepping = eax & 0xf;
                processor.Model = (eax >> 4) & 0xf;
                processor.Family = (eax >> 8) & 0xf;
                if (processor.Model == 11) { processor.Identification = "1.48 GHz Intel Tualatin Celeron (DreamX)"; }
                else if (processor.Model == 8 && processor.Stepping == 6) { processor.Identification = "1.00 GHz Intel Pentium III Coppermine"; }
                else { processor.Identification = "733.33 MHz Intel Pentium III"; }

                // hardware info
                uint ver = GetUInt32(Kernel.HardwareInfo);
                string vstr = Convert.ToString(ver, 16).PadLeft(8, '0');
                string vstr2 = Util.HexBytesToString(GetMemory(Kernel.HardwareInfo + 4, 2)).Insert(2, " ");
                hardwareInfo = vstr + " " + vstr2;

                macAddress = BitConverter.ToString(eeprom, 0x40, 6).Replace('-', ':');

                serialNumber = Convert.ToUInt64(ASCIIEncoding.ASCII.GetString(eeprom, 0x34, 12));
                lanKey = GetMemory(Kernel.XboxLANKey, 16);
                signatureKey = GetMemory(Kernel.XboxSignatureKey, 16);
                eepromKey = GetMemory(Kernel.XboxEEPROMKey, 16);
                hardDriveKey = GetMemory(Kernel.XboxHDKey, 16);

                byte[] hdModelInfo = GetMemory(Kernel.HalDiskModelNumber, 40);
                uint unk1 = BitConverter.ToUInt32(hdModelInfo, 0);
                uint index = BitConverter.ToUInt32(hdModelInfo, 4);
                hardDriveModel = ASCIIEncoding.ASCII.GetString(hdModelInfo, 8, 32).Trim().Replace("\0", "");

                byte[] hdSerialInfo = GetMemory(Kernel.HalDiskSerialNumber, 32);
                unk1 = BitConverter.ToUInt32(hdSerialInfo, 0);
                index = BitConverter.ToUInt32(hdSerialInfo, 4);
                hardDriveSerial = ASCIIEncoding.ASCII.GetString(hdSerialInfo, 8, 16).Trim().Replace("\0", "");

                alternateSignatureKeys = new byte[16][];
                byte[] keyData = GetMemory(Kernel.XboxAlternateSignatureKeys, 256);
                for (int i = 0; i < 16; i++)
                {
                    alternateSignatureKeys[i] = new byte[16];
                    Buffer.BlockCopy(keyData, i * 16, alternateSignatureKeys[i], 0, 16);
                }

                StringBuilder krnlStr = new StringBuilder();
                byte[] krnlVersion = GetMemory(Kernel.XboxKrnlVersion, 8);
                krnlStr.AppendFormat("{0}.{1}.{2}.{3}",
                    BitConverter.ToUInt16(krnlVersion, 0),
                    BitConverter.ToUInt16(krnlVersion, 2),
                    BitConverter.ToUInt16(krnlVersion, 4),
                    BitConverter.ToUInt16(krnlVersion, 6)
                    );
                kernelVersion = new Version(krnlStr.ToString());

                try
                {
                    // OPTIONAL - will fail on some boxes that return "not debuggable" error
                    processID = Convert.ToUInt32(SendCommand("getpid").Message.Substring(6), 16);

                    SendCommand("xbeinfo running");
                    xbeInfo = new XbeInfo();
                    line = ReceiveSocketLine();
                    XbeInfo.TimeStamp = Util.TimeStampToUniversalDateTime((uint)Util.GetResponseInfo(line, 0));
                    XbeInfo.Checksum = (uint)Util.GetResponseInfo(line, 1);
                    line = ReceiveSocketLine();
                    XbeInfo.LaunchPath = (string)Util.GetResponseInfo(line, 0);
                    ReceiveSocketLine();    // '.'
                }
                catch { }

                try
                {
                    string hex = SendCommand("altaddr").Message.Substring(7);
                    titleIP = new IPAddress(Util.HexStringToBytes(hex));
                }
                catch { }
                linkStatus = (LinkStatus)CallAddressEx(Kernel.PhyGetLinkState, null, true, 0);

                MemoryStream.SafeMode = false;
            }
            else throw new NoConnectionException("Unable to connect.");
        }
예제 #52
0
 /// <summary>
 /// The set encoder.
 /// </summary>
 /// <param name="encoder">
 /// The encoder.
 /// </param>
 public void SetEncoder(VideoEncoder encoder)
 {
 }
 public void videoencoder_created_correctly()
 {
     var obj = new VideoEncoder();
     Assert.NotNull(obj);
 }
예제 #54
0
 /// <summary>
 /// Set the currently selected encoder.
 /// </summary>
 /// <param name="encoder">
 /// The Video Encoder.
 /// </param>
 public void SetEncoder(VideoEncoder encoder)
 {
     this.DisplayX264Options = encoder == VideoEncoder.X264;
 }
예제 #55
0
 /// <summary>
 /// Get the Video Encoder for a given string
 /// </summary>
 /// <param name="encoder">
 /// The encoder name
 /// </param>
 /// <returns>
 /// VideoEncoder enum object
 /// </returns>
 public static string GetVideoEncoder(VideoEncoder encoder)
 {
     switch (encoder)
     {
         case VideoEncoder.FFMpeg:
             return "mpeg4";
         case VideoEncoder.FFMpeg2:
             return "mpeg2";
         case VideoEncoder.X264:
             return "x264";
         case VideoEncoder.QuickSync:
             return "qsv_h264";
         case VideoEncoder.Theora:
             return "theora";
         default:
             return "x264";
     }
 }
예제 #56
0
        /// <summary>
        /// Convert a Quality Value to a position value for the Video Quality slider
        /// </summary>
        /// <param name="videoEncoder">The selected video encoder</param>
        /// <param name="value">The Quality value</param>
        /// <returns>The position on the video quality slider</returns>
        private static int QualityToSliderValue(VideoEncoder videoEncoder, double? value)
        {
            if (!value.HasValue)
            {
                // Default to a sensible level.
                return 20;
            }

            int sliderValue = 0;
            switch (videoEncoder)
            {
                case VideoEncoder.FFMpeg:
                    sliderValue = 32 - (int)value;
                    break;
                case VideoEncoder.X264:
                    double cqStep = UserSettingService.GetUserSettingDouble(UserSettingConstants.X264Step);
                    sliderValue = (int)((51.0 / cqStep) - (value / cqStep));
                    break;
                case VideoEncoder.Theora:
                    sliderValue = (int)value;
                    break;
            }

            return sliderValue;
        }
예제 #57
-1
        public static void Main(string[] args)
        {
            var video = new Video() { Title = "Video 1"};
            var videoEncoder = new VideoEncoder(); //publisher
            var mailService = new MailService(); //subscriber
            var messageService = new MessageService();

            videoEncoder.VideoEncoded += mailService.OnVideoEncoded;
            videoEncoder.VideoEncoded += messageService.OnVideoEncoded;

            videoEncoder.Encode(video);
        }
예제 #58
-1
        static void Main(string[] args)
        {
            Video myVideo = new Video();
            myVideo.Title = "Video 1";

            VideoEncoder myVideoEncoder = new VideoEncoder();       // Publisher
            MailService myMailService = new MailService();          // Subscriber
            MessageService myMessageService = new MessageService(); // Another subscriber

            myVideoEncoder.VideoEncoded += myMessageService.OnVideoEncoded;
            myVideoEncoder.VideoEncoded += myMailService.OnVideoEncoded; /* Code explanation:
                                                                         * the object "myVideoEncoder" has an event called "VideoEncoded",
                                                                         * we then add the "OnVideoEncoded" method from "myMailService" as a subscriber,
                                                                         * so that when "myVideoEncoder" raises the event "VideoEncoded", the
                                                                         * function: "OnVideoEncoded" is called from the class: "myMailService".
                                                                         */

            myVideoEncoder.Encode(myVideo);
        }