Le 21 nov. 2009 à 10:28, Ratin a écrit : > Hi All, I am developing an app that opens multiple streams and read > data in threads and que in buffers, using avcodec as a demuxer, the > code is contained in one shared object module which is dynamically > loaded by the app (lets call it streamer module). I am then passing > the same AVFormatContexts to another shared object module that I load > dynamically by the app (lets say decoder module), to regain the > AVCodecContext from the AVFormatContexts and, open the codec to decode > whats in the queue. > > The problem I am having has to do with having codec open in both of > these modules, in the comments for the prototype of avcodec_open, it > states that this function is not thread safe.To me that means I cant > have two copies of codec opened with the same codec contexts in both > modules. If thats true, then what would be the best way to reopen a > codec which relates to the same codec context that I have opened on > the streamer module. I could probably pass around pointer to codec > itself but then how to get back the format contexts and avcontexts? >
You can register a lock manager using av_lockmgr_register(). This manager will be call in avcodec_open() and avcodec_close() to prevent race condition. -- Jean-Daniel _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
