Hi On Wed, 2010-02-03 at 11:26 +0530, Shubham Bhattacharya wrote: > Hi, > > Is it possible to use multiple instances of the *libavformat *from the same > thread context ? > Can I open two different files of the same format at the same and yet > operate independently on them using the libAvformat ? > Can I acheive the above if the two files belong to different file-format > types ? > (Formats I am specifically looking at as of now are asf, 3gp and avi) > > Regards > Shubham
You can open multiple files using one AVFormatContext per file. How you go from there is up to you, but you basically have three choice. Either read packets from one file at a time and end up filling up the muxer's buffer (uses lots of RAM). You could also alternate reading packets from each file, which is a lot better. Finally, you could read each file in its own thread and use a couple of mutexes to synchronize them. I'd recommend one of the two latter approaches. My guess is that your program is single-threaded in which case simply alternate between reading each file. Might not be perfect, but it probably works good enough. /Tomas _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
