First timer... Lost & confused & in need of help/guidance

OSS specific BSD discussion (FreeBSD/NetBSD/OpenBSD)

Moderators: cesium, dev, kodachi, hannu

First timer... Lost & confused & in need of help/guidance

Postby rfg » Fri Oct 19, 2012 10:37 pm

I have had _no_ prior exposure to OSS, and indeed, I would not even be dealing with it now except for the fact that I'm trying to get xbmc running properly on FreebSD. (In general, it seems to work, but it seems that it doesn't really want to send sound out via my laptop's HDMI port (even though mplayer and vlc seem happy to do so, and they even send down Dolby Digital 5.1).

So, to begin with, I suppose that I should ask the more fundamental question(s): Does XBMC require OSS on FreeBSD? Does XBMC require OSS on FreeBSD _if_ one wishes to have XBMC send Dolby Digital 5.1 out an HDMI port?

If the answer to one or both of these questions is "no", then no offense to anybody here, but I am probably wasting my time trying to get OSS working properly on my specific machine (and I should go off instead in another direction). Frankly, I have no idea what it is that XBMC wants to have present in order to output sound (of any kind and via any port or the speakers). I asked for some guidance on the FreeBSD multimedia list and got only dead silence as a reply. I am only _guessing_ that XBMC might want OSS to be installed and working because I read that XBMC on Linux platforms likes to have ALSA installed and working, and I gather that OSS is, in effect, the FreeBSD alternative to ALSA. (Yes?)

So anyway, I started my OSS journey just the other day, and I started with the first and second message in this thread:

viewtopic.php?f=5&t=4505

(I got to that thread by googling for something... I can't even remember what now.)

Just a short while ago, I found the OSS WIKI, and then, quickly, this page:

http://www.opensound.com/wiki/index.php/Troubleshooting

which is helpful, but suggests things that one should do, and for me at least, several of these things seem to be failing... for reasons that I can only dimly guess at.

So anyway, in a nutshell, here's where I am and what I have done, and the results...

I have a laptop. It's an MSI X340-218US. It has a built-in 1366x768 LCD, speakers, a headphone jack, and an HDMI output port. I also have a Sony STR-DH520 AV Receiver which is capable of decoding just about anything (in the way of audio) that one could throw at it, including Dolby Digital, Dolby IIz, Dolby TrueHD, DTS, and DTS HD (aka Master Audio). The Sony has 4 HDMI inputs and 1 HDMI output. That output is wired to a Samsung 42" plasma TV which apparently represents itself (via EDID?) as having 1280x720 resolution. The Sony Receiver is also connected to my 4 speakers, FL, FR, RL, RR.

I have the laptop setup currently to dual-boot to either (a) Windows 7 or else (b) FreeBSD 9.1-RC2. (I am using -RC2 because someone pointed out to me that there had been a LOT of recent work on support for the Intel GS45/GMA4500MHD chipset post 9.0-RELEASE that I would almost certainly benefit from.)

After much gnashing of teeth and tearing of hair, I have managed to get XBMC & mplayer & VLC to all correctly output Dolbly Digital 5.1 to the HDMI output port,
but so far only under Windows 7. Under FreeBSD 9.1-RC2 I can also get DD 5.1 out the HDMI port, but only from mplayer and VLC. (I gather that the latter may perhaps be using the former to actually render videos, so that may explain why they both work.) Output of DD 5.1 from XBMC to the HDMI is still problematic under FreeBSD.

I am attaching relevant diagnostic output that folks here can perhaps diagnose the problem(s) from. Specifically, I am attaching:

1) output from cat /dev/sndstat
2) output from ossinfo -v3

I am worried... perhaps needlessly so... about the fact that on the laptop in question, the output from ossinfo -v3 fails to show any "Nodes". Is this normal or abnormal? (It seems to me that perhaps ossinfo may be crashing half-way through.)

I also ran the suggested "osstest" program and the actual auditory results from that test, as well as the printed output were also troubling. As far as audio out from osstest, only the two built-in laptop speakers made any sound during the test. None of the 4 speakers wired to the Sony AVR made a peep. Based on the printed output from "osstest" during this initial run, it does seem that there was indeed _something_ that osstest did not like about my pcm2 device, which is my digital HDMI output:

==============================================================================================================================
% osstest
Sound subsystem and version: FreeBSD native OSS ABI 901000 (0x00040000)
Platform: FreeBSD/amd64 9.1-RC2 FreeBSD 9.1-RC2 #0 r241106: Mon Oct 1 18:26:44 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
/dev/dsp0.p0 (audio engine 0): pcm0:play:dsp0.p0
- Performing audio playback test... /dev/dsp0.p0: Device busy
Can't open the device
/dev/dsp0.vp0 (audio engine 1): pcm0:virtual:dsp0.vp0
- Performing audio playback test...
<left> OK <right> OK <stereo> OK <measured srate 47993.00 Hz (-0.01%)>
/dev/dsp0.r0 (audio engine 2): pcm0:record:dsp0.r0
- Skipping input only device
/dev/dsp0.vr0 (audio engine 3): pcm0:virtual:dsp0.vr0
- Skipping input only device
/dev/dsp1.r0 (audio engine 4): pcm1:record:dsp1.r0
- Skipping input only device
/dev/dsp1.vr0 (audio engine 5): pcm1:virtual:dsp1.vr0
- Skipping input only device
/dev/dsp2.p0 (audio engine 6): pcm2:play:dsp2.p0
- Performing audio playback test... /dev/dsp2.p0: Device busy
Can't open the device
/dev/dsp2.vp0 (audio engine 7): pcm2:virtual:dsp2.vp0
- Performing audio playback test...
<left> OK <right> OK <stereo> OK <measured srate 47988.00 Hz (-0.03%)>

*** Some errors were detected during the tests ***
==========================================================================================================================

I don't have the first clue as to why /dev/dsp2.p0 would have been, in any sense, "busy". Certainly no other programs that might use that output were running at the time. If anyone can shed light on this, it would be much appreciated.

Another problem... I noticed from this thread:

viewtopic.php?f=5&t=4448

that if I have OSS installed on FreeBSD (which I do) then I shuld have a program called "ossmix" installed. In fact, I *do* seem to have such a program installed, and it is right here:

/usr/local/bin/ossmix

Unfortunately, when I try to invoke it, EVEN USING ITS FULL PATHNAME all I get is the following cryptic error message:

No such file or directory

So, um, what the heck is up with that??

When I run "file" on /usr/local/bin/ossmix I get this:

/usr/local/bin/ossmix: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 9.1, stripped

so I cannot begin to guess what the problem is.

Yet another problem... After running the inital osstest, with the results describe above, I found this page:

http://www.opensound.com/wiki/index.php/Troubleshooting

which suggested (among many other things) doing these commands (as root):

ossdevlinks -r -v
ossdetect -d -v

I *did* in fact run these commands, only because I looked and say that I had nothing called /dev/oss... no directory, no file by that name, nothing.

Unfortunately, after running the above two commands and then re-running the osstest program, *now* I am getting no sound out of the laptop AT ALL! This is actually a step BACKWARDS from where I was initially. So why are the above two commands being suggested to people if their primary effect is actually to break whatever small parts of OSS are actually working already?

Here is the output from this subsequent run of osstest. As you can see, now it thinks that pmc0 is also "busy" for some reason:

===============================================================================================================================
% osstest
Sound subsystem and version: FreeBSD native OSS ABI 901000 (0x00040000)
Platform: FreeBSD/amd64 9.1-RC2 FreeBSD 9.1-RC2 #0 r241106: Mon Oct 1 18:26:44 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
/dev/dsp0.p0 (audio engine 0): pcm0:play:dsp0.p0
- Performing audio playback test... /dev/dsp0.p0: Device busy
Can't open the device
/dev/dsp0.vp0 (audio engine 1): pcm0:virtual:dsp0.vp0
- Performing audio playback test... /dev/dsp0.vp0: No such file or directory
Can't open the device
/dev/dsp0.r0 (audio engine 2): pcm0:record:dsp0.r0
- Skipping input only device
/dev/dsp0.vr0 (audio engine 3): pcm0:virtual:dsp0.vr0
- Skipping input only device
/dev/dsp1.r0 (audio engine 4): pcm1:record:dsp1.r0
- Skipping input only device
/dev/dsp1.vr0 (audio engine 5): pcm1:virtual:dsp1.vr0
- Skipping input only device
/dev/dsp2.p0 (audio engine 6): pcm2:play:dsp2.p0
- Performing audio playback test... /dev/dsp2.p0: Device busy
Can't open the device
/dev/dsp2.vp0 (audio engine 7): pcm2:virtual:dsp2.vp0
- Performing audio playback test... /dev/dsp2.vp0: No such file or directory
Can't open the device

*** Some errors were detected during the tests ***
====================================================================================================================================

Lastly, I saw it suggested on the WIKI troubleshooting page that running "soundon" might be helpful. So I tried it:

====================================================================================================================================
% soundon
kldload: can't load /usr/local/lib/oss/modules/osscore.ko: Exec format error
Loading the osscore module failed
====================================================================================================================================

I have no idea what these errors mean. The "file command has this to say about usr/local/lib/oss/modules/osscore.ko:

/usr/local/lib/oss/modules/osscore.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (FreeBSD), not stripped

Looks reasonable to me! But hay! What do I know?

Sorry, I mean no offense to anybody here, but as a brand new user who is unfamiliar with the current state of this stuff I have to ask... Is OSS really ready for prime time on FreeBSD? It does seem to me that quite a few things are basically, and not to put too fine a point on it, busted.
rfg
New Member
 
Posts: 4
Joined: Fri Oct 19, 2012 9:32 pm

Re: First timer... Lost & confused & in need of help/guidanc

Postby rfg » Fri Oct 19, 2012 10:45 pm

Well, it appears... from where I am sitting at least... that the "attach file" feature of this BBS system doesn't actually work, so here are the two files that I had intended to have attached to the preceding message

======================================================================================================================================
% cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm0: <Realtek ALC888 (Analog 2.0+HP/2.0)> (play/rec)
pcm1: <Realtek ALC888 (Onboard Analog Mic)> (rec)
pcm2: <Intel Cantiga (HDMI 8ch)> (play) default
======================================================================================================================================

======================================================================================================================================
% ossinfo -v3
Version info: FreeBSD native OSS ABI 901000 (0x00040000) BSD
Platform: FreeBSD/amd64 9.1-RC2 FreeBSD 9.1-RC2 #0 r241106: Mon Oct 1 18:26:44 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC (slim.tristatelogic.com)

Number of audio devices: 8
Number of audio engines: 8
Number of MIDI devices: 0
Number of mixer devices: 3


Device objects
0: pcm0 Realtek ALC888 (Analog 2.0+HP/2.0)
on hdaa0
1: pcm1 Realtek ALC888 (Onboard Analog Mic)
on hdaa0
2: pcm2 Intel Cantiga (HDMI 8ch)
on hdaa1

MIDI devices (/dev/midi*)

Mixer devices
0: pcm0:mixer (Mixer 0 of device object 0)
Device file , Legacy device /dev/mixer0
Priority: 0
Caps:
Device handle:
Device priority: 0

1: pcm1:mixer (Mixer 0 of device object 1)
Device file , Legacy device /dev/mixer0
Priority: 0
Caps:
Device handle:
Device priority: 0

2: pcm2:mixer (Mixer 0 of device object 2)
Device file , Legacy device /dev/mixer0
Priority: 0
Caps:
Device handle:
Device priority: 0


Audio devices
pcm0:play:dsp0.p0 /dev/dsp0.p0 (device index 0)
Legacy device NONE
Caps: REALTIME TRIGGER MMAP
Modes: OUTPUT
Out engine 1: 0/pcm0:play:dsp0.p0
Busy (OUT)
Input formats (0x00000000):
Output formats (0x00201010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Device handle:
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 192000
HW Type: Not indicated.
Minimum latency: 0 usec

pcm0:virtual:dsp0.vp0 /dev/dsp0.vp0 (device index 1)
Legacy device NONE
Caps: REALTIME TRIGGER MMAP
Modes: OUTPUT
Out engine 1: 1/pcm0:virtual:dsp0.vp0
Available for use
Input formats (0x00000000):
Output formats (0x00200010):
AFMT_S16_LE - 16 bit signed little endian
Device handle:
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 48000 - 48000
HW Type: Not indicated.
Minimum latency: 0 usec

pcm0:record:dsp0.r0 /dev/dsp0.r0 (device index 2)
Legacy device NONE
Caps: REALTIME TRIGGER MMAP
Modes: INPUT
In engine 1: 2/pcm0:record:dsp0.r0
Busy (IN)
Input formats (0x00201010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00000000):
Device handle:
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 192000
HW Type: Not indicated.
Minimum latency: 0 usec

pcm0:virtual:dsp0.vr0 /dev/dsp0.vr0 (device index 3)
Legacy device NONE
Caps: REALTIME TRIGGER MMAP
Modes: INPUT
In engine 1: 3/pcm0:virtual:dsp0.vr0
Available for use
Input formats (0x00200010):
AFMT_S16_LE - 16 bit signed little endian
Output formats (0x00000000):
Device handle:
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 48000 - 48000
HW Type: Not indicated.
Minimum latency: 0 usec

pcm1:record:dsp1.r0 /dev/dsp1.r0 (device index 4)
Legacy device NONE
Caps: REALTIME TRIGGER MMAP
Modes: INPUT
In engine 1: 4/pcm1:record:dsp1.r0
Busy (IN)
Input formats (0x00201010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00000000):
Device handle:
Related mixer dev: 1
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 192000
HW Type: Not indicated.
Minimum latency: 0 usec

pcm1:virtual:dsp1.vr0 /dev/dsp1.vr0 (device index 5)
Legacy device NONE
Caps: REALTIME TRIGGER MMAP
Modes: INPUT
In engine 1: 5/pcm1:virtual:dsp1.vr0
Available for use
Input formats (0x00200010):
AFMT_S16_LE - 16 bit signed little endian
Output formats (0x00000000):
Device handle:
Related mixer dev: 1
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 48000 - 48000
HW Type: Not indicated.
Legacy device NONE
Caps: REALTIME TRIGGER MMAP
Modes: INPUT
In engine 1: 4/pcm1:record:dsp1.r0
Busy (IN)
Input formats (0x00201010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00000000):
Device handle:
Related mixer dev: 1
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 192000
HW Type: Not indicated.
Minimum latency: 0 usec

pcm1:virtual:dsp1.vr0 /dev/dsp1.vr0 (device index 5)
Legacy device NONE
Caps: REALTIME TRIGGER MMAP
Modes: INPUT
In engine 1: 5/pcm1:virtual:dsp1.vr0
Available for use
Input formats (0x00200010):
AFMT_S16_LE - 16 bit signed little endian
Output formats (0x00000000):
Device handle:
Related mixer dev: 1
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 48000 - 48000
HW Type: Not indicated.
Minimum latency: 0 usec

pcm2:play:dsp2.p0 /dev/dsp2.p0 (device index 6)
Legacy device NONE
Caps: REALTIME TRIGGER MMAP
Modes: OUTPUT
Out engine 1: 6/pcm2:play:dsp2.p0
Busy (OUT)
Input formats (0x00000000):
Output formats (0x02f01410):
AFMT_S16_LE - 16 bit signed little endian
AFMT_AC3 - AC3 (Dolby Digital) encoded audio
AFMT_S32_LE - 32 bit signed little endian
Device handle:
Related mixer dev: 2
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 32000 - 192000
HW Type: Not indicated.
Minimum latency: 0 usec

pcm2:virtual:dsp2.vp0 /dev/dsp2.vp0 (device index 7)
Legacy device NONE
Caps: REALTIME TRIGGER MMAP
Modes: OUTPUT
Out engine 1: 7/pcm2:virtual:dsp2.vp0
Available for use
Input formats (0x00000000):
Output formats (0x02e00410):
AFMT_S16_LE - 16 bit signed little endian
AFMT_AC3 - AC3 (Dolby Digital) encoded audio
Device handle:
Related mixer dev: 2
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 48000 - 48000
HW Type: Not indicated.
Minimum latency: 0 usec


Nodes
======================================================================================================================================
rfg
New Member
 
Posts: 4
Joined: Fri Oct 19, 2012 9:32 pm

Re: First timer... Lost & confused & in need of help/guidanc

Postby cesium » Sat Oct 20, 2012 12:04 am

OSS is used to refer to several things: First, there's the various "Open Source Software" acronyms etc. Second, there's the Audio API called OSS, used by FreeBSD, newer Solaris and old Linuxs. Third, there's a particular implementation of the sound API (there are several implementations of OSS). And so on.

The sources you read refer to the second meaning - OSS is the audio API used in FreeBSD (i.e. software which plays music uses OSS interface to communication with the device). Provided you want to emit sound from XBMC, it requires using this OSS API.

However, as I wrote earlier, this OSS API has several different implementations. FreeBSD has its own native implementation which comes with the OS and which you are already using per the ossinfo output.

The forum supports a different implementation from 4front software (OSSv4) - which does support FreeBSD and 5.1 under FreeBSD, but AFAIK doesn't support HDMI under FreeBSD. You tried to install it, but for some reason the module didn't load (I think this is because one needs to disable the native sound system first). The issues you are seeing are probably because you are using the OSSv4 tools under the FreeBSD OSS and I suspect a correct installation would have worked much smoother.

You are welcome to post here, but I suggest you write to the freebsd-multimedia email list to get proper support for the native soundsystem (which according to this message can output from XBMC to HDMI, i.e. do what you want).

See http://lists.freebsd.org/mailman/listin ... multimedia for list information

[Edit: Sorry... I reread the mailing list message and it appear you're the same rfg... Oops.]
cesium
Developer
 
Posts: 902
Joined: Sun Aug 12, 2007 12:51 am

Re: First timer... Lost & confused & in need of help/guidanc

Postby cesium » Sat Oct 20, 2012 1:02 am

I see you also posted to freebsd-questions... Well, since the output works under mplayer, this must be an XBMC issue. Some ideas (note I use neither FreeBSD nor XBMC):

A) Is 'downmix to stereo' selected under XBMC's audio menu? Hopefully it's not. You can also experiment with different custom audio outputs (IIRC, their format match the ossinfo output).

B) Writes to OSS devices nodes use the UNIX read/write/ioctl system calls, so you can trace those and see exactly how XBMC set up the card. You can also use a library wrapper to interfere in the middle. Under Linux, I sometimes use strace with this patch I made to see what's going on. FreeBSD uses ktrace, but AFAICT it doesn't dereference the ioctl argument...

Also, I made a wrapper library once which also printed output, which might also work under FreeBSD. Compile the code here with "cc -fPIC -shared -Wl,-soname,libwrap_frag.so.1 -I/usr/lib/oss/include -I/usr/include -o libwrap_frag.so.1.0 -ldl ${c filename which you copied the code to}". Then load xbmc with "LD_PRELOAD=${full path to libwrap]/libwrap_frag.so.1.0 xbmc". It should output info on stderr. Look for how many channels it set ups the card with - 2 (stereo) or more.
cesium
Developer
 
Posts: 902
Joined: Sun Aug 12, 2007 12:51 am

Re: First timer... Lost & confused & in need of help/guidanc

Postby rfg » Sat Oct 20, 2012 7:31 pm

Cesium,

First, thanks for responding, and in such a timely manner.

Second, let me see if I have this straight... You're telling me that on FreeBSD, there are _two_ possible implementations of the OSS API, that one is commercial (belonging to 4front) and the other is gratis, and supplied courtesy of the FreeBSD community. All correct so far? (I must say that this is all quite certainly news to me.)

And are you further telling me that it is possible that (without me having paid 4front any money) I ended up with bits and parts of _both_ OSS implementations on this one machine, and that now, the two of them may perhaps be conflicting with one another, messing things up, and causing goofy output?

Assuming this is alto true, can you suggest to me how I can avoid such a situation in the future?

It appears to me that one or the other implementation of the API may perhaps (nowadays, e.g. in FreeBSD 9.1-RC2) be implemented as a loadable kernel module. Is that the commercial version? Or is that the other version?

Thanks in advance for any further enlightenment.
rfg
New Member
 
Posts: 4
Joined: Fri Oct 19, 2012 9:32 pm

Re: First timer... Lost & confused & in need of help/guidanc

Postby cesium » Sat Oct 20, 2012 9:00 pm

The 4front oss is always an external kernel module. The only way the 4front implementation came to your installation is because you installed it sometime... It doesn't come with the installation. I guess you installed the port, and could uninstall it the same way most ports are uninstalled. The easiest way to avoid having both is either to not install ossv4, or to disable the native implementation.

That said, I don't think that's the reason for your XBMC predicament nor something that affects other programs - only one set of modules may be loaded at a time (otherwise they'd conflict on the same hw, and the kernel doesn't let this happen). I said the reason some of the tools coming with ossv4 didn't work for you is probably because you were running them on the native sound system (the public API is mostly compatible but some tools use private APIs and there are some implementation differences. For example, ossdevlinks/ossdetect make no sense on the native implementation - it has its own detection and a different device node layout).
cesium
Developer
 
Posts: 902
Joined: Sun Aug 12, 2007 12:51 am

Re: First timer... Lost & confused & in need of help/guidanc

Postby rfg » Sun Oct 21, 2012 12:39 am

Yes, I _did_ install the port, because I knew no better. (I thought that perhaps I needed it in order to get OSS sound support on the box.)

Now I know. If I want to _just_ use the plain vanilla (non-commercial) OSS then I should _avoid_ installing the port, right?

As regards to XBMC... yes. I'm sure that you are correct that there is nothing fundamentally wrong with _either_ flavor of OSS on FreeBSD, but I do believe that at present, XBMC may not be playing well at all with whatever version or versions of OSS I have installed. But as I say, I have no reason to believe that that is in any way the fault of OSS. The FreeBSD port of XBMC just has some rough spots. I am hoping to help out and perhaps see if I can fix a few of those.

Thanks for your kind assistance.
rfg
New Member
 
Posts: 4
Joined: Fri Oct 19, 2012 9:32 pm


Return to BSD

Who is online

Users browsing this forum: No registered users and 1 guest

cron