Winsoft Camera for MacOS v1.2 for Delphi 10.3 Full Source

Winsoft Camera for MacOS v1.2 for Delphi 10.3 Full Source

Winsoft Camera for MacOS v1.2 for Delphi 10.3 Full Source
Winsoft Camera for MacOS v1.2 for Delphi 10.3 Full Source


Delphi camera component for macOS.

Uses AVFoundation framework
Available for Delphi 10.3
Source code included in registered version
Royalty free distribution in applications

Version 1.2

added TXCameraCaptureFormat.MediaSubType item
added macOS 64-bit files
removed macOS 32-bit files
improved demo example
minor improvements and bugfixes


type
  TXCameraAspectRatio = (arUnknown, arFit, arFill, arResize);

  TXCameraAuthorizationStatus = (asNotDetermined, asRestricted, asDenied, asAuthorized);

  TXCameraExposureMode = (exUnknown, exLocked, exAutoExpose, exContinuousAutoExposure);

  TXCameraFlashMode = (flUnknown, flOff, flOn, flAuto);

  TXCameraFocusMode = (foUnknown, foLocked, foAutoFocus, foContinuousAutoFocus);

  TXCameraPosition = (poUnknown, poBack, poFront);

  TXCameraTorchMode = (toUnknown, toOff, toOn, toAuto);

  TXCameraVideoMirrored = (vmUnknown, vmOff, vmOn);

  TXCameraVideoOrientation = (voUnknown, voPortrait, voPortraitUpsideDown, voLandscapeLeft, voLandscapeRight);

  TXCameraWhiteBalanceMode = (wbUnknown, wbLocked, wbAutoWhiteBalance, wbContinuousAutoWhiteBalance);

  TXCameraFrameRate = record
    Min: Double;
    Max: Double;
  end;

  TXCameraCaptureFormat = record
  public
    property Format: AVCaptureDeviceFormat read;
    property FrameRates: TArray<TXCameraFrameRate> read;
    property MediaSubType: string read;
    property MediaType: string read;
    property Size: TSize read;
  end;

  TXCameraCaptureDevice = record
  public
    property ActiveFormat: TXCameraCaptureFormat read;
    property Device: AVCaptureDevice read;
    property Formats: TArray<TXCameraCaptureFormat> read;
    property Manufacturer: string read;
    property Model: string read;
    property Name: string read;
    property Position: TXCameraPosition read;
    property UniqueID: string read;
  end;

  TXCamera = class(TComponent)
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;

    function IsExposureModeSupported(ExposureMode: TXCameraExposureMode): Boolean;
    function IsFlashModeSupported(FlashMode: TXCameraFlashMode): Boolean;
    function IsFocusModeSupported(FlashMode: TXCameraFocusMode): Boolean;
    function IsTorchModeSupported(TorchMode: TXCameraTorchMode): Boolean;
    function IsWhiteBalanceModeSupported(WhiteBalanceMode: TXCameraWhiteBalanceMode): Boolean;
    procedure RequestAccess;
    function SampleBufferToBitmap(const Bitmap: TBitmap; const SetSize: Boolean): Boolean;
    procedure Start;
    procedure Stop;

    property ActiveFormat: TXCameraCaptureFormat read write;
    property AuthorizationStatus: TXCameraAuthorizationStatus read;
    property CaptureVideoDevices: TArray<TXCameraCaptureDevice> read;
    property DefaultCaptureVideoDevice: TXCameraCaptureDevice read;
    property Device: AVCaptureDevice read write;
    property DeviceInput: AVCaptureDeviceInput read;
    property DeviceName: string read;
    property ExposurePointOfInterest: TPointF read write;
    property FocusPointOfInterest: TPointF read write;
    property Formats: TArray<TXCameraCaptureFormat> read;
    property HasFlash: Boolean read;
    property HasTorch: Boolean read;
    property IsAdjustingExposure: Boolean read;
    property IsAdjustingFocus: Boolean read;
    property IsAdjustingWhiteBalance: Boolean read;
    property IsConnected: Boolean read;
    property IsExposurePointOfInterestSupported: Boolean read;
    property IsFocusPointOfInterestSupported: Boolean read;
    property IsInUseByAnotherApplication: Boolean read;
    property IsPreviewMirroringSupported: Boolean read;
    property IsPreviewOrientationSupported: Boolean read;
    property IsRunning: Boolean read;
    property IsSuspended: Boolean read;
    property IsVideoMirroringSupported: Boolean read;
    property IsVideoOrientationSupported: Boolean read;
    property Manufacturer: string read;
    property MaxFrameRate: Integer read;
    property MinFrameRate: Integer read;
    property Model: string read;
    property Position: TXCameraPosition read;
    property SampleBuffer: CMSampleBufferRef read;
    property Session: AVCaptureSession read;
    property UniqueID: string read;
    property VideoDataOutput: AVCaptureVideoDataOutput read;
    property VideoDataOutputConnection: AVCaptureConnection read;
    property VideoPreviewLayer: AVCaptureVideoPreviewLayer read;
    property View: NSView read;
  published
    property About: string read write stored False;
    property Active: Boolean read write default False;
    property ExposureMode: TXCameraExposureMode read write default exUnknown;
    property FlashMode: TXCameraFlashMode read write default flUnknown;
    property FocusMode: TXCameraFocusMode read write default foUnknown;
    property Preview: Boolean read write default False;
    property PreviewAspectRatio: TXCameraAspectRatio read write default arUnknown;
    property PreviewAutoMirroring: TXCameraVideoMirrored read write default vmUnknown;
    property PreviewFrame: TBounds read write;
    property PreviewMirrored: TXCameraVideoMirrored read write default vmUnknown;
    property PreviewOrientation: TXCameraVideoOrientation read write default voUnknown;
    property TorchMode: TXCameraTorchMode read write default toUnknown;
    property VideoMirrored: TXCameraVideoMirrored read write default vmUnknown;
    property VideoOrientation: TXCameraVideoOrientation read write default voUnknown;
    property WhiteBalanceMode: TXCameraWhiteBalanceMode read write default wbUnknown;

    property OnSampleBufferReady: TNotifyEvent read write;
  end;


Only for V.I.P
Warning! You are not allowed to view this text.