AtiQah-FC / lavfilters

Automatically exported from code.google.com/p/lavfilters
GNU General Public License v2.0
0 stars 0 forks source link

use WAVE_FORMAT_IEEE_FLOAT for stereo float output regardless of sample rate #98

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/lavfilters/issues/detail?id=96#c6

44.1 does not appear to be a limit for WAVE_FORMAT_IEEE_FLOAT.

MPC-HC plays 48.0 kHz stereo down-mixed ac3, without down-sampling.

Filter : Default DirectSound Device - CLSID : 
{79376820-07D0-11CF-A24D-0020AFD79767}

- Connected to:

CLSID: {18C16B08-6497-420E-AD14-22D21C2CEAB7}
Filter: Audio Switcher
Pin: Out

- Connection media type:

Audio: IEEE Float 48000Hz stereo 3072kbps

AM_MEDIA_TYPE: 
majortype: MEDIATYPE_Audio {73647561-0000-0010-8000-00AA00389B71}
subtype: MEDIASUBTYPE_IEEE_FLOAT {00000003-0000-0010-8000-00AA00389B71}
formattype: FORMAT_WaveFormatEx {05589F81-C356-11CE-BF01-00AA0055595A}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 8
cbFormat: 18

WAVEFORMATEX:
wFormatTag: 0x0003
nChannels: 2
nSamplesPerSec: 48000
nAvgBytesPerSec: 384000
nBlockAlign: 8
wBitsPerSample: 32
cbSize: 0 (extra bytes)
_______________________________________

I then also tried a 96 khz aac, no problem

Filter : Default DirectSound Device - CLSID : 
{79376820-07D0-11CF-A24D-0020AFD79767}

- Connected to:

CLSID: {18C16B08-6497-420E-AD14-22D21C2CEAB7}
Filter: Audio Switcher
Pin: Out

- Connection media type:

Audio: IEEE Float 96000Hz stereo 6144kbps

AM_MEDIA_TYPE: 
majortype: MEDIATYPE_Audio {73647561-0000-0010-8000-00AA00389B71}
subtype: MEDIASUBTYPE_IEEE_FLOAT {00000003-0000-0010-8000-00AA00389B71}
formattype: FORMAT_WaveFormatEx {05589F81-C356-11CE-BF01-00AA0055595A}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 8
cbFormat: 18

WAVEFORMATEX:
wFormatTag: 0x0003
nChannels: 2
nSamplesPerSec: 96000
nAvgBytesPerSec: 768000
nBlockAlign: 8
wBitsPerSample: 32
cbSize: 0 (extra bytes)
____________________________________________________

I don't think there's a sample rate limit for WAVE_FORMAT_IEEE_FLOAT, beyond 
the hardware.

Original issue reported on code.google.com by laxera...@gmail.com on 15 Sep 2011 at 5:03

GoogleCodeExporter commented 9 years ago
Whats allowed in WAVEFORMATEX is defined by the MSDN. Anything above 44100 Hz 
will get WAVEFORMATEXTENSIBLE.

If your driver does not cope with 100% valid values, well, too bad.

Original comment by h.lepp...@gmail.com on 15 Sep 2011 at 5:13

GoogleCodeExporter commented 9 years ago
Where does it say on MSDN that 44.1 kHz is the limit for WAVE_FORMAT_IEEE_FLOAT?

"If wFormatTag is WAVE_FORMAT_PCM, then common values for nSamplesPerSec are 
8.0 kHz, 11.025 kHz, 22.05 kHz, and 44.1 kHz. For non-PCM formats, this member 
must be computed according to the manufacturer's specification of the format 
tag."

There is no limit specified even for WAVE_FORMAT_PCM, only a few common values, 
but for WAVE_FORMAT_IEEE_FLOAT there's not even a hint of a limit.  Here's 
mpc-hc playing 48000 mp3 with WAVE_FORMAT_PCM with no problems:

Filter : Default DirectSound Device - CLSID : 
{79376820-07D0-11CF-A24D-0020AFD79767}

- Connected to:

CLSID: {18C16B08-6497-420E-AD14-22D21C2CEAB7}
Filter: Audio Switcher
Pin: Out

- Connection media type:

Audio: PCM 48000Hz mono 768kbps

AM_MEDIA_TYPE: 
majortype: MEDIATYPE_Audio {73647561-0000-0010-8000-00AA00389B71}
subtype: MEDIASUBTYPE_PCM {00000001-0000-0010-8000-00AA00389B71}
formattype: FORMAT_WaveFormatEx {05589F81-C356-11CE-BF01-00AA0055595A}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 2
cbFormat: 18

WAVEFORMATEX:
wFormatTag: 0x0001
nChannels: 1
nSamplesPerSec: 48000
nAvgBytesPerSec: 96000
nBlockAlign: 2
wBitsPerSample: 16
cbSize: 0 (extra bytes)
__________________________________________

I can name three filters that do higher than 44.1 with WAVE_FORMAT_IEEE_FLOAT:

ffdshow, mpc-hc internal, vlc internal

with no problems.  Are they all wrong?

Since you fixed Issue 96, it doesn't make sense to WONTFIX this, 48kHz is very 
common.

Original comment by laxera...@gmail.com on 15 Sep 2011 at 6:08

GoogleCodeExporter commented 9 years ago
Can you please review your position that MS docs forbid sample size > 44100 in 
WAVEFORMATEX.  If you were wrong, wouldn't you want to know?

And if that was the sole objection, will you reconsider the wontfix?

Original comment by laxera...@gmail.com on 15 Sep 2011 at 7:04

GoogleCodeExporter commented 9 years ago
I really don't care much about this. I write modern filters for modern systems. 
Windows XP is not a modern system, its legacy. Any newer Windows OS has a 
proper DirectSound mixer which will gladly take any format, independent off how 
broken your driver is.

Anyway, it looks like i found some reference that the 44100 Hz quoted in the 
Windows SDK is not correct, but instead it will accept up to 48000 Hz without 
using WAVEFORMATEXTENSIBLE.

Original comment by h.lepp...@gmail.com on 16 Sep 2011 at 5:53

GoogleCodeExporter commented 9 years ago
Can you post you reference?

48000 is much better it covers the vast majority of current content, but to be 
clear, its not the limit either. I've played 96 kHz files as WAVE_FORMAT_PCM 
and WAVE_FORMAT_IEEE_FLOAT with no problems.  I think you can safely set it to 
at least 96000 as mpc-hc, ffdshow, and vlc do (perhaps they don't enforce any 
limit)

Original comment by laxera...@gmail.com on 16 Sep 2011 at 9:19

GoogleCodeExporter commented 9 years ago
I will not change it anymore. This ticket is closed.

The documented limit is 44100 Hz, but some explanations from a Microsoft MVP 
cleared it up that DirectSound and WaveOut can deal with 48000. Anything above 
will need WAVEFORMATEXTENSIBLE.

This is my last comment on the matter. Get better drivers, a newer OS, or just 
use a audio renderer that does it properly. I'll not risk breaking playback if 
some component actually enforces the spec.

Original comment by h.lepp...@gmail.com on 16 Sep 2011 at 2:50

GoogleCodeExporter commented 9 years ago
You must be referring to this thread:
https://groups.google.com/group/microsoft.public.win32.programmer.directx.video/
browse_thread/thread/c24f0fcf7b3f0d5d

Though the current MSDN WAVEFORMATEXTENSIBLE page:
http://msdn.microsoft.com/en-us/library/dd390971(VS.85).aspx
does not mention the limit even for PCM, the version still in Google cache:
http://google.com/search?q=cache:http://msdn.microsoft.com/en-us/library/dd75772
1(v=vs.85).aspx
does, but specifically and only for PCM (i.e. WAVE_FORMAT_PCM)

so for PCM, sticking to 48000 makes sense, to be on the safe side

But you have posted no evidence for a 44.1 or a 48 kHz sample rate limit for 
WAVE_FORMAT_IEEE_FLOAT, and empirically it's not there, as you can confirm 
yourself.  mpc-hc, ffdshow, vlc, when configured for 2 channel float output, 
all successfully output WAVE_FORMAT_IEEE_FLOAT, even for 96000.  If that were a 
problem, they would have changed it by now, but probably the opposite is true, 
they do it because it's less problematic, as my experience with Audigi SE, a 
fairly popular entry level card, shows.

You can of course do whatever you want, but I think you're making this decision 
based on a misconception.

Original comment by laxera...@gmail.com on 17 Sep 2011 at 7:04