From: Mathieu Duponchelle Date: Wed, 3 Apr 2019 15:34:00 +0000 (+0200) Subject: gstvideometa: do not emit criticals when adding timecode metas X-Git-Tag: 1.19.3~511^2~1148 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=abed7c2d3d0247431811d932975aca3f46d368b2;p=platform%2Fupstream%2Fgstreamer.git gstvideometa: do not emit criticals when adding timecode metas This is inconsistent with other add_meta methods such as gst_buffer_add_video_meta , which will return NULL without logging when gst_video_info_set_format fails. It is up to the caller to check the return value of the function, and log if appropriate. --- diff --git a/gst-libs/gst/video/gstvideometa.c b/gst-libs/gst/video/gstvideometa.c index 0ebe1b4..a090edf 100644 --- a/gst-libs/gst/video/gstvideometa.c +++ b/gst-libs/gst/video/gstvideometa.c @@ -1010,14 +1010,17 @@ gst_video_time_code_meta_get_info (void) * Attaches #GstVideoTimeCodeMeta metadata to @buffer with the given * parameters. * - * Returns: (transfer none): the #GstVideoTimeCodeMeta on @buffer. + * Returns: (transfer none): the #GstVideoTimeCodeMeta on @buffer, or + * (since 1.16) %NULL if the timecode was invalid. * * Since: 1.10 */ GstVideoTimeCodeMeta * gst_buffer_add_video_time_code_meta (GstBuffer * buffer, GstVideoTimeCode * tc) { - g_return_val_if_fail (gst_video_time_code_is_valid (tc), NULL); + if (!gst_video_time_code_is_valid (tc)) + return NULL; + return gst_buffer_add_video_time_code_meta_full (buffer, tc->config.fps_n, tc->config.fps_d, tc->config.latest_daily_jam, tc->config.flags, tc->hours, tc->minutes, tc->seconds, tc->frames, tc->field_count); @@ -1039,7 +1042,8 @@ gst_buffer_add_video_time_code_meta (GstBuffer * buffer, GstVideoTimeCode * tc) * Attaches #GstVideoTimeCodeMeta metadata to @buffer with the given * parameters. * - * Returns: (transfer none): the #GstVideoTimeCodeMeta on @buffer. + * Returns: (transfer none): the #GstVideoTimeCodeMeta on @buffer, or + * (since 1.16) %NULL if the timecode was invalid. * * Since: 1.10 */ @@ -1059,7 +1063,10 @@ gst_buffer_add_video_time_code_meta_full (GstBuffer * buffer, guint fps_n, gst_video_time_code_init (&meta->tc, fps_n, fps_d, latest_daily_jam, flags, hours, minutes, seconds, frames, field_count); - g_return_val_if_fail (gst_video_time_code_is_valid (&meta->tc), NULL); + if (!gst_video_time_code_is_valid (&meta->tc)) { + gst_buffer_remove_meta (buffer, (GstMeta *) meta); + return NULL; + } return meta; }