[Interprocess] Sharing FFMPEG Datatypes
Hi All, I'm trying to figure out if it's possible using Boost to share FFMPEG data between 2 processes. What I'm trying to do is have one process read from a video stream and place the received packets in a buffer. The other process then reads from the buffer, decodes the packet, and does some analysis on the image. Unfortunately, due to some constraints I cannot take a multi-threaded approach to this problem. My data that I would like to share is as follows: struct FFMPEGData { AVFormatContext *pFormatCtx; AVCodecContext *pCodecCtx; AVCodec *pCodec; AVFrame *pFrame, dst; AVPacket *packet; AVPacket* pack = new AVPacket[packetNum]; struct SwsContext *convert_ctx; }; With "pack" being my buffer with a set size. I tried following the boost example here http://www.boost.org/doc/libs/1_57_0/doc/html/interprocess/allocators_contai... but it seems to be for a simpler form of complex data. All of the FFMPEG datatypes are structs themselves, so I wasn't sure what to do. My question is, is it even possible to share these kinds of datatypes between processes using Boost Interprocess and if so do I need to create allocators and containers for all of the data fields within these FFMPEG datatypes? Thanks, Loren
On 24/06/2016 4:14, Loren Garavaglia wrote:
Hi All,
I'm trying to figure out if it's possible using Boost to share FFMPEG data between 2 processes. What I'm trying to do is have one process read from a video stream and place the received packets in a buffer. The other process then reads from the buffer, decodes the packet, and does some analysis on the image. Unfortunately, due to some constraints I cannot take a multi-threaded approach to this problem.
My data that I would like to share is as follows:
struct FFMPEGData { AVFormatContext *pFormatCtx; AVCodecContext *pCodecCtx; AVCodec *pCodec; AVFrame *pFrame, dst; AVPacket *packet; AVPacket* pack = new AVPacket[packetNum];
struct SwsContext *convert_ctx; };
You can't place in shared memory raw pointers or any other handle to data that belongs to a process. So you need to use your own data structures. Best Ion
participants (2)
-
Ion Gaztañaga
-
Loren Garavaglia