#define DEFAULT_PROP_DEPTH 16
#define DEFAULT_PROP_FPS 0.
#define DEFAULT_PROP_DURATION GST_SECOND
+#define DEFAULT_PROP_INVERT FALSE
enum
{
PROP_DEPTH,
PROP_FPS,
PROP_DURATION,
+ PROP_INVERT,
PROP_LAST,
};
g_param_spec_uint64 ("duration", "Duration",
"Duration of the transition effect in nanoseconds", 0, G_MAXUINT64,
DEFAULT_PROP_DURATION, G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_INVERT,
+ g_param_spec_boolean ("invert", "Invert",
+ "Invert transition mask", DEFAULT_PROP_INVERT, G_PARAM_READWRITE));
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_smpte_change_state);
}
}
static gboolean
-gst_smpte_update_mask (GstSMPTE * smpte, gint type, gint depth, gint width,
- gint height)
+gst_smpte_update_mask (GstSMPTE * smpte, gint type, gboolean invert,
+ gint depth, gint width, gint height)
{
GstMask *newmask;
if (smpte->mask) {
if (smpte->type == type &&
+ smpte->invert == invert &&
smpte->depth == depth &&
smpte->width == width && smpte->height == height)
return TRUE;
}
- newmask = gst_mask_factory_new (type, depth, width, height);
+ newmask = gst_mask_factory_new (type, invert, depth, width, height);
if (newmask) {
if (smpte->mask) {
gst_mask_destroy (smpte->mask);
}
smpte->mask = newmask;
smpte->type = type;
+ smpte->invert = invert;
smpte->depth = depth;
smpte->width = width;
smpte->height = height;
GST_DEBUG_OBJECT (smpte, "duration: %d frames", smpte->end_position);
- ret = gst_smpte_update_mask (smpte, smpte->type, smpte->depth, smpte->width,
- smpte->height);
+ ret =
+ gst_smpte_update_mask (smpte, smpte->type, smpte->invert, smpte->depth,
+ smpte->width, smpte->height);
return ret;
}
smpte->border = DEFAULT_PROP_BORDER;
smpte->depth = DEFAULT_PROP_DEPTH;
smpte->duration = DEFAULT_PROP_DURATION;
+ smpte->invert = DEFAULT_PROP_INVERT;
smpte->fps_num = 0;
smpte->fps_denom = 1;
}
case PROP_DURATION:
smpte->duration = g_value_get_uint64 (value);
break;
+ case PROP_INVERT:
+ smpte->invert = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_DURATION:
g_value_set_uint64 (value, smpte->duration);
break;
+ case PROP_INVERT:
+ g_value_set_boolean (value, smpte->invert);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
#define DEFAULT_PROP_BORDER 0
#define DEFAULT_PROP_DEPTH 16
#define DEFAULT_PROP_POSITION 0.0
+#define DEFAULT_PROP_INVERT FALSE
enum
{
PROP_BORDER,
PROP_DEPTH,
PROP_POSITION,
+ PROP_INVERT,
PROP_LAST,
};
g_param_spec_double ("position", "Position",
"Position of the transition effect", 0.0, 1.0, DEFAULT_PROP_POSITION,
GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_INVERT,
+ g_param_spec_boolean ("invert", "Invert",
+ "Invert transition mask", DEFAULT_PROP_POSITION,
+ GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_smpte_alpha_setcaps);
trans_class->get_unit_size =
}
static gboolean
-gst_smpte_alpha_update_mask (GstSMPTEAlpha * smpte, gint type, gint depth,
- gint width, gint height)
+gst_smpte_alpha_update_mask (GstSMPTEAlpha * smpte, gint type,
+ gboolean invert, gint depth, gint width, gint height)
{
GstMask *newmask;
* correct */
if (smpte->mask) {
if (smpte->type == type &&
+ smpte->invert == invert &&
smpte->depth == depth &&
smpte->width == width && smpte->height == height)
return TRUE;
}
smpte->type = type;
+ smpte->invert = invert;
smpte->depth = depth;
smpte->width = width;
smpte->height = height;
return TRUE;
}
- newmask = gst_mask_factory_new (type, depth, width, height);
+ newmask = gst_mask_factory_new (type, invert, depth, width, height);
if (!newmask)
goto mask_failed;
/* try to update the mask now, this will also adjust the width/height on
* success */
GST_OBJECT_LOCK (smpte);
- ret = gst_smpte_alpha_update_mask (smpte, smpte->type, smpte->depth,
- width, height);
+ ret =
+ gst_smpte_alpha_update_mask (smpte, smpte->type, smpte->invert,
+ smpte->depth, width, height);
GST_OBJECT_UNLOCK (smpte);
if (!ret)
goto mask_failed;
smpte->border = DEFAULT_PROP_BORDER;
smpte->depth = DEFAULT_PROP_DEPTH;
smpte->position = DEFAULT_PROP_POSITION;
+ smpte->invert = DEFAULT_PROP_INVERT;
}
static void
* have to wait for the transform lock */
GST_OBJECT_LOCK (smpte);
GST_OBJECT_UNLOCK (smpte);
- gst_smpte_alpha_update_mask (smpte, type,
+ gst_smpte_alpha_update_mask (smpte, type, smpte->invert,
smpte->depth, smpte->width, smpte->height);
GST_BASE_TRANSFORM_UNLOCK (smpte);
break;
* have to wait for the transform lock */
GST_OBJECT_LOCK (smpte);
GST_OBJECT_UNLOCK (smpte);
- gst_smpte_alpha_update_mask (smpte, smpte->type,
+ gst_smpte_alpha_update_mask (smpte, smpte->type, smpte->invert,
depth, smpte->width, smpte->height);
GST_BASE_TRANSFORM_UNLOCK (smpte);
break;
smpte->position = g_value_get_double (value);
GST_OBJECT_UNLOCK (smpte);
break;
+ case PROP_INVERT:{
+ gboolean invert;
+
+ invert = g_value_get_boolean (value);
+ GST_BASE_TRANSFORM_LOCK (smpte);
+ /* also lock with the object lock so that reading the property doesn't
+ * have to wait for the transform lock */
+ GST_OBJECT_LOCK (smpte);
+ GST_OBJECT_UNLOCK (smpte);
+ gst_smpte_alpha_update_mask (smpte, smpte->type, invert,
+ smpte->depth, smpte->width, smpte->height);
+ GST_BASE_TRANSFORM_UNLOCK (smpte);
+ break;
+ }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
g_value_set_double (value, smpte->position);
GST_OBJECT_UNLOCK (smpte);
break;
+ case PROP_INVERT:
+ GST_OBJECT_LOCK (smpte);
+ g_value_set_boolean (value, smpte->invert);
+ GST_OBJECT_UNLOCK (smpte);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;