External Devices, CD Changers and Streamed Media

The MME supports playing streamed media, as well as media on mediastores on external changers. This chapter describes:

Getting and setting device options

The MME supports getting and setting device option configurations, even if the MME does not know about the options:

Device option configuration API

The API or getting and setting device option configurations uses the following functions, data structures, enumerated types and events:

Getting and setting device configuration values

The mme_device_get_config() and mme_device_set_config() functions get and set configuration option values for devices accessed through MediaFS. The MME does not need to know about the options or their settings.

At present, you can use mme_device_get_config() to get configuration values for iPod devices and Bluetooth devices that use a Temic stack, and mme_device_set_config() to set options on iPod devices, with these constraints:

Supported interfaces

At present, the MME supports getting and setting interface options for two types of interfaces:

The <interface> configuration element for USB devices uses the following attribute template:

<interface type="usb" path="USB_bus_number" devno="USB_device_number" vendorid="USB_vendor_id_number" productid="USB_product_id_number"/>

The <interface> configuration element for devices accessed through a device driver uses the following attribute template:

<interface type="device" path="/fsys/path/to/device/resmgr"/>

Getting configuration values from iPods

To get the configured settings for an iPod:

  1. Reserve a buffer for the information that will be returned from the device.
  2. Call mme_device_get_config().

For example, for an iPod with the mediastore ID 2:

char buf[1000];

mme_device_get_config(hdl, 2, "/", 0, sizeof(buf), buf);

The function will fill the buffer with the device information, which will be presented in a format like the following for an iPod using USB transport:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<device api_version="1">
 <interface type="usb" path="0" devno="1" vendorid="0x5ac" productid="0x5ac"/>
 <media>
  <iPod>
   <version>
    <model_id value="00150000" valuetype="hex"/>
    <model_number value="MA627C" valuetype="text"/>
    <firmware value="020201" valuetype="hex"/>
   </version>
   <capabilities>
    <video/>
    <digitalaudio/>
    <cta/>
   </capabilities>
   <transport value="usb_ipod" valuetype="text"/>
   <audiobook_speed value="normal" valuetype="enum" modifiable="yes" alternatives="slower,normal,faster"/>
   <preferences>
    <video value="ask" valuetype="enum" modifiable="no" alternatives="off,on,ask"/>
    <screen value="fit" valuetype="enum" modifiable="yes" alternatives="fill,fit"/>
    <format value="ntsc" valuetype="enum" modifiable="no" alternatives="ntsc,pal"/>
    <lineout value="on" valuetype="enum" modifiable="no" alternatives="off,on"/>
    <connection value="composite" valuetype="enum" modifiable="no" alternatives="none,composite,svideo,component"/>
    <caption value="off" valuetype="enum" modifiable="no" alternatives="off,on"/>
    <ratio value="full" valuetype="enum" modifiable="no" alternatives="full,wide"/>
    <subtitle value="off" valuetype="enum" modifiable="no" alternatives="off,on"/>
    <audioalt value="off" valuetype="enum" modifiable="no" alternatives="off,on"/>
   </preferences>
   <displayimage>
    <upload value="on" valuetype="enum" modifiable="no" alternatives="on"/>
   </displayimage>
  </iPod>
 </media>
</device>

Or the following for an iPod using serial transport:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<device api_version="1">>
<interface type="device" path="/net/groytest2.ott.qnx.com/dev/ser1"/>
 <media>
  <iPod>
   <version>
    <model_id value="00150000" valuetype="hex"/>
    <model_number value="MA627C" valuetype="text"/>
    <firmware value="020201" valuetype="hex"/>
   </version>
   <capabilities>
    <video/>
    <digitalaudio/>
   </capabilities>
   <transport value="ser_ipod" valuetype="text"/>
   <preferences/>
  </iPod>
 </media>
</device>

Getting configuration values from Bluetooth devices

The mme_device_get_config() can be used to retrieve device configuration settings from Bluetooth (A2DP) devices.

To retrieve this information from a Bluetooth device, simply call mme_device_get_config() as you would for an iPod device, but with the mediastore ID set for the Bluetooth device. The information in buffer filled in by the call will look something like the following:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<device api_version="1">
  <interface type="device" path="/dev/wms/player1"/>
  <media>
    <AVRCP>
      <version>
        <major value="1" valuetype="num"/>
        <minor value="3" valuetype="num"/>
      </version>
    </AVRCP>
  </media>
</device>

Setting configuration values on an iPod

The mme_device_set_config() allows you to change the iPod preferences that were configured when the iPod driver was started. It sets configuration values by setting the attributes for sub-elements inside the <preferences> attribute.

Each element inside the <preferences> has the following attributes:


Note: At present, the only element with modifiable attributes is <screen>.

To modify an iPod's screen zoom mode:

  1. Call mme_device_set_config() with the xpath argument set to the path to the element's value attribute, and the newvalue set to the desire value.

For example:

mme_device_set_config(hdl, 2, "/device/media/iPod/capabilities/screen@value", "fill", 0);

Note: On an iPod:
  • “fill” means stretch the image without altering the aspect ratio. That is, the image will have no vertical or horizontal black bars (no letterbox or pillar box), but it may be cropped to make it fit the iPod screen
  • “fit” means that the image is not cropped, but the image may be framed by horizontal or vertical black bars

Determining the iPod connection and capabilities

To determine how an iPod is connected, simply call mme_device_get_config(), and in the returned buffer with the device information, check the following elements and attributes:

Working with external CD changers

The MME includes several features that facilitate working with external CD changers:


Note: A random or repeat mode setting works only if the external device supports the setting. If the external device does not support the requested setting, the MME logs a warning and continues playback.

For more information about building systems that use external CD changers, contact your QNX representative.

Working with internet streamed media

The MME supports playback of internet streamed media, including:

RTP streamed media

The MME can output RTP streamed media from a camera. Support is presently limited to ouput of the media stream; features such as pan and tilt control are not supported.

To access the RTP stream, pass the RTSP (Real Time Stream Protocol) access URL of the camera to io-media.

For example, an Axis 207 network camera on a network could be accessed with the following URL: rtsp://10.42.108.95:554/mpeg4/1/media.amp, where:


Note: To maintain optimal sycnhronization performance, add a keepdll configuration element to your io-media configuration file as follows:
keepdll {
  name = rtp_reader
  optional = yes
}

Or, use the io-media configuration element, keepdlls, which allows you to specify DLLs to keep by an interface name, rather than by the DLL name.


Configuring the MME to support streamed media

To configure the MME to support streamed media, you must:

  1. Add a rule to the MCD to detect internet connections.
  2. Enable an internet slot in the slots table.

Add a rule to the MCD to detect internet connections

To add a rule to the MCD to detect internet connections, simply add a rule to the MME's MCD configuration file to have the MCD look for internet connections. For example:

[/dev/socket]
Callout     = PATH_MEDIA_PROCMGR
Argument    = /proc/mount
Priority    = 11,10
Start Rule  = INSERTED
Stop Rule   = EJECTED

For more information about MCD rules, see Configuring the mcd utility in the MME Configuration Guide chapter Configuring Device Support.

Enable an internet slot in the slots table

After you have configured the MCD to look for internet connections you must configure the slots table to support internet connections. For example:

INSERT INTO slots(path,zoneid, name, slottype)
    VALUES('/dev/socket', 1, 'INTERNET', 10);

For more information about configuring the slots table, see Configuring the slots table for supported devices in the MME Configuration Guide chapter Configuring Device Support.

Playing streamed media

If you have configured the MME to support internet connections, its mediastores table should have an entry for an “internet” mediastore. You can check this by querying the database from the commandline. For example:

qdbc -d mme "select msid,slotid,name,mountpath from mediastores"

One of the returned lines should return values something like:

|2|13|Internet|/dev/socket|

Media streams cannot be synchronized, so to play it you should played in a file-based track session:

  1. Create a file-based track session by calling mme_newtrksession() with the mode argument set to MME_PLAYMODE_FILE.
  2. Set the track sesssion by calling mme_settrksession().
  3. Append the the HTTP stream by calling mme_trksession_append_files() with the filename argument referencing to the HTTP stream.

    or:

  4. Append the RTP stream by calling mme_trksession_append_files() with the filename argument set to the URL of the RTP stream from the Axis camera server: "rtsp://10.42.108.95:554/mpeg4/1/media.amp".
  5. Proceed with playback.

Note: The SELECT statement used to create the track session query for media where ftype=5 (media that can be played as one file).

For example, with the mmecli commandline utility, you might play streamed media as follows:

# mmecli newtrksession f "select fid from library where ftype=5 and msid=2"

# mmecli settrksession 1

# mmecli trksessionview_append_file 1 2 http://www.playsong.com/song

# mmecli play

Audio input playback

The MME now supports playback of audio inputs on a system by treating audio inputs as type of mediastore.

This feature uses a new mediastore type and a new slot type:


Note: Audio input playback requires audio_streamer.so, a streamer for reading audio from a sound card.

Configuring the MME to recognize audio input “mediastores”

To have the MME recognize audio input “mediastores”, you must:

Configuring the slots table

To use audio input “mediastores”, you must add an entry to the slots table that sets:

For example:

INSERT INTO slots(path, zoneid, name, slottype)
    VALUES('/dev/snd', 1, 'snd', 11);

Configuring the MCD

You must also configure the MCD to tell the MME about the appearance of audio input “mediastores” by adding a section like the following to the MCD configuration:

[/dev/snd]
Callout	= PATH_MEDIA_SCAN
Argument	= 5000
Priority	= 11,10
Start Rule	= INSERTED
Stop Rule	= EJECTED

Since /dev/snd is normally permanent, the argument and priority values may be changed. The section name must be the path to the audio input devices.


Note: An audio input “mediastore” is not synchronizable; an explicit attempt to synchronize it will result in a MME_EVENT_SYNCABORTED error.

Playing media from an audio input “mediastore”

Media from an audio input “mediastore” is played in a file-based track session. Once playback has begun, however, it will continue until explicitly stopped because it will never reach an end of file.

To play media from an audio input “mediastore” you must know the exact path to the mixer output you want to play. Generally tis path is something like pcmC0D0c#Mic In.


Note: You may learn what is available by:
  • doing an ls of the path to the location of the audio input
  • looking at the output of mix_ctl

Once you know the path of your audio input, simply create a file-based track session and play the media

  1. create a file-based track session, using the snd “mediastore”'s device file ID.
  2. Set the track session for playback.
  3. Call mme_trksession_set_files() to set the input to the track session.
  4. Play the track session.