vlc_bool_t b_interface; /**< render interface */
vlc_bool_t b_scale; /**< allow picture scaling */
vlc_bool_t b_fullscreen; /**< toogle fullscreen display */
- vlc_bool_t b_override_aspect; /**< aspect ratio overriden */
uint32_t render_time; /**< last picture render time */
unsigned int i_window_width; /**< video window width */
unsigned int i_window_height; /**< video window height */
*/
vout_synchro_t *p_synchro;
int i_aspect;
+ int i_sar_num;
+ int i_sar_den;
mtime_t i_last_frame_pts;
};
p_dec->fmt_out.video.i_visible_height =
p_sys->p_info->sequence->picture_height;
p_dec->fmt_out.video.i_aspect = p_sys->i_aspect;
+ p_dec->fmt_out.video.i_sar_num = p_sys->i_sar_num;
+ p_dec->fmt_out.video.i_sar_den = p_sys->i_sar_den;
if( p_sys->p_info->sequence->frame_period > 0 )
{
{
case AR_3_4_PICTURE:
p_sys->i_aspect = VOUT_ASPECT_FACTOR * 4 / 3;
+ p_sys->i_sar_num = p_sys->p_info->sequence->display_height * 4;
+ p_sys->i_sar_den = p_sys->p_info->sequence->display_width * 3;
break;
case AR_16_9_PICTURE:
p_sys->i_aspect = VOUT_ASPECT_FACTOR * 16 / 9;
+ p_sys->i_sar_num = p_sys->p_info->sequence->display_height * 16;
+ p_sys->i_sar_den = p_sys->p_info->sequence->display_width * 9;
break;
case AR_221_1_PICTURE:
p_sys->i_aspect = VOUT_ASPECT_FACTOR * 221 / 100;
+ p_sys->i_sar_num = p_sys->p_info->sequence->display_height * 221;
+ p_sys->i_sar_den = p_sys->p_info->sequence->display_width * 100;
break;
case AR_SQUARE_PICTURE:
p_sys->i_aspect = VOUT_ASPECT_FACTOR *
p_sys->p_info->sequence->width /
p_sys->p_info->sequence->height;
+ p_sys->i_sar_num = p_sys->i_sar_den = 1;
break;
}
}
VOUT_ASPECT_FACTOR /
p_sys->p_info->sequence->display_height /
p_sys->p_info->sequence->pixel_height;
+ p_sys->i_sar_num = p_sys->p_info->sequence->pixel_width;
+ p_sys->i_sar_den = p_sys->p_info->sequence->pixel_height;
}
else
{
* This shouldn't happen and if it does it is a bug
* in libmpeg2 (likely triggered by an invalid stream) */
p_sys->i_aspect = VOUT_ASPECT_FACTOR * 4 / 3;
+ p_sys->i_sar_num = p_sys->p_info->sequence->display_height * 4;
+ p_sys->i_sar_den = p_sys->p_info->sequence->display_width * 3;
}
}
- msg_Dbg( p_dec, "%dx%d, aspect %d, %u.%03u fps",
+ msg_Dbg( p_dec, "%dx%d, aspect %d, sar %i:%i, %u.%03u fps",
p_sys->p_info->sequence->display_width,
- p_sys->p_info->sequence->display_height, p_sys->i_aspect,
+ p_sys->p_info->sequence->display_height,
+ p_sys->i_aspect, p_sys->i_sar_num, p_sys->i_sar_den,
(uint32_t)((uint64_t)1001000000 * 27 /
p_sys->p_info->sequence->frame_period / 1001),
(uint32_t)((uint64_t)1001000000 * 27 /
for( y = 1; y < (int)fmt.i_height - 1; y++ )
{
- memcpy( p_top, p_dst, fmt.i_width );
+ if( y > 1 ) memcpy( p_top, p_dst, fmt.i_width );
p_dst += p_region->picture.Y_PITCH;
left = 0;
}
FT_Glyph_Get_CBox( tmp_glyph, ft_glyph_bbox_pixels, &glyph_size );
i_error = FT_Glyph_To_Bitmap( &tmp_glyph, ft_render_mode_normal, 0, 1);
- if( i_error ) continue;
+ if( i_error )
+ {
+ FT_Done_Glyph( tmp_glyph );
+ continue;
+ }
p_line->pp_glyphs[ i ] = (FT_BitmapGlyph)tmp_glyph;
/* Do rest */
if( i_width && i_height )
{
- val.i_int = ( GET_X_LPARAM(msg.lParam) - i_x )
- * p_event->p_vout->render.i_width / i_width;
+ val.i_int = ( GET_X_LPARAM(msg.lParam) - i_x ) *
+ p_event->p_vout->fmt_in.i_visible_width / i_width +
+ p_event->p_vout->fmt_in.i_x_offset;
var_Set( p_event->p_vout, "mouse-x", val );
- val.i_int = ( GET_Y_LPARAM(msg.lParam) - i_y )
- * p_event->p_vout->render.i_height / i_height;
+ val.i_int = ( GET_Y_LPARAM(msg.lParam) - i_y ) *
+ p_event->p_vout->fmt_in.i_visible_height / i_height +
+ p_event->p_vout->fmt_in.i_y_offset;
var_Set( p_event->p_vout, "mouse-y", val );
val.b_bool = VLC_TRUE;
#include <string.h>
#include <vlc/vlc.h>
+#include <vlc/intf.h>
#include <vlc/vout.h>
#include <commctrl.h>
#define SetWindowLongPtr SetWindowLong
#define GetWindowLongPtr GetWindowLong
#define GWLP_USERDATA GWL_USERDATA
+#define AdjustWindowRect(a,b,c)
#endif //UNDER_CE
#ifndef WS_NONAVDONEBUTTON
int i_window_y;
int i_window_width;
int i_window_height;
+ int i_window_style;
int render_width;
int render_height;
#else
p_vout->output.i_width = p_vout->render.i_width;
p_vout->output.i_height = p_vout->render.i_height;
+
+ p_vout->fmt_out = p_vout->fmt_in;
+ p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;
#endif
+
p_vout->output.i_aspect = p_vout->render.i_aspect;
p_pic->p->p_pixels = p_vout->p_sys->p_pic_buffer;
else
i_style = WS_OVERLAPPEDWINDOW|WS_SIZEBOX|WS_VISIBLE|WS_CLIPCHILDREN;
+ p_vout->p_sys->i_window_style = i_style;
+
p_vout->p_sys->hwnd =
CreateWindow( _T("VLC WinGDI"), _T(VOUT_TITLE), i_style,
(p_vout->p_sys->i_window_x < 0) ? CW_USEDEFAULT :
p_vout->p_sys->b_video_display = VLC_TRUE;
break;
+ /* the user wants to close the window */
+ case WM_CLOSE:
+ {
+ playlist_t * p_playlist =
+ (playlist_t *)vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+ if( p_playlist == NULL ) return 0;
+
+ playlist_Stop( p_playlist );
+ vlc_object_release( p_playlist );
+ return 0;
+ }
+
case WM_DESTROY:
msg_Dbg( p_vout, "WinProc WM_DESTROY" );
PostQuitMessage( 0 );
static int Control( vout_thread_t *p_vout, int i_query, va_list args )
{
vlc_bool_t b_bool;
+ double f_arg;
+ RECT rect_window;
+ POINT point;
switch( i_query )
{
+ case VOUT_SET_ZOOM:
+ if( p_vout->p_sys->hparent )
+ return vout_ControlWindow( p_vout,
+ (void *)p_vout->p_sys->hparent, i_query, args );
+
+ f_arg = va_arg( args, double );
+
+ /* Update dimensions */
+ rect_window.top = rect_window.left = 0;
+ rect_window.right = p_vout->i_window_width * f_arg;
+ rect_window.bottom = p_vout->i_window_height * f_arg;
+ AdjustWindowRect( &rect_window, p_vout->p_sys->i_window_style, 0 );
+
+ SetWindowPos( p_vout->p_sys->hwnd, 0, 0, 0,
+ rect_window.right - rect_window.left,
+ rect_window.bottom - rect_window.top, SWP_NOMOVE );
+
+ return VLC_SUCCESS;
+
+ case VOUT_CLOSE:
+ ShowWindow( p_vout->p_sys->hwnd, SW_HIDE );
+ case VOUT_REPARENT:
+ /* Change window style, borders and title bar */
+ //vlc_mutex_lock( &p_vout->p_sys->lock );
+ p_vout->p_sys->hparent = 0;
+ //vlc_mutex_unlock( &p_vout->p_sys->lock );
+
+ /* Retrieve the window position */
+ point.x = point.y = 0;
+ ClientToScreen( p_vout->p_sys->hwnd, &point );
+
+ SetParent( p_vout->p_sys->hwnd, 0 );
+ p_vout->p_sys->i_window_style =
+ WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
+ SetWindowLong( p_vout->p_sys->hwnd, GWL_STYLE,
+ p_vout->p_sys->i_window_style |
+ (i_query == VOUT_CLOSE ? 0 : WS_VISIBLE) );
+ SetWindowLong( p_vout->p_sys->hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW );
+ SetWindowPos( p_vout->p_sys->hwnd, 0, point.x, point.y, 0, 0,
+ SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED );
+
+ return vout_vaControlDefault( p_vout, i_query, args );
+
case VOUT_SET_FOCUS:
b_bool = va_arg( args, vlc_bool_t );
vout_PlacePicture( p_vout, p_vout->p_sys->p_win->i_width,
p_vout->p_sys->p_win->i_height,
&i_index, &i_index,
- &p_vout->output.i_width, &p_vout->output.i_height );
+ &p_vout->fmt_out.i_visible_width,
+ &p_vout->fmt_out.i_visible_height );
- /* Assume we have square pixels */
- p_vout->output.i_aspect = p_vout->output.i_width
- * VOUT_ASPECT_FACTOR / p_vout->output.i_height;
+ p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;
+
+ p_vout->output.i_width = p_vout->fmt_out.i_width =
+ p_vout->fmt_out.i_visible_width * p_vout->fmt_in.i_width /
+ p_vout->fmt_in.i_visible_width;
+ p_vout->output.i_height = p_vout->fmt_out.i_height =
+ p_vout->fmt_out.i_visible_height * p_vout->fmt_in.i_height /
+ p_vout->fmt_in.i_visible_height;
+ p_vout->fmt_out.i_x_offset =
+ p_vout->fmt_out.i_visible_width * p_vout->fmt_in.i_x_offset /
+ p_vout->fmt_in.i_visible_width;
+ p_vout->fmt_out.i_y_offset =
+ p_vout->fmt_out.i_visible_height * p_vout->fmt_in.i_y_offset /
+ p_vout->fmt_in.i_visible_height;
+
+ p_vout->fmt_out.i_sar_num = p_vout->fmt_out.i_sar_den = 1;
+ p_vout->output.i_aspect = p_vout->fmt_out.i_aspect =
+ p_vout->fmt_out.i_width * VOUT_ASPECT_FACTOR /p_vout->fmt_out.i_height;
+
+ msg_Dbg( p_vout, "x11 image size %ix%i (%i,%i,%ix%i)",
+ p_vout->fmt_out.i_width, p_vout->fmt_out.i_height,
+ p_vout->fmt_out.i_x_offset, p_vout->fmt_out.i_y_offset,
+ p_vout->fmt_out.i_visible_width,
+ p_vout->fmt_out.i_visible_height );
#endif
/* Try to initialize up to MAX_DIRECTBUFFERS direct buffers */
XShmPutImage( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->video_window,
p_vout->p_sys->p_win->gc, p_pic->p_sys->p_image,
- 0 /*src_x*/, 0 /*src_y*/, 0 /*dest_x*/, 0 /*dest_y*/,
- p_vout->output.i_width, p_vout->output.i_height,
+ p_vout->fmt_out.i_x_offset,
+ p_vout->fmt_out.i_y_offset,
+ 0 /*dest_x*/, 0 /*dest_y*/,
+ p_vout->fmt_out.i_visible_width,
+ p_vout->fmt_out.i_visible_height,
False /* Don't put True here ! */ );
# endif
}
XPutImage( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->video_window,
p_vout->p_sys->p_win->gc, p_pic->p_sys->p_image,
- 0 /*src_x*/, 0 /*src_y*/, 0 /*dest_x*/, 0 /*dest_y*/,
- p_vout->output.i_width, p_vout->output.i_height );
+ p_vout->fmt_out.i_x_offset,
+ p_vout->fmt_out.i_y_offset,
+ 0 /*dest_x*/, 0 /*dest_y*/,
+ p_vout->fmt_out.i_visible_width,
+ p_vout->fmt_out.i_visible_height );
#endif
}
p_vout->p_sys->p_win->i_height,
&i_x, &i_y, &i_width, &i_height );
- val.i_int = ( xevent.xmotion.x - i_x )
- * p_vout->render.i_width / i_width;
+ val.i_int = ( xevent.xmotion.x - i_x ) *
+ p_vout->fmt_in.i_visible_width / i_width +
+ p_vout->fmt_in.i_x_offset;
var_Set( p_vout, "mouse-x", val );
- val.i_int = ( xevent.xmotion.y - i_y )
- * p_vout->render.i_height / i_height;
+ val.i_int = ( xevent.xmotion.y - i_y ) *
+ p_vout->fmt_in.i_visible_height / i_height +
+ p_vout->fmt_in.i_y_offset;
var_Set( p_vout, "mouse-y", val );
val.b_bool = VLC_TRUE;
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
-#ifndef MODULE_NAME_IS_x11
if( p_vout->i_changes & VOUT_CROP_CHANGE ||
p_vout->i_changes & VOUT_ASPECT_CHANGE )
{
p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num;
p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den;
p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
+
p_vout->i_changes |= VOUT_SIZE_CHANGE;
}
-#endif
/*
* Size change
vlc_ureduce( &p_dec->fmt_out.video.i_sar_num,
&p_dec->fmt_out.video.i_sar_den,
p_dec->fmt_out.video.i_sar_num,
- p_dec->fmt_out.video.i_sar_den, 0 );
+ p_dec->fmt_out.video.i_sar_den, 50000 );
p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
p_sys->video = p_dec->fmt_out.video;
static void AspectRatio ( int, int *, int * );
static int BinaryLog ( uint32_t );
static void MaskToShift ( int *, int *, uint32_t );
-static void InitWindowSize ( vout_thread_t *, unsigned *, unsigned * );
/* Object variables callbacks */
static int DeinterlaceCallback( vlc_object_t *, char const *,
if( ( p_vout->fmt_render.i_width != p_fmt->i_width ) ||
( p_vout->fmt_render.i_height != p_fmt->i_height ) ||
( p_vout->fmt_render.i_chroma != p_fmt->i_chroma ) ||
- ( p_vout->fmt_render.i_aspect != p_fmt->i_aspect
- && !p_vout->b_override_aspect ) ||
+ ( p_vout->fmt_render.i_aspect != p_fmt->i_aspect ) ||
p_vout->b_filter_change )
{
/* We are not interested in this format, close this vout */
/* Initialize the rendering heap */
I_RENDERPICTURES = 0;
+
+ vlc_ureduce( &p_fmt->i_sar_num, &p_fmt->i_sar_den,
+ p_fmt->i_sar_num, p_fmt->i_sar_den, 50000 );
p_vout->fmt_render = *p_fmt; /* FIXME palette */
p_vout->fmt_in = *p_fmt; /* FIXME palette */
- vlc_ureduce( &p_vout->fmt_render.i_sar_num, &p_vout->fmt_render.i_sar_den,
- p_vout->fmt_render.i_sar_num, p_vout->fmt_render.i_sar_den, 0 );
- vlc_ureduce( &p_vout->fmt_in.i_sar_num, &p_vout->fmt_in.i_sar_den,
- p_vout->fmt_in.i_sar_num, p_vout->fmt_in.i_sar_den, 0 );
p_vout->render.i_width = i_width;
p_vout->render.i_height = i_height;
/* Take care of some "interface/control" related initialisations */
vout_IntfInit( p_vout );
- p_vout->b_override_aspect = VLC_FALSE;
-
/* If the parent is not a VOUT object, that means we are at the start of
* the video output pipe */
if( p_parent->i_object_type != VLC_OBJECT_VOUT )
else psz_plugin = strdup( p_vout->psz_filter_chain );
}
- /* Initialize the dimensions of the video window */
- InitWindowSize( p_vout, &p_vout->i_window_width,
- &p_vout->i_window_height );
- msg_Dbg( p_vout, "Window size: %dx%d", p_vout->i_window_width,
- p_vout->i_window_height );
-
/* Create the vout thread */
p_vout->p_module = module_Need( p_vout,
( p_vout->psz_filter_chain && *p_vout->psz_filter_chain ) ?
*pi_right = (8 - i_high + i_low);
}
-/*****************************************************************************
- * InitWindowSize: find the initial dimensions the video window should have.
- *****************************************************************************
- * This function will check the "width", "height" and "zoom" config options and
- * will calculate the size that the video window should have.
- *****************************************************************************/
-static void InitWindowSize( vout_thread_t *p_vout, unsigned *pi_width,
- unsigned *pi_height )
-{
- vlc_value_t val;
- int i_width, i_height;
- uint64_t ll_zoom;
-
-#define FP_FACTOR 1000 /* our fixed point factor */
-
- var_Get( p_vout, "align", &val );
- p_vout->i_alignment = val.i_int;
-
- var_Get( p_vout, "width", &val );
- i_width = val.i_int;
- var_Get( p_vout, "height", &val );
- i_height = val.i_int;
- var_Get( p_vout, "zoom", &val );
- ll_zoom = (uint64_t)( FP_FACTOR * val.f_float );
-
- if( i_width > 0 && i_height > 0)
- {
- *pi_width = (int)( i_width * ll_zoom / FP_FACTOR );
- *pi_height = (int)( i_height * ll_zoom / FP_FACTOR );
- return;
- }
- else if( i_width > 0 )
- {
- *pi_width = (int)( i_width * ll_zoom / FP_FACTOR );
- *pi_height = (int)( i_width * ll_zoom * VOUT_ASPECT_FACTOR /
- p_vout->fmt_in.i_aspect / FP_FACTOR );
- return;
- }
- else if( i_height > 0 )
- {
- *pi_height = (int)( i_height * ll_zoom / FP_FACTOR );
- *pi_width = (int)( i_height * ll_zoom * p_vout->fmt_in.i_aspect /
- VOUT_ASPECT_FACTOR / FP_FACTOR );
- return;
- }
-
- if( p_vout->fmt_in.i_visible_height * p_vout->fmt_in.i_aspect
- >= p_vout->fmt_in.i_visible_width * VOUT_ASPECT_FACTOR )
- {
- *pi_width = (int)( p_vout->fmt_in.i_visible_height * ll_zoom
- * p_vout->fmt_in.i_aspect / VOUT_ASPECT_FACTOR / FP_FACTOR );
- *pi_height = (int)( p_vout->fmt_in.i_visible_height * ll_zoom
- / FP_FACTOR );
- }
- else
- {
- *pi_width = (int)( p_vout->fmt_in.i_visible_width * ll_zoom
- / FP_FACTOR );
- *pi_height = (int)( p_vout->fmt_in.i_visible_width * ll_zoom
- * VOUT_ASPECT_FACTOR / p_vout->fmt_in.i_aspect / FP_FACTOR );
- }
-
-#undef FP_FACTOR
-}
-
/*****************************************************************************
* vout_VarCallback: generic callback for intf variables
*****************************************************************************/
/*****************************************************************************
* Local prototypes
*****************************************************************************/
+static void InitWindowSize( vout_thread_t *, unsigned *, unsigned * );
/* Object variables callbacks */
static int ZoomCallback( vlc_object_t *, char const *,
var_Create( p_vout, "width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "align", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+ var_Get( p_vout, "align", &val );
+ p_vout->i_alignment = val.i_int;
+
var_Create( p_vout, "video-x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "video-y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
vlc_ureduce( &i_aspect_num, &i_aspect_den,
i_aspect *VOUT_ASPECT_FACTOR, VOUT_ASPECT_FACTOR, 0 );
}
- free( val.psz_string );
if( !i_aspect_num || !i_aspect_den ) i_aspect_num = i_aspect_den = 1;
p_vout->i_par_num = i_aspect_num;
p_vout->i_par_num, p_vout->i_par_den );
b_force_par = VLC_TRUE;
}
+ if( val.psz_string ) free( val.psz_string );
/* Aspect-ratio object var */
var_Create( p_vout, "aspect-ratio", VLC_VAR_STRING |
var_Change( p_vout, "aspect-ratio", VLC_VAR_TRIGGER_CALLBACKS, 0, 0 );
if( old_val.psz_string ) free( old_val.psz_string );
+ /* Initialize the dimensions of the video window */
+ InitWindowSize( p_vout, &p_vout->i_window_width,
+ &p_vout->i_window_height );
+ msg_Dbg( p_vout, "window size: %dx%d", p_vout->i_window_width,
+ p_vout->i_window_height );
+
/* Add a variable to indicate if the window should be on top of others */
var_Create( p_vout, "video-on-top", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
text.psz_string = _("Always on top");
}
}
+/*****************************************************************************
+ * InitWindowSize: find the initial dimensions the video window should have.
+ *****************************************************************************
+ * This function will check the "width", "height" and "zoom" config options and
+ * will calculate the size that the video window should have.
+ *****************************************************************************/
+static void InitWindowSize( vout_thread_t *p_vout, unsigned *pi_width,
+ unsigned *pi_height )
+{
+ vlc_value_t val;
+ int i_width, i_height;
+ uint64_t ll_zoom;
+
+#define FP_FACTOR 1000 /* our fixed point factor */
+
+ var_Get( p_vout, "width", &val );
+ i_width = val.i_int;
+ var_Get( p_vout, "height", &val );
+ i_height = val.i_int;
+ var_Get( p_vout, "zoom", &val );
+ ll_zoom = (uint64_t)( FP_FACTOR * val.f_float );
+
+ if( i_width > 0 && i_height > 0)
+ {
+ *pi_width = (int)( i_width * ll_zoom / FP_FACTOR );
+ *pi_height = (int)( i_height * ll_zoom / FP_FACTOR );
+ return;
+ }
+ else if( i_width > 0 )
+ {
+ *pi_width = (int)( i_width * ll_zoom / FP_FACTOR );
+ *pi_height = (int)( p_vout->fmt_in.i_visible_height * ll_zoom *
+ p_vout->fmt_in.i_sar_den * i_width / p_vout->fmt_in.i_sar_num /
+ FP_FACTOR / p_vout->fmt_in.i_visible_width );
+ return;
+ }
+ else if( i_height > 0 )
+ {
+ *pi_height = (int)( i_height * ll_zoom / FP_FACTOR );
+ *pi_width = (int)( p_vout->fmt_in.i_visible_width * ll_zoom *
+ p_vout->fmt_in.i_sar_num * i_height / p_vout->fmt_in.i_sar_den /
+ FP_FACTOR / p_vout->fmt_in.i_visible_height );
+ return;
+ }
+
+ if( p_vout->fmt_in.i_sar_num >= p_vout->fmt_in.i_sar_den )
+ {
+ *pi_width = (int)( p_vout->fmt_in.i_visible_width * ll_zoom *
+ p_vout->fmt_in.i_sar_num / p_vout->fmt_in.i_sar_den / FP_FACTOR );
+ *pi_height = (int)( p_vout->fmt_in.i_visible_height * ll_zoom
+ / FP_FACTOR );
+ }
+ else
+ {
+ *pi_width = (int)( p_vout->fmt_in.i_visible_width * ll_zoom
+ / FP_FACTOR );
+ *pi_height = (int)( p_vout->fmt_in.i_visible_height * ll_zoom *
+ p_vout->fmt_in.i_sar_den / p_vout->fmt_in.i_sar_num / FP_FACTOR );
+ }
+
+#undef FP_FACTOR
+}
+
/*****************************************************************************
* Object variables callbacks
*****************************************************************************/
}
crop_end:
+ InitWindowSize( p_vout, &p_vout->i_window_width,
+ &p_vout->i_window_height );
+
p_vout->i_changes |= VOUT_CROP_CHANGE;
msg_Dbg( p_vout, "cropping picture %ix%i to %i,%i,%ix%i",
}
if( p_vout->fmt_in.i_visible_width * (int64_t)p_vout->fmt_in.i_sar_num *
- *pi_height /
- (p_vout->fmt_in.i_visible_height * p_vout->fmt_in.i_sar_den) >
- *pi_width )
+ *pi_height / p_vout->fmt_in.i_visible_height /
+ p_vout->fmt_in.i_sar_den > *pi_width )
{
*pi_height = p_vout->fmt_in.i_visible_height *
(int64_t)p_vout->fmt_in.i_sar_den * *pi_width /
- (p_vout->fmt_in.i_visible_width * p_vout->fmt_in.i_sar_num);
+ p_vout->fmt_in.i_visible_width / p_vout->fmt_in.i_sar_num;
}
else
{
*pi_width = p_vout->fmt_in.i_visible_width *
(int64_t)p_vout->fmt_in.i_sar_num * *pi_height /
- (p_vout->fmt_in.i_visible_height * p_vout->fmt_in.i_sar_den);
+ p_vout->fmt_in.i_visible_height / p_vout->fmt_in.i_sar_den;
}
switch( p_vout->i_alignment & VOUT_ALIGN_HMASK )