On 29/04/21 14:40, Gerd Hoffmann wrote:
In other words you would do something like -audiohw
<audiodev-args>,model=xxx and it gets desugared automatically to either

    -audiodev <audiodev-args>,id=foo -device devname,audiodev=xxx

or

    -audiodev <audiodev-args>,id=foo -M propname=foo
Suggestions how to do that in a clean way?
Given that -audiodev is qapi-based I tried it this way:

Since this is sugar, I think it's okay to make it desugar into QAPI, instead of being QAPI all the way down:

- use qobject_input_visitor_new_str in softmmu/vl.c

- visit the "model" key

- look up the "model", fail if it doesn't match a known model

- pass the rest into a variant of audio_parse_option that takes a Visitor and returns and Audiodev*

- pass the id into a constructor function keyed by the model

Paolo


Reply via email to