* other: implement on the fly aspect ratio change. Only works in the ogl output at the moment
"o_messages" = id;
"o_mi_about" = id;
"o_mi_add_intf" = id;
"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;
"o_mi_audiotrack" = id;
"o_mi_bookmarks" = id;
"o_mi_bring_atf" = id;
"o_msgs_btn_crashlog" = id;
"o_msgs_panel" = id;
"o_mu_add_intf" = id;
"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;
"o_mu_audio" = id;
"o_mu_audiotrack" = id;
"o_mu_channels" = id;
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<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>
<key>IBEditorPositions</key>
<dict>
<key>1617</key>
<key>2197</key>
<string>422 532 596 143 0 0 1440 878 </string>
<key>29</key>
<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>
<key>915</key>
<string>777 479 187 249 0 0 1440 878 </string>
</dict>
<array/>
<key>IBOpenObjects</key>
<array>
<array/>
<key>IBOpenObjects</key>
<array>
</array>
<key>IBSystem Version</key>
<string>8H14</string>
</array>
<key>IBSystem Version</key>
<string>8H14</string>
IBOutlet id o_mu_videotrack;
IBOutlet id o_mi_screen;
IBOutlet id o_mu_screen;
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;
IBOutlet id o_mi_subtitle;
IBOutlet id o_mu_subtitle;
IBOutlet id o_mi_deinterlace;
[o_mi_snapshot setTitle: _NS("Snapshot")];
[o_mi_videotrack setTitle: _NS("Video Track")];
[o_mu_videotrack setTitle: _NS("Video Track")];
[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")];
[o_mi_screen setTitle: _NS("Video Device")];
[o_mu_screen setTitle: _NS("Video Device")];
[o_mi_subtitle setTitle: _NS("Subtitles Track")];
{
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]
+ var: "aspect-ratio" selector: @selector(toggleVar:)];
+
[o_controls setupVarMenuItem: o_mi_screen target: (vlc_object_t *)p_vout
var: "video-device" selector: @selector(toggleVar:)];
[o_controls setupVarMenuItem: o_mi_screen target: (vlc_object_t *)p_vout
var: "video-device" selector: @selector(toggleVar:)];
[o_mi_ffmpeg_pp setEnabled: b_enabled];
[o_mi_device setEnabled: b_enabled];
[o_mi_screen setEnabled: b_enabled];
[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
}
- (void)manageVolumeSlider
- (BOOL)windowContainsEmbedded: (id)o_window
{
- (BOOL)windowContainsEmbedded: (id)o_window
{
- if( ![[o_window className] isEqualToString: @"VLCWindow"] )
+/* if( ![[o_window className] isEqualToString: @"VLCWindow"] )
{
NSLog( @"We were not given a VLCWindow" );
{
NSLog( @"We were not given a VLCWindow" );
return ([self getViewForWindow: o_window] == nil ? NO : YES );
}
return ([self getViewForWindow: o_window] == nil ? NO : YES );
}
NSRect s_frame;
vlc_bool_t b_got_frame;
vlc_mutex_t lock;
NSRect s_frame;
vlc_bool_t b_got_frame;
vlc_mutex_t lock;
+ vlc_bool_t b_vout_size_update;
};
/*****************************************************************************
};
/*****************************************************************************
static int Lock ( vout_thread_t * p_vout );
static void Unlock ( 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;
int E_(OpenVideoGL) ( vlc_object_t * p_this )
{
vout_thread_t * p_vout = (vout_thread_t *) p_this;
static int Init( vout_thread_t * p_vout )
{
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 )
{
[[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];
}
[[p_vout->p_sys->o_glview openGLContext] makeCurrentContext];
}
p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
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;
}
[p_vout->p_sys->o_vout_view manage];
return VLC_SUCCESS;
}
vlc_mutex_unlock( &p_vout->p_sys->lock );
}
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
*****************************************************************************/
/*****************************************************************************
* VLCGLView implementation
*****************************************************************************/
x = bounds.size.width;
y = bounds.size.height;
}
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.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,
}
glViewport( ( bounds.size.width - x ) / 2,