Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 1.38 KB

File metadata and controls

56 lines (42 loc) · 1.38 KB

Using the MXL C Public API

Below is a minimal example of how to use the MXL SDK C API in your application:

  1. Create an MXL instance
#include <mxl/mxl.h>

mxlInstance instance = mxlCreateInstance("/dev/shm/mxl", NULL);
if (!instance) {
    // handle error
}
  1. Create a Flow Writer
#include <mxl/flow.h>

const char* flowDef = "{...}"; // NMOS Flow Resource JSON describing the flow desired
mxlFlowWriter writer;
bool wasCreated;
mxlStatus status = mxlCreateFlowWriter(instance, flowDef, NULL, &writer, NULL, &wasCreated);
if (status != MXL_STATUS_OK) {
    // handle error
}
  1. Create a Flow Reader
mxlFlowReader reader;
status = mxlCreateFlowReader(instance, "<flow-id>", NULL, &reader);
if (status != MXL_STATUS_OK) {
    // handle error
}
  1. Read/Write Data
  • For discrete flows, use mxlFlowReaderGetGrain and mxlFlowWriterOpenGrain/mxlFlowWriterCommitGrain.
  • For continuous flows, use mxlFlowReaderGetSamples and mxlFlowWriterOpenSamples/mxlFlowWriterCommitSamples.
  1. Release Resources
mxlReleaseFlowWriter(instance, writer);
mxlReleaseFlowReader(instance, reader);
mxlDestroyInstance(instance);

See the header files in lib/include/mxl/ for full API details and additional options.