[gst-cvs] gst-plugins-ugly: x264enc: Fix b-pyramid libx264 API boolean arg for non-boolean issue

Tim Müller tpm at kemper.freedesktop.org
Wed Aug 11 08:52:50 PDT 2010


Module: gst-plugins-ugly
Branch: master
Commit: f45ff93586daef0a39105f8046b8c107623cebd9
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/commit/?id=f45ff93586daef0a39105f8046b8c107623cebd9

Author: Robert Swain <robert.swain at collabora.co.uk>
Date:   Wed Aug 11 09:21:43 2010 +0200

x264enc: Fix b-pyramid libx264 API boolean arg for non-boolean issue

In X264_BUILD >= 78, b-pyramid became a non-boolean so passing a boolean
argument to the option string value causes an error. For < 78 we pass the
boolean value, for >= 78 we use the x264_b_pyramid_names[] array which will
result in passing 'none' for false and 'strict' for true. Other modes can be
set through the option-string property for now.

https://bugzilla.gnome.org/show_bug.cgi?id=626577

---

 ext/x264/gstx264enc.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c
index 70e3981..c5748e6 100644
--- a/ext/x264/gstx264enc.c
+++ b/ext/x264/gstx264enc.c
@@ -87,6 +87,11 @@
 #define X264_MB_RC
 #endif
 
+#if X264_BUILD >= 78
+/* b-pyramid was available before but was changed from boolean here */
+#define X264_B_PYRAMID
+#endif
+
 #if X264_BUILD >= 80
 #define X264_ENH_THREADING
 #endif
@@ -669,8 +674,13 @@ gst_x264_enc_class_init (GstX264EncClass * klass)
       g_param_spec_boolean ("b-pyramid", "B-Pyramid",
           "Keep some B-frames as references", ARG_B_PYRAMID_DEFAULT,
           G_PARAM_READWRITE));
+#ifdef X264_B_PYRAMID
+  g_string_append_printf (x264enc_defaults, ":b-pyramid=%s",
+      x264_b_pyramid_names[ARG_B_PYRAMID_DEFAULT]);
+#else
   g_string_append_printf (x264enc_defaults, ":b-pyramid=%d",
       ARG_B_PYRAMID_DEFAULT);
+#endif /* X264_B_PYRAMID */
   g_object_class_install_property (gobject_class, ARG_WEIGHTB,
       g_param_spec_boolean ("weightb", "Weighted B-Frames",
           "Weighted prediction for B-frames", ARG_WEIGHTB_DEFAULT,
@@ -1788,8 +1798,13 @@ gst_x264_enc_set_property (GObject * object, guint prop_id,
       break;
     case ARG_B_PYRAMID:
       encoder->b_pyramid = g_value_get_boolean (value);
+#ifdef X264_B_PYRAMID
+      g_string_append_printf (encoder->option_string, ":b-pyramid=%s",
+          x264_b_pyramid_names[encoder->b_pyramid]);
+#else
       g_string_append_printf (encoder->option_string, ":b-pyramid=%d",
           encoder->b_pyramid);
+#endif /* X264_B_PYRAMID */
       break;
     case ARG_WEIGHTB:
       encoder->weightb = g_value_get_boolean (value);





More information about the Gstreamer-commits mailing list