]> git.sesse.net Git - mlt/commitdiff
+ Big endian patch courtesy of Goncalo Carvalho (glslang at gmail dot com) - specific...
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Thu, 4 May 2006 20:06:48 +0000 (20:06 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Thu, 4 May 2006 20:06:48 +0000 (20:06 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@909 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/avformat/filter_avcolour_space.c

index 53b6780c2c3321890a043763096112e1a10d11b4..9ea2b8fee8e1894e9dbaba57666afd11072ceea7 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 
+static inline int is_big_endian( )
+{
+       union { int i; char c[ 4 ]; } big_endian_test;
+       big_endian_test.i = 1;
+
+       return big_endian_test.c[ 0 ] != 1;
+}
+
 static inline int convert_mlt_to_av_cs( mlt_image_format format )
 {
        int value = 0;
@@ -96,10 +104,8 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
                        register uint8_t *bits = *image;
                        register int n = ( len + 7 ) / 8;
 
-                       // TODO: Proper check for big endian systems
-                       #ifndef __DARWIN__
-                       bits += 3;
-                       #endif
+                       if( !is_big_endian( ) )
+                               bits += 3;
 
                        // Extract alpha mask from the image using Duff's Device
                        switch( len % 8 )
@@ -134,11 +140,9 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
                                register uint8_t *bits = *image;
                                register int len = *width * *height;
                                register int n = ( len + 7 ) / 8;
-
-                               // TODO: Proper check for big endian systems
-                               #ifndef __DARWIN__
-                               bits += 3;
-                               #endif
+                               
+                               if( !is_big_endian( ) )
+                                       bits += 3;
 
                                // Merge the alpha mask into the RGB image using Duff's Device
                                switch( len % 8 )