Commit f6015e93 authored by Gildas Bazin's avatar Gildas Bazin

* src/video_output/video_output.c, include/video_output.h: modified vout_Request() to take into account the
filter chain. If the filter chain has changed, a new vout will be respawned allowing to switch filters on
the fly. This is still a bit hacky but to do it nicely will require implementing inheritance in object
variables.
* modules/video_filter/deinterlace/deinterlace.c: added a "deinterlace-mode" object variable to allow
switching deinterlace modes on the fly.
* modules/gui/gtk/menu.c: updated the deinterlace menu.
* include/vlc_common.h: compilation fixes for gtk_main and gnome_main.
parent c83f667f
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* thread, and destroy a previously opened video output thread. * thread, and destroy a previously opened video output thread.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: video_output.h,v 1.90 2003/01/28 02:03:32 sam Exp $ * $Id: video_output.h,v 1.91 2003/01/28 12:30:44 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -116,6 +116,7 @@ struct vout_thread_t ...@@ -116,6 +116,7 @@ struct vout_thread_t
/* Filter chain */ /* Filter chain */
char *psz_filter_chain; char *psz_filter_chain;
vlc_bool_t b_filter_change;
}; };
#define I_OUTPUTPICTURES p_vout->output.i_pictures #define I_OUTPUTPICTURES p_vout->output.i_pictures
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.50 2003/01/28 03:11:02 sam Exp $ * $Id: vlc_common.h,v 1.51 2003/01/28 12:30:44 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -649,7 +649,6 @@ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) ); ...@@ -649,7 +649,6 @@ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
#if defined( ENABLE_NLS ) && \ #if defined( ENABLE_NLS ) && \
(defined(MODULE_NAME_IS_gnome)||defined(MODULE_NAME_IS_gtk) \ (defined(MODULE_NAME_IS_gnome)||defined(MODULE_NAME_IS_gtk) \
||defined(MODULE_NAME_IS_gnome_main)||defined(MODULE_NAME_IS_gtk_main) \
||defined(MODULE_NAME_IS_familiar)) ||defined(MODULE_NAME_IS_familiar))
/* Declare nothing: gtk.h will do it for us */ /* Declare nothing: gtk.h will do it for us */
#elif defined( ENABLE_NLS ) && defined( HAVE_INCLUDED_GETTEXT ) #elif defined( ENABLE_NLS ) && defined( HAVE_INCLUDED_GETTEXT )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* menu.c : functions to handle menu items. * menu.c : functions to handle menu items.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: menu.c,v 1.6 2003/01/23 15:52:04 sam Exp $ * $Id: menu.c,v 1.7 2003/01/28 12:30:44 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -364,8 +364,6 @@ static void GtkDeinterlaceUpdate( intf_thread_t *p_intf, char *psz_mode ) ...@@ -364,8 +364,6 @@ static void GtkDeinterlaceUpdate( intf_thread_t *p_intf, char *psz_mode )
} }
config_PutPsz( p_intf, "filter", psz_filter ); config_PutPsz( p_intf, "filter", psz_filter );
} }
config_PutPsz( p_intf, "deinterlace-mode", psz_mode );
} }
if( psz_filter ) if( psz_filter )
...@@ -374,7 +372,18 @@ static void GtkDeinterlaceUpdate( intf_thread_t *p_intf, char *psz_mode ) ...@@ -374,7 +372,18 @@ static void GtkDeinterlaceUpdate( intf_thread_t *p_intf, char *psz_mode )
/* now restart all video stream */ /* now restart all video stream */
if( p_intf->p_sys->p_input ) if( p_intf->p_sys->p_input )
{ {
vout_thread_t *p_vout;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
/* Warn the vout we are about to change the filter chain */
p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout )
{
p_vout->b_filter_change = VLC_TRUE;
vlc_object_release( p_vout );
}
#define ES p_intf->p_sys->p_input->stream.pp_es[i] #define ES p_intf->p_sys->p_input->stream.pp_es[i]
/* create a set of language buttons and append them to the container */ /* create a set of language buttons and append them to the container */
for( i = 0 ; i < p_intf->p_sys->p_input->stream.i_es_number ; i++ ) for( i = 0 ; i < p_intf->p_sys->p_input->stream.i_es_number ; i++ )
...@@ -389,6 +398,26 @@ static void GtkDeinterlaceUpdate( intf_thread_t *p_intf, char *psz_mode ) ...@@ -389,6 +398,26 @@ static void GtkDeinterlaceUpdate( intf_thread_t *p_intf, char *psz_mode )
} }
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
} }
if( strcmp( psz_mode, "None" ) )
{
vout_thread_t *p_vout;
p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout )
{
vlc_value_t val;
val.psz_string = psz_mode;
if( var_Set( p_vout, "deinterlace-mode", val ) != VLC_SUCCESS )
config_PutPsz( p_intf, "deinterlace-mode", psz_mode );
vlc_object_release( p_vout );
}
else
config_PutPsz( p_intf, "deinterlace-mode", psz_mode );
}
} }
static void GtkMenubarDeinterlaceToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) static void GtkMenubarDeinterlaceToggle( GtkCheckMenuItem * menuitem, gpointer user_data )
...@@ -1174,11 +1203,24 @@ static gint GtkDeinterlaceMenus( gpointer p_data, ...@@ -1174,11 +1203,24 @@ static gint GtkDeinterlaceMenus( gpointer p_data,
if( psz_filter && *psz_filter ) if( psz_filter && *psz_filter )
{ {
if( strstr ( psz_filter, "deinterlace" ) ) if( strstr ( psz_filter, "deinterlace" ) )
{
vlc_value_t val;
vout_thread_t *p_vout;
p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout &&
var_Get( p_vout, "deinterlace-mode", &val ) == VLC_SUCCESS )
{
if( val.psz_string && *val.psz_string )
{ {
free( psz_deinterlace_option ); free( psz_deinterlace_option );
psz_deinterlace_option = config_GetPsz( p_intf, "deinterlace-mode" ); psz_deinterlace_option = val.psz_string;
if( !psz_deinterlace_option ) }
psz_deinterlace_option = strdup( "None" ); else if( val.psz_string ) free( val.psz_string );
}
if( p_vout ) vlc_object_release( p_vout );
} }
} }
if( psz_filter ) if( psz_filter )
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread. * thread, and destroy a previously oppened video output thread.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.207 2003/01/22 10:44:50 fenrir Exp $ * $Id: video_output.c,v 1.208 2003/01/28 12:30:44 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -81,7 +81,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -81,7 +81,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
else else
{ {
vlc_object_detach( p_vout ); vlc_object_detach( p_vout );
// vlc_object_release( p_vout ); vlc_object_release( p_vout );
vout_Destroy( p_vout ); vout_Destroy( p_vout );
} }
if( psz_sout ) free( psz_sout ); if( psz_sout ) free( psz_sout );
...@@ -108,10 +108,39 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -108,10 +108,39 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
/* If we now have a video output, check it has the right properties */ /* If we now have a video output, check it has the right properties */
if( p_vout ) if( p_vout )
{ {
char *psz_filter_chain;
/* We don't directly check for the "filter" variable for obvious
* performance reasons. */
if( p_vout->b_filter_change )
{
psz_filter_chain = config_GetPsz( p_this, "filter" );
if( psz_filter_chain && !*psz_filter_chain )
{
free( psz_filter_chain );
psz_filter_chain = NULL;
}
if( p_vout->psz_filter_chain && !*p_vout->psz_filter_chain )
{
free( p_vout->psz_filter_chain );
p_vout->psz_filter_chain = NULL;
}
if( ( !psz_filter_chain && !p_vout->psz_filter_chain ) ||
( psz_filter_chain && p_vout->psz_filter_chain &&
!strcmp( psz_filter_chain, p_vout->psz_filter_chain ) ) )
{
p_vout->b_filter_change = VLC_FALSE;
}
}
if( ( p_vout->render.i_width != i_width ) || if( ( p_vout->render.i_width != i_width ) ||
( p_vout->render.i_height != i_height ) || ( p_vout->render.i_height != i_height ) ||
( p_vout->render.i_chroma != i_chroma ) || ( p_vout->render.i_chroma != i_chroma ) ||
( p_vout->render.i_aspect != i_aspect ) ) ( p_vout->render.i_aspect != i_aspect ) ||
p_vout->b_filter_change )
{ {
/* We are not interested in this format, close this vout */ /* We are not interested in this format, close this vout */
vlc_object_detach( p_vout ); vlc_object_detach( p_vout );
...@@ -126,6 +155,8 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -126,6 +155,8 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
vlc_object_attach( p_vout, p_this ); vlc_object_attach( p_vout, p_this );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
} }
if( psz_filter_chain ) free( psz_filter_chain );
} }
if( !p_vout ) if( !p_vout )
...@@ -218,7 +249,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, ...@@ -218,7 +249,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
} }
/* Choose the video output module */ /* Choose the video output module */
if( !p_vout->psz_filter_chain ) if( !p_vout->psz_filter_chain || !*p_vout->psz_filter_chain )
{ {
psz_plugin = config_GetPsz( p_parent, "vout" ); psz_plugin = config_GetPsz( p_parent, "vout" );
} }
...@@ -287,6 +318,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, ...@@ -287,6 +318,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
p_vout->b_fullscreen = 0; p_vout->b_fullscreen = 0;
p_vout->render_time = 10; p_vout->render_time = 10;
p_vout->c_fps_samples= 0; p_vout->c_fps_samples= 0;
p_vout->b_filter_change = 0;
/* Mouse coordinates */ /* Mouse coordinates */
var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER ); var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER );
...@@ -307,7 +339,8 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, ...@@ -307,7 +339,8 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
p_vout->p_module = module_Need( p_vout, p_vout->p_module = module_Need( p_vout,
( p_vout->psz_filter_chain ) ? ( p_vout->psz_filter_chain &&
*p_vout->psz_filter_chain ) ?
"video filter" : "video output", "video filter" : "video output",
psz_plugin ); psz_plugin );
......
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