[totem/wip/hadess/24p-fps: 6/6] properties: Use 3 significant figures to display 24p
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/24p-fps: 6/6] properties: Use 3 significant figures to display 24p
- Date: Thu, 17 Feb 2022 16:47:18 +0000 (UTC)
commit 9117d214b66ec557bc16588642bc3e8b12c8ea25
Author: Bastien Nocera <hadess hadess net>
Date: Thu Feb 17 17:40:47 2022 +0100
properties: Use 3 significant figures to display 24p
Use 3 significant figures to display 24p FPS as defined in:
https://gitlab.gnome.org/GNOME/totem/-/issues/458
This only uses 3 significant figures for that framerate, as it's the
only common one that requires 3 significant figures.
Closes: #458
src/plugins/properties/bacon-video-widget-properties.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/properties/bacon-video-widget-properties.c
b/src/plugins/properties/bacon-video-widget-properties.c
index 1cfbf0429..a40403fd2 100644
--- a/src/plugins/properties/bacon-video-widget-properties.c
+++ b/src/plugins/properties/bacon-video-widget-properties.c
@@ -243,9 +243,17 @@ bacon_video_widget_properties_set_framerate (BaconVideoWidgetProperties *props,
g_return_if_fail (props != NULL);
g_return_if_fail (BACON_IS_VIDEO_WIDGET_PROPERTIES (props));
+/* https://en.wikipedia.org/wiki/24p#23.976p */
+#define _24P_FPS (24000.0/1001.0)
+
if (framerate > 1.0) {
- temp = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%0.2f frame per second", "%0.2f frames
per second", (int) (ceilf (framerate))),
- framerate);
+ if (G_APPROX_VALUE (framerate, _24P_FPS, .000001)) {
+ temp = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%0.3f frame per second",
"%0.3f frames per second", (int) (ceilf (framerate))),
+ framerate);
+ } else {
+ temp = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%0.2f frame per second",
"%0.2f frames per second", (int) (ceilf (framerate))),
+ framerate);
+ }
} else {
temp = g_strdup (C_("Frame rate", "N/A"));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]