[FFmpeg-cvslog] r25567 - trunk/libavcodec/libx264.c

Nicolas George nicolas.george
Tue Oct 26 17:11:51 CEST 2010


Le quintidi 5 brumaire, an CCXIX, Reinhard Tartler a ?crit?:
>>> Nicolas, can you add some #ifdefs so that libx264.c can also be compiled
>>> with an older x264?
>> Why not bump the libx264 requirement in configure?
> because there might be folks that prefer to use their 'outdated' system
> ffmpeg that comes with their distribution.

I think I have noticed people around here do not like #ifdefs very much.
Here are three possible fixes, depending on the tastes. Build was tested
with x264 >= 99, but not with < 99. Sorry for the inconvenience.

Regards,

-- 
  Nicolas George


Version 1: bump requirement for x264:


diff --git a/configure b/configure
index abd599e..27f807a 100755
--- a/configure
+++ b/configure
@@ -2770,8 +2770,8 @@ enabled libvpx     && {
     enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
                                 die "ERROR: libvpx encoder version must be >=0.9.1"; } }
 enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 &&
-                      { check_cpp_condition x264.h "X264_BUILD >= 98" ||
-                        die "ERROR: libx264 version must be >= 0.98."; }
+                      { check_cpp_condition x264.h "X264_BUILD >= 99" ||
+                        die "ERROR: libx264 version must be >= 0.99."; }
 enabled libxavs    && require  libxavs xavs.h xavs_encoder_encode -lxavs
 enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
 enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib


Version 2: always use X264_TYPE_I rather than X264_TYPE_KEYFRAME:


diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 6da7f2a..5ce5077 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -101,7 +101,7 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
 
         x4->pic.i_pts  = frame->pts;
         x4->pic.i_type =
-            frame->pict_type == FF_I_TYPE ? X264_TYPE_KEYFRAME :
+            frame->pict_type == FF_I_TYPE ? X264_TYPE_I :
             frame->pict_type == FF_P_TYPE ? X264_TYPE_P :
             frame->pict_type == FF_B_TYPE ? X264_TYPE_B :
                                             X264_TYPE_AUTO;


Version 3: use #ifdefs:


diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 6da7f2a..663226e 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -101,7 +101,12 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
 
         x4->pic.i_pts  = frame->pts;
         x4->pic.i_type =
-            frame->pict_type == FF_I_TYPE ? X264_TYPE_KEYFRAME :
+            frame->pict_type == FF_I_TYPE ?
+#if X264_BUILD < 99
+                                            X264_TYPE_I :
+#else
+                                            X264_TYPE_KEYFRAME :
+#endif
             frame->pict_type == FF_P_TYPE ? X264_TYPE_P :
             frame->pict_type == FF_B_TYPE ? X264_TYPE_B :
                                             X264_TYPE_AUTO;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20101026/3cd58922/attachment.pgp>



More information about the ffmpeg-cvslog mailing list