public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Initialize the class responsible for managing AV capture session and asset writer
            videoProcessor = new RosyWriterVideoProcessor();

            // Keep track of changes to the device orientation so we can update the video processor
            var notificationCenter = NSNotificationCenter.DefaultCenter;

            notificationCenter.AddObserver(UIApplication.DidChangeStatusBarOrientationNotification, DeviceOrientationDidChange);

            UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications();

            // Setup and start the capture session
            videoProcessor.SetupAndStartCaptureSession();
            Console.WriteLine("Finished Setting up AV");

            notificationCenter.AddObserver(UIApplication.DidBecomeActiveNotification, On_ApplicationDidBecomeActive);

            oglView = new RosyWriterPreviewWindow(RectangleF.Empty);

            // Our interface is always in portrait
            oglView.Transform = videoProcessor.TransformFromCurrentVideoOrientationToOrientation(AVCaptureVideoOrientation.Portrait);

            RectangleF bounds = viewPreview.ConvertRectToView(viewPreview.Bounds, oglView);

            oglView.Bounds = bounds;
            oglView.Center = new PointF(viewPreview.Bounds.Size.Width / 2.0F, viewPreview.Bounds.Size.Height / 2.0F);

            viewPreview.AddSubview(oglView);

            Console.WriteLine("Added OGL View");

            // Set up labels
            shouldShowStats = true;

            frameRateLabel = LabelWithText(string.Empty, 10.0F);
            viewPreview.AddSubview(frameRateLabel);

            dimensionsLabel = LabelWithText(string.Empty, 54.0F);
            viewPreview.AddSubview(dimensionsLabel);

            typeLabel = LabelWithText(string.Empty, 90F);
            viewPreview.Add(typeLabel);

            // btnRecord Event Handler
            btnRecord.Clicked += On_ToggleRecording;

            // Video Processor Event Handlers
            videoProcessor.RecordingDidStart          += On_RecordingDidStart;
            videoProcessor.RecordingDidStop           += On_RecordingDidStop;
            videoProcessor.RecordingWillStart         += On_RecordingWillStart;
            videoProcessor.RecordingWillStop          += On_RecordingWillStop;
            videoProcessor.PixelBufferReadyForDisplay += On_PixelBufferReadyForDisplay;

            Console.WriteLine("Finished OnDidLoad");
        }
Пример #2
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (timer != null)
            {
                timer.Invalidate();
                timer.Dispose();
                timer = null;
            }

            if (videoProcessor != null)
            {
                videoProcessor.Dispose();
                videoProcessor = null;
            }
        }
Пример #3
0
        internal void UpdateLabel(RosyWriterVideoProcessor videoProcessor)
        {
            fpsLabel.Text = String.Format("{0:F} FPS", videoProcessor.VideoFrameRate);

            var dimension = videoProcessor.VideoDimensions;

            dimensionsLabel.Text = String.Format("{0} x {1}", dimension.Width, dimension.Height);

            // Turn the integer constant into something human readable
            var type = videoProcessor.VideoType;

            char[] code = new char[4];
            for (int i = 0; i < 4; i++)
            {
                code[3 - i] = (char)(type & 0xff);
                type        = type >> 8;
            }
            var typeString = new String(code);

            colorLabel.Text = typeString;
        }
Пример #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            statisticView.Layer.CornerRadius = 4f;

            // Initialize the class responsible for managing AV capture session and asset writer
            videoProcessor = new RosyWriterVideoProcessor();

            // Setup and start the capture session
            var isSupported = videoProcessor.SetupAndStartCaptureSession();

            if (isSupported)
            {
                // Our interface is always in portrait
                previewView.Transform = videoProcessor.TransformFromCurrentVideoOrientationToOrientation(AVCaptureVideoOrientation.Portrait);
                previewView.Bounds    = View.ConvertRectToView(View.Bounds, previewView);
                previewView.Center    = new CGPoint(View.Bounds.Size.Width / 2f, View.Bounds.Size.Height / 2f);

                UIApplication.Notifications.ObserveDidBecomeActive(OnApplicationDidBecomeActive);

                // Set up labels
                shouldShowStats = true;

                // Video Processor Event Handlers
                videoProcessor.RecordingDidStart          += OnRecordingDidStart;
                videoProcessor.RecordingDidStop           += OnRecordingDidStop;
                videoProcessor.RecordingWillStart         += OnRecordingWillStart;
                videoProcessor.RecordingWillStop          += OnRecordingWillStop;
                videoProcessor.PixelBufferReadyForDisplay += OnPixelBufferReadyForDisplay;
            }
            else
            {
                errorLabel.Hidden = false;

                previewView.Hidden   = true;
                recordButton.Enabled = false;
            }
        }
Пример #5
0
 public VideoOutputDataDelegate(RosyWriterVideoProcessor processor)
 {
     Console.WriteLine("Creating VideoOutputDataDelegate");
     this.processor = processor;
 }
Пример #6
0
 public AudioOutputDataDelegate(RosyWriterVideoProcessor processor)
 {
     this.processor = processor;
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            // Initialize the class responsible for managing AV capture session and asset writer
            videoProcessor = new RosyWriterVideoProcessor ();

            // Keep track of changes to the device orientation so we can update the video processor
            var notificationCenter = NSNotificationCenter.DefaultCenter;
            notificationCenter.AddObserver(UIApplication.DidChangeStatusBarOrientationNotification, DeviceOrientationDidChange);

            UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications ();

            // Setup and start the capture session
            videoProcessor.SetupAndStartCaptureSession ();

            notificationCenter.AddObserver (UIApplication.DidBecomeActiveNotification, OnApplicationDidBecomeActive);

            oglView = new RosyWriterPreviewWindow(CGRect.Empty);

            // Our interface is always in portrait
            oglView.Transform = videoProcessor.TransformFromCurrentVideoOrientationToOrientation(AVCaptureVideoOrientation.Portrait);

            CGRect bounds = previewView.ConvertRectToView(previewView.Bounds, oglView);
            oglView.Bounds = bounds;
            oglView.Center = new CGPoint(previewView.Bounds.Size.Width / 2.0F, previewView.Bounds.Size.Height / 2.0F);

            previewView.AddSubview(oglView);

            // Set up labels
            shouldShowStats = true;

            frameRateLabel = LabelWithText (string.Empty, 10.0F);
            previewView.AddSubview (frameRateLabel);

            dimensionsLabel = LabelWithText (string.Empty, 54.0F);
            previewView.AddSubview (dimensionsLabel);

            typeLabel = LabelWithText (string.Empty, 90F);
            previewView.Add (typeLabel);

            // btnRecord Event Handler
            btnRecord.Clicked += OnToggleRecording;

            // Video Processor Event Handlers
            videoProcessor.RecordingDidStart += OnRecordingDidStart;
            videoProcessor.RecordingDidStop += OnRecordingDidStop;
            videoProcessor.RecordingWillStart += OnRecordingWillStart;
            videoProcessor.RecordingWillStop += OnRecordingWillStop;
            videoProcessor.PixelBufferReadyForDisplay += OnPixelBufferReadyForDisplay;
        }
			public VideoOutputDataDelegate (RosyWriterVideoProcessor processor)
			{
				Console.WriteLine ("Creating VideoOutputDataDelegate");
				this.processor = processor;
			}
			public AudioOutputDataDelegate (RosyWriterVideoProcessor processor)
			{
				this.processor = processor;
			}