[MPlayer-cvslog] r21242 - trunk/bswap.h

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Nov 25 22:46:13 CET 2006


Hello,
On Sat, Nov 25, 2006 at 07:30:44PM +0100, reimar wrote:
> Author: reimar
> Date: Sat Nov 25 19:30:44 2006
> New Revision: 21242
> 
> Modified:
>    trunk/bswap.h
> 
> Log:
> Reuse bswap.h from libavutil. Will only work when libavutil subdir is available.
> Applied at Diego's request.

This broke compilation on some bigendian systems, because in libavutil
bswap_32 is a function, not a macro.
Attached patch just removes that (IMO) horrible initialization in
ao_pcm.c.
Btw. all bswap.h files have #ifdef HAVE_BYTESWAP_H part, but we never
define HAVE_BYTESWAP_H, is that intentional or did just nobody write a
configure test?

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libao2/ao_pcm.c
===================================================================
--- libao2/ao_pcm.c	(revision 21243)
+++ libao2/ao_pcm.c	(working copy)
@@ -53,22 +53,7 @@
 };
 
 /* init with default values */
-static struct WaveHeader wavhdr = {
-	le2me_32(WAV_ID_RIFF),
-        /* same conventions than in sox/wav.c/wavwritehdr() */
-	0, //le2me_32(0x7ffff024),
-	le2me_32(WAV_ID_WAVE),
-	le2me_32(WAV_ID_FMT),
-	le2me_32(16),
-	le2me_16(WAV_ID_PCM),
-	le2me_16(2),
-	le2me_32(44100),
-	le2me_32(192000),
-	le2me_16(4),
-	le2me_16(16),
-	le2me_32(WAV_ID_DATA),
-	0, //le2me_32(0x7ffff000)
-};
+static struct WaveHeader wavhdr;
 
 static FILE *fp = NULL;
 
@@ -121,12 +106,18 @@
 	ao_data.format=format;
 	ao_data.bps=channels*rate*(bits/8);
 
+	wavhdr.riff = le2me_32(WAV_ID_RIFF);
+	wavhdr.wave = le2me_32(WAV_ID_WAVE);
+	wavhdr.fmt = le2me_32(WAV_ID_FMT);
+	wavhdr.fmt_length = le2me_32(16);
+	wavhdr.fmt_tag = le2me_16(WAV_ID_PCM);
 	wavhdr.channels = le2me_16(ao_data.channels);
 	wavhdr.sample_rate = le2me_32(ao_data.samplerate);
 	wavhdr.bytes_per_second = le2me_32(ao_data.bps);
 	wavhdr.bits = le2me_16(bits);
 	wavhdr.block_align = le2me_16(ao_data.channels * (bits / 8));
 	
+	wavhdr.data = le2me_32(WAV_ID_DATA);
 	wavhdr.data_length=le2me_32(0x7ffff000);
 	wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8;
 


More information about the MPlayer-cvslog mailing list