mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
videoaggregator: Move needs_alpha pad field to the private struct
And also trigger renegotiation if the value has changed. https://bugzilla.gnome.org/show_bug.cgi?id=795836
This commit is contained in:
parent
83192bce84
commit
0680c3e47d
3 changed files with 36 additions and 6 deletions
|
@ -72,6 +72,10 @@ struct _GstVideoAggregatorPadPrivate
|
|||
guint zorder;
|
||||
gboolean repeat_after_eos;
|
||||
|
||||
/* Subclasses can force an alpha channel in the (input thus output)
|
||||
* colorspace format */
|
||||
gboolean needs_alpha;
|
||||
|
||||
/* Converter, if NULL no conversion is done */
|
||||
GstVideoConverter *convert;
|
||||
|
||||
|
@ -435,6 +439,32 @@ gst_video_aggregator_pad_get_prepared_frame (GstVideoAggregatorPad * pad)
|
|||
return pad->priv->prepared_frame.buffer ? &pad->priv->prepared_frame : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_video_aggregator_pad_set_needs_alpha:
|
||||
* @pad: a #GstVideoAggregatorPad
|
||||
* @needs_alpha: %TRUE if this pad requires alpha output
|
||||
*
|
||||
* Allows selecting that this pad requires an output format with alpha
|
||||
*
|
||||
* Returns: (transfer none): The currently prepared video frame
|
||||
*/
|
||||
void
|
||||
gst_video_aggregator_pad_set_needs_alpha (GstVideoAggregatorPad * pad,
|
||||
gboolean needs_alpha)
|
||||
{
|
||||
g_return_if_fail (GST_IS_VIDEO_AGGREGATOR_PAD (pad));
|
||||
|
||||
if (needs_alpha != pad->priv->needs_alpha) {
|
||||
GstAggregator *agg =
|
||||
GST_AGGREGATOR (gst_object_get_parent (GST_OBJECT (pad)));
|
||||
pad->priv->needs_alpha = needs_alpha;
|
||||
if (agg) {
|
||||
gst_pad_mark_reconfigure (GST_AGGREGATOR_SRC_PAD (agg));
|
||||
gst_object_unref (agg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************
|
||||
* GstVideoAggregator implementation *
|
||||
**************************************/
|
||||
|
@ -562,7 +592,7 @@ gst_video_aggregator_find_best_format (GstVideoAggregator * vagg,
|
|||
GINT_TO_POINTER (format_number));
|
||||
|
||||
/* If that pad is the first with alpha, set it as the new best format */
|
||||
if (!need_alpha && (pad->needs_alpha
|
||||
if (!need_alpha && (pad->priv->needs_alpha
|
||||
&& (!GST_VIDEO_FORMAT_INFO_HAS_ALPHA (pad->info.finfo)))) {
|
||||
need_alpha = TRUE;
|
||||
/* Just fallback to ARGB in case we require alpha but the input pad
|
||||
|
|
|
@ -71,10 +71,6 @@ struct _GstVideoAggregatorPad
|
|||
/* read-only, with OBJECT_LOCK */
|
||||
GstVideoInfo info;
|
||||
|
||||
/* Subclasses can force an alpha channel in the (input thus output)
|
||||
* colorspace format */
|
||||
gboolean needs_alpha;
|
||||
|
||||
/* < private > */
|
||||
GstVideoAggregatorPadPrivate *priv;
|
||||
|
||||
|
@ -122,6 +118,9 @@ GstBuffer * gst_video_aggregator_pad_get_current_buffer (GstVideoAggregatorPad *
|
|||
GST_VIDEO_BAD_API
|
||||
GstVideoFrame * gst_video_aggregator_pad_get_prepared_frame (GstVideoAggregatorPad *pad);
|
||||
|
||||
GST_VIDEO_BAD_API
|
||||
void gst_video_aggregator_pad_set_needs_alpha (GstVideoAggregatorPad *pad, gboolean needs_alpha);
|
||||
|
||||
#define GST_TYPE_VIDEO_AGGREGATOR (gst_video_aggregator_get_type())
|
||||
#define GST_VIDEO_AGGREGATOR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_AGGREGATOR, GstVideoAggregator))
|
||||
|
|
|
@ -198,7 +198,8 @@ gst_compositor_pad_set_property (GObject * object, guint prop_id,
|
|||
break;
|
||||
case PROP_PAD_CROSSFADE_RATIO:
|
||||
pad->crossfade = g_value_get_double (value);
|
||||
GST_VIDEO_AGGREGATOR_PAD (pad)->needs_alpha = pad->crossfade >= 0.0f;
|
||||
gst_video_aggregator_pad_set_needs_alpha (GST_VIDEO_AGGREGATOR_PAD (pad),
|
||||
pad->crossfade >= 0.0f);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
|
Loading…
Reference in a new issue