summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2004-10-07 13:16:26 +0000
committerBastien Nocera <hadess@src.gnome.org>2004-10-07 13:16:26 +0000
commita0e919f6e7ed219712bca4ba577e6e93edf63aee (patch)
treedbcc447b3e5954a58e46153cfeca39d1a089dbe0
parent1d7ad1eec24f43ea88d5f0547330cdef2170fe88 (diff)
downloadtotem-a0e919f6e7ed219712bca4ba577e6e93edf63aee.tar.gz
move bacon_video_widget_ratio_fits_screen to totem_ratio_fits_screen, from
2004-10-07 Bastien Nocera <hadess@hadess.net> * src/bacon-video-widget-xine.c: (bacon_video_widget_set_scale_ratio): * src/video-utils.c: (totem_ratio_fits_screen): * src/video-utils.h: move bacon_video_widget_ratio_fits_screen to totem_ratio_fits_screen, from the xine-lib backend to the video-utils.[ch]
-rw-r--r--ChangeLog8
-rw-r--r--src/backend/bacon-video-widget-xine.c36
-rw-r--r--src/backend/video-utils.c28
-rw-r--r--src/backend/video-utils.h3
-rw-r--r--src/bacon-video-widget-xine.c36
-rw-r--r--src/video-utils.c28
-rw-r--r--src/video-utils.h3
7 files changed, 78 insertions, 64 deletions
diff --git a/ChangeLog b/ChangeLog
index fa4c90714..f5565b87b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2004-10-07 Bastien Nocera <hadess@hadess.net>
+ * src/bacon-video-widget-xine.c:
+ (bacon_video_widget_set_scale_ratio):
+ * src/video-utils.c: (totem_ratio_fits_screen):
+ * src/video-utils.h: move bacon_video_widget_ratio_fits_screen to
+ totem_ratio_fits_screen, from the xine-lib backend to the video-utils.[ch]
+
+2004-10-07 Bastien Nocera <hadess@hadess.net>
+
* src/bacon-video-widget-xine.c: (bacon_video_widget_new),
(bacon_video_widget_size_request),
(bacon_video_widget_set_scale_ratio): use
diff --git a/src/backend/bacon-video-widget-xine.c b/src/backend/bacon-video-widget-xine.c
index f2eff06f8..f24113c72 100644
--- a/src/backend/bacon-video-widget-xine.c
+++ b/src/backend/bacon-video-widget-xine.c
@@ -2916,34 +2916,6 @@ bacon_video_widget_get_aspect_ratio (BaconVideoWidget *bvw)
return xine_get_param (bvw->priv->stream, XINE_PARAM_VO_ASPECT_RATIO);
}
-static gboolean
-bacon_video_widget_ratio_fits_screen (BaconVideoWidget *bvw, gfloat ratio)
-{
- GdkRectangle fullscreen_rect;
- int new_w, new_h;
-
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
-
- new_w = bvw->priv->video_width * ratio;
- new_h = bvw->priv->video_height * ratio;
-
- gdk_screen_get_monitor_geometry (gdk_screen_get_default (),
- gdk_screen_get_monitor_at_window
- (gdk_screen_get_default (),
- bvw->priv->video_window),
- &fullscreen_rect);
-
- if (new_w > (fullscreen_rect.width - 128) ||
- new_h > (fullscreen_rect.height - 128))
- {
- return FALSE;
- }
-
- return TRUE;
-}
-
void
bacon_video_widget_set_scale_ratio (BaconVideoWidget *bvw, gfloat ratio)
{
@@ -2961,13 +2933,13 @@ bacon_video_widget_set_scale_ratio (BaconVideoWidget *bvw, gfloat ratio)
/* Try best fit for the screen */
if (ratio == 0)
{
- if (bacon_video_widget_ratio_fits_screen (bvw, 2) != FALSE)
+ if (totem_ratio_fits_screen (bvw->priv->video_window, bvw->priv->video_width, bvw->priv->video_height, 2) != FALSE)
{
ratio = 2;
- } else if (bacon_video_widget_ratio_fits_screen (bvw, 1)
+ } else if (totem_ratio_fits_screen (bvw->priv->video_window, bvw->priv->video_width, bvw->priv->video_height, 1)
!= FALSE) {
ratio = 1;
- } else if (bacon_video_widget_ratio_fits_screen (bvw, 0.5)
+ } else if (totem_ratio_fits_screen (bvw->priv->video_window, bvw->priv->video_width, bvw->priv->video_height, 0.5)
!= FALSE) {
ratio = 0.5;
} else {
@@ -2976,7 +2948,7 @@ bacon_video_widget_set_scale_ratio (BaconVideoWidget *bvw, gfloat ratio)
} else {
/* don't scale to something bigger than the screen, and leave
* us some room */
- if (bacon_video_widget_ratio_fits_screen (bvw, ratio) == FALSE)
+ if (totem_ratio_fits_screen (bvw->priv->video_window, bvw->priv->video_width, bvw->priv->video_height, ratio) == FALSE)
return;
}
diff --git a/src/backend/video-utils.c b/src/backend/video-utils.c
index 8defbfc45..c73fb2d12 100644
--- a/src/backend/video-utils.c
+++ b/src/backend/video-utils.c
@@ -394,3 +394,31 @@ totem_widget_set_preferred_size (GtkWidget *widget, gint width,
gtk_widget_queue_resize (widget);
}
+
+gboolean
+totem_ratio_fits_screen (GdkWindow *video_window, int video_width,
+ int video_height, gfloat ratio)
+{
+ GdkRectangle fullscreen_rect;
+ int new_w, new_h;
+
+ g_return_val_if_fail (video_width > 0, FALSE);
+ g_return_val_if_fail (video_height > 0, FALSE);
+
+ new_w = video_width * ratio;
+ new_h = video_height * ratio;
+
+ gdk_screen_get_monitor_geometry (gdk_screen_get_default (),
+ gdk_screen_get_monitor_at_window
+ (gdk_screen_get_default (),
+ video_window),
+ &fullscreen_rect);
+
+ if (new_w > (fullscreen_rect.width - 128) ||
+ new_h > (fullscreen_rect.height - 128))
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/src/backend/video-utils.h b/src/backend/video-utils.h
index f17ae5da9..5a0129f61 100644
--- a/src/backend/video-utils.h
+++ b/src/backend/video-utils.h
@@ -19,3 +19,6 @@ char *totem_time_to_string_text (gint64 msecs);
void totem_widget_set_preferred_size (GtkWidget *widget, gint width,
gint height);
+gboolean totem_ratio_fits_screen (GdkWindow *window, int video_width,
+ int video_height, gfloat ratio);
+
diff --git a/src/bacon-video-widget-xine.c b/src/bacon-video-widget-xine.c
index f2eff06f8..f24113c72 100644
--- a/src/bacon-video-widget-xine.c
+++ b/src/bacon-video-widget-xine.c
@@ -2916,34 +2916,6 @@ bacon_video_widget_get_aspect_ratio (BaconVideoWidget *bvw)
return xine_get_param (bvw->priv->stream, XINE_PARAM_VO_ASPECT_RATIO);
}
-static gboolean
-bacon_video_widget_ratio_fits_screen (BaconVideoWidget *bvw, gfloat ratio)
-{
- GdkRectangle fullscreen_rect;
- int new_w, new_h;
-
- g_return_val_if_fail (bvw != NULL, FALSE);
- g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
- g_return_val_if_fail (bvw->priv->xine != NULL, FALSE);
-
- new_w = bvw->priv->video_width * ratio;
- new_h = bvw->priv->video_height * ratio;
-
- gdk_screen_get_monitor_geometry (gdk_screen_get_default (),
- gdk_screen_get_monitor_at_window
- (gdk_screen_get_default (),
- bvw->priv->video_window),
- &fullscreen_rect);
-
- if (new_w > (fullscreen_rect.width - 128) ||
- new_h > (fullscreen_rect.height - 128))
- {
- return FALSE;
- }
-
- return TRUE;
-}
-
void
bacon_video_widget_set_scale_ratio (BaconVideoWidget *bvw, gfloat ratio)
{
@@ -2961,13 +2933,13 @@ bacon_video_widget_set_scale_ratio (BaconVideoWidget *bvw, gfloat ratio)
/* Try best fit for the screen */
if (ratio == 0)
{
- if (bacon_video_widget_ratio_fits_screen (bvw, 2) != FALSE)
+ if (totem_ratio_fits_screen (bvw->priv->video_window, bvw->priv->video_width, bvw->priv->video_height, 2) != FALSE)
{
ratio = 2;
- } else if (bacon_video_widget_ratio_fits_screen (bvw, 1)
+ } else if (totem_ratio_fits_screen (bvw->priv->video_window, bvw->priv->video_width, bvw->priv->video_height, 1)
!= FALSE) {
ratio = 1;
- } else if (bacon_video_widget_ratio_fits_screen (bvw, 0.5)
+ } else if (totem_ratio_fits_screen (bvw->priv->video_window, bvw->priv->video_width, bvw->priv->video_height, 0.5)
!= FALSE) {
ratio = 0.5;
} else {
@@ -2976,7 +2948,7 @@ bacon_video_widget_set_scale_ratio (BaconVideoWidget *bvw, gfloat ratio)
} else {
/* don't scale to something bigger than the screen, and leave
* us some room */
- if (bacon_video_widget_ratio_fits_screen (bvw, ratio) == FALSE)
+ if (totem_ratio_fits_screen (bvw->priv->video_window, bvw->priv->video_width, bvw->priv->video_height, ratio) == FALSE)
return;
}
diff --git a/src/video-utils.c b/src/video-utils.c
index 8defbfc45..c73fb2d12 100644
--- a/src/video-utils.c
+++ b/src/video-utils.c
@@ -394,3 +394,31 @@ totem_widget_set_preferred_size (GtkWidget *widget, gint width,
gtk_widget_queue_resize (widget);
}
+
+gboolean
+totem_ratio_fits_screen (GdkWindow *video_window, int video_width,
+ int video_height, gfloat ratio)
+{
+ GdkRectangle fullscreen_rect;
+ int new_w, new_h;
+
+ g_return_val_if_fail (video_width > 0, FALSE);
+ g_return_val_if_fail (video_height > 0, FALSE);
+
+ new_w = video_width * ratio;
+ new_h = video_height * ratio;
+
+ gdk_screen_get_monitor_geometry (gdk_screen_get_default (),
+ gdk_screen_get_monitor_at_window
+ (gdk_screen_get_default (),
+ video_window),
+ &fullscreen_rect);
+
+ if (new_w > (fullscreen_rect.width - 128) ||
+ new_h > (fullscreen_rect.height - 128))
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/src/video-utils.h b/src/video-utils.h
index f17ae5da9..5a0129f61 100644
--- a/src/video-utils.h
+++ b/src/video-utils.h
@@ -19,3 +19,6 @@ char *totem_time_to_string_text (gint64 msecs);
void totem_widget_set_preferred_size (GtkWidget *widget, gint width,
gint height);
+gboolean totem_ratio_fits_screen (GdkWindow *window, int video_width,
+ int video_height, gfloat ratio);
+