1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719
|
/* GStreamer Editing Services
* Copyright (C) 2010 Brandon Lewis <brandon.lewis@collabora.co.uk>
* 2010 Nokia Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/**
* SECTION:gesvideotransition
* @title: GESVideoTransition
* @short_description: implements video crossfade transition
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <ges/ges.h>
#include "ges-internal.h"
#include "ges-smart-video-mixer.h"
#include <gst/controller/gstdirectcontrolbinding.h>
#define parent_class ges_video_transition_parent_class
static inline void
ges_video_transition_set_border_internal (GESVideoTransition * self,
guint border);
static inline void
ges_video_transition_set_inverted_internal (GESVideoTransition *
self, gboolean inverted);
static inline gboolean
ges_video_transition_set_transition_type_internal (GESVideoTransition
* self, GESVideoStandardTransitionType type);
struct _GESVideoTransitionPrivate
{
GESVideoStandardTransitionType type;
/* prevents cases where the transitions have not been created yet */
GESVideoStandardTransitionType pending_type;
/* these enable video interpolation */
GstTimedValueControlSource *fade_in_control_source;
GstTimedValueControlSource *fade_out_control_source;
GstTimedValueControlSource *smpte_control_source;
/* so we can support changing between wipes */
GstElement *smpte;
GstPad *mixer_sink;
GstElement *mixer;
GstPad *mixer_sinka;
GstPad *mixer_sinkb;
GstPad *mixer_ghosta;
GstPad *mixer_ghostb;
/* This is in case the smpte doesn't exist yet */
gint pending_border_value;
gboolean pending_inverted;
GstElement *positioner;
};
enum
{
PROP_0,
PROP_BORDER,
PROP_TRANSITION_TYPE,
PROP_INVERT,
PROP_LAST
};
static GParamSpec *properties[PROP_LAST];
G_DEFINE_TYPE_WITH_PRIVATE (GESVideoTransition, ges_video_transition,
GES_TYPE_TRANSITION);
#define fast_element_link(a,b) gst_element_link_pads_full((a),"src",(b),"sink",GST_PAD_LINK_CHECK_NOTHING)
static GObject *link_element_to_mixer_with_smpte (GstBin * bin,
GstElement * element, GstElement * mixer, gint type,
GstElement ** smpteref, GESVideoTransitionPrivate * priv, GstPad ** ghost);
static void
ges_video_transition_duration_changed (GESTrackElement * self,
guint64 duration);
static GstElement *ges_video_transition_create_element (GESTrackElement * self);
static void ges_video_transition_dispose (GObject * object);
static void ges_video_transition_finalize (GObject * object);
static void ges_video_transition_get_property (GObject * object, guint
property_id, GValue * value, GParamSpec * pspec);
static void ges_video_transition_set_property (GObject * object, guint
property_id, const GValue * value, GParamSpec * pspec);
static void
duration_changed_cb (GESTrackElement * self, GParamSpec * arg G_GNUC_UNUSED)
{
ges_video_transition_duration_changed (self,
ges_timeline_element_get_duration (GES_TIMELINE_ELEMENT (self)));
}
static gboolean
_set_priority (GESTimelineElement * element, guint32 priority)
{
gboolean res;
GESVideoTransition *self = GES_VIDEO_TRANSITION (element);
res = GES_TIMELINE_ELEMENT_CLASS (parent_class)->set_priority (element,
priority);
if (res && self->priv->positioner)
g_object_set (self->priv->positioner, "zorder", G_MAXUINT - priority, NULL);
return res;
}
static void
ges_video_transition_class_init (GESVideoTransitionClass * klass)
{
GObjectClass *object_class;
GESTrackElementClass *toclass;
GESTimelineElementClass *element_class = GES_TIMELINE_ELEMENT_CLASS (klass);
GESTrackElementClass *track_element_class = GES_TRACK_ELEMENT_CLASS (klass);
object_class = G_OBJECT_CLASS (klass);
object_class->get_property = ges_video_transition_get_property;
object_class->set_property = ges_video_transition_set_property;
object_class->dispose = ges_video_transition_dispose;
object_class->finalize = ges_video_transition_finalize;
track_element_class->ABI.abi.default_track_type = GES_TRACK_TYPE_VIDEO;
/**
* GESVideoTransition:border:
*
* This value represents the border width of the transition.
*
*/
properties[PROP_BORDER] =
g_param_spec_uint ("border", "Border", "The border width", 0,
G_MAXUINT, 0, G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_BORDER,
properties[PROP_BORDER]);
/**
* GESVideoTransition:type:
*
* The #GESVideoStandardTransitionType currently applied on the object
*
* Deprecated:1.20: Use ges_timeline_element_[sg]et_child_property instead.
*/
properties[PROP_TRANSITION_TYPE] =
g_param_spec_enum ("transition-type", "Transition type",
"The type of the transition", GES_VIDEO_STANDARD_TRANSITION_TYPE_TYPE,
GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE, G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_TRANSITION_TYPE,
properties[PROP_TRANSITION_TYPE]);
/**
* GESVideoTransition:invert:
*
* This value represents the direction of the transition.
*
* Deprecated:1.20: Use ges_timeline_element_[sg]et_child_property instead.
*/
properties[PROP_INVERT] =
g_param_spec_boolean ("invert", "Invert",
"Whether the transition is inverted", FALSE, G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_INVERT,
properties[PROP_INVERT]);
toclass = GES_TRACK_ELEMENT_CLASS (klass);
toclass->create_element = ges_video_transition_create_element;
element_class->set_priority = _set_priority;
}
static void
ges_video_transition_init (GESVideoTransition * self)
{
self->priv = ges_video_transition_get_instance_private (self);
self->priv->fade_in_control_source = NULL;
self->priv->fade_out_control_source = NULL;
self->priv->smpte_control_source = NULL;
self->priv->smpte = NULL;
self->priv->mixer_sink = NULL;
self->priv->mixer = NULL;
self->priv->mixer_sinka = NULL;
self->priv->mixer_sinkb = NULL;
self->priv->pending_type = GES_VIDEO_STANDARD_TRANSITION_TYPE_NONE;
self->priv->pending_border_value = 0;
self->priv->pending_inverted = TRUE;
}
static void
ges_video_transition_release_mixer (GESVideoTransition * self)
{
GESVideoTransitionPrivate *priv = self->priv;
if (priv->mixer_ghosta && priv->mixer_ghostb) {
gst_element_release_request_pad (priv->mixer, priv->mixer_ghosta);
gst_element_release_request_pad (priv->mixer, priv->mixer_ghostb);
gst_clear_object (&priv->mixer_ghosta);
gst_clear_object (&priv->mixer_ghostb);
}
gst_clear_object (&priv->mixer_sinka);
gst_clear_object (&priv->mixer_sinkb);
gst_clear_object (&priv->mixer);
}
static void
ges_video_transition_dispose (GObject * object)
{
GESVideoTransition *self = GES_VIDEO_TRANSITION (object);
GESVideoTransitionPrivate *priv = self->priv;
GST_DEBUG ("disposing");
if (priv->fade_in_control_source) {
gst_object_unref (priv->fade_in_control_source);
priv->fade_in_control_source = NULL;
}
if (priv->fade_out_control_source) {
gst_object_unref (priv->fade_out_control_source);
priv->fade_out_control_source = NULL;
}
if (priv->smpte_control_source) {
gst_object_unref (priv->smpte_control_source);
priv->smpte_control_source = NULL;
}
ges_video_transition_release_mixer (self);
g_signal_handlers_disconnect_by_func (GES_TRACK_ELEMENT (self),
duration_changed_cb, NULL);
G_OBJECT_CLASS (ges_video_transition_parent_class)->dispose (object);
}
static void
ges_video_transition_finalize (GObject * object)
{
G_OBJECT_CLASS (ges_video_transition_parent_class)->finalize (object);
}
static void
ges_video_transition_get_property (GObject * object,
guint property_id, GValue * value, GParamSpec * pspec)
{
GESVideoTransition *tr = GES_VIDEO_TRANSITION (object);
switch (property_id) {
case PROP_BORDER:
g_value_set_uint (value, ges_video_transition_get_border (tr));
break;
case PROP_TRANSITION_TYPE:
g_value_set_enum (value, ges_video_transition_get_transition_type (tr));
break;
case PROP_INVERT:
g_value_set_boolean (value, ges_video_transition_is_inverted (tr));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
ges_video_transition_set_property (GObject * object,
guint property_id, const GValue * value, GParamSpec * pspec)
{
GESVideoTransition *tr = GES_VIDEO_TRANSITION (object);
switch (property_id) {
case PROP_BORDER:
ges_video_transition_set_border_internal (tr, g_value_get_uint (value));
break;
case PROP_TRANSITION_TYPE:
ges_video_transition_set_transition_type_internal (tr,
g_value_get_enum (value));
break;
case PROP_INVERT:
ges_video_transition_set_inverted_internal (tr,
g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static GstTimedValueControlSource *
set_interpolation (GstObject * element, GESVideoTransitionPrivate * priv,
const gchar * propname)
{
GstControlSource *control_source;
g_object_set (element, propname, (gfloat) 0.0, NULL);
control_source = gst_interpolation_control_source_new ();
gst_object_add_control_binding (GST_OBJECT (element),
gst_direct_control_binding_new (GST_OBJECT (element), propname,
control_source));
g_object_set (control_source, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
return GST_TIMED_VALUE_CONTROL_SOURCE (control_source);
}
static GstElement *
ges_video_transition_create_element (GESTrackElement * object)
{
GstElement *topbin, *iconva, *iconvb;
GstElement *mixer = NULL;
GstPad *sinka_target, *sinkb_target, *src_target, *sinka, *sinkb, *src;
GESVideoTransition *self;
GESVideoTransitionPrivate *priv;
const gchar *smpte_properties[] = { "invert", "border", NULL };
gboolean is_fade;
self = GES_VIDEO_TRANSITION (object);
priv = self->priv;
is_fade = (priv->type == GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE ||
priv->type == GES_VIDEO_STANDARD_TRANSITION_TYPE_FADE_IN);
GST_LOG ("creating a video bin");
topbin = gst_bin_new ("transition-bin");
iconva = gst_element_factory_make ("videoconvert", "tr-csp-a");
iconvb = gst_element_factory_make ("videoconvert", "tr-csp-b");
priv->positioner =
gst_element_factory_make ("framepositioner", "frame_tagger");
g_object_set (priv->positioner, "zorder",
G_MAXUINT - GES_TIMELINE_ELEMENT_PRIORITY (self), NULL);
gst_bin_add_many (GST_BIN (topbin), iconva, iconvb, priv->positioner, NULL);
mixer =
g_object_new (GES_TYPE_SMART_MIXER, "name",
GES_TIMELINE_ELEMENT_NAME (object), NULL);
GES_SMART_MIXER (mixer)->is_transition = TRUE;
gst_util_set_object_arg (G_OBJECT (GES_SMART_MIXER (mixer)->mixer),
"background", "transparent");
gst_bin_add (GST_BIN (topbin), mixer);
priv->mixer_sinka =
(GstPad *) link_element_to_mixer_with_smpte (GST_BIN (topbin), iconva,
mixer, GES_VIDEO_STANDARD_TRANSITION_TYPE_BAR_WIPE_LR, NULL, priv,
&priv->mixer_ghosta);
priv->mixer_sinkb =
(GstPad *) link_element_to_mixer_with_smpte (GST_BIN (topbin), iconvb,
mixer, GES_VIDEO_STANDARD_TRANSITION_TYPE_BAR_WIPE_LR, &priv->smpte,
priv, &priv->mixer_ghostb);
g_object_set (priv->mixer_sinka, "zorder", 0, NULL);
g_object_set (priv->mixer_sinkb, "zorder", 1, NULL);
gst_util_set_object_arg (G_OBJECT (priv->mixer_sinka), "operator",
is_fade ? "source" : "over");
gst_util_set_object_arg (G_OBJECT (priv->mixer_sinkb), "operator",
is_fade ? "add" : "over");
fast_element_link (mixer, priv->positioner);
sinka_target = gst_element_get_static_pad (iconva, "sink");
sinkb_target = gst_element_get_static_pad (iconvb, "sink");
src_target = gst_element_get_static_pad (priv->positioner, "src");
sinka = gst_ghost_pad_new ("sinka", sinka_target);
sinkb = gst_ghost_pad_new ("sinkb", sinkb_target);
src = gst_ghost_pad_new ("src", src_target);
gst_element_add_pad (topbin, src);
gst_element_add_pad (topbin, sinka);
gst_element_add_pad (topbin, sinkb);
gst_object_unref (sinka_target);
gst_object_unref (sinkb_target);
gst_object_unref (src_target);
/* set up interpolation */
priv->fade_out_control_source =
set_interpolation (GST_OBJECT (priv->mixer_ghosta), priv, "alpha");
priv->fade_in_control_source =
set_interpolation (GST_OBJECT (priv->mixer_ghostb), priv, "alpha");
priv->smpte_control_source =
set_interpolation (GST_OBJECT (priv->smpte), priv, "position");
priv->mixer = gst_object_ref (mixer);
if (priv->pending_type)
ges_video_transition_set_transition_type_internal (self,
priv->pending_type);
else
ges_video_transition_set_transition_type_internal (self, priv->type);
ges_video_transition_duration_changed (object,
ges_timeline_element_get_duration (GES_TIMELINE_ELEMENT (object)));
g_signal_connect (object, "notify::duration",
G_CALLBACK (duration_changed_cb), NULL);
priv->pending_type = GES_VIDEO_STANDARD_TRANSITION_TYPE_NONE;
ges_track_element_add_children_props (GES_TRACK_ELEMENT (self),
priv->smpte, NULL, NULL, smpte_properties);
return topbin;
}
static GObject *
link_element_to_mixer_with_smpte (GstBin * bin, GstElement * element,
GstElement * mixer, gint type, GstElement ** smpteref,
GESVideoTransitionPrivate * priv, GstPad ** ghost)
{
GstPad *srcpad, *mixerpad;
GstElement *smptealpha = gst_element_factory_make ("smptealpha", NULL);
g_object_set (G_OBJECT (smptealpha),
"type", (gint) type, "invert", (gboolean) priv->pending_inverted,
"border", priv->pending_border_value, NULL);
gst_bin_add (bin, smptealpha);
fast_element_link (element, smptealpha);
/* crack */
if (smpteref) {
*smpteref = smptealpha;
}
srcpad = gst_element_get_static_pad (smptealpha, "src");
*ghost = ges_smart_mixer_get_mixer_pad (GES_SMART_MIXER (mixer), &mixerpad);
gst_pad_link_full (srcpad, *ghost, GST_PAD_LINK_CHECK_NOTHING);
gst_object_unref (srcpad);
return G_OBJECT (mixerpad);
}
static void
ges_video_transition_update_control_source (GstTimedValueControlSource * ts,
guint64 duration, gdouble start_value, gdouble end_value)
{
gst_timed_value_control_source_unset_all (ts);
gst_timed_value_control_source_set (ts, 0, start_value);
gst_timed_value_control_source_set (ts, duration, end_value);
}
static void
ges_video_transition_update_control_sources (GESVideoTransition * self,
GESVideoStandardTransitionType type)
{
GESVideoTransitionPrivate *priv = self->priv;
guint64 duration =
ges_timeline_element_get_duration (GES_TIMELINE_ELEMENT (self));
GST_LOG ("updating controller");
if (type == GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE) {
ges_video_transition_update_control_source
(priv->fade_in_control_source, duration, 0.0, 1.0);
ges_video_transition_update_control_source
(priv->fade_out_control_source, duration, 1.0, 0.0);
ges_video_transition_update_control_source (priv->smpte_control_source,
duration, 0.0, 0.0);
} else if (type == GES_VIDEO_STANDARD_TRANSITION_TYPE_FADE_IN) {
ges_video_transition_update_control_source
(priv->fade_in_control_source, duration, 0.0, 1.0);
ges_video_transition_update_control_source
(priv->fade_out_control_source, duration, 1.0, 1.0);
ges_video_transition_update_control_source (priv->smpte_control_source,
duration, 0.0, 0.0);
} else {
ges_video_transition_update_control_source
(priv->fade_in_control_source, duration, 1.0, 1.0);
ges_video_transition_update_control_source
(priv->fade_out_control_source, duration, 1.0, 1.0);
ges_video_transition_update_control_source (priv->smpte_control_source,
duration, 1.0, 0.0);
}
GST_LOG ("done updating controller");
}
static void
ges_video_transition_duration_changed (GESTrackElement * object,
guint64 duration)
{
GESVideoTransition *self = GES_VIDEO_TRANSITION (object);
ges_video_transition_update_control_sources (self, self->priv->type);
}
static inline void
ges_video_transition_set_border_internal (GESVideoTransition * self,
guint value)
{
GESVideoTransitionPrivate *priv = self->priv;
if (!priv->smpte) {
priv->pending_border_value = value;
return;
}
g_object_set (priv->smpte, "border", value, NULL);
}
static inline void
ges_video_transition_set_inverted_internal (GESVideoTransition *
self, gboolean inverted)
{
GESVideoTransitionPrivate *priv = self->priv;
if (!priv->smpte) {
priv->pending_inverted = !inverted;
return;
}
g_object_set (priv->smpte, "invert", !inverted, NULL);
}
static inline gboolean
ges_video_transition_set_transition_type_internal (GESVideoTransition
* self, GESVideoStandardTransitionType type)
{
GESVideoTransitionPrivate *priv = self->priv;
gboolean is_fade;
GST_DEBUG ("%p %d => %d", self, priv->type, type);
if (!priv->mixer) {
priv->pending_type = type;
return TRUE;
}
if (type == priv->type) {
GST_DEBUG ("%d type is already set on this transition\n", type);
return TRUE;
}
ges_video_transition_update_control_sources (self, type);
priv->type = type;
is_fade = (type == GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE ||
type == GES_VIDEO_STANDARD_TRANSITION_TYPE_FADE_IN);
if (!is_fade) {
g_object_set (priv->smpte, "type", (gint) type, NULL);
}
gst_util_set_object_arg (G_OBJECT (priv->mixer_sinka), "operator",
is_fade ? "source" : "over");
gst_util_set_object_arg (G_OBJECT (priv->mixer_sinkb), "operator",
is_fade ? "add" : "over");
return TRUE;
}
/**
* ges_video_transition_set_border:
* @self: The #GESVideoTransition to set the border to
* @value: The value of the border to set on @object
*
* Set the border property of @self, this value represents
* the border width of the transition. In case this value does
* not make sense for the current transition type, it is cached
* for later use.
*
* Deprecated:1.20: Use ges_timeline_element_set_child_property instead.
*/
void
ges_video_transition_set_border (GESVideoTransition * self, guint value)
{
ges_video_transition_set_border_internal (self, value);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_BORDER]);
}
/**
* ges_video_transition_get_border:
* @self: The #GESVideoTransition to get the border from
*
* Get the border property of @self, this value represents
* the border width of the transition.
*
* Returns: The border values of @self or -1 if not meaningful
* (this will happen when not using a smpte transition).
*
* Deprecated:1.20: Use ges_timeline_element_get_child_property instead.
*/
gint
ges_video_transition_get_border (GESVideoTransition * self)
{
gint value;
if (!self->priv->smpte) {
return -1;
}
g_object_get (self->priv->smpte, "border", &value, NULL);
return value;
}
/**
* ges_video_transition_set_inverted:
* @self: The #GESVideoTransition to set invert on
* @inverted: %TRUE if the transition should be inverted %FALSE otherwise
*
* Set the invert property of @self, this value represents
* the direction of the transition. In case this value does
* not make sense for the current transition type, it is cached
* for later use.
*
* Deprecated:1.20: Use ges_timeline_element_set_child_property instead.
*/
void
ges_video_transition_set_inverted (GESVideoTransition * self, gboolean inverted)
{
ges_video_transition_set_inverted_internal (self, inverted);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_INVERT]);
}
/**
* ges_video_transition_is_inverted:
* @self: The #GESVideoTransition to get the inversion from
*
* Get the invert property of @self, this value represents
* the direction of the transition.
*
* Returns: The invert value of @self
*
* Deprecated:1.20: Use ges_timeline_element_get_child_property instead.
*/
gboolean
ges_video_transition_is_inverted (GESVideoTransition * self)
{
gboolean inverted;
if (!self->priv->smpte) {
return FALSE;
}
g_object_get (self->priv->smpte, "invert", &inverted, NULL);
return !inverted;
}
/**
* ges_video_transition_set_transition_type:
* @self: a #GESVideoTransition
* @type: a #GESVideoStandardTransitionType
*
* Sets the transition being used to @type.
*
* Returns: %TRUE if the transition type was properly changed, else %FALSE.
*/
gboolean
ges_video_transition_set_transition_type (GESVideoTransition * self,
GESVideoStandardTransitionType type)
{
gboolean ret = ges_video_transition_set_transition_type_internal (self, type);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TRANSITION_TYPE]);
return ret;
}
/**
* ges_video_transition_get_transition_type:
* @trans: a #GESVideoTransition
*
* Get the transition type used by @trans.
*
* Returns: The transition type used by @trans.
*/
GESVideoStandardTransitionType
ges_video_transition_get_transition_type (GESVideoTransition * trans)
{
if (trans->priv->pending_type)
return trans->priv->pending_type;
return trans->priv->type;
}
/* ges_video_transition_new:
*
* Creates a new #GESVideoTransition.
*
* Returns: (transfer floating) (nullable): The newly created
* #GESVideoTransition, or %NULL if there was an error.
*/
GESVideoTransition *
ges_video_transition_new (void)
{
GESVideoTransition *res;
GESAsset *asset = ges_asset_request (GES_TYPE_VIDEO_TRANSITION, NULL, NULL);
res = GES_VIDEO_TRANSITION (ges_asset_extract (asset, NULL));
gst_object_unref (asset);
return res;
}
|