I just started using the latest build of ffmpeg into which ffmpeg-mt has been merged.
However, since my application uses TBB (Intel Threading Building Blocks), the ffmpeg-mt imlementation with new thread creation and synchronization does not quite fit, as it could potentially block my TBB tasks executing the decode functions. Also it would trash the cache unnecessarily.
I was looking around in pthread.c which seems to implement the interface which ffmpeg uses to enable multithreading.
My question is whether it would be possible to create a tbb.c which implements the same functions but using tbb tasks instead of explicit threads?
I am not experienced with C, but my guess is that it would not be possible to easily compile tbb (which is C++) into ffmpeg. So maybe somehow overwriting the ffmpeg function pointers during run-time would be the way to go?
I would appreciate any suggestions or comments in regards to implementing TBB into ffmpeg threading api.
So I figured out how to do it by reading through the ffmpeg code.
Basicly all you have to do is to include the code below and use
tbb_avcodec_open/tbb_avcodec_closeinstead of ffmpegs’avcodec_open/avcodec_close.This will use TBB tasks to execute decoding in parallel.