• Trizard

    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 read more
  • Trizard

    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 read more
  • Trizard

    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 read more
  • Trizard

    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 read more

Internal error.

Oops! Looks like something went wrong!