Hello,

I apologize for the horribly long email, but it is hard to
explain this in shorter message.


First: Are you using the exactly same binary to play the 2 files?

There is a conceptual difficulty of identifying where the apps
need to be routed if we can't separate them or they are not
providing additional information through the audio API to be
handled by the policy engine. So apps would need to set some environment
variable, come from different sessions, set some properties on the
audio API's. Or then just they have to be different binaries...

*****************************

Second: Which API are the apps using for audio playback? 1) pulseaudio,
2) gstreamer or 3 some higher level API (like QT or similar)?

With 1 and 2 you can set properties to indicate where to route, or
what is your application class. With 3 it depends on the API can
you pass properties to underlying layers.

So for example with pulseaudio API I can just define the routing
target where to play. In my IVI box:

paplay -d 
alsa_output.usb-Logitech_Logitech_USB_Headset-00-Headset.analog-stereo test1.wav
paplay -d alsa_output.pci-0000_00_1b.0.analog-stereo test2.wav

*******************************

pulseaudio-module-murphy-ivi can do automatic routing and its configuration
file is murphy-ivi.lua. There you define zones, routing groups and application
classes. Application class binds together zones and routing groups. 
Unfortunately
you can't bind binary names to zones (and on to different routing groups) and if
you are using the same binary, that would not even work for you.

Here's what I changed in murphy-ivi.lua:

routing_group {
    name = "default_driver",
    node_type = node.output,
    accept = function(self, n)
        return (n.type ~= node.bluetooth_carkit and n.type ~= node.hdmi and 
n.type ~= node.usb_headset)
    end,
    compare = builtin.method.compare_default
}

routing_group {
    name = "default_passanger2",
    node_type = node.output,
    accept = function(self, n)
        return (n.type == node.usb_headset or n.name == 'Silent')
    end,
    compare = builtin.method.compare_default
}

application_class {
    class = "player",
    node_type = node.player,
    priority = 1,
    route = {
        output = { driver = routing_group.default_driver_output,
                   passanger1 = routing_group.default_passanger1_output,
                   passanger2 = routing_group.default_passanger2_output}
    },
    roles = { music    = {0, "mandatory", "exclusive"},
              video    = {0, "mandatory", "exclusive"},
              test     = {0, "mandatory", "exclusive"},
              bt_music = no_resource,
              player   = no_resource
    },
    binaries = { ['t8j6HTRpuz.MediaPlayer'] = "music" }
}

In english:
1) I changed the default_driver routing group _not_ to route ever to usb_headset
2) I created new routing group passanger2, which routes only to usb_headset 
(and to null if you don't have usb)
3) I bind the new routing group to app class player in the "output" section

So now you can play to different outputs:
paplay media.role=player test1.wav
paplay media.role=player --property=zone.name=passanger2 test2.wav

First stream goes to (default) driver zone and to speakers.
Second stream goes to passanger2 zone -> to usb (if it is attached)

****************************************

br,
Jaska


________________________________________
From: IVI [[email protected]] on behalf of 虞申鹏 [[email protected]]
Sent: Tuesday, December 16, 2014 5:08 AM
To: [email protected]
Subject: [IVI]  Audio stream routing

This is a question about audio stream routing in IVI .

We want to play different MP3 files at the same time, and output to different 
sound card.
(example:MP3 file A → sound card A
         MP3 file B → sound card B
It will be play at the same time )

I'm sure we can route them by murphy.

I know the file[murphy-ivi.lua] is open in file[module-murphy-ivi.c].
But i don't know how to related to pulseaudio module?
And how to customize the route rule?

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
_______________________________________________
IVI mailing list
[email protected]
https://lists.tizen.org/listinfo/ivi

Reply via email to