ListenerList and parameters


Hi everyone,

in a ListenerList I try to call a callback with complex parameters, one is

class FFmpegVideoListener {
    virtual void presentationTimestampChanged (const double) {}
    virtual void displayNewFrame (const AVFrame*) {}
    virtual void displayNewFrame (const juce::Image&) {}

// and calling it; no problem with double
double pts = 123.4; (&FFmpegVideoListener::presentationTimestampChanged, pts);

// but doesn't compile with pointer or reference
AVFrame* nextFrame; (&FFmpegVideoListener::displayNewFrame, nextFrame);
Image outputImage; (&FFmpegVideoListener::displayNewFrame, outputImage);

Is this a restriction of the ListenerList template or is there something I did the wrong way?

Thanks for any insight…


Uhm, I’m not an expert with method pointers, but couldn’t it be that the compiler is finding it difficult to understand which of the two methods with the same name (displayNewFrame) you are getting the address of?

Try temporarily commenting one of them and see if that resolves the issue. If that’s it, I guess there must be a syntactic way (which I don’t know) to explicitly tell the compiler which method you are getting the pointer of, based on its prototype…


Indeed, that solves the problem. Thanks @yfede.

Or I simply name them slightly different…