- Create a custom MATLAB data type that wraps the FILE pointer.
- Allocate and return an instance of the custom data type from the 1st Mex function.
- Accept the custom data type as an input to the 2nd Mex function.
- Unwrap the custom data type in the 1st Mex function to obtain the FILE pointer.
Pass an open pipeline from C++ to Matlab
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi
I have created a Mex function that opens an FFMPEG streaming pipeline. I need this open pipeline to be passed as an input to a second Mex function which processes video frames and writes the output to the open pipeline. My ideal workflow is as follows:
Open the pipeline in the 1st Mex function. Pass this open pipeline back into Matlab. Create a While loop to process video frames and generate bounding boxes. Call a second Mex function within the loop which takes the open pipeline as input together with a frame and writes the output to an RTSP server.
The problem is that I currently can't pass the open pipeline from my first Mex function to a Matlab variable. The data type of the open pipeline is a File and the error I get is:
note: while trying to match the argument list '(matlab::data::Array, FILE *)'.
I use the c++ function _popen to open the pipeline and according to the documentation, _popen() returns a pointer to an open stream that can be used to read or write to the pipe.
Is there a way to somehow pass an open pipeline to a matlab variable?
0 Commenti
Risposte (1)
Harsh Sanghai
il 23 Mar 2023
Hi,
It is not possible to pass an open pipeline (a FILE pointer) directly to a MATLAB variable using MATLAB's built-in data types. However, you can create a custom MATLAB data type that wraps the FILE pointer and pass that custom data type between the two MEX functions.
You can follow the steps mention below to obtain this:
0 Commenti
Vedere anche
Categorie
Scopri di più su Audio and Video Data in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!