Commit 3096d7e5 authored by Bastien Nocera's avatar Bastien Nocera Committed by Carlos Soriano

audio-video-properties: Make the framerate more precise

Add a bit more precision to the frames per second property.

Closes: #901
parent fdc4300a
Pipeline #58796 passed with stages
in 8 minutes and 3 seconds
......@@ -222,17 +222,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"));
}
......
......@@ -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 */
......@@ -191,11 +191,11 @@ update_video (TotemPropertiesView *props,
/* Round up/down to the nearest integer framerate */
fps_n = gst_discoverer_video_info_get_framerate_num (info);
fps_d = gst_discoverer_video_info_get_framerate_denom (info);
if (fps_d == 0)
bacon_video_widget_properties_set_framerate (props->priv->props, 0);
else
if (fps_d > 0.0)
bacon_video_widget_properties_set_framerate (props->priv->props,
(fps_n + fps_d/2) / fps_d);
(float) fps_n / (float) fps_d);
else
bacon_video_widget_properties_set_framerate (props->priv->props, 0.0);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment