static void
ges_timeline_pipeline_dispose (GObject * object)
{
  GESTimelinePipeline *self = GES_TIMELINE_PIPELINE (object);

  if (self->priv->playsink) {
    if (self->priv->mode & (TIMELINE_MODE_PREVIEW))
      gst_bin_remove (GST_BIN (object), self->priv->playsink);
    else
      gst_object_unref (self->priv->playsink);
    self->priv->playsink = NULL;
  }

  if (self->priv->encodebin) {
    if (self->priv->mode & (TIMELINE_MODE_RENDER | TIMELINE_MODE_SMART_RENDER))
      gst_bin_remove (GST_BIN (object), self->priv->encodebin);
    else
      gst_object_unref (self->priv->encodebin);
    self->priv->encodebin = NULL;
  }

  if (self->priv->profile) {
    gst_encoding_profile_unref (self->priv->profile);
    self->priv->profile = NULL;
  }

  G_OBJECT_CLASS (ges_timeline_pipeline_parent_class)->dispose (object);
}
Exemple #2
0
static gboolean
thumbnail_cb (gpointer user)
{
  GstSample *b = NULL;
  GstCaps *caps;
  GESTimelinePipeline *p;

  p = GES_TIMELINE_PIPELINE (user);

  caps = gst_caps_from_string ("image/jpeg");
  GST_INFO ("getting thumbnails");

  /* check raw rgb use-case with scaling */
  b = ges_timeline_pipeline_get_thumbnail_rgb24 (p, 320, 240);
  g_assert (b);
  gst_sample_unref (b);

  /* check encoding use-case from caps */
  b = NULL;
  b = ges_timeline_pipeline_get_thumbnail (p, caps);
  g_assert (b);
  gst_sample_unref (b);

  g_assert (ges_timeline_pipeline_save_thumbnail (p, -1, -1, (gchar *)
          "image/jpeg", (gchar *) TEST_PATH));
  g_assert (g_file_test (TEST_PATH, G_FILE_TEST_EXISTS));
  g_unlink (TEST_PATH);

  gst_caps_unref (caps);
  return FALSE;
}
static GstStateChangeReturn
ges_timeline_pipeline_change_state (GstElement * element,
    GstStateChange transition)
{
  GESTimelinePipeline *self;
  GstStateChangeReturn ret;

  self = GES_TIMELINE_PIPELINE (element);

  switch (transition) {
    case GST_STATE_CHANGE_READY_TO_PAUSED:
      if (G_UNLIKELY (self->priv->timeline == NULL)) {
        GST_ERROR_OBJECT (element,
            "No GESTimeline set on the pipeline, cannot play !");
        ret = GST_STATE_CHANGE_FAILURE;
        goto done;
      }
      if (self->
          priv->mode & (TIMELINE_MODE_RENDER | TIMELINE_MODE_SMART_RENDER))
        GST_DEBUG ("rendering => Updating pipeline caps");
      if (!ges_timeline_pipeline_update_caps (self)) {
        GST_ERROR_OBJECT (element, "Error setting the caps for rendering");
        ret = GST_STATE_CHANGE_FAILURE;
        goto done;
      }
      /* Set caps on all tracks according to profile if present */
      /* FIXME : Add a new SMART_RENDER mode to avoid decoding */
      break;
    default:
      break;
  }

  ret =
      GST_ELEMENT_CLASS (ges_timeline_pipeline_parent_class)->change_state
      (element, transition);

done:
  return ret;
}