Commit ac1de0c7 authored by Benjamin Pracht's avatar Benjamin Pracht

* Implement Aspect ratio change in the QT vout

parent 00788d2d
...@@ -1154,10 +1154,10 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1154,10 +1154,10 @@ static VLCMain *_o_sharedMainInstance = nil;
{ {
vlc_object_t * p_dec_obj; vlc_object_t * p_dec_obj;
[o_controls setupVarMenuItem: o_mi_aspect_ratio target: (vlc_object_t *)[VLCVoutView getRealVout: p_vout] [o_controls setupVarMenuItem: o_mi_aspect_ratio target: (vlc_object_t *)p_vout
var: "aspect-ratio" selector: @selector(toggleVar:)]; var: "aspect-ratio" selector: @selector(toggleVar:)];
[o_controls setupVarMenuItem: o_mi_crop target: (vlc_object_t *)[VLCVoutView getRealVout: p_vout] [o_controls setupVarMenuItem: o_mi_crop target: (vlc_object_t *) p_vout
var: "crop" selector: @selector(toggleVar:)]; var: "crop" selector: @selector(toggleVar:)];
[o_controls setupVarMenuItem: o_mi_screen target: (vlc_object_t *)p_vout [o_controls setupVarMenuItem: o_mi_screen target: (vlc_object_t *)p_vout
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videolan dot org> * Derk-Jan Hartman <hartman at videolan dot org>
* Eric Petit <titer@m0k.org> * Eric Petit <titer@m0k.org>
* Benjamin Pracht <bigben AT videolan DOT org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -378,14 +379,21 @@ static int ManageVideo( vout_thread_t *p_vout ) ...@@ -378,14 +379,21 @@ static int ManageVideo( vout_thread_t *p_vout )
p_vout->i_changes |= VOUT_SIZE_CHANGE; p_vout->i_changes |= VOUT_SIZE_CHANGE;
} }
if( p_vout->i_changes & VOUT_SIZE_CHANGE ) if( p_vout->i_changes & VOUT_SIZE_CHANGE ||
p_vout->i_changes & VOUT_ASPECT_CHANGE )
{ {
QTScaleMatrix( p_vout ); QTScaleMatrix( p_vout );
SetDSequenceMatrix( p_vout->p_sys->i_seq, SetDSequenceMatrix( p_vout->p_sys->i_seq,
p_vout->p_sys->p_matrix ); p_vout->p_sys->p_matrix );
}
if( p_vout->i_changes & VOUT_SIZE_CHANGE )
{
p_vout->i_changes &= ~VOUT_SIZE_CHANGE; p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
} }
if( p_vout->i_changes & VOUT_ASPECT_CHANGE )
{
p_vout->i_changes &= ~VOUT_ASPECT_CHANGE;
}
[p_vout->p_sys->o_vout_view manage]; [p_vout->p_sys->o_vout_view manage];
return( 0 ); return( 0 );
...@@ -591,27 +599,34 @@ static void QTScaleMatrix( vout_thread_t *p_vout ) ...@@ -591,27 +599,34 @@ static void QTScaleMatrix( vout_thread_t *p_vout )
Long2Fix( p_vout->output.i_height ) ); Long2Fix( p_vout->output.i_height ) );
} }
else if( i_height * p_vout->output.i_aspect < i_width * VOUT_ASPECT_FACTOR ) else if( i_height * p_vout->fmt_in.i_visible_width *
p_vout->fmt_in.i_sar_num <
i_width * p_vout->fmt_in.i_visible_height *
p_vout->fmt_in.i_sar_den )
{ {
int i_adj_width = i_height * p_vout->output.i_aspect / int i_adj_width = i_height * p_vout->fmt_in.i_visible_width *
VOUT_ASPECT_FACTOR; p_vout->fmt_in.i_sar_num /
( p_vout->fmt_in.i_sar_den *
p_vout->fmt_in.i_visible_height );
factor_x = FixDiv( Long2Fix( i_adj_width ), factor_x = FixDiv( Long2Fix( i_adj_width ),
Long2Fix( p_vout->output.i_width ) ); Long2Fix( p_vout->fmt_in.i_visible_width ) );
factor_y = FixDiv( Long2Fix( i_height ), factor_y = FixDiv( Long2Fix( i_height ),
Long2Fix( p_vout->output.i_height ) ); Long2Fix( p_vout->fmt_in.i_visible_height ) );
i_offset_x = (i_width - i_adj_width) / 2; i_offset_x = (i_width - i_adj_width) / 2;
} }
else else
{ {
int i_adj_height = i_width * VOUT_ASPECT_FACTOR / int i_adj_height = i_width * p_vout->fmt_in.i_visible_height *
p_vout->output.i_aspect; p_vout->fmt_in.i_sar_den /
( p_vout->fmt_in.i_sar_num *
p_vout->fmt_in.i_visible_width );
factor_x = FixDiv( Long2Fix( i_width ), factor_x = FixDiv( Long2Fix( i_width ),
Long2Fix( p_vout->output.i_width ) ); Long2Fix( p_vout->fmt_in.i_visible_width ) );
factor_y = FixDiv( Long2Fix( i_adj_height ), factor_y = FixDiv( Long2Fix( i_adj_height ),
Long2Fix( p_vout->output.i_height ) ); Long2Fix( p_vout->fmt_in.i_visible_height ) );
i_offset_y = (i_height - i_adj_height) / 2; i_offset_y = (i_height - i_adj_height) / 2;
} }
......
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