Index: /pjproject/trunk/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c	(revision 5197)
+++ /pjproject/trunk/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c	(revision 5198)
@@ -195,5 +195,5 @@
      * may be needed for post-decoding.
      */
-    enum PixelFormat		     expected_dec_fmt;
+    enum AVPixelFormat		     expected_dec_fmt;
 						/**< Expected output format of 
 						     ffmpeg decoder	    */
@@ -674,5 +674,5 @@
 	    unsigned raw_fmt_cnt = 0;
 	    unsigned raw_fmt_cnt_should_be = 0;
-	    const enum PixelFormat *p = c->pix_fmts;
+	    const enum AVPixelFormat *p = c->pix_fmts;
 
 	    for(;(p && *p != -1) &&
@@ -1097,5 +1097,5 @@
                                      pj_mutex_t *ff_mutex)
 {
-    enum PixelFormat pix_fmt;
+    enum AVPixelFormat pix_fmt;
     pjmedia_video_format_detail *vfd;
     pj_bool_t enc_opened = PJ_FALSE, dec_opened = PJ_FALSE;
@@ -1430,5 +1430,6 @@
     PJ_ASSERT_RETURN(ff->enc_ctx, PJ_EINVALIDOP);
 
-    avcodec_get_frame_defaults(&avframe);
+    pj_bzero(&avframe, sizeof(avframe));
+    av_frame_unref(&avframe);
 
     // Let ffmpeg manage the timestamps
@@ -1680,5 +1681,6 @@
      * closed).
      */
-    avcodec_get_frame_defaults(&avframe);
+    pj_bzero(&avframe, sizeof(avframe));
+    av_frame_unref(&avframe);
 
     /* Init packet, the container of the encoded data */
Index: /pjproject/trunk/pjmedia/src/pjmedia/converter_libswscale.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/converter_libswscale.c	(revision 5197)
+++ /pjproject/trunk/pjmedia/src/pjmedia/converter_libswscale.c	(revision 5198)
@@ -67,5 +67,5 @@
 					    pjmedia_converter **p_cv)
 {
-    enum PixelFormat srcFormat, dstFormat;
+    enum AVPixelFormat srcFormat, dstFormat;
     const pjmedia_video_format_detail *src_detail, *dst_detail;
     const pjmedia_video_format_info *src_fmt_info, *dst_fmt_info;
Index: /pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.c	(revision 5197)
+++ /pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.c	(revision 5198)
@@ -27,37 +27,24 @@
 #include <libavformat/avformat.h>
 
-/* PIX_FMT_GBR24P hassle:
- * - PIX_FMT_GBR24P is introduced (perhaps in avutil 51.20.1)
- * - suddenly PIX_FMT_GBR24P is replaced by PIX_FMT_GBRP, no alias defined,
- *   so PIX_FMT_GBR24P is just gone! (perhaps in avutil 51.42.0)
- * - then lately PIX_FMT_GBR24P is defined as PIX_FMT_GBRP
- */
-#if !defined(PIX_FMT_GBR24P) && \
-    LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,42,0)
-#  define PIX_FMT_GBR24P PIX_FMT_GBRP
-#endif
-
-/* Conversion table between pjmedia_format_id and PixelFormat */
+/* Conversion table between pjmedia_format_id and AVPixelFormat */
 static const struct ffmpeg_fmt_table_t
 {
     pjmedia_format_id	id;
-    enum PixelFormat	pf;
+    enum AVPixelFormat	pf;
 } ffmpeg_fmt_table[] =
 {
-    { PJMEDIA_FORMAT_RGBA, PIX_FMT_RGBA},
-    { PJMEDIA_FORMAT_RGB24,PIX_FMT_BGR24},
-    { PJMEDIA_FORMAT_BGRA, PIX_FMT_BGRA},
-#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51, 20, 1)
-    { PJMEDIA_FORMAT_GBRP, PIX_FMT_GBR24P},
-#endif
+    { 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, PIX_FMT_NONE},
-    { PJMEDIA_FORMAT_YUY2, PIX_FMT_YUYV422},
-    { PJMEDIA_FORMAT_UYVY, PIX_FMT_UYVY422},
-    { PJMEDIA_FORMAT_I420, PIX_FMT_YUV420P},
-    //{ PJMEDIA_FORMAT_YV12, PIX_FMT_YUV420P},
-    { PJMEDIA_FORMAT_I422, PIX_FMT_YUV422P},
-    { PJMEDIA_FORMAT_I420JPEG, PIX_FMT_YUVJ420P},
-    { PJMEDIA_FORMAT_I422JPEG, 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},
 };
 
@@ -69,12 +56,12 @@
 } ffmpeg_codec_table[] =
 {
-    {PJMEDIA_FORMAT_H261,	CODEC_ID_H261},
-    {PJMEDIA_FORMAT_H263,	CODEC_ID_H263},
-    {PJMEDIA_FORMAT_H263P,	CODEC_ID_H263P},
-    {PJMEDIA_FORMAT_H264,	CODEC_ID_H264},
-    {PJMEDIA_FORMAT_MPEG1VIDEO,	CODEC_ID_MPEG1VIDEO},
-    {PJMEDIA_FORMAT_MPEG2VIDEO, CODEC_ID_MPEG2VIDEO},
-    {PJMEDIA_FORMAT_MPEG4,	CODEC_ID_MPEG4},
-    {PJMEDIA_FORMAT_MJPEG,	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}
 };
 
@@ -140,10 +127,10 @@
 
 pj_status_t pjmedia_format_id_to_PixelFormat(pjmedia_format_id fmt_id,
-					     enum PixelFormat *pixel_format)
+					     enum AVPixelFormat *pixel_format)
 {
     unsigned i;
     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 != PIX_FMT_NONE) {
+	if (t->id==fmt_id && t->pf != AV_PIX_FMT_NONE) {
 	    *pixel_format = t->pf;
 	    return PJ_SUCCESS;
@@ -151,9 +138,9 @@
     }
 
-    *pixel_format = PIX_FMT_NONE;
+    *pixel_format = AV_PIX_FMT_NONE;
     return PJ_ENOTFOUND;
 }
 
-pj_status_t PixelFormat_to_pjmedia_format_id(enum PixelFormat pf,
+pj_status_t PixelFormat_to_pjmedia_format_id(enum AVPixelFormat pf,
 					     pjmedia_format_id *fmt_id)
 {
@@ -176,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 != PIX_FMT_NONE) {
+	if (t->id==fmt_id && t->codec_id != AV_PIX_FMT_NONE) {
 	    *codec_id = t->codec_id;
 	    return PJ_SUCCESS;
@@ -182,5 +169,5 @@
     }
 
-    *codec_id = (unsigned)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 5197)
+++ /pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.h	(revision 5198)
@@ -42,7 +42,7 @@
 
 pj_status_t pjmedia_format_id_to_PixelFormat(pjmedia_format_id fmt_id,
-					     enum PixelFormat *pixel_format);
+					     enum AVPixelFormat *pixel_format);
 
-pj_status_t PixelFormat_to_pjmedia_format_id(enum PixelFormat pf,
+pj_status_t PixelFormat_to_pjmedia_format_id(enum AVPixelFormat pf,
 					     pjmedia_format_id *fmt_id);
 
