From: Sebastian Dröge Date: Tue, 9 Apr 2019 13:56:20 +0000 (+0300) Subject: avcfg: Override type of bitrate property from int64 to int X-Git-Tag: 1.19.3~499^2~112 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=935c21a9a966c1ed5a6c797ec4ab026db952823b;p=platform%2Fupstream%2Fgstreamer.git avcfg: Override type of bitrate property from int64 to int See https://gitlab.freedesktop.org/gstreamer/gst-libav/issues/41#note_142808 The switch to the new ffmpeg property system changed the type of the bitrate property from int to int64, which potentially breaks many existing applications at runtime as properties are usually set via g_object_set(). As such, override the type to int until GStreamer 2.0. --- diff --git a/ext/libav/gstavcfg.c b/ext/libav/gstavcfg.c index 9d34462..1c58dd5 100644 --- a/ext/libav/gstavcfg.c +++ b/ext/libav/gstavcfg.c @@ -298,11 +298,22 @@ install_opts (GObjectClass * gobject_class, const AVClass ** obj, guint prop_id, break; case AV_OPT_TYPE_DURATION: /* Fall through */ case AV_OPT_TYPE_INT64: - /* ffmpeg expresses all ranges with doubles, this is sad */ - pspec = g_param_spec_int64 (name, name, help, - (min == (gdouble) INT64_MIN ? INT64_MIN : (gint64) min), - (max == (gdouble) INT64_MAX ? INT64_MAX : (gint64) max), - opt->default_val.i64, G_PARAM_READWRITE); + /* FIXME 2.0: Workaround for worst property related API change. We + * continue using a 32 bit integer for the bitrate property as + * otherwise too much existing code will fail at runtime. + * + * See https://gitlab.freedesktop.org/gstreamer/gst-libav/issues/41#note_142808 */ + if (g_strcmp0 (name, "bitrate") == 0) { + pspec = g_param_spec_int (name, name, help, + (gint) MAX (min, G_MININT), (gint) MIN (max, G_MAXINT), + (gint) opt->default_val.i64, G_PARAM_READWRITE); + } else { + /* ffmpeg expresses all ranges with doubles, this is sad */ + pspec = g_param_spec_int64 (name, name, help, + (min == (gdouble) INT64_MIN ? INT64_MIN : (gint64) min), + (max == (gdouble) INT64_MAX ? INT64_MAX : (gint64) max), + opt->default_val.i64, G_PARAM_READWRITE); + } g_object_class_install_property (gobject_class, prop_id++, pspec); break; case AV_OPT_TYPE_DOUBLE: