Jean-Daniel Dupas <devli...@...> writes:

> 
> 
> 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.
> 

Thanks for your reply.

My problem has to do with what pointers I should pass around so I can open the
right decoder. 

Is it possible to: 

 1. Open the stream with  av_open_input_file and av_find_stream_info (or
av_open_input_stream) which populates the codec context values based on whats on
the file
 2. Change the fields in returned codec context and call avcodec_find_decoder to
open HW accelerated decoder instead of what it finds by default? 
avcodec_find_decoder doesn't return HW accelared decoder by default.




_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to