set_subcategory( SUBCAT_VIDEO_VOUT )
set_description( N_("OpenGL video output") )
#ifdef __APPLE__
- set_capability( "video output", 200 )
+ set_capability( "video output", 400 )
#else
set_capability( "video output", 20 )
#endif
VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
/* Forward events from the opengl provider */
- var_Create( p_sys->p_vout, "mouse-x", VLC_VAR_INTEGER );
- var_Create( p_sys->p_vout, "mouse-y", VLC_VAR_INTEGER );
- var_Create( p_sys->p_vout, "mouse-moved", VLC_VAR_BOOL );
- var_Create( p_sys->p_vout, "mouse-clicked", VLC_VAR_BOOL );
+ var_Create( p_sys->p_vout, "mouse-moved", VLC_VAR_COORDS );
+ var_Create( p_sys->p_vout, "mouse-clicked", VLC_VAR_COORDS );
var_Create( p_sys->p_vout, "mouse-button-down", VLC_VAR_INTEGER );
var_Create( p_sys->p_vout, "video-on-top",
VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_sys->p_vout, "scale",
VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
- var_AddCallback( p_sys->p_vout, "mouse-x", SendEvents, p_vout );
- var_AddCallback( p_sys->p_vout, "mouse-y", SendEvents, p_vout );
var_AddCallback( p_sys->p_vout, "mouse-moved", SendEvents, p_vout );
var_AddCallback( p_sys->p_vout, "mouse-clicked", SendEvents, p_vout );
var_AddCallback( p_sys->p_vout, "mouse-button-down", SendEvents, p_vout );
if( p_sys->p_vout->p_module == NULL )
{
msg_Warn( p_vout, "No OpenGL provider found" );
- vlc_object_detach( p_sys->p_vout );
/* no need for var_DelCallback here :-) */
vlc_object_release( p_sys->p_vout );
free( p_sys );
p_vout->fmt_in.i_visible_width;
p_vout->fmt_out.i_visible_height = p_sys->p_vout->fmt_in.i_visible_height =
p_vout->fmt_in.i_visible_height;
- p_vout->fmt_out.i_aspect = p_sys->p_vout->fmt_in.i_aspect =
- p_vout->fmt_in.i_aspect;
p_vout->fmt_out.i_sar_num = p_sys->p_vout->fmt_in.i_sar_num =
p_vout->fmt_in.i_sar_num;
p_vout->fmt_out.i_sar_den = p_sys->p_vout->fmt_in.i_sar_den =
p_vout->fmt_in.i_sar_den;
- p_vout->output.i_aspect = p_vout->fmt_in.i_aspect;
+ p_vout->output.i_aspect = (int64_t)p_vout->fmt_in.i_sar_num * p_vout->fmt_in.i_width * VOUT_ASPECT_FACTOR /
+ p_vout->fmt_in.i_sar_den / p_vout->fmt_in.i_height;
p_sys->p_vout->i_changes = p_vout->i_changes;
i_ret = p_sys->p_vout->pf_manage( p_sys->p_vout );
if (p_sys->p_vout->i_alignment != p_vout->i_alignment)
{
p_vout->i_changes |= VOUT_CROP_CHANGE; //to force change
- p_sys->p_vout->i_alignment = p_vout->i_alignment;
+ p_sys->p_vout->i_alignment = p_vout->i_alignment;
}
/* forward signal that autoscale toggle has changed */
{
vout_sys_t *p_sys = p_vout->p_sys;
+ picture_t *p_next = p_sys->p_current;
+
+ if( VLCGL_TEXTURE_COUNT > 1 )
+ {
+ /* Get the next picture to display */
+ p_next = picture_pool_Get( p_sys->p_pool );
+ assert( p_next );
+ }
+
if( p_sys->p_current )
{
assert( p_sys->p_current->p[0].p_pixels == p_pic->p[0].p_pixels );
+ /* Make sure we have the prepare after the picture_pool_Get,
+ * because picture_pool_Get() will bind the new picture texture,
+ * and vout_display_opengl_Prepare() bind the current rendered picture
+ * texture.
+ * DisplayVideo() will effectively use the last binded texture. */
+
vout_display_opengl_Prepare( &p_sys->vgl, p_sys->p_current );
- picture_Release( p_sys->p_current );
}
- p_sys->p_current = picture_pool_Get( p_sys->p_pool );
- if( p_sys->p_current )
+ if( p_sys->p_current != p_next ) {
+ if( p_sys->p_current )
+ picture_Release( p_sys->p_current );
+
+ /* Swap the picture texture on opengl vout side. */
+ p_sys->p_current = p_next;
+
+ /* Now, switch the only picture that is being used
+ * to render in the backend to point to our "next"
+ * picture texture */
p_pic->p[0].p_pixels = p_sys->p_current->p[0].p_pixels;
+ }
VLC_UNUSED( p_pic );
}