summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_flv.c11
-rw-r--r--src/xine-engine/bswap.h6
2 files changed, 17 insertions, 0 deletions
diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c
index 988d7938f..5c3eefe69 100644
--- a/src/demuxers/demux_flv.c
+++ b/src/demuxers/demux_flv.c
@@ -111,6 +111,17 @@ typedef struct {
limited clip duration to 4:39:37.215. The backwards compatible solution:
hand over 1 byte from stream ID. Hence the weird byte order 2-1-0-3 */
#define gettimestamp(p,o) (((((((uint32_t)p[o+3]<<8)|p[o])<<8)|p[o+1])<<8)|p[o+2])
+#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ > 3)) || defined(__clang__)
+#if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
+#undef gettimestamp
+#define gettimestamp(p,o) ({ \
+ uint32_t tempi; \
+ __builtin_memcpy (&tempi, (p + o), 4); \
+ __asm__ __volatile__ ("bswapl\t%0\n\trorl\t$8, %0" : "=r" (tempi) : "0" (tempi) : "cc"); \
+ tempi; \
+})
+#endif
+#endif
#define FLV_FLAG_HAS_VIDEO 0x01
#define FLV_FLAG_HAS_AUDIO 0x04
diff --git a/src/xine-engine/bswap.h b/src/xine-engine/bswap.h
index 089f4f6db..b1ae34abc 100644
--- a/src/xine-engine/bswap.h
+++ b/src/xine-engine/bswap.h
@@ -73,18 +73,24 @@
/* Tested with gcc 4.4 */
#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ > 3)) || defined(__clang__)
+# undef _X_BE_24
# undef _X_BE_32
# undef _X_BE_64
+# undef _X_LE_24
# undef _X_LE_32
# undef _X_LE_64
# ifdef WORDS_BIGENDIAN
+# define _X_LE_24(x) ({ int32_t tempi; __builtin_memcpy (&tempi, (x), 4); (uint32_t)(__builtin_bswap32 (tempi)) & 0xffffff; })
# define _X_LE_32(x) ({ int32_t tempi; __builtin_memcpy (&tempi, (x), 4); (uint32_t)(__builtin_bswap32 (tempi)); })
# define _X_LE_64(x) ({ int64_t tempi; __builtin_memcpy (&tempi, (x), 8); (uint64_t)(__builtin_bswap64 (tempi)); })
+# define _X_BE_24(x) ({ uint32_t tempi; __builtin_memcpy (&tempi, (x), 4); tempi >> 8; })
# define _X_BE_32(x) ({ uint32_t tempi; __builtin_memcpy (&tempi, (x), 4); tempi; })
# define _X_BE_64(x) ({ uint64_t tempi; __builtin_memcpy (&tempi, (x), 8); tempi; })
# else
+# define _X_BE_24(x) ({ int32_t tempi; __builtin_memcpy (&tempi, (x), 4); (uint32_t)(__builtin_bswap32 (tempi)) >> 8; })
# define _X_BE_32(x) ({ int32_t tempi; __builtin_memcpy (&tempi, (x), 4); (uint32_t)(__builtin_bswap32 (tempi)); })
# define _X_BE_64(x) ({ int64_t tempi; __builtin_memcpy (&tempi, (x), 8); (uint64_t)(__builtin_bswap64 (tempi)); })
+# define _X_LE_24(x) ({ uint32_t tempi; __builtin_memcpy (&tempi, (x), 4); tempi & 0xffffff; })
# define _X_LE_32(x) ({ uint32_t tempi; __builtin_memcpy (&tempi, (x), 4); tempi; })
# define _X_LE_64(x) ({ uint64_t tempi; __builtin_memcpy (&tempi, (x), 8); tempi; })
# endif