summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2019-04-09 16:56:20 +0300
committerSebastian Dröge <sebastian@centricular.com>2019-04-09 16:56:20 +0300
commit935c21a9a966c1ed5a6c797ec4ab026db952823b (patch)
tree10b464ea3e0f51a89231bdc787c6b5f47615d272
parentb2cc8a57d4b1f9d7d399606d194a55583b3639df (diff)
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.
-rw-r--r--ext/libav/gstavcfg.c21
1 files changed, 16 insertions, 5 deletions
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: