File libdv-endian.patch of Package libdv

--- libdv-1.0.0.orig/libdv/bitstream.h
+++ libdv-1.0.0/libdv/bitstream.h
@@ -42,16 +42,6 @@
 extern "C" {
 #endif
 
-//My new and improved vego-matic endian swapping routine
-//(stolen from the kernel)
-#if (BYTE_ORDER == BIG_ENDIAN)
-#define swab32(x) (x)
-#else // LITTLE_ENDIAN
-#    define swab32(x)\
-((((uint8_t*)&x)[0] << 24) | (((uint8_t*)&x)[1] << 16) |  \
- (((uint8_t*)&x)[2] << 8)  | (((uint8_t*)&x)[3]))
-#endif // LITTLE_ENDIAN
-
 bitstream_t *_dv_bitstream_init();
 void _dv_bitstream_set_fill_func(bitstream_t *bs,uint32_t (*next_function) (uint8_t **,void *),void *priv);
 void _dv_bitstream_next_buffer(bitstream_t * bs);
@@ -66,7 +56,7 @@ static void bitstream_next_word(bitstrea
 
   if ((bs->buflen - bs->bufoffset) >=4 ) {
     bs->next_word = *(uint32_t *)(bs->buf + bs->bufoffset);
-    bs->next_word = swab32(bs->next_word);
+    bs->next_word = htobe32(bs->next_word);
     bs->next_bits = 32;
 //    fprintf(stderr,"next_word is %08x at %d\n",bs->next_word,bs->bufoffset);
     bs->bufoffset += 4;
@@ -195,10 +185,10 @@ static inline void bitstream_flush_large
 static inline void bitstream_seek_set(bitstream_t *bs, uint32_t offset) {
   bs->bufoffset = ((offset & (~0x1f)) >> 5) << 2;
   bs->current_word = *(uint32_t *)(bs->buf + bs->bufoffset);
-  bs->current_word = swab32(bs->current_word);
+  bs->current_word = htobe32(bs->current_word);
   bs->bufoffset += 4;
   bs->next_word = *(uint32_t *)(bs->buf + bs->bufoffset);
-  bs->next_word = swab32(bs->next_word);
+  bs->next_word = htobe32(bs->next_word);
   bs->bufoffset += 4;
   bs->bits_left = 32 - (offset & 0x1f);
   bs->next_bits = 32;
--- libdv-1.0.0.orig/libdv/YUY2.c
+++ libdv-1.0.0/libdv/YUY2.c
@@ -275,7 +275,7 @@ dv_mb420_YUY2 (dv_macroblock_t *mb, uint
           cb_frame++;
           cr_frame++;
 
-#if (BYTE_ORDER == LITTLE_ENDIAN)
+#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
           *pwyuv0++ = ylut[CLAMP(*(Ytmp0 + 0), -256, 511)];
           *pwyuv0++ = cb;
           *pwyuv0++ = ylut[CLAMP(*(Ytmp0 + 1), -256, 511)];
--- libdv-1.0.0.orig/libdv/dv_types.h
+++ libdv-1.0.0/libdv/dv_types.h
@@ -253,11 +253,13 @@ typedef struct {
    counter examples.  If we do find out there is one, we'll have to
    fix it... */
 
-#if (BYTE_ORDER == LITTLE_ENDIAN)
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 #define LITTLE_ENDIAN_BITFIELD
-#else
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
 #define BIG_ENDIAN_BITFIELD
-#endif  /* (BYTE_ORDER == LITTLE_ENDIAN) */
+#else
+#error "cannot determine endianness"
+#endif
 
 typedef struct {
 #if defined(LITTLE_ENDIAN_BITFIELD)