[Libav-user] Errors when creating a C++ object (with a C API) in FFmpeg filter
R n
flynewdream at hotmail.com
Wed Sep 14 06:30:22 EEST 2016
Dear all,
First, thanks for this mail list which helped me solve the compilation problem.
I wrote a C++ class using openCV as well as a C wrapper/API. I am now using it in FFmpeg filter. In the filter, I create a pointer to an object which is generated by calling the C API (The API actually returns "new myCPPclass()"). It can compile but the execution of the program "stop" around the place where the pointer is created. "Stop" here means that there is no printed info anymore (I print out the execution steps) but the response of the computer to my typing is wired. Looks like the memory has some problems.
In FFmpeg, people use av_malloc... , but it is not encouraged to first malloc the memory to the C++ object using malloc and then cast its type to a C++ class.
Did I miss anything? Thanks a lot.
My code looks like the following:
1. C++ class:
class myCPPclass {
myCPPclass(abc);
memberVar;
memberMethod();
}
2. C API:
typedef myCPPclass myCPPclass;
extern "C" myCPPclass* myCPPclass_new(abc) {
return new myCPPclass(abc);
}
3. FFmpeg filter (in C):
myCPPclass* ptr = myCPPclass_new(abc);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160914/f76b0c27/attachment.html>
More information about the Libav-user
mailing list