[totem/wip/hadess/move-properties-code] properties: Make the framerate more precise
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/move-properties-code] properties: Make the framerate more precise
- Date: Mon, 11 Feb 2019 17:03:29 +0000 (UTC)
commit 39a5ada320f750e64c5d8bc589375a89b9b8a2d8
Author: Bastien Nocera <hadess hadess net>
Date: Mon Feb 11 18:02:06 2019 +0100
properties: Make the framerate more precise
Add a bit more precision to the frames per second property.
Closes: #248
src/backend/bacon-video-widget.c | 21 +++++++++++----------
.../properties/bacon-video-widget-properties.c | 8 +++-----
.../properties/bacon-video-widget-properties.h | 2 +-
src/plugins/properties/totem-movie-properties.c | 2 +-
4 files changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index f7515cfab..5cd83849a 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -5713,15 +5713,6 @@ bacon_video_widget_get_metadata_int (BaconVideoWidget * bvw,
case BVW_INFO_DIMENSION_Y:
integer = bvw->priv->video_height;
break;
- case BVW_INFO_FPS:
- if (bvw->priv->video_fps_d > 0) {
- /* Round up/down to the nearest integer framerate */
- integer = (bvw->priv->video_fps_n + bvw->priv->video_fps_d/2) /
- bvw->priv->video_fps_d;
- }
- else
- integer = 0;
- break;
case BVW_INFO_AUDIO_BITRATE:
if (bvw->priv->audiotags == NULL)
break;
@@ -5868,7 +5859,6 @@ bacon_video_widget_get_metadata (BaconVideoWidget * bvw,
case BVW_INFO_DURATION:
case BVW_INFO_DIMENSION_X:
case BVW_INFO_DIMENSION_Y:
- case BVW_INFO_FPS:
case BVW_INFO_AUDIO_BITRATE:
case BVW_INFO_VIDEO_BITRATE:
case BVW_INFO_TRACK_NUMBER:
@@ -5893,6 +5883,17 @@ bacon_video_widget_get_metadata (BaconVideoWidget * bvw,
}
}
break;
+ case BVW_INFO_FPS:
+ {
+ float fps = 0.0;
+
+ if (bvw->priv->video_fps_d > 0)
+ fps = (float) bvw->priv->video_fps_n / (float) bvw->priv->video_fps_d;
+
+ g_value_init (value, G_TYPE_FLOAT);
+ g_value_set_float (value, fps);
+ }
+ break;
default:
g_return_if_reached ();
}
diff --git a/src/plugins/properties/bacon-video-widget-properties.c
b/src/plugins/properties/bacon-video-widget-properties.c
index 0e899a978..df6583555 100644
--- a/src/plugins/properties/bacon-video-widget-properties.c
+++ b/src/plugins/properties/bacon-video-widget-properties.c
@@ -224,17 +224,15 @@ bacon_video_widget_properties_set_has_type (BaconVideoWidgetProperties *props,
void
bacon_video_widget_properties_set_framerate (BaconVideoWidgetProperties *props,
- int framerate)
+ float framerate)
{
gchar *temp;
g_return_if_fail (props != NULL);
g_return_if_fail (BACON_IS_VIDEO_WIDGET_PROPERTIES (props));
- /* The FPS has to be done differently because it's a plural string */
- if (framerate != 0) {
- temp = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "%d frame per second", "%d frames per
second", framerate),
- framerate);
+ if (framerate > 1.0) {
+ temp = g_strdup_printf ("%0.2f frames per second", framerate);
} else {
temp = g_strdup (C_("Frame rate", "N/A"));
}
diff --git a/src/plugins/properties/bacon-video-widget-properties.h
b/src/plugins/properties/bacon-video-widget-properties.h
index cef7e53e9..32ec5e0b8 100644
--- a/src/plugins/properties/bacon-video-widget-properties.h
+++ b/src/plugins/properties/bacon-video-widget-properties.h
@@ -57,6 +57,6 @@ void bacon_video_widget_properties_set_has_type (BaconVideoWidgetProperties
*pr
gboolean has_video,
gboolean has_audio);
void bacon_video_widget_properties_set_framerate (BaconVideoWidgetProperties *props,
- int framerate);
+ float framerate);
#endif /* BACON_VIDEO_WIDGET_PROPERTIES_H */
diff --git a/src/plugins/properties/totem-movie-properties.c b/src/plugins/properties/totem-movie-properties.c
index f80e143de..203d0d6ad 100644
--- a/src/plugins/properties/totem-movie-properties.c
+++ b/src/plugins/properties/totem-movie-properties.c
@@ -154,7 +154,7 @@ update_properties_from_bvw (BaconVideoWidgetProperties *props,
N_("%d kbps"), C_("Stream bit rate", "N/A"));
bacon_video_widget_get_metadata (BACON_VIDEO_WIDGET (bvw), BVW_INFO_FPS, &value);
- bacon_video_widget_properties_set_framerate (props, g_value_get_int (&value));
+ bacon_video_widget_properties_set_framerate (props, g_value_get_float (&value));
g_value_unset (&value);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]