I just started trying to upgrade our code to use the asynchronous interface and
I am a bit perplexed at the mix of C and C++. In other libraries the callbacks
generally have a void pointer to clientData or 'instance' or something like
that which allows me to pass the 'this' pointer, cast it, to the class and
access all the particular instances' members. In the openRTSP and PlayCommon
code I see the signatures for the callbacks are hard coded to
foo(RTSPClient::responsehandler*,int,char*). One level deep it is ok, but as
soon as one of these callbacks chains to the next callback, I have lost any
reference to my instance data.
I suspect the architecture of this code is to thready but I still want
instances of my objects.
For example. This is what causes the ourRTSPClient in the example to be a
Global variable. I need to have this as a class member variable, and perhaps do
something like this....
getOptions(RTSPClient::responseHandler* afterFunc, void* clientData) {
myClass * instancePTR = (myClass *) clientData;
instancePTR->ourClient_->sendOptionsCommand(instancePTR,
ourAuthenticator, clientData);
}
I guess an ideal way would be to create a callback interface that we just
include in our code and fill in the blanks. A pointer to the instance is then
all live555 needs as it would dictate the names and signatures of the calls.
What is the best way to use these callbacks in a multi threaded (multiple
UsageEnvironments) c++ program.?
_______________________________________________
live-devel mailing list
[email protected]
http://lists.live555.com/mailman/listinfo/live-devel