static void ges_pipeline_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { GESPipeline *self = GES_PIPELINE (object); switch (property_id) { case PROP_AUDIO_SINK: g_object_set_property (G_OBJECT (self->priv->playsink), "audio-sink", value); break; case PROP_VIDEO_SINK: g_object_set_property (G_OBJECT (self->priv->playsink), "video-sink", value); break; case PROP_TIMELINE: ges_pipeline_set_timeline (GES_PIPELINE (object), g_value_get_object (value)); break; case PROP_MODE: ges_pipeline_set_mode (GES_PIPELINE (object), g_value_get_flags (value)); break; case PROP_AUDIO_FILTER: g_object_set (self->priv->playsink, "audio-filter", GST_ELEMENT (g_value_get_object (value)), NULL); break; case PROP_VIDEO_FILTER: g_object_set (self->priv->playsink, "video-filter", GST_ELEMENT (g_value_get_object (value)), NULL); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } }
/**************************************************** * Video Overlay vmethods implementation * ****************************************************/ static void _overlay_expose (GstVideoOverlay * overlay) { GESPipeline *pipeline = GES_PIPELINE (overlay); gst_video_overlay_expose (GST_VIDEO_OVERLAY (pipeline->priv->playsink)); }
static void ges_pipeline_dispose (GObject * object) { GESPipeline *self = GES_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_pipeline_parent_class)->dispose (object); }
static void ges_pipeline_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { GESPipeline *self = GES_PIPELINE (object); switch (property_id) { case PROP_AUDIO_SINK: g_object_get_property (G_OBJECT (self->priv->playsink), "audio-sink", value); break; case PROP_VIDEO_SINK: g_object_get_property (G_OBJECT (self->priv->playsink), "video-sink", value); break; case PROP_TIMELINE: g_value_set_object (value, self->priv->timeline); break; case PROP_MODE: g_value_set_flags (value, self->priv->mode); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } }
static gboolean thumbnail_cb (gpointer user) { GstSample *b = NULL; GstCaps *caps; GESPipeline *p; p = GES_PIPELINE (user); caps = gst_caps_from_string ("image/jpeg"); GST_INFO ("getting thumbnails"); /* check raw rgb use-case with scaling */ b = ges_pipeline_get_thumbnail_rgb24 (p, 320, 240); g_assert (b); gst_sample_unref (b); /* check encoding use-case from caps */ b = NULL; b = ges_pipeline_get_thumbnail (p, caps); g_assert (b); gst_sample_unref (b); g_assert (ges_pipeline_save_thumbnail (p, -1, -1, (gchar *) "image/jpeg", (gchar *) TEST_PATH, NULL)); g_assert (g_file_test (TEST_PATH, G_FILE_TEST_EXISTS)); g_unlink (TEST_PATH); gst_caps_unref (caps); return FALSE; }
static void _overlay_set_window_handle (GstVideoOverlay * overlay, guintptr handle) { GESPipeline *pipeline = GES_PIPELINE (overlay); gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (pipeline-> priv->playsink), handle); }
static void _overlay_handle_events (GstVideoOverlay * overlay, gboolean handle_events) { GESPipeline *pipeline = GES_PIPELINE (overlay); gst_video_overlay_handle_events (GST_VIDEO_OVERLAY (pipeline->priv->playsink), handle_events); }
static void _overlay_set_render_rectangle (GstVideoOverlay * overlay, gint x, gint y, gint width, gint height) { GESPipeline *pipeline = GES_PIPELINE (overlay); gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (pipeline->priv-> playsink), x, y, width, height); }
static GstStateChangeReturn ges_pipeline_change_state (GstElement * element, GstStateChange transition) { GESPipeline *self; GstStateChangeReturn ret; self = GES_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 & (GES_PIPELINE_MODE_RENDER | GES_PIPELINE_MODE_SMART_RENDER)) GST_DEBUG ("rendering => Updating pipeline caps"); /* Set caps on all tracks according to profile if present */ if (!ges_pipeline_update_caps (self)) { GST_ERROR_OBJECT (element, "Error setting the caps for rendering"); ret = GST_STATE_CHANGE_FAILURE; goto done; } _link_tracks (self); break; case GST_STATE_CHANGE_PAUSED_TO_READY: { GList *tmp; for (tmp = self->priv->not_rendered_tracks; tmp; tmp = tmp->next) gst_element_set_locked_state (tmp->data, FALSE); } break; default: break; } ret = GST_ELEMENT_CLASS (ges_pipeline_parent_class)->change_state (element, transition); switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: _unlink_tracks (self); break; default: break; } done: return ret; }
static GstStateChangeReturn ges_pipeline_change_state (GstElement * element, GstStateChange transition) { GESPipeline *self; GstStateChangeReturn ret; self = GES_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_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 */ break; default: break; } ret = GST_ELEMENT_CLASS (ges_pipeline_parent_class)->change_state (element, transition); done: return ret; }
static void ges_pipeline_dispose (GObject * object) { GESPipeline *self = GES_PIPELINE (object); if (self->priv->playsink) { if (self->priv->mode & (GES_PIPELINE_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 & (GES_PIPELINE_MODE_RENDER | GES_PIPELINE_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; } if (self->priv->timeline) { g_signal_handlers_disconnect_by_func (self->priv->timeline, _timeline_track_added_cb, self); g_signal_handlers_disconnect_by_func (self->priv->timeline, _timeline_track_removed_cb, self); } G_OBJECT_CLASS (ges_pipeline_parent_class)->dispose (object); }
/** * ges_pipeline_new: * * Creates a new conveninence #GESPipeline. * * Returns: the new #GESPipeline. */ GESPipeline * ges_pipeline_new (void) { return GES_PIPELINE (gst_element_factory_make ("gespipeline", NULL)); }