formats = 0; while ((cur_format = strsep(&list, XENSND_LIST_SEPARATOR))) { for (i = 0; i < ARRAY_SIZE(CFG_HW_SUPPORTED_FORMATS); i++) if (!strncasecmp(cur_format,
CFG_HW_SUPPORTED_FORMATS[i].name,
XENSND_SAMPLE_FORMAT_MAX_LEN))
formats |= CFG_HW_SUPPORTED_FORMATS[i].mask;
}
/* Get next stream index. */
stream->index = (*stream_cnt)++;
stream->xenstore_path = stream_path; /* * Check XenStore if PCM HW configuration exists for this stream * and update if so, e.g. we inherit all values from device's PCM HW, * but can still override some of the values for the stream.
*/
cfg_read_pcm_hw(stream->xenstore_path,
&pcm_instance->pcm_hw, &stream->pcm_hw);
ret = 0;
fail:
kfree(str); return ret;
}
staticint cfg_device(struct xen_snd_front_info *front_info, struct xen_front_cfg_pcm_instance *pcm_instance, struct snd_pcm_hardware *parent_pcm_hw, constchar *path, int node_index, int *stream_cnt)
{ char *str; char *device_path; int ret, i, num_streams; int num_pb, num_cap; int cur_pb, cur_cap; char node[3];
device_path = kasprintf(GFP_KERNEL, "%s/%d", path, node_index); if (!device_path) return -ENOMEM;
/* * Check XenStore if PCM HW configuration exists for this device * and update if so, e.g. we inherit all values from card's PCM HW, * but can still override some of the values for the device.
*/
cfg_read_pcm_hw(device_path, parent_pcm_hw, &pcm_instance->pcm_hw);
/* Find out how many streams were configured in Xen store. */
num_streams = 0; do {
snprintf(node, sizeof(node), "%d", num_streams); if (!xenbus_exists(XBT_NIL, device_path, node)) break;
num_streams++;
} while (num_streams < VSND_MAX_STREAM);
pcm_instance->num_streams_pb = 0;
pcm_instance->num_streams_cap = 0; /* Get number of playback and capture streams. */ for (i = 0; i < num_streams; i++) {
ret = cfg_get_stream_type(device_path, i, &num_pb, &num_cap); if (ret < 0) goto fail;
if (pcm_instance->num_streams_pb) {
pcm_instance->streams_pb =
devm_kcalloc(&front_info->xb_dev->dev,
pcm_instance->num_streams_pb, sizeof(struct xen_front_cfg_stream),
GFP_KERNEL); if (!pcm_instance->streams_pb) {
ret = -ENOMEM; goto fail;
}
}
if (pcm_instance->num_streams_cap) {
pcm_instance->streams_cap =
devm_kcalloc(&front_info->xb_dev->dev,
pcm_instance->num_streams_cap, sizeof(struct xen_front_cfg_stream),
GFP_KERNEL); if (!pcm_instance->streams_cap) {
ret = -ENOMEM; goto fail;
}
}
cur_pb = 0;
cur_cap = 0; for (i = 0; i < num_streams; i++) {
ret = cfg_stream(front_info, pcm_instance, device_path, i,
&cur_pb, &cur_cap, stream_cnt); if (ret < 0) goto fail;
}
ret = 0;
fail:
kfree(device_path); return ret;
}
int xen_snd_front_cfg_card(struct xen_snd_front_info *front_info, int *stream_cnt)
{ struct xenbus_device *xb_dev = front_info->xb_dev; struct xen_front_cfg_card *cfg = &front_info->cfg; int ret, num_devices, i; char node[3];
*stream_cnt = 0;
num_devices = 0; do {
scnprintf(node, sizeof(node), "%d", num_devices); if (!xenbus_exists(XBT_NIL, xb_dev->nodename, node)) break;
num_devices++;
} while (num_devices < SNDRV_PCM_DEVICES);
if (!num_devices) {
dev_warn(&xb_dev->dev, "No devices configured for sound card at %s\n",
xb_dev->nodename); return -ENODEV;
}
/* Start from default PCM HW configuration for the card. */
cfg_read_pcm_hw(xb_dev->nodename, NULL, &cfg->pcm_hw);
for (i = 0; i < num_devices; i++) {
ret = cfg_device(front_info, &cfg->pcm_instances[i],
&cfg->pcm_hw, xb_dev->nodename, i, stream_cnt); if (ret < 0) return ret;
}
cfg->num_pcm_instances = num_devices; return 0;
}
Messung V0.5
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.1Angebot
Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.