- 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
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Harsh Sanghai
el 23 de Mzo. de 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 comentarios
Ver también
Categorías
Más información sobre Audio and Video Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!