Updated: May 06, 2022

Attach an input


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


A handle to the context to which the input is being attached
The URL of the new input. The allowable URL formats depend on the type setting.
The input type. This string can be one:
  • track—a media file or stream to be played in isolation
  • playlist—a track sequence, with ordering information and track metadata contained in a playlist file; both audio and video playlists are supported
  • autolist—a single audio or video track formatted as a playlist, so it can be played repeatedly




Attach an input track or playlist. If the context already has an input, mm-renderer detaches it first.

The input type affects how mm-renderer responds to certain playback requests. For instance, when jumping to new track positions with mmr_seek(), the way that you specify the new position depends on the input type. Also, mmr_list_change() applies to playlist only.

Which input types are supported depends on the configuration of mm-renderer; however, the playback behavior for a given input type does not depend on the configuration.

The track and autolist types support the same input URL formats. The URL can name an audio or video file or stream, as shown in Playing audio content, Playing video content, and Playing autolists. It can also name an audio capture device (i.e., microphone), as explained in Recording audio content, or a Bluetooth-connected source, which lets you play an A2DP stream. In the latter case, the exact device (/dev entry) you must name in the URL depends on how the Bluetooth driver was configured when it was loaded by io-audio. For more information, see the references for these utilities.

For the playlist input type, the input URL can contain the path to a local or HTTP-accessible playlist file, or the path to a database file followed by an SQL query that produces a list of track URLs. Examples of these playlist URLs are given in Playing playlists.

When you attach the input, there must be an output that supports one of the media types found in the input file. This means that you can't attach an input when there are no outputs, and you can't attach an audio-only input when no audio output type is defined, and similarly with a video-only input. You can, however, attach an input video file that has an audio component when only an audio or only a video output is defined, or an audio- or video-only input when both output types are defined. In the latter case, the output for which there is no media content is simply ignored.


Zero on success, -1 on failure (use mmr_error_info())