Ejemplo n.º 1
0
        public override LiveViewData GetLiveViewImage()
        {
            LiveViewData viewData = new LiveViewData();
            if (Monitor.TryEnter(Locker, 10))
            {
                try
                {
                    //DeviceReady();
                    viewData.HaveFocusData = true;

                    const int headerSize = 384;

                    var result = StillImageDevice.ExecuteReadData(CONST_CMD_GetLiveViewImage);
                    if (result.Data == null || result.Data.Length <= headerSize)
                        return null;
                    GetAditionalLIveViewData(viewData, result.Data);
                    viewData.ImageDataPosition = headerSize;
                    viewData.ImageData = result.Data;
                }
                finally
                {
                    Monitor.Exit(Locker);
                }
            }
            return viewData;
        }
Ejemplo n.º 2
0
        protected override void GetAdditionalLiveViewData(LiveViewData viewData, byte[] result)
        {
            viewData.LiveViewImageWidth = ToInt16(result, 8);
            viewData.LiveViewImageHeight = ToInt16(result, 10);

            viewData.ImageWidth = ToInt16(result, 12);
            viewData.ImageHeight = ToInt16(result, 14);

            viewData.FocusFrameXSize = ToInt16(result, 24);
            viewData.FocusFrameYSize = ToInt16(result, 26);

            viewData.FocusX = ToInt16(result, 28);
            viewData.FocusY = ToInt16(result, 30);

            viewData.Focused = result[48] != 1;
            viewData.MovieIsRecording = result[68] == 1;
            viewData.MovieTimeRemain = ToDeciaml(result, 64);

            if (result[37] == 1)
                viewData.Rotation = -90;
            if (result[37] == 2)
                viewData.Rotation = 90;

            viewData.HaveLevelAngleData = true;
            viewData.LevelAngleRolling = ToInt16(result, 52);
            viewData.PeakSoundL = (int)(result[352] / 14.0 * 100);
            viewData.PeakSoundR = (int)(result[353] / 14.0 * 100);
            viewData.SoundL = (int)(result[354] / 14.0 * 100);
            viewData.SoundR = (int)(result[355] / 14.0 * 100);
            viewData.HaveSoundData = true;
        }
Ejemplo n.º 3
0
        public override LiveViewData GetLiveViewImage()
        {
            LiveViewData viewData = new LiveViewData();
            viewData.HaveFocusData = true;

            const int headerSize = 128;

            var result = StillImageDevice.ExecuteReadData(CONST_CMD_GetLiveViewImage);
            if (result.ErrorCode == ErrorCodes.MTP_Not_LiveView)
            {
                _timer.Start();
                viewData.IsLiveViewRunning = false;
                viewData.ImageData = null;
                return viewData;
            }
            if (result.Data == null || result.Data.Length <= headerSize)
                return null;
            int cbBytesRead = result.Data.Length;
            GetAdditionalLiveViewData(viewData, result.Data);

            MemoryStream copy = new MemoryStream(cbBytesRead - headerSize);
            copy.Write(result.Data, headerSize, cbBytesRead - headerSize);
            copy.Close();
            viewData.ImageData = copy.GetBuffer();

            return viewData;
        }
Ejemplo n.º 4
0
        protected override void GetAdditionalLiveViewData(LiveViewData viewData, byte[] result)
        {
            viewData.LiveViewImageWidth = ToInt16(result, 8);
            viewData.LiveViewImageHeight = ToInt16(result, 10);

            viewData.ImageWidth = ToInt16(result, 12);
            viewData.ImageHeight = ToInt16(result, 14);

            viewData.FocusFrameXSize = 800;
            viewData.FocusFrameYSize = 800;

            viewData.FocusX = ToInt16(result, 20);
            viewData.FocusY = ToInt16(result, 22);

            viewData.Focused = result[40] != 1;
        }
Ejemplo n.º 5
0
        public override LiveViewData GetLiveViewImage()
        {
            LiveViewData viewData = new LiveViewData();
              viewData.HaveFocusData = true;

              const int headerSize = 64;

              byte[] result = StillImageDevice.ExecuteReadData(CONST_CMD_GetLiveViewImage);
              if (result == null || result.Length <= headerSize)
            return null;
              int cbBytesRead = result.Length;
              GetAditionalLIveViewData(viewData, result);

              MemoryStream copy = new MemoryStream((int)cbBytesRead - headerSize);
              copy.Write(result, headerSize, (int)cbBytesRead - headerSize);
              copy.Close();
              viewData.ImageData = copy.GetBuffer();

              return viewData;
        }
Ejemplo n.º 6
0
        protected override void GetAditionalLIveViewData(LiveViewData viewData, byte[] result)
        {
            viewData.LiveViewImageWidth = ToInt16(result, 8);
            viewData.LiveViewImageHeight = ToInt16(result, 10);

            viewData.ImageWidth = ToInt16(result, 12);
            viewData.ImageHeight = ToInt16(result, 14);

            viewData.FocusFrameXSize = ToInt16(result, 24);
            viewData.FocusFrameYSize = ToInt16(result, 26);

            viewData.FocusX = ToInt16(result, 28);
            viewData.FocusY = ToInt16(result, 30);

            viewData.Focused = result[48] != 1;
            viewData.MovieIsRecording = result[70] == 1;

            if (result[37] == 1)
                viewData.Rotation = -90;
            if (result[37] == 2)
                viewData.Rotation = 90;
        }
Ejemplo n.º 7
0
        protected override void GetAdditionalLiveViewData(LiveViewData viewData, byte[] result)
        {
            viewData.LiveViewImageWidth = ToInt16(result, 8);
            viewData.LiveViewImageHeight = ToInt16(result, 10);

            viewData.ImageWidth = ToInt16(result, 12);
            viewData.ImageHeight = ToInt16(result, 14);

            viewData.FocusFrameXSize = ToInt16(result, 16);
            viewData.FocusFrameYSize = ToInt16(result, 18);

            viewData.FocusX = ToInt16(result, 20);
            viewData.FocusY = ToInt16(result, 22);

            viewData.Focused = result[40] != 1;
            viewData.MovieIsRecording = result[60] == 1;
            viewData.MovieTimeRemain = ToDeciaml(result, 56);

            if (result[29] == 1)
                viewData.Rotation = -90;
            if (result[29] == 2)
                viewData.Rotation = 90;

            viewData.HaveLevelAngleData = true;
            viewData.LevelAngleRolling = ToInt16(result, 44);
            viewData.LevelAnglePitching = ToInt16(result, 48);
            viewData.LevelAngleYawing = ToInt16(result, 52);

            viewData.PeakSoundL = (int)(result[344] / 14.0 * 100);
            viewData.PeakSoundR = (int)(result[345] / 14.0 * 100);
            viewData.SoundL = (int)(result[346] / 14.0 * 100);
            viewData.SoundR = (int)(result[347] / 14.0 * 100);
            viewData.HaveSoundData = true;
        }
Ejemplo n.º 8
0
 private void Camera_LiveViewUpdate(object sender, EosLiveImageEventArgs e)
 {
     LiveViewData viewData = new LiveViewData();
     if (Monitor.TryEnter(Locker, 1))
     {
         try
         {
             _liveViewImageData = e;
         }
         catch (Exception exception)
         {
             Log.Error("Error get live view image event", exception);
         }
         finally
         {
             Monitor.Exit(Locker);
         }
     }
 }
Ejemplo n.º 9
0
 public override LiveViewData GetLiveViewImage()
 {
     LiveViewData viewData = new LiveViewData();
     if (Monitor.TryEnter(Locker, 1))
     {
         try
         {
             //DeviceReady();
             viewData.HaveFocusData = true;
             viewData.ImageDataPosition = 0;
             viewData.ImageData = _liveViewImageData.ImageData;
             viewData.ImageHeight = _liveViewImageData.ImageSize.Height;
             viewData.ImageWidth = _liveViewImageData.ImageSize.Width;
             viewData.LiveViewImageHeight = 100;
             viewData.LiveViewImageWidth = 100;
             viewData.FocusX = _liveViewImageData.ZommBounds.X + (_liveViewImageData.ZommBounds.Width/2);
             viewData.FocusY = _liveViewImageData.ZommBounds.Y + (_liveViewImageData.ZommBounds.Height/2);
             viewData.FocusFrameXSize = _liveViewImageData.ZommBounds.Width;
             viewData.FocusFrameYSize = _liveViewImageData.ZommBounds.Height;
         }
         catch (Exception)
         {
             //Log.Error("Error get live view image ", e);
         }
         finally
         {
             Monitor.Exit(Locker);
         }
     }
     return viewData;
 }
Ejemplo n.º 10
0
 public override LiveViewData GetLiveViewImage()
 {
     _timer.Stop();
     LiveViewData viewData = new LiveViewData();
     if (Monitor.TryEnter(Locker, 10))
     {
         try
         {
             //DeviceReady();
             viewData.HaveFocusData = false;
             MTPDataResponse response = ExecuteReadDataEx(CONST_CMD_CANON_EOS_GetViewFinderData, 0x00100000);
             ErrorCodes.GetException(response.ErrorCode);
             if (response.Data == null)
             {
                 _timer.Start();
                 return null;
             }
             viewData.ImageDataPosition = 0;
             viewData.ImageData = response.Data;
         }
         catch (Exception e)
         {
             Log.Error("Error get live view image ", e);
         }
         finally
         {
             Monitor.Exit(Locker);
         }
     }
     _timer.Start();
     return viewData;
 }
Ejemplo n.º 11
0
        public override LiveViewData GetLiveViewImage()
        {
            _timer.Stop();
            LiveViewData viewData = new LiveViewData();
            if (Monitor.TryEnter(Locker, 10))
            {
                try
                {
                    //DeviceReady();
                    viewData.HaveFocusData = true;

                    const int headerSize = 384;

                    var result = StillImageDevice.ExecuteReadData(CONST_CMD_GetLiveViewImage);
                    if (result.ErrorCode == ErrorCodes.MTP_Not_LiveView)
                    {
                        _timer.Start();
                        viewData.IsLiveViewRunning = false;
                        viewData.ImageData = null;
                        return viewData;
                    }
                    if (result.Data == null || result.Data.Length <= headerSize)
                    {
                        _timer.Start();
                        viewData.ImageData = null;
                        return viewData;
                    }
                    int cbBytesRead = result.Data.Length;
                    GetAdditionalLiveViewData(viewData, result.Data);
                    viewData.ImageDataPosition = 384;
                    viewData.ImageData = result.Data;
                }
                finally
                {
                    Monitor.Exit(Locker);
                }
            }
            _timer.Start();
            return viewData;
        }
Ejemplo n.º 12
0
 protected virtual void GetAditionalLIveViewData(LiveViewData viewData, byte[] result)
 {
     GetAdditionalLiveViewData(viewData, result);
 }
Ejemplo n.º 13
0
        protected virtual void GetAdditionalLiveViewData(LiveViewData viewData, byte[] result)
        {
            viewData.LiveViewImageWidth = ToInt16(result, 0);
            viewData.LiveViewImageHeight = ToInt16(result, 2);

            viewData.ImageWidth = ToInt16(result, 4);
            viewData.ImageHeight = ToInt16(result, 6);

            viewData.FocusFrameXSize = ToInt16(result, 16);
            viewData.FocusFrameYSize = ToInt16(result, 18);

            viewData.FocusX = ToInt16(result, 20);
            viewData.FocusY = ToInt16(result, 22);

            viewData.MovieTimeRemain = ToDeciaml(result, 56);

            viewData.Focused = result[40] != 1;
            if (result[29] == 1)
                viewData.Rotation = -90;
            if (result[29] == 2)
                viewData.Rotation = 90;
            viewData.MovieIsRecording = result[60] == 1;
        }
Ejemplo n.º 14
0
        public override LiveViewData GetLiveViewImage()
        {
            _timer.Stop();
            LiveViewData viewData = new LiveViewData();
            if (Monitor.TryEnter(Locker, 10))
            {
                try
                {
                    //DeviceReady();
                    viewData.HaveFocusData = true;

                    const int headerSize = 384;

                    byte[] result = StillImageDevice.ExecuteReadData(CONST_CMD_GetLiveViewImage);
                    if (result == null || result.Length <= headerSize)
                    {
                        _timer.Start();
                        return null;
                    }
                    int cbBytesRead = result.Length;
                    GetAditionalLIveViewData(viewData, result);
                    viewData.ImageDataPosition = 384;
                    viewData.ImageData = result;
                }
                finally
                {
                    Monitor.Exit(Locker);
                }
            }
            _timer.Start();
            return viewData;
        }