[FFmpeg-devel] [PATCH] Fix warning when libav API users include avformat.h

Art Clarke aclarke
Sat Apr 24 21:02:53 CEST 2010

This crept in during a checkin last week (sorry it took me so longer to
patch).  Clipping method generates warnings because constants used can be
interpreted in different ways depending on your C compiler.  The warning
shows up under GCC 4.2.4 and higher.

To reproduce the problem, include avformat.h in a program and compile your
program.  The patch just clarifies that the numbers should be treated as
int64_t constants on the LHS of the if clause.  Both constants are changed
to "LL" even though only the first generates the warnings for clarity.

- Art

  [exec] cc1plus: warnings being treated as errors
    [exec] In file included from /mnt/hudson/data/jobs/xuggle_
    [exec]                  from /mnt/hudson
    [exec]                  from /mnt/hudson
    [exec]                  from /mnt/hudson
    [exec]                  from
    [exec] /mnt/hudson/data/jobs/xuggle_xuggler_quicktest/workspace/workingcopy/build/native/i686-pc-linux-gnu/captive/usr/local/include/libavutil/common.h:154:
warning: this decimal constant is unsigned only in ISO C90

xu?ggle (z?' gl) v. To freely encode, decode, and experience audio and

Use Xuggle to get the power of FFmpeg in Java.
-------------- next part --------------
Index: libavutil/common.h
--- libavutil/common.h	(revision 22960)
+++ libavutil/common.h	(working copy)
@@ -151,7 +151,7 @@
 static inline av_const int32_t av_clipl_int32(int64_t a)
-    if ((a+2147483648) & ~2147483647) return (a>>63) ^ 2147483647;
+    if ((a+2147483648LL) & ~2147483647LL) return (a>>63) ^ 2147483647;
     else                              return a;

More information about the ffmpeg-devel mailing list