mmr_output_attach()

Attach an output.

Synopsis:

#include <mm/renderer.h>
int mmr_output_attach( mmr_context_t *ctxt, 
                       const char *url, 
                       const char *type )

Arguments:

ctxt
A context handle.
url
The URL of the new output.
type
The output type. Possible values are "audio", "video", and "file" (quotes are required).

Library:

mmrndclient

Description:

Attach an output to the context and return its output ID (a non-negative integer, unique for this context). An output can be an audio or video device, a combined audio/video device (such as a DSP directly connected to output hardware), or a file. The types of outputs attached to a context may affect the set of operations that the context will allow. For instance, when "playing" to a file (i.e. ripping), seeking or trick play (i.e., playing at non-normal speeds) may not be supported.

Although the API allows requesting multiple outputs of the same type, this may not be supported by all player module implementations. Attaching or detaching outputs while the context has an input may not be supported, either.

Valid URLs for the "audio" output type are in one of the following forms:

Valid output URLs for the "video" output type are of the following form:

screen:?wingrp=window_group&
  winid=window_id&nodstviewport=1&initflags=invisible

In the video URL:

Valid output URLs for the "file" output type are of the form file:path, where path is the full filepath. The file: prefix is optional. The following file types (and their extensions that can go in the URL) are supported:

Returns:

A non-negative output ID on success, -1 on failure (use mmr_error_info()).

Classification:

QNX Neutrino

Safety:  
Interrupt handler No
Signal handler No
Thread Yes

Example:

Suppose you want mm-renderer to route the audio output to the "speaker" device. You can do this as follows:
#include <mm/renderer.h>
#include <audio/audio_manager_device.h>

// Point the output URL to the default device
char audio_URL[100];
snprintf( audio_URL, 100, “audio:default” );

// Check if the speaker device is supported and
// connected to the system; if so, point the
// output URL to the speaker device
bool supported, connected;

if ( audio_manager_is_device_supported( 
                        AUDIO_DEVICE_SPEAKER, 
                        &supported ) == EOK 
                                  && supported ) 
{
    if ( audio_manager_is_device_connected( 
                        AUDIO_DEVICE_SPEAKER, 
                        &connected ) == EOK 
                                  && connected )
    {
        sprintf( audio_URL, “audio:%s”, 
            audio_manager_get_device_name( 
                        AUDIO_DEVICE_SPEAKER ) );
    } 
} 

// Attach an audio output, routed to the
// chosen device
int outputID;

if ( outputID = mmr_output_attach( context, 
                        audio_URL, "audio" ) < 0 )
{
    // Call mmr_error_info() and do error handling
}
You can make mm-renderer read the input audio from a particular device in a similar way, by substituting the call to mmr_output_attach() with a call to mmr_input_attach(). The input URL would be of the same form.