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