/**
 * ges_timeline_text_overlay_set_font_desc:
 * @self: the #GESTimelineTextOverlay*
 * @font_desc: the pango font description
 *
 * Sets the pango font description of the text
 *
 */
void
ges_timeline_text_overlay_set_font_desc (GESTimelineTextOverlay * self,
    const gchar * font_desc)
{
  GList *tmp, *trackobjects;
  GESTimelineObject *object = (GESTimelineObject *) self;

  GST_DEBUG ("self:%p, font_desc:%s", self, font_desc);

  if (self->priv->font_desc)
    g_free (self->priv->font_desc);

  self->priv->font_desc = g_strdup (font_desc);

  trackobjects = ges_timeline_object_get_track_objects (object);
  for (tmp = trackobjects; tmp; tmp = tmp->next) {
    GESTrackObject *trackobject = (GESTrackObject *) tmp->data;

    if (ges_track_object_get_track (trackobject)->type == GES_TRACK_TYPE_VIDEO)
      ges_track_text_overlay_set_font_desc (GES_TRACK_TEXT_OVERLAY
          (trackobject), self->priv->font_desc);

    g_object_unref (GES_TRACK_OBJECT (tmp->data));
  }
  g_list_free (trackobjects);

}
static void
ges_track_object_set_property (GObject * object, guint property_id,
    const GValue * value, GParamSpec * pspec)
{
  GESTrackObject *tobj = GES_TRACK_OBJECT (object);

  switch (property_id) {
    case PROP_START:
      ges_track_object_set_start_internal (tobj, g_value_get_uint64 (value));
      break;
    case PROP_INPOINT:
      ges_track_object_set_inpoint_internal (tobj, g_value_get_uint64 (value));
      break;
    case PROP_DURATION:
      ges_track_object_set_duration_internal (tobj, g_value_get_uint64 (value));
      break;
    case PROP_PRIORITY:
      ges_track_object_set_priority_internal (tobj, g_value_get_uint (value));
      break;
    case PROP_ACTIVE:
      ges_track_object_set_active (tobj, g_value_get_boolean (value));
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
  }
}
static void
ges_track_object_dispose (GObject * object)
{
  GESTrackObjectPrivate *priv = GES_TRACK_OBJECT (object)->priv;

  if (priv->properties_hashtable)
    g_hash_table_destroy (priv->properties_hashtable);

  if (priv->gnlobject) {
    GstState cstate;

    if (priv->track != NULL) {
      GST_ERROR_OBJECT (object, "Still in %p, this means that you forgot"
          " to remove it from the GESTrack it is contained in. You always need"
          " to remove a GESTrackObject from its track before dropping the last"
          " reference\n"
          "This problem may also be caused by a refcounting bug in"
          " the application or GES itself.", priv->track);
      gst_element_get_state (priv->gnlobject, &cstate, NULL, 0);
      if (cstate != GST_STATE_NULL)
        gst_element_set_state (priv->gnlobject, GST_STATE_NULL);
    }

    gst_object_unref (priv->gnlobject);
    priv->gnlobject = NULL;
  }

  G_OBJECT_CLASS (ges_track_object_parent_class)->dispose (object);
}
static void
ges_track_object_get_property (GObject * object, guint property_id,
    GValue * value, GParamSpec * pspec)
{
  GESTrackObject *tobj = GES_TRACK_OBJECT (object);

  switch (property_id) {
    case PROP_START:
      g_value_set_uint64 (value, ges_track_object_get_start (tobj));
      break;
    case PROP_INPOINT:
      g_value_set_uint64 (value, ges_track_object_get_inpoint (tobj));
      break;
    case PROP_DURATION:
      g_value_set_uint64 (value, ges_track_object_get_duration (tobj));
      break;
    case PROP_PRIORITY:
      g_value_set_uint (value, ges_track_object_get_priority (tobj));
      break;
    case PROP_ACTIVE:
      g_value_set_boolean (value, ges_track_object_is_active (tobj));
      break;
    case PROP_LOCKED:
      g_value_set_boolean (value, ges_track_object_is_locked (tobj));
      break;
    case PROP_MAX_DURATION:
      g_value_set_uint64 (value, tobj->priv->maxduration);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
  }
}
Exemplo n.º 5
0
static void
ges_track_dispose (GObject * object)
{
  GESTrack *track = (GESTrack *) object;
  GESTrackPrivate *priv = track->priv;

  while (priv->trackobjects) {
    GESTrackObject *trobj = GES_TRACK_OBJECT (priv->trackobjects->data);
    ges_track_remove_object (track, trobj);
    ges_timeline_object_release_track_object ((GESTimelineObject *)
        ges_track_object_get_timeline_object (trobj), trobj);
  }

  if (priv->composition) {
    gst_bin_remove (GST_BIN (object), priv->composition);
    priv->composition = NULL;
  }

  if (priv->caps) {
    gst_caps_unref (priv->caps);
    priv->caps = NULL;
  }

  G_OBJECT_CLASS (ges_track_parent_class)->dispose (object);
}
static void
ges_track_object_dispose (GObject * object)
{
  GESTrackObjectPrivate *priv = GES_TRACK_OBJECT (object)->priv;
  if (priv->properties_hashtable)
    g_hash_table_destroy (priv->properties_hashtable);

  G_OBJECT_CLASS (ges_track_object_parent_class)->dispose (object);
}
static GESTrackObject *
ges_tl_transition_create_track_object (GESTimelineObject * obj,
    GESTrack * track)
{
  GESTimelineStandardTransition *transition =
      (GESTimelineStandardTransition *) obj;
  GESTrackObject *res = NULL;
  GESTrackType supportedformats;

  GST_DEBUG ("Creating a GESTrackTransition");

  supportedformats = ges_timeline_object_get_supported_formats (obj);
  if (track->type == GES_TRACK_TYPE_VIDEO) {
    if (supportedformats == GES_TRACK_TYPE_UNKNOWN ||
        supportedformats & GES_TRACK_TYPE_VIDEO) {
      GESTrackVideoTransition *trans;

      trans = ges_track_video_transition_new ();
      ges_track_video_transition_set_transition_type (trans, transition->vtype);

      res = GES_TRACK_OBJECT (trans);
    } else {
      GST_DEBUG ("Not creating transition as video track not on"
          " supportedformats");
    }

  } else if (track->type == GES_TRACK_TYPE_AUDIO) {

    if (supportedformats == GES_TRACK_TYPE_UNKNOWN ||
        supportedformats & GES_TRACK_TYPE_AUDIO)
      res = GES_TRACK_OBJECT (ges_track_audio_transition_new ());
    else
      GST_DEBUG ("Not creating transition as audio track"
          " not on supportedformats");

  } else
    GST_WARNING ("Transitions don't handle this track type");

  return res;
}
static GstPadProbeReturn
switch_to_smpte_cb (GstPad * sink, gboolean blocked,
    GESTrackVideoTransition * transition)
{
  GstElement *smptealpha = gst_element_factory_make ("smptealpha", NULL);
  GstElement *smptealphab = gst_element_factory_make ("smptealpha", NULL);
  GESTrackVideoTransitionPrivate *priv = transition->priv;

  if (priv->pending_type == GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE)
    goto beach;

  GST_INFO ("Bin %p switching from crossfade to smpte", priv->topbin);

  add_smpte_to_bin (priv->sinka, smptealpha, priv);
  add_smpte_to_bin (priv->sinkb, smptealphab, priv);

  if (priv->pending_border_value != -1) {
    g_object_set (smptealphab, "border", priv->pending_border_value, NULL);
    priv->pending_border_value = -1;
  }

  if (priv->pending_inverted) {
    g_object_set (smptealphab, "invert", priv->pending_inverted, NULL);
    priv->pending_inverted = FALSE;
  }

  replace_mixer (priv);

  priv->start_value = 1.0;
  priv->end_value = 0.0;

  set_interpolation (GST_OBJECT (smptealphab), priv, (gchar *) "position");
  ges_track_video_transition_duration_changed (GES_TRACK_OBJECT (transition),
      priv->dur);


  priv->sinka = (GstPad *) link_element_to_mixer (smptealpha, priv->mixer);
  priv->sinkb = (GstPad *) link_element_to_mixer (smptealphab, priv->mixer);

  priv->smpte = smptealphab;

  priv->type = priv->pending_type;

  GST_INFO ("Bin %p switched from crossfade to smpte", priv->topbin);

beach:
  priv->pending_type = GES_VIDEO_STANDARD_TRANSITION_TYPE_NONE;

  return GST_PAD_PROBE_REMOVE;
}
static GstPadProbeReturn
switch_to_crossfade_cb (GstPad * sink, gboolean blocked,
    GESTrackVideoTransition * transition)
{
  GstElement *peera;
  GstElement *peerb;
  GESTrackVideoTransitionPrivate *priv = transition->priv;

  GST_INFO ("Bin %p switching from smpte to crossfade", priv->topbin);

  if (priv->pending_type != GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE)
    goto beach;

  peera = remove_smpte_from_bin (priv, priv->sinka);
  peerb = remove_smpte_from_bin (priv, priv->sinkb);
  if (!peera || !peerb)
    goto beach;

  replace_mixer (priv);

  priv->sinka = (GstPad *) link_element_to_mixer (peera, priv->mixer);
  priv->sinkb = (GstPad *) link_element_to_mixer (peerb, priv->mixer);

  priv->start_value = 0.0;
  priv->end_value = 1.0;
  set_interpolation (GST_OBJECT (priv->sinkb), priv, (gchar *) "alpha");
  ges_track_video_transition_duration_changed (GES_TRACK_OBJECT (transition),
      priv->dur);

  priv->smpte = NULL;

  gst_object_unref (peera);
  gst_object_unref (peerb);

  priv->type = priv->pending_type;

  GST_INFO ("Bin %p switched from smpte to crossfade", priv->topbin);

beach:
  priv->pending_type = GES_VIDEO_STANDARD_TRANSITION_TYPE_NONE;

  return GST_PAD_PROBE_REMOVE;
}
/**
 * ges_timeline_text_overlay_set_valign:
 * @self: the #GESTimelineTextOverlay* to set vertical alignement of text on
 * @valign: #GESTextVAlign
 *
 * Sets the vertical aligment of the text.
 *
 */
void
ges_timeline_text_overlay_set_valign (GESTimelineTextOverlay * self,
    GESTextVAlign valign)
{
  GList *tmp, *trackobjects;
  GESTimelineObject *object = (GESTimelineObject *) self;

  GST_DEBUG ("self:%p, valign:%d", self, valign);

  self->priv->valign = valign;

  trackobjects = ges_timeline_object_get_track_objects (object);
  for (tmp = trackobjects; tmp; tmp = tmp->next) {
    GESTrackObject *trackobject = (GESTrackObject *) tmp->data;

    if (ges_track_object_get_track (trackobject)->type == GES_TRACK_TYPE_VIDEO)
      ges_track_text_overlay_set_valignment (GES_TRACK_TEXT_OVERLAY
          (trackobject), self->priv->valign);

    g_object_unref (GES_TRACK_OBJECT (tmp->data));
  }
  g_list_free (trackobjects);

}