mirror of
https://code.videolan.org/videolan/vlc
synced 2024-10-07 03:56:28 +02:00
* vout.m : comment the NSLog call in windowContainsEmbedded: this method is called on something else than an NSWindow in normal operation
* other: implement on the fly aspect ratio change. Only works in the ogl output at the moment
This commit is contained in:
parent
1069842422
commit
acb0bedc7d
@ -229,6 +229,7 @@
|
||||
"o_messages" = id;
|
||||
"o_mi_about" = id;
|
||||
"o_mi_add_intf" = id;
|
||||
"o_mi_aspect_ratio" = id;
|
||||
"o_mi_audiotrack" = id;
|
||||
"o_mi_bookmarks" = id;
|
||||
"o_mi_bring_atf" = id;
|
||||
@ -300,6 +301,7 @@
|
||||
"o_msgs_btn_crashlog" = id;
|
||||
"o_msgs_panel" = id;
|
||||
"o_mu_add_intf" = id;
|
||||
"o_mu_aspect_ratio" = id;
|
||||
"o_mu_audio" = id;
|
||||
"o_mu_audiotrack" = id;
|
||||
"o_mu_channels" = id;
|
||||
|
@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>35 101 478 430 0 0 1440 878 </string>
|
||||
<string>43 22 478 430 0 0 1024 746 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>1617</key>
|
||||
@ -11,7 +11,7 @@
|
||||
<key>2197</key>
|
||||
<string>422 532 596 143 0 0 1440 878 </string>
|
||||
<key>29</key>
|
||||
<string>71 662 438 44 0 0 1024 746 </string>
|
||||
<string>76 675 438 44 0 0 1024 746 </string>
|
||||
<key>915</key>
|
||||
<string>777 479 187 249 0 0 1440 878 </string>
|
||||
</dict>
|
||||
@ -21,8 +21,8 @@
|
||||
<array/>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>21</integer>
|
||||
<integer>1789</integer>
|
||||
<integer>29</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8H14</string>
|
||||
|
Binary file not shown.
@ -228,6 +228,8 @@ struct intf_sys_t
|
||||
IBOutlet id o_mu_videotrack;
|
||||
IBOutlet id o_mi_screen;
|
||||
IBOutlet id o_mu_screen;
|
||||
IBOutlet id o_mi_aspect_ratio;
|
||||
IBOutlet id o_mu_aspect_ratio;
|
||||
IBOutlet id o_mi_subtitle;
|
||||
IBOutlet id o_mu_subtitle;
|
||||
IBOutlet id o_mi_deinterlace;
|
||||
|
@ -555,6 +555,8 @@ static VLCMain *_o_sharedMainInstance = nil;
|
||||
[o_mi_snapshot setTitle: _NS("Snapshot")];
|
||||
[o_mi_videotrack setTitle: _NS("Video Track")];
|
||||
[o_mu_videotrack setTitle: _NS("Video Track")];
|
||||
[o_mi_aspect_ratio setTitle: _NS("Aspect-ratio")];
|
||||
[o_mu_aspect_ratio setTitle: _NS("Aspect-ratio")];
|
||||
[o_mi_screen setTitle: _NS("Video Device")];
|
||||
[o_mu_screen setTitle: _NS("Video Device")];
|
||||
[o_mi_subtitle setTitle: _NS("Subtitles Track")];
|
||||
@ -1150,6 +1152,9 @@ static VLCMain *_o_sharedMainInstance = nil;
|
||||
{
|
||||
vlc_object_t * p_dec_obj;
|
||||
|
||||
[o_controls setupVarMenuItem: o_mi_aspect_ratio target: (vlc_object_t *)[VLCVoutView getRealVout: p_vout]
|
||||
var: "aspect-ratio" selector: @selector(toggleVar:)];
|
||||
|
||||
[o_controls setupVarMenuItem: o_mi_screen target: (vlc_object_t *)p_vout
|
||||
var: "video-device" selector: @selector(toggleVar:)];
|
||||
|
||||
@ -1325,6 +1330,7 @@ static VLCMain *_o_sharedMainInstance = nil;
|
||||
[o_mi_ffmpeg_pp setEnabled: b_enabled];
|
||||
[o_mi_device setEnabled: b_enabled];
|
||||
[o_mi_screen setEnabled: b_enabled];
|
||||
[o_mi_aspect_ratio setEnabled: b_enabled];
|
||||
}
|
||||
|
||||
- (void)manageVolumeSlider
|
||||
|
@ -111,10 +111,10 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
|
||||
|
||||
- (BOOL)windowContainsEmbedded: (id)o_window
|
||||
{
|
||||
if( ![[o_window className] isEqualToString: @"VLCWindow"] )
|
||||
/* if( ![[o_window className] isEqualToString: @"VLCWindow"] )
|
||||
{
|
||||
NSLog( @"We were not given a VLCWindow" );
|
||||
}
|
||||
}*/
|
||||
return ([self getViewForWindow: o_window] == nil ? NO : YES );
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ struct vout_sys_t
|
||||
NSRect s_frame;
|
||||
vlc_bool_t b_got_frame;
|
||||
vlc_mutex_t lock;
|
||||
vlc_bool_t b_vout_size_update;
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
@ -75,6 +76,9 @@ static void Swap ( vout_thread_t * p_vout );
|
||||
static int Lock ( vout_thread_t * p_vout );
|
||||
static void Unlock ( vout_thread_t * p_vout );
|
||||
|
||||
static int AspectCallback( vlc_object_t *, char const *,
|
||||
vlc_value_t, vlc_value_t, void * );
|
||||
|
||||
int E_(OpenVideoGL) ( vlc_object_t * p_this )
|
||||
{
|
||||
vout_thread_t * p_vout = (vout_thread_t *) p_this;
|
||||
@ -140,12 +144,20 @@ void E_(CloseVideoGL) ( vlc_object_t * p_this )
|
||||
|
||||
static int Init( vout_thread_t * p_vout )
|
||||
{
|
||||
/* The variable is in fact changed on the parent vout */
|
||||
if( !var_Type( p_vout->p_parent, "aspect-ratio" ) )
|
||||
{
|
||||
var_Create( p_vout->p_parent, "aspect-ratio",
|
||||
VLC_VAR_STRING | VLC_VAR_DOINHERIT );
|
||||
}
|
||||
var_AddCallback( p_vout->p_parent, "aspect-ratio", AspectCallback, p_vout );
|
||||
[[p_vout->p_sys->o_glview openGLContext] makeCurrentContext];
|
||||
return VLC_SUCCESS;
|
||||
}
|
||||
|
||||
static void End( vout_thread_t * p_vout )
|
||||
{
|
||||
var_DelCallback( p_vout->p_parent, "aspect-ratio", AspectCallback, p_vout );
|
||||
[[p_vout->p_sys->o_glview openGLContext] makeCurrentContext];
|
||||
}
|
||||
|
||||
@ -192,6 +204,20 @@ static int Manage( vout_thread_t * p_vout )
|
||||
|
||||
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
|
||||
}
|
||||
|
||||
if( p_vout->p_sys->b_vout_size_update )
|
||||
{
|
||||
NSRect old_bounds = [p_vout->p_sys->o_glview bounds];
|
||||
[p_vout->p_sys->o_glview reshape];
|
||||
if( [p_vout->p_sys->o_glview bounds].size.height !=
|
||||
old_bounds.size.height ||
|
||||
[p_vout->p_sys->o_glview bounds].size.width !=
|
||||
old_bounds.size.width);
|
||||
{
|
||||
p_vout->p_sys->b_vout_size_update = VLC_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
[p_vout->p_sys->o_vout_view manage];
|
||||
return VLC_SUCCESS;
|
||||
}
|
||||
@ -235,6 +261,18 @@ static void Unlock( vout_thread_t * p_vout )
|
||||
vlc_mutex_unlock( &p_vout->p_sys->lock );
|
||||
}
|
||||
|
||||
static int AspectCallback( vlc_object_t *p_this, char const *psz_cmd,
|
||||
vlc_value_t oldval, vlc_value_t newval, void *p_data )
|
||||
{
|
||||
/* Only update the vout size if the aspect ratio has actually been changed*/
|
||||
|
||||
if( strcmp( oldval.psz_string, newval.psz_string ) )
|
||||
{
|
||||
((vout_thread_t *)p_data)->p_sys->b_vout_size_update = VLC_TRUE;
|
||||
}
|
||||
return VLC_SUCCESS;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* VLCGLView implementation
|
||||
*****************************************************************************/
|
||||
@ -295,16 +333,21 @@ static void Unlock( vout_thread_t * p_vout )
|
||||
x = bounds.size.width;
|
||||
y = bounds.size.height;
|
||||
}
|
||||
else if( bounds.size.height * p_vout->render.i_aspect <
|
||||
bounds.size.width * VOUT_ASPECT_FACTOR )
|
||||
else if( bounds.size.height * p_vout->render.i_aspect *
|
||||
p_vout->fmt_in.i_sar_num <
|
||||
bounds.size.width * VOUT_ASPECT_FACTOR * p_vout->fmt_in.i_sar_den )
|
||||
{
|
||||
x = bounds.size.height * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
|
||||
x = bounds.size.height * p_vout->render.i_aspect *
|
||||
p_vout->fmt_in.i_sar_num / ( VOUT_ASPECT_FACTOR *
|
||||
p_vout->fmt_in.i_sar_den );
|
||||
y = bounds.size.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = bounds.size.width;
|
||||
y = bounds.size.width * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
|
||||
y = bounds.size.width * p_vout->fmt_in.i_sar_den *
|
||||
VOUT_ASPECT_FACTOR / ( p_vout->fmt_in.i_sar_num *
|
||||
p_vout->render.i_aspect );
|
||||
}
|
||||
|
||||
glViewport( ( bounds.size.width - x ) / 2,
|
||||
|
Loading…
Reference in New Issue
Block a user