pipeline: Add a GError argument

This commit is contained in:
Thibault Saunier 2013-04-17 16:51:30 -03:00
parent fee4167292
commit 70d5680748
4 changed files with 14 additions and 15 deletions

View file

@ -112,8 +112,8 @@ _overlay_set_render_rectangle (GstVideoOverlay * overlay, gint x,
{ {
GESTimelinePipeline *pipeline = GES_TIMELINE_PIPELINE (overlay); GESTimelinePipeline *pipeline = GES_TIMELINE_PIPELINE (overlay);
gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (pipeline-> gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (pipeline->priv->
priv->playsink), x, y, width, height); playsink), x, y, width, height);
} }
static void static void
@ -121,8 +121,8 @@ _overlay_set_window_handle (GstVideoOverlay * overlay, guintptr handle)
{ {
GESTimelinePipeline *pipeline = GES_TIMELINE_PIPELINE (overlay); GESTimelinePipeline *pipeline = GES_TIMELINE_PIPELINE (overlay);
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (pipeline->priv-> gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (pipeline->
playsink), handle); priv->playsink), handle);
} }
static void static void
@ -429,8 +429,8 @@ ges_timeline_pipeline_change_state (GstElement * element,
ret = GST_STATE_CHANGE_FAILURE; ret = GST_STATE_CHANGE_FAILURE;
goto done; goto done;
} }
if (self-> if (self->priv->
priv->mode & (TIMELINE_MODE_RENDER | TIMELINE_MODE_SMART_RENDER)) mode & (TIMELINE_MODE_RENDER | TIMELINE_MODE_SMART_RENDER))
GST_DEBUG ("rendering => Updating pipeline caps"); GST_DEBUG ("rendering => Updating pipeline caps");
if (!ges_timeline_pipeline_update_caps (self)) { if (!ges_timeline_pipeline_update_caps (self)) {
GST_ERROR_OBJECT (element, "Error setting the caps for rendering"); 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, * @format: a string specifying the desired mime type (for example,
* image/jpeg) * image/jpeg)
* @location: the path to save the thumbnail * @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. * Saves the current frame to the specified @location.
* *
* Returns: %TRUE if the thumbnail was properly save, else %FALSE. * Returns: %TRUE if the thumbnail was properly save, else %FALSE.
*/ */
/* FIXME 0.11: save_thumbnail should have a GError parameter */
gboolean gboolean
ges_timeline_pipeline_save_thumbnail (GESTimelinePipeline * self, int width, int 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; GstMapInfo map_info;
GstBuffer *b; GstBuffer *b;
@ -1063,12 +1064,9 @@ ges_timeline_pipeline_save_thumbnail (GESTimelinePipeline * self, int width, int
b = gst_sample_get_buffer (sample); b = gst_sample_get_buffer (sample);
if (gst_buffer_map (b, &map_info, GST_MAP_READ)) { if (gst_buffer_map (b, &map_info, GST_MAP_READ)) {
GError *err = NULL;
if (!g_file_set_contents (location, (const char *) map_info.data, 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); GST_WARNING ("Could not save thumbnail: %s", err->message);
g_error_free (err);
res = FALSE; res = FALSE;
} }
} }

View file

@ -97,7 +97,8 @@ ges_timeline_pipeline_get_thumbnail_rgb24(GESTimelinePipeline *self,
gboolean gboolean
ges_timeline_pipeline_save_thumbnail(GESTimelinePipeline *self, 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 * GstElement *
ges_timeline_pipeline_preview_get_video_sink (GESTimelinePipeline * self); ges_timeline_pipeline_preview_get_video_sink (GESTimelinePipeline * self);

View file

@ -61,7 +61,7 @@ thumbnail_cb (gpointer user)
gst_sample_unref (b); gst_sample_unref (b);
g_assert (ges_timeline_pipeline_save_thumbnail (p, -1, -1, (gchar *) 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_assert (g_file_test (TEST_PATH, G_FILE_TEST_EXISTS));
g_unlink (TEST_PATH); g_unlink (TEST_PATH);

View file

@ -56,7 +56,7 @@ thumbnail_cb (gpointer pipeline)
filename = g_strdup_printf ("thumbnail%d.jpg", i++); filename = g_strdup_printf ("thumbnail%d.jpg", i++);
res = ges_timeline_pipeline_save_thumbnail (p, -1, -1, res = ges_timeline_pipeline_save_thumbnail (p, -1, -1,
(gchar *) "image/jpeg", filename); (gchar *) "image/jpeg", filename, NULL);
g_free (filename); g_free (filename);