Re: [pulseaudio-discuss] [PATCH]sndfile-util : Correct wav file creation/writing for 24-32 and 24 bits PCM sample formats

2011-02-22 Thread Colin Guthrie
'Twas brillig, and Becker, VincentX at 08/02/11 14:33 did gyre and gimble:
 This patch corrects format values that are set for specific sample
 formats PA_SAMPLE_S24NE and PA_SAMPLE_S24_32NE, for wav file creation
 and writing. Also PA_SAMPLE_S24_32NE was not fully supported in
 sndfile-util.c. For the unusual format PA_SAMPLE_S24_32NE, sfi format
 has to be SF_FORMAT_PCM_32 as the audio is coded on 32 bits. In this
 case, one has to shift 8 bits on the left 24 bits in order to fit
 into the MSB audio data on 32 bits.

Thanks. Applied!

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH]sndfile-util : Correct wav file creation/writing for 24-32 and 24 bits PCM sample formats

2011-02-21 Thread Colin Guthrie
'Twas brillig, and Becker, VincentX at 21/02/11 12:35 did gyre and gimble:
 Did you get the opportunity to inspect this patch ?

Hiya,

Yeah I did, but it's still in my to process pile. Not yet caught up
after holidays, but will be trying to clear the decks this evening :)

(emphasis on trying but rest assured it wont be lost :D)

Cheers

COl

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH]sndfile-util : Correct wav file creation/writing for 24-32 and 24 bits PCM sample formats

2011-02-08 Thread Becker, VincentX
Hi,

This patch corrects format values that are set for specific sample formats 
PA_SAMPLE_S24NE and PA_SAMPLE_S24_32NE, for wav file creation and writing. Also 
PA_SAMPLE_S24_32NE was not fully supported in sndfile-util.c. For the unusual 
format PA_SAMPLE_S24_32NE, sfi format has to be SF_FORMAT_PCM_32 as the audio 
is coded on 32 bits. In this case, one has to shift 8 bits on the left 24 bits 
in order to fit into the MSB audio data on 32 bits.

Vincent


---
 src/pulsecore/sndfile-util.c |   13 +++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/sndfile-util.c b/src/pulsecore/sndfile-util.c
index 9d15a86..cadda93 100644
--- a/src/pulsecore/sndfile-util.c
+++ b/src/pulsecore/sndfile-util.c
@@ -51,6 +51,9 @@ int pa_sndfile_read_sample_spec(SNDFILE *sf, pa_sample_spec 
*ss) {
 break;
 
 case SF_FORMAT_PCM_24:
+ss-format = PA_SAMPLE_S24NE;
+   break;
+
 case SF_FORMAT_PCM_32:
 ss-format = PA_SAMPLE_S32NE;
 break;
@@ -106,10 +109,14 @@ int pa_sndfile_write_sample_spec(SF_INFO *sfi, 
pa_sample_spec *ss) {
 
 case PA_SAMPLE_S24LE:
 case PA_SAMPLE_S24BE:
+   ss-format = PA_SAMPLE_S24NE;
+   sfi-format |= SF_FORMAT_PCM_24;
+   break;
+
 case PA_SAMPLE_S24_32LE:
 case PA_SAMPLE_S24_32BE:
-ss-format = PA_SAMPLE_S32NE;
-sfi-format |= SF_FORMAT_PCM_24;
+ss-format = PA_SAMPLE_S24_32NE;
+sfi-format |= SF_FORMAT_PCM_32;
 break;
 
 case PA_SAMPLE_S32LE:
@@ -362,6 +369,7 @@ pa_sndfile_readf_t pa_sndfile_readf_function(const 
pa_sample_spec *ss) {
 return (pa_sndfile_readf_t) sf_readf_short;
 
 case PA_SAMPLE_S32NE:
+case PA_SAMPLE_S24_32NE:
 return (pa_sndfile_readf_t) sf_readf_int;
 
 case PA_SAMPLE_FLOAT32NE:
@@ -384,6 +392,7 @@ pa_sndfile_writef_t pa_sndfile_writef_function(const 
pa_sample_spec *ss) {
 return (pa_sndfile_writef_t) sf_writef_short;
 
 case PA_SAMPLE_S32NE:
+case PA_SAMPLE_S24_32NE:
 return (pa_sndfile_writef_t) sf_writef_int;
 
 case PA_SAMPLE_FLOAT32NE:
-- 
1.7.2.3

-
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: Les Montalets- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


0001-Correct-wav-file-creation-for-24-32-and-24-bits-samp.patch
Description: 0001-Correct-wav-file-creation-for-24-32-and-24-bits-samp.patch
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss