jeudi 30 juin 2016

Sharing FFMPEG video stream data between processes


I'm trying to find a method for sharing FFMPEG library datatypes between two processes.

The project that I'm working on requires one process to buffer the FFMPEG stream that is being received and another process needs to read from the buffer and perform some actions on the video stream. Unfortunately, I can't use a multi-threaded approach for this project. Due to some limitations in my system I have to use separate processes.

The data that I would like to share I have placed in a general struct as follows:

struct FFMPEGData {
AVFormatContext *pFormatCtx;
AVCodecContext  *pCodecCtx;
AVCodec         *pCodec;
AVFrame         *pFrame, dst;
AVPacket        *packet;
AVPacket* pack = new AVPacket[packetNum];
};

The buffering process uses the format context and codec context to read the video stream and then it places packets in the AVPacket array pack. The other process should grab packets from the array and decode them, also using the format and codec contexts.

I looked into the Boost Interprocess library, but that does not seem to be setup to handle this type of situation easily.

Would anyone know a method for sharing my general struct between multiple processes?


Aucun commentaire:

Enregistrer un commentaire