Script for launching multimedia services

Updated: April 19, 2023

To ensure multimedia operations are available to applications when the embedded system loads up, the buildfile's script must launch the multimedia services and the services on which they depend in the correct order.

As explained in the Scripts topic of the Building Embedded Systems guide, any buildfile scripts are executed by the OS just after it finishes its own setup. Multiple scripts are combined into one, so you could add the contents shown below as a separate script to an existing buildfile.

To enable multimedia, our script first launches the prerequisite services of pps, which supports interprocess communication (IPC) through filesystem objects, and resarb, which arbitrates access to encoder/decoder instances and to VPU memory. Then, we launch the following multimedia services:
We specify this entire command sequence using an inline file named .script:
[+script] .script = {
    display_msg Starting QNX Multimedia Services

    #######################################################################
    ## pps
    #######################################################################
    display_msg Starting PPS ...
    mount  /dev/hd1t177 /var
    pps -v -l0 -P 50 -C -t 300000 > /dev/shmem/pps.stdout 2>&1

    #######################################################################
    ## resarb
    #######################################################################
    display_msg Starting Resource Arbitration ...
    resarb &

    #######################################################################
    ## mm-renderer
    #######################################################################
    display_msg Starting mm-renderer ...
    mkdir -p /pps/services/multimedia/
    mm-renderer -c

    #######################################################################
    ## mm-stream
    #######################################################################
    display_msg Starting Media Streaming Server ...
    mm-stream
}

The mount instruction just before the pps startup command serves to mount a local hard disk to the path used by pps to persist information; thus, the instruction is part of the PPS setup. The pps command line enables verbosity, and sets the object load behavior, process priority, and more. It also redirects standard output and error to the specified file in shared memory. For details on all command-line options and the service itself, see the pps entry in the Utilities Reference or the Persistent Publish/Subscribe Developer's Guide.

Before launching mm-renderer, the script creates the PPS directory used by the utility. The subsequent command line provides one option, -c, to configure the behavior of contexts (or playback zones). We then launch the other multimedia service of mm-stream without any options, to use default behavior. For information about how any of these services can be configured, see the command line references in their individual guides: