Index: /pjproject/trunk/aconfigure
===================================================================
--- /pjproject/trunk/aconfigure	(revision 5270)
+++ /pjproject/trunk/aconfigure	(revision 5271)
@@ -2011,4 +2011,58 @@
 
 } # ac_fn_c_check_func
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+	 return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+	    return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
@@ -2274,5 +2328,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
   fi
 done
@@ -2417,5 +2471,5 @@
 case $ac_cv_build in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
 esac
 build=$ac_cv_build
@@ -2450,5 +2504,5 @@
 case $ac_cv_host in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
 esac
 host=$ac_cv_host
@@ -2483,5 +2537,5 @@
 case $ac_cv_target in
 *-*-*) ;;
-*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;;
 esac
 target=$ac_cv_target
@@ -2820,5 +2874,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 
 # Provide some information about the compiler.
@@ -2935,5 +2989,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -2978,5 +3032,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f conftest conftest$ac_cv_exeext
@@ -3037,5 +3091,5 @@
 as_fn_error $? "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
     fi
   fi
@@ -3089,5 +3143,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
@@ -4483,5 +4537,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
@@ -4973,5 +5027,5 @@
    *)
      as_fn_error $? "unknown endianness
- presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5  ;;
  esac
 
@@ -7077,4 +7131,19 @@
 		fi
 
+		ac_fn_c_check_type "$LINENO" "enum AVPixelFormat" "ac_cv_type_enum_AVPixelFormat" "#include <libavformat/avformat.h>
+
+"
+if test "x$ac_cv_type_enum_AVPixelFormat" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ENUM_AVPIXELFORMAT 1
+_ACEOF
+
+
+else
+  ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_USE_OLD_FFMPEG=1"
+fi
+
+
 		LIBS="$LIBS $ac_ffmpeg_ldflags"
 		export PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH
@@ -7614,5 +7683,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "Error: unable to recognize your IPP installation. Make sure the paths and ARCH suffix are set correctly, run with --help for more info
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f core conftest.err conftest.$ac_objext \
@@ -7670,5 +7739,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "Unable to find to find built binaries under $IPPSAMPLES/speech-codecs/{bin,_bin}. Have you built the IPP samples?
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 	    fi
 	else
@@ -7676,5 +7745,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "unable to find $IPPSAMPLES/speech-codecs/bin/*gcc*/lib or $IPPSAMPLES/speech-codecs/_bin/*gcc*/lib directory. Have you built the samples?
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 	fi
 
@@ -7684,5 +7753,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "There's something wrong with this script, directory $IPPSAMP_DIR does not exist
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 	    exit 1;
 	fi
@@ -7698,5 +7767,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "bug in this script: unsupported IPP version
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 	fi
 
@@ -7705,5 +7774,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "$IPPSAMP_LIBS doesn't exist in $IPPSAMP_DIR
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 	fi
 
@@ -7741,5 +7810,5 @@
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no
-See \`config.log' for more details" "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f core conftest.err conftest.$ac_objext \
@@ -9139,5 +9208,5 @@
     "third_party/build/os-auto.mak") CONFIG_FILES="$CONFIG_FILES third_party/build/os-auto.mak" ;;
 
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
   esac
 done
@@ -9456,5 +9525,5 @@
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
@@ -9484,5 +9553,5 @@
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
@@ -9511,5 +9580,5 @@
     case $ac_tag in
     *:-:* | *:-) cat >"$ac_tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
     esac
     ;;
Index: /pjproject/trunk/aconfigure.ac
===================================================================
--- /pjproject/trunk/aconfigure.ac	(revision 5270)
+++ /pjproject/trunk/aconfigure.ac	(revision 5271)
@@ -1098,4 +1098,10 @@
 		fi
 		
+		AC_CHECK_TYPES(enum AVPixelFormat,
+			       [],
+			       [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_USE_OLD_FFMPEG=1"],
+			       [[#include <libavformat/avformat.h>]]
+			     )
+				     
 		LIBS="$LIBS $ac_ffmpeg_ldflags"
 		export PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH
Index: /pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.c	(revision 5270)
+++ /pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.c	(revision 5271)
@@ -34,17 +34,17 @@
 } ffmpeg_fmt_table[] =
 {
-    { PJMEDIA_FORMAT_RGBA, AV_PIX_FMT_RGBA},
-    { PJMEDIA_FORMAT_RGB24,AV_PIX_FMT_BGR24},
-    { PJMEDIA_FORMAT_BGRA, AV_PIX_FMT_BGRA},
-    { PJMEDIA_FORMAT_GBRP, AV_PIX_FMT_GBRP},
+    { PJMEDIA_FORMAT_RGBA, AV(PIX_FMT_RGBA)},
+    { PJMEDIA_FORMAT_RGB24,AV(PIX_FMT_BGR24)},
+    { PJMEDIA_FORMAT_BGRA, AV(PIX_FMT_BGRA)},
+    { PJMEDIA_FORMAT_GBRP, AV(PIX_FMT_GBRP)},
 
-    { PJMEDIA_FORMAT_AYUV, AV_PIX_FMT_NONE},
-    { PJMEDIA_FORMAT_YUY2, AV_PIX_FMT_YUYV422},
-    { PJMEDIA_FORMAT_UYVY, AV_PIX_FMT_UYVY422},
-    { PJMEDIA_FORMAT_I420, AV_PIX_FMT_YUV420P},
-    //{ PJMEDIA_FORMAT_YV12, AV_PIX_FMT_YUV420P},
-    { PJMEDIA_FORMAT_I422, AV_PIX_FMT_YUV422P},
-    { PJMEDIA_FORMAT_I420JPEG, AV_PIX_FMT_YUVJ420P},
-    { PJMEDIA_FORMAT_I422JPEG, AV_PIX_FMT_YUVJ422P},
+    { PJMEDIA_FORMAT_AYUV, AV(PIX_FMT_NONE)},
+    { PJMEDIA_FORMAT_YUY2, AV(PIX_FMT_YUYV422)},
+    { PJMEDIA_FORMAT_UYVY, AV(PIX_FMT_UYVY422)},
+    { PJMEDIA_FORMAT_I420, AV(PIX_FMT_YUV420P)},
+    //{ PJMEDIA_FORMAT_YV12, AV(PIX_FMT_YUV420P)},
+    { PJMEDIA_FORMAT_I422, AV(PIX_FMT_YUV422P)},
+    { PJMEDIA_FORMAT_I420JPEG, AV(PIX_FMT_YUVJ420P)},
+    { PJMEDIA_FORMAT_I422JPEG, AV(PIX_FMT_YUVJ422P)},
 };
 
@@ -56,12 +56,12 @@
 } ffmpeg_codec_table[] =
 {
-    {PJMEDIA_FORMAT_H261,	AV_CODEC_ID_H261},
-    {PJMEDIA_FORMAT_H263,	AV_CODEC_ID_H263},
-    {PJMEDIA_FORMAT_H263P,	AV_CODEC_ID_H263P},
-    {PJMEDIA_FORMAT_H264,	AV_CODEC_ID_H264},
-    {PJMEDIA_FORMAT_MPEG1VIDEO,	AV_CODEC_ID_MPEG1VIDEO},
-    {PJMEDIA_FORMAT_MPEG2VIDEO, AV_CODEC_ID_MPEG2VIDEO},
-    {PJMEDIA_FORMAT_MPEG4,	AV_CODEC_ID_MPEG4},
-    {PJMEDIA_FORMAT_MJPEG,	AV_CODEC_ID_MJPEG}
+    {PJMEDIA_FORMAT_H261,	AV(CODEC_ID_H261)},
+    {PJMEDIA_FORMAT_H263,	AV(CODEC_ID_H263)},
+    {PJMEDIA_FORMAT_H263P,	AV(CODEC_ID_H263P)},
+    {PJMEDIA_FORMAT_H264,	AV(CODEC_ID_H264)},
+    {PJMEDIA_FORMAT_MPEG1VIDEO,	AV(CODEC_ID_MPEG1VIDEO)},
+    {PJMEDIA_FORMAT_MPEG2VIDEO, AV(CODEC_ID_MPEG2VIDEO)},
+    {PJMEDIA_FORMAT_MPEG4,	AV(CODEC_ID_MPEG4)},
+    {PJMEDIA_FORMAT_MJPEG,	AV(CODEC_ID_MJPEG)}
 };
 
@@ -132,5 +132,5 @@
     for (i=0; i<PJ_ARRAY_SIZE(ffmpeg_fmt_table); ++i) {
 	const struct ffmpeg_fmt_table_t *t = &ffmpeg_fmt_table[i];
-	if (t->id==fmt_id && t->pf != AV_PIX_FMT_NONE) {
+	if (t->id==fmt_id && t->pf != AV(PIX_FMT_NONE)) {
 	    *pixel_format = t->pf;
 	    return PJ_SUCCESS;
@@ -138,5 +138,5 @@
     }
 
-    *pixel_format = AV_PIX_FMT_NONE;
+    *pixel_format = AV(PIX_FMT_NONE);
     return PJ_ENOTFOUND;
 }
@@ -163,5 +163,5 @@
     for (i=0; i<PJ_ARRAY_SIZE(ffmpeg_codec_table); ++i) {
 	const struct ffmpeg_codec_table_t *t = &ffmpeg_codec_table[i];
-	if (t->id==fmt_id && t->codec_id != AV_PIX_FMT_NONE) {
+	if (t->id==fmt_id && t->codec_id != AV(PIX_FMT_NONE)) {
 	    *codec_id = t->codec_id;
 	    return PJ_SUCCESS;
@@ -169,5 +169,5 @@
     }
 
-    *codec_id = (unsigned)AV_PIX_FMT_NONE;
+    *codec_id = (unsigned)AV(PIX_FMT_NONE);
     return PJ_ENOTFOUND;
 }
Index: /pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.h
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.h	(revision 5270)
+++ /pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.h	(revision 5271)
@@ -38,4 +38,14 @@
 #include <libavcodec/avcodec.h>
 
+
+#ifdef PJMEDIA_USE_OLD_FFMPEG
+#   define AVPixelFormat	PixelFormat
+#   define AV(str)		str
+#   define PIX_FMT_GBRP 	PIX_FMT_GBR24P
+#else
+#   define AV(str)		AV_ ## str
+#endif
+					 
+
 void pjmedia_ffmpeg_add_ref();
 void pjmedia_ffmpeg_dec_ref();
