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);
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to