From 58fe5c23b32388da6ab3f909fe4140ecacde34cf Mon Sep 17 00:00:00 2001 From: Gildas Bazin Date: Sat, 24 May 2003 20:54:27 +0000 Subject: [PATCH] * src/video_output/video_output.c: new "deinterlace" object variable. * modules/gui/macosx/prefs.m: compilation fix. * modules/gui/wxwindows/menus.cpp: use the "deinterlace" object var. * modules/gui/skins/*: couple of fixes. --- modules/gui/macosx/prefs.m | 6 +- modules/gui/skins/src/themeloader.cpp | 10 ++- modules/gui/skins/x11/x11_run.cpp | 9 +-- modules/gui/wxwindows/menus.cpp | 6 +- src/video_output/video_output.c | 96 ++++++++++++++++++++++++++- 5 files changed, 115 insertions(+), 12 deletions(-) diff --git a/modules/gui/macosx/prefs.m b/modules/gui/macosx/prefs.m index 2905895556..44e966a86c 100644 --- a/modules/gui/macosx/prefs.m +++ b/modules/gui/macosx/prefs.m @@ -2,7 +2,7 @@ * prefs.m: MacOS X plugin for vlc ***************************************************************************** * Copyright (C) 2002-2003 VideoLAN - * $Id: prefs.m,v 1.25 2003/05/24 02:48:55 hartman Exp $ + * $Id: prefs.m,v 1.26 2003/05/24 20:54:27 gbazin Exp $ * * Authors: Jon Lech Johansen * Derk-Jan Hartman @@ -140,8 +140,8 @@ NSString *o_value; o_value = [o_vlc_config titleOfSelectedItem]; - [o_value isEqualToString: _NS("Auto") ] ? psz_value = "" : - psz_value = (char *)[o_value lossyCString]; + psz_value = [o_value isEqualToString: _NS("Auto") ] ? "" : + (char *)[o_value lossyCString]; config_PutPsz( p_intf, psz_name, psz_value ); } break; diff --git a/modules/gui/skins/src/themeloader.cpp b/modules/gui/skins/src/themeloader.cpp index f431f29578..f8cc5a39f0 100644 --- a/modules/gui/skins/src/themeloader.cpp +++ b/modules/gui/skins/src/themeloader.cpp @@ -2,7 +2,7 @@ * themeloader.cpp: ThemeLoader class ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: themeloader.cpp,v 1.9 2003/05/02 15:53:32 gbazin Exp $ + * $Id: themeloader.cpp,v 1.10 2003/05/24 20:54:27 gbazin Exp $ * * Authors: Olivier Teulière * Emmanuel Puig @@ -331,8 +331,12 @@ int tar_extract_all( TAR *t, char *prefix ) * Always expect complete blocks to process * the tar information. */ - if(len != BLOCKSIZE) fprintf(stderr, "gzread: incomplete block read"); - + if(len != BLOCKSIZE) + { + fprintf(stderr, "gzread: incomplete block read"); + return -1; + } + /* * If we have to get a tar header */ diff --git a/modules/gui/skins/x11/x11_run.cpp b/modules/gui/skins/x11/x11_run.cpp index a888037018..ff3a3061c2 100644 --- a/modules/gui/skins/x11/x11_run.cpp +++ b/modules/gui/skins/x11/x11_run.cpp @@ -2,7 +2,7 @@ * x11_run.cpp: ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: x11_run.cpp,v 1.6 2003/05/19 21:39:34 asmax Exp $ + * $Id: x11_run.cpp,v 1.7 2003/05/24 20:54:27 gbazin Exp $ * * Authors: Cyril Deguet * @@ -344,9 +344,10 @@ void OSRun( intf_thread_t *p_intf ) VlcProc *proc = new VlcProc( p_intf ); -/* wxTheApp = new Instance( p_intf, callbackobj ); - wxEntry( 1, p_args );*/ - +#ifndef BASIC_SKINS + wxTheApp = new Instance( p_intf ); + wxEntry( 1, p_args ); +#endif Display *display = ((OSTheme *)p_intf->p_sys->p_theme)->GetDisplay(); diff --git a/modules/gui/wxwindows/menus.cpp b/modules/gui/wxwindows/menus.cpp index 1ce9c79e55..c5501d42b1 100644 --- a/modules/gui/wxwindows/menus.cpp +++ b/modules/gui/wxwindows/menus.cpp @@ -2,7 +2,7 @@ * menus.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: menus.cpp,v 1.12 2003/05/21 13:27:25 gbazin Exp $ + * $Id: menus.cpp,v 1.13 2003/05/24 20:54:27 gbazin Exp $ * * Authors: Gildas Bazin * @@ -129,6 +129,8 @@ void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface, { ppsz_varnames[i] = "fullscreen"; pi_objects[i++] = p_object->i_object_id; + ppsz_varnames[i] = "deinterlace"; + pi_objects[i++] = p_object->i_object_id; ppsz_varnames[i] = "directx-on-top"; pi_objects[i++] = p_object->i_object_id; vlc_object_release( p_object ); @@ -225,6 +227,8 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, Interface *_p_main_interface ) { ppsz_varnames[i] = "fullscreen"; pi_objects[i++] = p_object->i_object_id; + ppsz_varnames[i] = "deinterlace"; + pi_objects[i++] = p_object->i_object_id; ppsz_varnames[i] = "directx-on-top"; pi_objects[i++] = p_object->i_object_id; vlc_object_release( p_object ); diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 5171350071..c0ac983d2f 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -5,7 +5,7 @@ * thread, and destroy a previously oppened video output thread. ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: video_output.c,v 1.222 2003/05/21 13:27:25 gbazin Exp $ + * $Id: video_output.c,v 1.223 2003/05/24 20:54:27 gbazin Exp $ * * Authors: Vincent Seguin * @@ -60,6 +60,8 @@ static void InitWindowSize ( vout_thread_t *, int *, int * ); /* Object variables callbacks */ static int FullscreenCallback( vlc_object_t *, char const *, vlc_value_t, vlc_value_t, void * ); +static int DeinterlaceCallback( vlc_object_t *, char const *, + vlc_value_t, vlc_value_t, void * ); /***************************************************************************** * vout_Request: find a video output thread, create one, or destroy one. @@ -383,6 +385,25 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, var_Change( p_vout, "fullscreen", VLC_VAR_SETTEXT, &text, NULL ); var_AddCallback( p_vout, "fullscreen", FullscreenCallback, NULL ); + var_Create( p_vout, "deinterlace", VLC_VAR_STRING | VLC_VAR_HASCHOICE ); + text.psz_string = _("Deinterlace"); + var_Change( p_vout, "deinterlace", VLC_VAR_SETTEXT, &text, NULL ); + val.psz_string = ""; text.psz_string = _("Disable"); + var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); + var_Set( p_vout, "deinterlace", val ); + val.psz_string = "discard"; text.psz_string = _("Discard"); + var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); + val.psz_string = "blend"; text.psz_string = _("Blend"); + var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); + val.psz_string = "mean"; text.psz_string = _("Mean"); + var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); + val.psz_string = "bob"; text.psz_string = _("Bob"); + var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); + val.psz_string = "linear"; text.psz_string = _("Linear"); + var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); + //var_Change( p_vout, "deinterlace", VLC_VAR_INHERITVALUE, NULL, NULL ); + var_AddCallback( p_vout, "deinterlace", DeinterlaceCallback, NULL ); + /* Calculate delay created by internal caching */ p_input_thread = (input_thread_t *)vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_ANYWHERE ); @@ -1175,3 +1196,76 @@ static int FullscreenCallback( vlc_object_t *p_this, char const *psz_cmd, var_Set( p_vout, "intf-change", val ); return VLC_SUCCESS; } + +static int DeinterlaceCallback( vlc_object_t *p_this, char const *psz_cmd, + vlc_value_t oldval, vlc_value_t newval, void *p_data ) +{ + vout_thread_t *p_vout = (vout_thread_t *)p_this; + input_thread_t *p_input; + vlc_value_t val; + + char *psz_mode = newval.psz_string; + char *psz_filter; + unsigned int i; + + psz_filter = config_GetPsz( p_vout, "filter" ); + + if( !psz_mode || !*psz_mode ) + { + config_PutPsz( p_vout, "filter", "" ); + } + else + { + if( !psz_filter || !*psz_filter ) + { + config_PutPsz( p_vout, "filter", "deinterlace" ); + } + else + { + if( strstr( psz_filter, "deinterlace" ) == NULL ) + { + psz_filter = realloc( psz_filter, strlen( psz_filter ) + 20 ); + strcat( psz_filter, ",deinterlace" ); + } + config_PutPsz( p_vout, "filter", psz_filter ); + } + } + + if( psz_filter ) free( psz_filter ); + + /* now restart all video streams */ + p_input = (input_thread_t *)vlc_object_find( p_this, VLC_OBJECT_INPUT, + FIND_PARENT ); + if( p_input ) + { + vlc_mutex_lock( &p_input->stream.stream_lock ); + + p_vout->b_filter_change = VLC_TRUE; + +#define ES p_input->stream.pp_es[i] + + for( i = 0 ; i < p_input->stream.i_es_number ; i++ ) + { + if( ( ES->i_cat == VIDEO_ES ) && ES->p_decoder_fifo != NULL ) + { + input_UnselectES( p_input, ES ); + input_SelectES( p_input, ES ); + } +#undef ES + } + vlc_mutex_unlock( &p_input->stream.stream_lock ); + + vlc_object_release( p_input ); + } + + if( psz_mode && *psz_mode ) + { + val.psz_string = psz_mode; + if( var_Set( p_vout, "deinterlace-mode", val ) != VLC_SUCCESS ) + config_PutPsz( p_vout, "deinterlace-mode", psz_mode ); + } + + val.b_bool = VLC_TRUE; + var_Set( p_vout, "intf-change", val ); + return VLC_SUCCESS; +} -- 2.39.2