mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
x264enc: Strip trailing whitespace from x264's log messages
x264 has linebreaks at the end of its log messages that we should ignore. Add G_GNUC_PRINTF to the callback to make sure GCC lets us forward the format string to another function marked as printf (g_strdup_vprintf) without triggering -Wformat-nonliteral. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-ugly/-/merge_requests/85>
This commit is contained in:
parent
de87e0d381
commit
e4a9db6abe
1 changed files with 14 additions and 2 deletions
|
@ -1228,6 +1228,10 @@ gst_x264_enc_class_init (GstX264EncClass * klass)
|
||||||
gst_type_mark_as_plugin_api (GST_X264_ENC_TUNE_TYPE, 0);
|
gst_type_mark_as_plugin_api (GST_X264_ENC_TUNE_TYPE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
|
G_GNUC_PRINTF (3, 0)
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_x264_enc_log_callback (gpointer private, gint level, const char *format,
|
gst_x264_enc_log_callback (gpointer private, gint level, const char *format,
|
||||||
va_list args)
|
va_list args)
|
||||||
|
@ -1235,6 +1239,7 @@ gst_x264_enc_log_callback (gpointer private, gint level, const char *format,
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
GstDebugLevel gst_level;
|
GstDebugLevel gst_level;
|
||||||
GObject *object = (GObject *) private;
|
GObject *object = (GObject *) private;
|
||||||
|
gchar *formatted;
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case X264_LOG_NONE:
|
case X264_LOG_NONE:
|
||||||
|
@ -1258,8 +1263,15 @@ gst_x264_enc_log_callback (gpointer private, gint level, const char *format,
|
||||||
if (G_LIKELY (gst_level > _gst_debug_min))
|
if (G_LIKELY (gst_level > _gst_debug_min))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gst_debug_log_valist (GST_CAT_DEFAULT, gst_level, __FILE__, GST_FUNCTION,
|
if (G_LIKELY (gst_level > gst_debug_category_get_threshold (GST_CAT_DEFAULT)))
|
||||||
__LINE__, object, format, args);
|
return;
|
||||||
|
|
||||||
|
formatted = g_strdup_vprintf (format, args);
|
||||||
|
g_strchomp (formatted);
|
||||||
|
|
||||||
|
GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, gst_level, object, "%s", formatted);
|
||||||
|
|
||||||
|
g_free (formatted);
|
||||||
#endif /* GST_DISABLE_GST_DEBUG */
|
#endif /* GST_DISABLE_GST_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue