Commit 123a98f9 authored by Clément Stenac's avatar Clément Stenac

* modules/misc/httpd.c: added missing sanity checks

* modules/misc/sap.c: added sanity checks and more coding style fixes

* src/video_output/video_output.c:
  Video filters can now be enabled on the fly (vout is respawned)
  You need to var_Set( p_vout, "filters", psz_yourvalue)
      for this

* modules/gui/wxwindows/interface.cpp : Enable the adjust filter on the fly
parent ef41e224
......@@ -2,7 +2,7 @@
* interface.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: interface.cpp,v 1.62 2003/10/06 17:41:47 gbazin Exp $
* $Id: interface.cpp,v 1.63 2003/10/08 10:07:22 zorglub Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -31,6 +31,7 @@
#include <vlc/vlc.h>
#include <vlc/aout.h>
#include <vlc/vout.h>
#include <vlc/intf.h>
#include "stream_control.h"
......@@ -498,9 +499,9 @@ void Interface::CreateOurExtraPanel()
hue_slider = new wxSlider ( extra_frame, Hue_Event, 0, 0,
360, wxDefaultPosition, wxDefaultSize );
hue_sizer->Add(hue_text,1, 0 ,0);
hue_sizer->Add(hue_slider,1, 0 ,0);
hue_sizer->Layout();
hue_sizer->Add(hue_text,1, 0 ,0);
hue_sizer->Add(hue_slider,1, 0 ,0);
hue_sizer->Layout();
wxBoxSizer *contrast_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *contrast_text = new wxStaticText( extra_frame, -1,
......@@ -598,6 +599,21 @@ void Interface::CreateOurExtraPanel()
hue_slider->Disable();
}
int i_value = config_GetInt( p_intf, "hue" );
if( i_value > 0 && i_value < 360 )
hue_slider->SetValue( i_value );
float f_value;
f_value = config_GetFloat( p_intf, "saturation" );
if( f_value > 0 && f_value < 3 )
saturation_slider->SetValue( (int)(100 * f_value) );
f_value = config_GetFloat( p_intf, "contrast" );
if( f_value > 0 && f_value < 2 )
contrast_slider->SetValue( (int)(100 * f_value) );
f_value = config_GetFloat( p_intf, "brightness" );
if( f_value > 0 && f_value < 2 )
brightness_slider->SetValue( (int)(100 * f_value) );
extra_frame->Hide();
free(psz_filters);
}
......@@ -859,7 +875,17 @@ void Interface::OnEnableAdjust(wxCommandEvent& event)
sprintf( psz_new, "%s:adjust", psz_filters);
}
config_PutPsz( p_intf, "filter", psz_new );
vlc_value_t val;
vout_thread_t *p_vout =
(vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout != NULL )
{
val.psz_string = strdup( psz_new );
var_Set( p_vout, "filter", val);
vlc_object_release( p_vout );
}
if( val.psz_string ) free( val.psz_string );
brightness_slider->Enable();
saturation_slider->Enable();
contrast_slider->Enable();
......@@ -890,6 +916,17 @@ void Interface::OnEnableAdjust(wxCommandEvent& event)
}
}
config_PutPsz( p_intf, "filter", psz_filters);
vlc_value_t val;
val.psz_string = strdup( psz_filters );
vout_thread_t *p_vout =
(vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout != NULL )
{
var_Set( p_vout, "filter", val);
vlc_object_release( p_vout );
}
if( val.psz_string ) free( val.psz_string );
}
brightness_slider->Disable();
saturation_slider->Disable();
......
This diff is collapsed.
This diff is collapsed.
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.237 2003/10/05 23:03:35 gbazin Exp $
* $Id: video_output.c,v 1.238 2003/10/08 10:07:22 zorglub Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -62,6 +62,8 @@ 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 * );
static int FilterCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
/*****************************************************************************
* vout_Request: find a video output thread, create one, or destroy one.
......@@ -399,12 +401,12 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
return NULL;
}
p_vout->p_text_renderer_module = module_Need( p_vout, "text renderer",
NULL );
p_vout->p_text_renderer_module = module_Need( p_vout, "text renderer",
NULL );
if( p_vout->p_text_renderer_module == NULL )
{
msg_Warn( p_vout, "no suitable text renderer module" );
p_vout->pf_add_string = NULL;
msg_Warn( p_vout, "no suitable text renderer module" );
p_vout->pf_add_string = NULL;
}
/* Create a few object variables for interface interaction */
......@@ -440,6 +442,17 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
}
var_AddCallback( p_vout, "deinterlace", DeinterlaceCallback, NULL );
var_Create( p_vout, "filter", VLC_VAR_STRING );
text.psz_string = _("Filters");
var_Change( p_vout, "filter", VLC_VAR_SETTEXT, &text, NULL );
var_Change( p_vout, "filter", VLC_VAR_INHERITVALUE, &val, NULL );
if( var_Get( p_vout, "filter", &val ) == VLC_SUCCESS )
{
var_Set( p_vout, "filter", val );
}
var_AddCallback( p_vout, "filter", FilterCallback, NULL );
/* Calculate delay created by internal caching */
p_input_thread = (input_thread_t *)vlc_object_find( p_vout,
VLC_OBJECT_INPUT, FIND_ANYWHERE );
......@@ -1363,3 +1376,45 @@ static int DeinterlaceCallback( vlc_object_t *p_this, char const *psz_cmd,
var_Set( p_vout, "intf-change", val );
return VLC_SUCCESS;
}
static int FilterCallback( 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;
unsigned int i;
p_input = (input_thread_t *)vlc_object_find( p_this, VLC_OBJECT_INPUT,
FIND_PARENT );
if (!p_input)
{
msg_Err( p_vout, "Input not found" );
return( VLC_EGENERIC );
}
/* Restart the video stream */
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 );
val.b_bool = VLC_TRUE;
var_Set( p_vout, "intf-change", val );
return VLC_SUCCESS;
}
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