From 1f781716d7b4a0320ca6253071b8ee0b00ee36e2 Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Sun, 30 May 2021 11:14:51 +0200 Subject: [PATCH] Add env variable to display FPS --- lib/gst/clapper/gstclapper.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/gst/clapper/gstclapper.c b/lib/gst/clapper/gstclapper.c index c65abacb..2992aba0 100644 --- a/lib/gst/clapper/gstclapper.c +++ b/lib/gst/clapper/gstclapper.c @@ -2983,12 +2983,23 @@ gst_clapper_main (gpointer data) GstElement *video_sink = gst_clapper_video_renderer_create_video_sink (self->video_renderer, self); if (video_sink) { + const gchar *fps_env; GstPad *video_sink_pad = gst_element_get_static_pad (video_sink, "sink"); if (video_sink_pad) { g_signal_connect (video_sink_pad, "notify::caps", (GCallback) notify_caps_cb, self); gst_object_unref (video_sink_pad); } + fps_env = g_getenv ("GST_CLAPPER_DISPLAY_FPS"); + if (fps_env && g_str_has_prefix (fps_env, "1")) { + GstElement *fpsdisplaysink = + gst_element_factory_make ("fpsdisplaysink", "fpsdisplaysink"); + if (fpsdisplaysink) { + GST_DEBUG_OBJECT (self, "FPS display enabled"); + g_object_set (fpsdisplaysink, "video-sink", video_sink, NULL); + video_sink = fpsdisplaysink; + } + } g_object_set (self->playbin, "video-sink", video_sink, NULL); } }