[MPlayer-dev-eng] [PATCH] endian fixes for ASF streaming

Guillaume Morin guillaume at morinfr.org
Sat Apr 13 18:16:46 CEST 2002


Hi,

Here is a patch which adds some support for big endian archs. Since I
tried this on a WMV2 stream, I could not do extensive testing. But,
before Mplayer complains about the lack of codecs, data looked similar
to what I got with an x86 box.

Please apply.

--- asfheader.c.old	Sat Apr 13 17:42:50 2002
+++ asfheader.c	Sat Apr 13 17:49:11 2002
@@ -293,6 +293,17 @@
         stream_read( demuxer->stream, object, objh.size );
 	// FIXME: We need some endian handling below...
 	ptr = object;
+#if WORDS_BIGENDIAN
+        *(uint16_t*)ptr = bswap_16(*(uint16_t*)ptr);
+        ptr += 2;
+        for (i = 2 ; i < objh.size ; i += 6) {
+                *(uint16_t*)ptr = bswap_16(*(uint16_t*)ptr);
+                ptr += 2;
+                *(uint32_t*)ptr = bswap_32(*(uint32_t*)ptr);
+                ptr += 4;
+        }
+        ptr = object;
+#endif       
         stream_count = *(uint16_t*)ptr;
         ptr += sizeof(uint16_t);
         if(stream_count > 0)
--- asf_streaming.c.old	Sat Apr 13 15:14:58 2002
+++ asf_streaming.c	Sat Apr 13 18:04:06 2002
@@ -85,6 +85,13 @@
 */
 	if( drop_packet!=NULL ) *drop_packet = 0;
 
+#if WORDS_BIGENDIAN
+        stream_chunck->size = bswap_16(stream_chunck->size);
+        stream_chunck->type = bswap_16(stream_chunck->type);
+        stream_chunck->unknown = bswap_16(stream_chunck->unknown);
+        stream_chunck->size_confirm = bswap_16(stream_chunck->size_confirm);
+        stream_chunck->sequence_number = bswap_32(stream_chunck->sequence_number);
+#endif   
 	if( stream_chunck->size<8 ) {
 		printf("Ahhhh, stream_chunck size is too small: %d\n", stream_chunck->size);
 		return -1;

PS: if you answer this message, please keep me CC'ed.

-- 
Guillaume Morin <guillaume at morinfr.org>

        Oh, that is nice out there, I think I'll stay for a while (RHCP)



More information about the MPlayer-dev-eng mailing list