From nobody Thu May 09 12:57:47 2024 X-Original-To: freebsd-multimedia@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VZsW50vKWz5JchY for ; Thu, 09 May 2024 12:57:53 +0000 (UTC) (envelope-from christos@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VZsW50Lbbz550q; Thu, 9 May 2024 12:57:53 +0000 (UTC) (envelope-from christos@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715259473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=gngSsBtubNLvp57Xmsw8l3LxW3hHJ6TgGlhGDgdbX5I=; b=X1Xvki5QX2c3bCYihZelspDlys4r5XEAcTPjf95A1mk7JBAT7VvqqU1SAkUOIhjHyYSOmQ qKUrE03tlcFZHvpi5wv1Lvw4ob2emlXN58pY+LrFIi9d/+wXQAVmE8LGT7HOKIyXwyqVQS 3gr2cZKeG7YsluLG+LlSzqQxHacYfx+g/3/O2IX0zc+ReaUxbW5eSpUPGFduIWWfO8wWrP Urqno/aVDOGMOlnyGK6m1M7gv0Lg1+2FIKFzxocj4pFCbRoJgeB0UwkYZvpqptfUqs9PHz /BrugG2ZBbVoAiQuaWl1EAy8xrFbQjPVW73wgw25Bvxj6pAGON71JBfURP+2Ag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715259473; a=rsa-sha256; cv=none; b=QiPTwK5IOlAEnnz+dA+0r2WHF/wpnaIKSUSXb37Hj+aUig4j2D2qpbglgLrrg59poaAhyu Nboc+IaLqSBQxwprhujz9q9ZG1FAVYG7Ip3ODA9i9G+jey21CN7rnZYZopMKK3jebbZ8wG zdF3fa4SfYtHCyjP4/+0TpBLiIFDI1+VXFYD2NizOEk7BLYS7YIXVgvZsRaF+P9oAoZ6mH I9uo3exLUAiWh6NIqk8NEt3GN7QaoExCrgjWuiYkxcpEM/2WqdSr7YkgZUQ0RvZ9NJosu5 QFmoTPSFt5hR5jvVAJ8Ku9Kb+WCbCofKp6BeyoUc1lsE5pK2AwWnH/z01in2bw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715259473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: dkim-signature; bh=gngSsBtubNLvp57Xmsw8l3LxW3hHJ6TgGlhGDgdbX5I=; b=kX5Xsyn6X7j7KG2mBMBwes7m4Ur6exrxSIYyYDSPyabmli8kJvwckVazfyUEBPsf4gMifm eepbTH6IDz+eX7+PCoh/pijp7jSf7IvPeLWTfmOxN+U0770OYw5xpG0+PtDg82EVRd0/9X sCVq1ftnouzAZHf2u1RxyU4NZZK9ijUvl+a/tUB5949ldn+durZU4CtSilAK3yNw6nDKyT crNgnGdS8S5vxbJlih4F+7AwGUsPJM7OykL5nPtVxHaFTDLmJjgGUx/grCH6u57zIzFu/f hK88cIivzPI51EHxYJPo06lwQjWwnXd52dzGjHxt8K8AFWJ+7VND1g/ooY8mEg== Received: from margiolis.net (mail.margiolis.net [95.179.159.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (Client did not present a certificate) (Authenticated sender: christos/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4VZsW43YTYzTVs; Thu, 9 May 2024 12:57:52 +0000 (UTC) (envelope-from christos@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=mail; bh=YFLjFfR0AhKankY SSN55Lz2trUfC/0UA84BI668VlEY=; h=subject:cc:to:from:date; d=margiolis.net; b=PRhT677D1o0Y0VYv9GG+1FdsHF5UJzS4GTyCnz38Rag3sp4+g6i PKVLDECabPgkqzb2VWwPYE7GXWTpXG5/Z2+OVgc6rJb9LGu5x5hXtdysIhhzJ45xtBdBOx 3Lgd/+ftkdFm6m2/PAFNVhYgJlF5wYRmi00oMDJCkHc/VNl5ys= Received: from tpad (ip-45-81-121-44.ask4internet.com [45.81.121.44]) by margiolis.net (OpenSMTPD) with ESMTPSA id c8f29a81 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Thu, 9 May 2024 12:57:48 +0000 (UTC) Date: Thu, 9 May 2024 14:57:47 +0200 From: Christos Margiolis To: dev@submerge.ch Cc: emaste@freebsd.org, freebsd-multimedia@freebsd.org Subject: SNDCTL_AUDIOINFO and SNDCTL_ENGINEINFO Message-ID: List-Id: Multimedia discussions List-Archive: https://lists.freebsd.org/archives/freebsd-multimedia List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-multimedia@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline A few days ago I stumbled into a bug report [1] which mentions that FreeBSD's SNDCTL_AUDIOINFO and SNDCTL_ENGINEINFO do not exactly work correctly. The problem is essentially that both IOCTLs return the same information, while in fact the information returned currently by dsp_oss_audioinfo() is what _only_ SNDCTL_ENGINEINFO is meant to return. This behavior is also noted in the OSS manual [2] (see bold paragraph in "Audio engines and device files" section), but I think that since the DEVFS_CDEVPRIV(9) patch we can actually fix this, because we now expose only a single device for each soundcard, and create the engines (channels) internally. SNDCTL_ENGINEINFO will report info about all channels in a given device (exactly what we do already), and SNDCTL_AUDIOINFO will only report information about /dev/dspX. The reason I writing this email however, is to hear your feedback on the following. Both SNDCTL_AUDIOINFO and SNDCTL_ENGINEINFO expect the same oss_audioinfo structure, so I am wondering what some of the fields will be filled with for SNDCTL_AUDIOINFO. Here are my thoughts about what we should fill the fields with: dev Device unit. name Either pcmX or device_get_desc(). I think the latter is better. busy Set this to true if we have >0 busy channels in the device? pid I think it's best to set this to -1. We could check if an application has exlusive access of the whole device, but I don't think this is useful in any way. caps We could gather the caps for every channel and OR them together, so we'll report all the currently enabled caps for the device. iformats Same as caps. oformats Same as caps. cmd Nothing. Same logic as pid. card_number Device unit. song_name Not supported. label Not supported. port_number Device unit. mixer_dev Device unit. legacy_device Device unit. devnode /dev/dspX enabled device_is_attached() min_rate Global (from all channels) minumum; max_rate Global maximum. min_channels Global minimum. max_channels Global maximum. nrates, rates Drivers do not support this yet, but I am not sure exactly what we should put here. handle Not supported. next_play_engine 0 next_rec_engine 0 Christos [1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246231 [2] http://manuals.opensound.com/developer/SNDCTL_AUDIOINFO.html