Re: asynchronous change of kAudioStreamPropertyPhysicalFormat
Re: asynchronous change of kAudioStreamPropertyPhysicalFormat
- Subject: Re: asynchronous change of kAudioStreamPropertyPhysicalFormat
- From: Derk-Jan Hartman <email@hidden>
- Date: Wed, 21 Dec 2005 23:46:25 +0100
On 21-dec-2005, at 21:38, Jeff Moore wrote:
On Dec 21, 2005, at 11:35 AM, Derk-Jan Hartman wrote:
For VLC I change the kAudioStreamPropertyPhysicalFormat so i can
do cac3 output:
I retrieve the original format, so that I can back it up
Set the new format, enter a conditional lock.
The Streamlistener listens for the
kAudioStreamPropertyPhysicalFormat, and unlocks the condition.
Then the main method continues, and will query the "fresh/new"
kAudioStreamPropertyPhysicalFormat.
Usually it works, however sometimes the following occurs...
[00000319] auhal audio output debug: original stream format:
[44100][lpcm][30][4][1][4][2][16]
[00000319] auhal audio output debug: setting stream format: [48000]
[cac3][94][6144][1536][0][2][16]
[00000319] auhal audio output debug: actual format in use: [44100]
[lpcm][94][4][1][4][2][16]
So naturally this has me confused... I receive the "callback" that
the property changed, but apparently it's not changed yet
sometimes (a timeout did not occur, i checked). However, later on,
when the playback actually commenced (the IOProc is running), the
format HAS changed. What is going on here. anyone have an idea?
If you look closely, the format _did_ change. At least the flags
field did. Specifically, kAudioFormatFlagIsNonMixable got set.
Correct
It would appear that the hardware accepted the non-mixable part of
what you set, but rejected the AC-3 part. It's tough to say why,
but you might want to compare the AC-3 ASBD you send to the device
with the AC-3 ASBD it is advertising that it supports. On the
surface, it doesn't seem like yours is incorrect but it may not
match up entirely with what the device is expecting.
Ha, but the fun part is that it IS in AC3 mode. and the IOProc is at
48000 Hz instead of 44100 Hz. Because the 44100 I get on the actual
format causes VLC to resample down to 44100, and the IOProc is
completely confused because of that. I also checked with HALLab, and
during playback, the Device is in the requested setup, even though
the by me queried actual format directly after setting still shows lpcm.
And I picked the ABSD from the kAudioFormatPropertyPhysicalFormats
that I query. I don't construct it myself.
It almost seems like the setup is changed in "2" steps instead of
atomically or something. I again verified this against HALLab, and I
can sort of confirm this when i keep observing the Device
information, while my file opens. The Stream goes from lpcm -> "blank
dropdown box" -> AC3 for SPDIF, and the samplerate seems to change
from 44100 to 48000 even AFTER the stream format is changed. (visual
observation, not 100% sure).
DVD player doesn't have the same issue. it seems to change the format
in one step. I'm clueless as to what is the cause.
It seems to me like it might actually be a driverbug or something?
You can find more of the code here:
https://trac.videolan.org/vlc/file/trunk/modules/audio_output/auhal.c
See OpenSPDIF() and RenderCallbackSPDIF()
This is on a Powermac G5 compiling for SDK 10.3.9
DJ
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden