is XPC from app to CMIOExtension possible?

Apple Recommended

  • @eskimo Where can we find sample code that shows us how to send sample buffers from a client using the old C style Core Media IO API to a camera extension that contains an output device?

Add a Comment

Replies

If you need to pass a video stream into your CMIO extension, have the CMIO extension publish an output device.

This somewhat confuses me, since in my case CMIO extension is used to create a virtual webcam. And webcam is a video input device, not video output. What if unwanted application decides to pass some video data to my CMIO extension? Is there a way to prevent this? This doesn't seem to be covered in WWDC 2022 Session 10022.

Maybe there are other options for IPC with CMIO extension, besides XPC (not recommended) and publishing an output device?

@ssmith_c we are working on a CMIO camera extension and need to use a XPC service to connect to the extension as we want to only add the device when the parent/configuration app is also running. Further when the parent app is closed the device should be removed again. We tried using a custom property on the class implementing CMIOExtensionProviderSource but could not access that via the CMIO C API. So we need an other way of telling the extension to add the device at runtime thats why we landed on the XPC helper approach.

For this we have setup a XPC helper service as you described in the comment on this reply, but for some reasons we can not get the parent application or the extension to connect to the helper daemon.

Would it be possible for you to provide an example code?

Even if it is not the intended way of doing things I am pretty sure that this would help others as well.

@eskimo I'm faced with a similar situation where I'm tasked with replacing my XPC interface to a Camera DAL-Plugin with a Camera Extension. I've been using XPC to stream audio and video buffers from a gstreamer pipeline that is processing an rtsp network stream. The pipeline has both an audio branch and a video branch. Audio goes to an Audio HAL driver and video goes to the DAL-Plugin, both via XPC. This mechanism resides in a custom Framework that my app consumes. First and foremost, how do I now continue to stream the video buffers from my external gstreamer client to the Camera Extension? You say "If you need to pass a video stream into your CMIO extension, have the CMIO extension publish an output device." Please clarify this statement - how do I access the CMIO extension in the first place? Is it possible to supply the Extension provider source with my queue? Secondly, I wish to continue to use XPC to supply audio to my audio driver while not incurring any lipsync issues that I'm wondering may arise from having both an Audio HAL and a Camera Extension, with apparently very different architectural flow, running in parallel.

@cullenp you asked "how do I access the CMIO extension in the first place"

From an app, use the routines in CoreMediaIO/CMIOHardwareObject.h to iterate through the CMIO objects, starting at kCMIOObjectSystemObject until you find an object with kCMIODevicePropertyDeviceUID with a value equal to the value of the deviceID parameter used in your initializer of your CMIOExtensionDevice.

You also asked "Is it possible to supply the Extension provider source with my queue? "

I'm not sure what you're asking here. You find the sink stream's ID by querying the sink device you found using the code above. Using that sink stream ID, you can copy its queue using CMIOStreamCopyBufferQueue, and you use CMSimpleQueueEnqueue to put your samples onto the sink stream's queue.

  • @ssmith_c Thanks for your reply. I am proceeding to do what you're suggesting, which is at a high level to create an extension that is both a sink and a source. With regard to my asking if it is possible to supply the queue to the extension provider source, I had noticed that the template camera extension includes this line in main.swift: let providerSource = CrestronAirMediaVideoProviderSource(clientQueue: nil) , so I had mistakenly thought that I could provide it there.

Add a Comment