From 70d5680748d1bc77670062e34a381ea117178b9d Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 17 Apr 2013 16:51:30 -0300 Subject: [PATCH] pipeline: Add a GError argument --- ges/ges-timeline-pipeline.c | 22 ++++++++++------------ ges/ges-timeline-pipeline.h | 3 ++- tests/examples/thumbnails.c | 2 +- tools/ges-launch.c | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/ges/ges-timeline-pipeline.c b/ges/ges-timeline-pipeline.c index e38ffd9..c5b8499 100644 --- a/ges/ges-timeline-pipeline.c +++ b/ges/ges-timeline-pipeline.c @@ -112,8 +112,8 @@ _overlay_set_render_rectangle (GstVideoOverlay * overlay, gint x, { GESTimelinePipeline *pipeline = GES_TIMELINE_PIPELINE (overlay); - gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (pipeline-> - priv->playsink), x, y, width, height); + gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (pipeline->priv-> + playsink), x, y, width, height); } static void @@ -121,8 +121,8 @@ _overlay_set_window_handle (GstVideoOverlay * overlay, guintptr handle) { GESTimelinePipeline *pipeline = GES_TIMELINE_PIPELINE (overlay); - gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (pipeline->priv-> - playsink), handle); + gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (pipeline-> + priv->playsink), handle); } static void @@ -429,8 +429,8 @@ ges_timeline_pipeline_change_state (GstElement * element, ret = GST_STATE_CHANGE_FAILURE; goto done; } - if (self-> - priv->mode & (TIMELINE_MODE_RENDER | TIMELINE_MODE_SMART_RENDER)) + 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"); @@ -1032,15 +1032,16 @@ ges_timeline_pipeline_get_thumbnail (GESTimelinePipeline * self, GstCaps * caps) * @format: a string specifying the desired mime type (for example, * image/jpeg) * @location: the path to save the thumbnail + * @error: (out) (allow-none) (transfer full): An error to be set in case + * something wrong happens or %NULL * * Saves the current frame to the specified @location. * * Returns: %TRUE if the thumbnail was properly save, else %FALSE. */ -/* FIXME 0.11: save_thumbnail should have a GError parameter */ gboolean ges_timeline_pipeline_save_thumbnail (GESTimelinePipeline * self, int width, int - height, const gchar * format, const gchar * location) + height, const gchar * format, const gchar * location, GError ** error) { GstMapInfo map_info; GstBuffer *b; @@ -1063,12 +1064,9 @@ ges_timeline_pipeline_save_thumbnail (GESTimelinePipeline * self, int width, int b = gst_sample_get_buffer (sample); if (gst_buffer_map (b, &map_info, GST_MAP_READ)) { - GError *err = NULL; - if (!g_file_set_contents (location, (const char *) map_info.data, - map_info.size, &err)) { + map_info.size, error)) { GST_WARNING ("Could not save thumbnail: %s", err->message); - g_error_free (err); res = FALSE; } } diff --git a/ges/ges-timeline-pipeline.h b/ges/ges-timeline-pipeline.h index 4df6451..4393d5d 100644 --- a/ges/ges-timeline-pipeline.h +++ b/ges/ges-timeline-pipeline.h @@ -97,7 +97,8 @@ ges_timeline_pipeline_get_thumbnail_rgb24(GESTimelinePipeline *self, gboolean ges_timeline_pipeline_save_thumbnail(GESTimelinePipeline *self, - int width, int height, const gchar *format, const gchar *location); + int width, int height, const gchar *format, const gchar *location, + GError **error); GstElement * ges_timeline_pipeline_preview_get_video_sink (GESTimelinePipeline * self); diff --git a/tests/examples/thumbnails.c b/tests/examples/thumbnails.c index 5971913..215b6c8 100644 --- a/tests/examples/thumbnails.c +++ b/tests/examples/thumbnails.c @@ -61,7 +61,7 @@ thumbnail_cb (gpointer user) gst_sample_unref (b); g_assert (ges_timeline_pipeline_save_thumbnail (p, -1, -1, (gchar *) - "image/jpeg", (gchar *) TEST_PATH)); + "image/jpeg", (gchar *) TEST_PATH, NULL)); g_assert (g_file_test (TEST_PATH, G_FILE_TEST_EXISTS)); g_unlink (TEST_PATH); diff --git a/tools/ges-launch.c b/tools/ges-launch.c index 457b0cd..584f55e 100644 --- a/tools/ges-launch.c +++ b/tools/ges-launch.c @@ -56,7 +56,7 @@ thumbnail_cb (gpointer pipeline) filename = g_strdup_printf ("thumbnail%d.jpg", i++); res = ges_timeline_pipeline_save_thumbnail (p, -1, -1, - (gchar *) "image/jpeg", filename); + (gchar *) "image/jpeg", filename, NULL); g_free (filename); -- 2.7.4