"type": "GstCompositorBackground",
"writable": true
},
+ "max-threads": {
+ "blurb": "Maximum number of blending/rendering worker threads to spawn (0 = auto)",
+ "conditionally-available": false,
+ "construct": false,
+ "construct-only": false,
+ "controllable": false,
+ "default": "0",
+ "max": "2147483647",
+ "min": "0",
+ "mutable": "ready",
+ "readable": true,
+ "type": "guint",
+ "writable": true
+ },
"zero-size-is-unscaled": {
"blurb": "If TRUE, then input video is unscaled in that dimension if width or height is 0 (for backwards compatibility)",
"conditionally-available": false,
/* GstCompositor */
#define DEFAULT_BACKGROUND COMPOSITOR_BACKGROUND_CHECKER
#define DEFAULT_ZERO_SIZE_IS_UNSCALED TRUE
+#define DEFAULT_MAX_THREADS 0
+
enum
{
PROP_0,
PROP_BACKGROUND,
PROP_ZERO_SIZE_IS_UNSCALED,
+ PROP_MAX_THREADS,
};
static void
case PROP_ZERO_SIZE_IS_UNSCALED:
g_value_set_boolean (value, self->zero_size_is_unscaled);
break;
+ case PROP_MAX_THREADS:
+ g_value_set_uint (value, self->max_threads);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_ZERO_SIZE_IS_UNSCALED:
self->zero_size_is_unscaled = g_value_get_boolean (value);
break;
+ case PROP_MAX_THREADS:
+ self->max_threads = g_value_get_uint (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
return FALSE;
}
- n_threads = g_get_num_processors ();
+ if (compositor->max_threads == 0)
+ n_threads = g_get_num_processors ();
+ else
+ n_threads = compositor->max_threads;
+
/* Magic number of 200 lines */
if (GST_VIDEO_INFO_HEIGHT (&v_info) / n_threads < 200)
n_threads = (GST_VIDEO_INFO_HEIGHT (&v_info) + 199) / 200;
DEFAULT_ZERO_SIZE_IS_UNSCALED,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * compositor:max-threads:
+ *
+ * Maximum number of blending/rendering worker threads to spawn (0 = auto)
+ *
+ * Since: 1.20
+ */
+ g_object_class_install_property (gobject_class, PROP_MAX_THREADS,
+ g_param_spec_uint ("max-threads", "Max Threads",
+ "Maximum number of blending/rendering worker threads to spawn "
+ "(0 = auto)", 0, G_MAXINT, DEFAULT_MAX_THREADS,
+ GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
gst_element_class_add_static_pad_template_with_gtype (gstelement_class,
&src_factory, GST_TYPE_AGGREGATOR_PAD);
gst_element_class_add_static_pad_template_with_gtype (gstelement_class,
/* initialize variables */
self->background = DEFAULT_BACKGROUND;
self->zero_size_is_unscaled = DEFAULT_ZERO_SIZE_IS_UNSCALED;
+ self->max_threads = DEFAULT_MAX_THREADS;
}
/* GstChildProxy implementation */