omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. Trizard

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 4
    • Best 0
    • Controversial 0
    • Groups 0

    Trizard

    @Trizard

    0
    Reputation
    995
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Trizard Unfollow Follow

    Latest posts made by Trizard

    • Querying returned NSError

      Hello,

      I'm trying to query a NSError object returned from on an AVFoundation call by reference.
      The ObjectiveC Definition is

      • (instancetype)deviceInputWithDevice:(AVCaptureDevice *)device
        error:(NSError **)outError;

      I tried many combinations and can't figure it out:

      err = c_void_p()
      print err
      err1 = pointer(err)
      print err1

      A)
      deviceInput2=ObjCClass('AVCaptureDeviceInput').deviceInputWithDevice_error_(self.inputDevice2, byref(err1) )
      print err1
      B)
      deviceInput2=ObjCClass('AVCaptureDeviceInput').deviceInputWithDevice_error
      (self._inputDevice2, err1 )
      print err1

      What I get is
      c_void_p(None)
      <objc_util.LP_c_void_p object at 0x10762af48>

      A) c_void_p(None)
      B) <objc_util.LP_c_void_p object at 0x10762af48>

      What is the right way to do this and to get the NSError in the end?

      All examples I found just seem to ignore the NSError by using None.

      Many thanks!

      posted in Pythonista
      Trizard
      Trizard
    • RE: Casting NSArray from ObjCInstanceMethodProxy

      Thank you! Yes it does work!
      On the 7 Plus I'm able to access all 4 cameras this way. This is what I get and it works perfect:

      (
      "<AVCaptureFigVideoDevice: 0x12db72c40 [Back Camera][com.apple.avfoundation.avcapturedevice.built-in_video:0]>",
      "<AVCaptureFigVideoDevice: 0x12dbeb240 [Front Camera][com.apple.avfoundation.avcapturedevice.built-in_video:1]>",
      "<AVCaptureFigVideoDevice: 0x12dbe1b20 [Back Telephoto Camera][com.apple.avfoundation.avcapturedevice.built-in_video:2]>",
      "<AVCaptureFigVideoDevice: 0x12dbe6bf0 [Back iSight Duo Camera][com.apple.avfoundation.avcapturedevice.built-in_video:3]>"
      )

      posted in Pythonista
      Trizard
      Trizard
    • RE: Casting NSArray from ObjCInstanceMethodProxy

      Thank you for the quick response. session.devices() returns empty even there should be a list of devices.
      Might be an issue how I call the new API.

      posted in Pythonista
      Trizard
      Trizard
    • Casting NSArray from ObjCInstanceMethodProxy

      I'm new to Pythonista and the way objc_util interacts. Currently I trying to query the dual cameras on an IPhone 7 Plus.
      I'm using the new way to query cameras in OSX 10
      This is where I got stuck:

      from objc_util import *

      AVCaptureDeviceDiscoverySession = ObjCClass('AVCaptureDeviceDiscoverySession')

      session = AVCaptureDeviceDiscoverySession.discoverySessionWithDeviceTypes_mediaType_position_(['AVCaptureDeviceTypeBuiltInDuoCamera' , 'AVCaptureDeviceTypeBuiltInWideAngleCamera', 'AVCaptureDeviceTypeBuiltInTelephotoCamera'],ns('AVMediaTypeVideo'),ns('AVCaptureDevicePositionUnspecified'))

      How to implement the following line in Pythonista?

      NSArray<AVCaptureDevice *> *devices = session.devices;
      session.devices contains when I look at it on an iPhone 7 Plus (IOS 10.1beta):

      <objc_util.ObjCInstanceMethodProxy object at 0x10c1a7a20>
      How to cast from here to the NSArray AVCaptureDevice??
      .
      Many thanks for any hints!

      posted in Pythonista
      Trizard
      Trizard