Commit 03cc8cbc authored by Philip Withnall's avatar Philip Withnall Committed by Philip Withnall

Change bacon_video_widget_set_zoom to take a double. (Closes: #577961)

2009-04-15  Philip Withnall  <philip@tecnocode.co.uk>

	* src/backend/bacon-video-widget-gst-0.10.c (resize_video_window),
	(bacon_video_widget_init), (bacon_video_widget_set_zoom),
	(bacon_video_widget_get_zoom):
	* src/backend/bacon-video-widget-xine.c
	(bacon_video_widget_realize), (bacon_video_widget_set_zoom),
	(bacon_video_widget_get_zoom):
	* src/backend/bacon-video-widget.h:
	* src/totem-object.c (totem_action_zoom),
	(totem_action_zoom_relative):
	* src/totem-private.h: Change bacon_video_widget_set_zoom to take a
	double. (Closes: #577961)


svn path=/trunk/; revision=6260
parent ed822521
2009-04-15 Philip Withnall <philip@tecnocode.co.uk>
* src/backend/bacon-video-widget-gst-0.10.c (resize_video_window),
(bacon_video_widget_init), (bacon_video_widget_set_zoom),
(bacon_video_widget_get_zoom):
* src/backend/bacon-video-widget-xine.c
(bacon_video_widget_realize), (bacon_video_widget_set_zoom),
(bacon_video_widget_get_zoom):
* src/backend/bacon-video-widget.h:
* src/totem-object.c (totem_action_zoom),
(totem_action_zoom_relative):
* src/totem-private.h: Change bacon_video_widget_set_zoom to take a
double. (Closes: #577961)
2009-04-15 Philip Withnall <philip@tecnocode.co.uk>
* src/backend/bacon-video-widget-common.c
......
......@@ -184,7 +184,7 @@ struct BaconVideoWidgetPrivate
gint video_fps_n;
gint video_fps_d;
gint zoom;
gdouble zoom;
gchar *media_device;
......@@ -872,7 +872,7 @@ resize_video_window (BaconVideoWidget *bvw)
}
/* apply zoom factor */
ratio = ratio * bvw->priv->zoom / 100;
ratio = ratio * bvw->priv->zoom;
width *= ratio;
height *= ratio;
......@@ -1080,7 +1080,7 @@ bacon_video_widget_init (BaconVideoWidget * bvw)
priv->tagcache = NULL;
priv->audiotags = NULL;
priv->videotags = NULL;
priv->zoom = 100;
priv->zoom = 1.0;
priv->lock = g_mutex_new ();
......@@ -3638,7 +3638,7 @@ bacon_video_widget_set_scale_ratio (BaconVideoWidget * bvw, gfloat ratio)
void
bacon_video_widget_set_zoom (BaconVideoWidget *bvw,
int zoom)
double zoom)
{
g_return_if_fail (bvw != NULL);
g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
......@@ -3648,11 +3648,11 @@ bacon_video_widget_set_zoom (BaconVideoWidget *bvw,
resize_video_window (bvw);
}
int
double
bacon_video_widget_get_zoom (BaconVideoWidget *bvw)
{
g_return_val_if_fail (bvw != NULL, 100);
g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 100);
g_return_val_if_fail (bvw != NULL, 1.0);
g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 1.0);
return bvw->priv->zoom;
}
......
......@@ -176,7 +176,7 @@ struct BaconVideoWidgetPrivate {
double volume;
BvwAudioOutType audio_out_type;
gint64 stream_length;
int zoom;
double zoom;
GAsyncQueue *queue;
int video_width, video_height;
......@@ -1253,7 +1253,7 @@ bacon_video_widget_realize (GtkWidget *widget)
bvw->priv->ev_queue = xine_event_new_queue (bvw->priv->stream);
/* Set the zoom that might have been recorded */
if (bvw->priv->zoom != 0)
if (bvw->priv->zoom != 0.0)
bacon_video_widget_set_zoom (bvw, bvw->priv->zoom);
/* Setup xine events */
......@@ -3621,12 +3621,12 @@ bacon_video_widget_set_scale_ratio (BaconVideoWidget *bvw, gfloat ratio)
}
void
bacon_video_widget_set_zoom (BaconVideoWidget *bvw, int zoom)
bacon_video_widget_set_zoom (BaconVideoWidget *bvw, double zoom)
{
g_return_if_fail (bvw != NULL);
g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
g_return_if_fail (bvw->priv->xine != NULL);
g_return_if_fail (zoom >= 0 && zoom <= 400);
g_return_if_fail (zoom >= 0.0 && zoom <= 4.0);
if (bvw->priv->stream == NULL) {
/* No stream yet, remember the zoom level */
......@@ -3635,22 +3635,22 @@ bacon_video_widget_set_zoom (BaconVideoWidget *bvw, int zoom)
}
xine_set_param (bvw->priv->stream,
XINE_PARAM_VO_ZOOM_X, zoom);
XINE_PARAM_VO_ZOOM_X, (int) (zoom * 100));
xine_set_param (bvw->priv->stream,
XINE_PARAM_VO_ZOOM_Y, zoom);
XINE_PARAM_VO_ZOOM_Y, (int) (zoom * 100));
}
int
double
bacon_video_widget_get_zoom (BaconVideoWidget *bvw)
{
g_return_val_if_fail (bvw != NULL, 100);
g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 100);
g_return_val_if_fail (bvw->priv->xine != NULL, 100);
g_return_val_if_fail (bvw != NULL, 1.0);
g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), 1.0);
g_return_val_if_fail (bvw->priv->xine != NULL, 1.0);
if (bvw->priv->stream == NULL)
return 100;
return 1.0;
return xine_get_param (bvw->priv->stream, XINE_PARAM_VO_ZOOM_X);
return (double) xine_get_param (bvw->priv->stream, XINE_PARAM_VO_ZOOM_X) / 100.0;
}
int
......
......@@ -258,8 +258,8 @@ void bacon_video_widget_set_scale_ratio (BaconVideoWidget *bvw,
float ratio);
void bacon_video_widget_set_zoom (BaconVideoWidget *bvw,
int zoom);
int bacon_video_widget_get_zoom (BaconVideoWidget *bvw);
double zoom);
double bacon_video_widget_get_zoom (BaconVideoWidget *bvw);
int bacon_video_widget_get_video_property (BaconVideoWidget *bvw,
BvwVideoProperty
......
......@@ -85,9 +85,9 @@
#define SEEK_FORWARD_LONG_OFFSET 10*60
#define SEEK_BACKWARD_LONG_OFFSET -3*60
#define ZOOM_UPPER 200
#define ZOOM_RESET 100
#define ZOOM_LOWER 10
#define ZOOM_UPPER 2.0
#define ZOOM_RESET 1.0
#define ZOOM_LOWER 0.1
#define ZOOM_DISABLE (ZOOM_LOWER - 1)
#define ZOOM_ENABLE (ZOOM_UPPER + 1)
......@@ -1900,7 +1900,7 @@ totem_action_seek_time (Totem *totem, gint64 sec)
}
static void
totem_action_zoom (Totem *totem, int zoom)
totem_action_zoom (Totem *totem, double zoom)
{
GtkAction *action;
gboolean zoom_reset, zoom_in, zoom_out;
......@@ -1933,9 +1933,9 @@ totem_action_zoom (Totem *totem, int zoom)
}
void
totem_action_zoom_relative (Totem *totem, int off_pct)
totem_action_zoom_relative (Totem *totem, double off_pct)
{
int zoom;
double zoom;
zoom = bacon_video_widget_get_zoom (totem->bvw);
totem_action_zoom (totem, zoom + off_pct);
......
......@@ -170,13 +170,13 @@ GtkWidget *totem_volume_create (void);
#define VOLUME_DOWN_OFFSET (-0.08)
#define VOLUME_UP_OFFSET (0.08)
#define ZOOM_IN_OFFSET 1
#define ZOOM_OUT_OFFSET -1
#define ZOOM_IN_OFFSET 0.01
#define ZOOM_OUT_OFFSET -0.01
void totem_action_open (Totem *totem);
void totem_action_open_location (Totem *totem);
void totem_action_eject (Totem *totem);
void totem_action_zoom_relative (Totem *totem, int off_pct);
void totem_action_zoom_relative (Totem *totem, double off_pct);
void totem_action_zoom_reset (Totem *totem);
void totem_action_show_help (Totem *totem);
void totem_action_show_properties (Totem *totem);
......
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