]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/common.h
GCC4 fix by (Keenan Pepper (keenanpepper gmail com)
[ffmpeg] / libavcodec / common.h
index 5b59def89f86e4c78a613e97c473716b7f6eedbb..5a47c4a3c84b4e4c985bb72e4c85f6ec2291823f 100644 (file)
 #define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr }
 #define AVOPTION_END() AVOPTION_SUB(NULL)
 
-struct AVOption;
-#ifdef HAVE_MMX
-extern const struct AVOption avoptions_common[3 + 5];
-#else
-extern const struct AVOption avoptions_common[3];
-#endif
-extern const struct AVOption avoptions_workaround_bug[11];
-
 #endif /* HAVE_AV_CONFIG_H */
 
 /* Suppress restrict if it was not defined in config.h.  */
@@ -85,6 +77,14 @@ extern const struct AVOption avoptions_workaround_bug[11];
 #endif
 #endif
 
+#ifndef attribute_unused
+#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
+#    define attribute_unused __attribute__((unused))
+#else
+#    define attribute_unused
+#endif
+#endif
+
 #ifndef EMULATE_INTTYPES
 #   include <inttypes.h>
 #else
@@ -457,6 +457,16 @@ if((y)<(x)){\
 #endif
 
 #if defined(ARCH_X86) || defined(ARCH_X86_64)
+#if defined(ARCH_X86_64)
+static inline uint64_t rdtsc(void)
+{
+       uint64_t a, d;
+       asm volatile(   "rdtsc\n\t"
+               : "=a" (a), "=d" (d)
+       );
+       return (d << 32) | (a & 0xffffffff);
+}
+#else
 static inline long long rdtsc(void)
 {
        long long l;
@@ -465,6 +475,7 @@ static inline long long rdtsc(void)
        );
        return l;
 }
+#endif
 
 #define START_TIMER \
 uint64_t tend;\
@@ -490,8 +501,6 @@ tend= rdtsc();\
 #define STOP_TIMER(id) {}
 #endif
 
-#define CLAMP_TO_8BIT(d) ((d > 0xff) ? 0xff : (d < 0) ? 0 : d)
-
 /* avoid usage of various functions */
 #define malloc please_use_av_malloc
 #define free please_use_av_free
@@ -499,6 +508,8 @@ tend= rdtsc();\
 #define time time_is_forbidden_due_to_security_issues
 #define rand rand_is_forbidden_due_to_state_trashing
 #define srand srand_is_forbidden_due_to_state_trashing
+#define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf
+#define strcat strcat_is_forbidden_due_to_security_issues_use_pstrcat
 #if !(defined(LIBAVFORMAT_BUILD) || defined(_FRAMEHOOK_H))
 #define printf please_use_av_log
 #define fprintf please_use_av_log