Reputation: 601
I have a piece of code written in C++ which is cross-platform and uses OpenCV.
My C++ code does some processing on an image input.
I want to use iOS's AVFoundation to decode a video and send the data to C++ for processing.
I can find many tutorials that allow me to run C++ code in my App, but what I need is to call an Objective-C function from C++ that will request the next frame of the video.
Please Help.
Oh and I know that OpenCV has a VideoReader class - but I need to have my own implementation.
Upvotes: 0
Views: 472
Reputation: 4955
The easiest way is to just change myFile.cpp to myFile.mm. Then the compiler will interpret this as Objective-C++ and you can import AVFoundation into the .mm file and use Objective-C.
Upvotes: 1
Reputation: 2790
ObjectiveC message calls are translated by the compiler into calls to the runtime library - for message calls refer to objc_msgSend
. You can call this runtime-function by hand from your C++ code.
Objective-C Runtime Programming Guide / Messaging
A further - and possibly easier - way would be to port the C++ parts to Objective-C++.
Upvotes: 0