Set output parameters.
#include <mm/renderer.h> #include <audio/audio_manager_routing.h>
int mmr_output_parameters( mmr_context_t *ctxt, unsigned output_id, strm_dict_t *parms )
Set parameters for an output device. The acceptable parameter values depend on the plugins loaded for the attached output and the attached input, if any. Unlike input and track parameters, the values of output parameters won't be changed by mm-renderer plugins. If the provided values aren't supported for the current output and input combination, the function call fails.
The output type determines which output parameters you can set. At present, there are no output parameters for the "file" output type.
For the "audio" output type, the following parameters are available for any URL format:
When using the "audio" output type with a URL that starts with audio:, you can set one of the following parameters:
For the "video" output type, your application should modify the output window directly by using the libscreen library, as demonstrated in "../managing_video_windows.html".
The mmr_output_attach() function sets the parameters url and type. Some plugins allow you to modify the URL with mmr_output_parameters(). For instance, you can ask mm-renderer to switch output devices by calling mmr_output_parameters() with a new URL in the parameters.
Zero on success, -1 on failure (use mmr_error_info()).
QNX Neutrino
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
Suppose you want to set the audio_type parameter to indicate that an output audio stream contains dialing and call progress tones, also referred to as voice tones. You must first look up the audio type string by passing the AUDIO_TYPES_VOICE_TONES code to the appropriate audio manager API function, then store this string in a dictionary, and then pass the dictionary to mm-renderer, as follows:
#include <mm/renderer.h> #include <strm.h> // Store the audio type in the dictionary before // setting the output parameters strm_dict_t* dict = strm_dict_new(); if ( dict = strm_dict_set( dict, "audio_type", audio_manager_get_name_from_type( AUDIO_TYPE_VOICE_TONES ) ) == NULL ) { // Do error handling } if ( mmr_output_parameters( context, output_id, dict ) < 0 ) { // Call mmr_error_info() and do error handling }
Presently, the audio type is the only audio stream characteristic that clients can set directly through mm-renderer. The Audio Manager API lets clients manage additional characteristics of an audio stream. For example, you could set both the audio type and reset conditions, as follows:
#include <mm/renderer.h> #include <strm.h> #include <audio/audio_manager_routing.h> // Get an audio manager handle for voice tones unsigned int audio_hndl; if ( audio_manager_get_handle( AUDIO_TYPE_VOICE_TONES, 0, false, &audio_hndl ) != EOK ) { // Check errno, do error handling, and exit } // Set the reset conditions if ( audio_manager_set_handle_routing_conditions( audio_hndl, SETTINGS_RESET_ON_DEVICE_CONNECTION ) != EOK ) { // Check errno, do error handling, and exit } // Store the handle in the dictionary before // setting the output parameters ...
You can set the audio_type or audioman_handle parameters for an input in a similar way, by substituting the call to mmr_output_parameters() with a call to mmr_input_parameters().