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"
......@@ -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.
......@@ -2,7 +2,7 @@
* sap.c : SAP interface module
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: sap.c,v 1.24 2003/10/06 16:23:30 zorglub Exp $
* $Id: sap.c,v 1.25 2003/10/08 10:07:22 zorglub Exp $
*
* Authors: Arnaud Schauly <gitan@via.ecp.fr>
* Clment Stenac <zorglub@via.ecp.fr>
......@@ -265,6 +265,11 @@ static void Run( intf_thread_t *p_intf )
/* Prepare the network_socket_t structure */
psz_addrv6=(char *)malloc(sizeof(char)*38);
if( !psz_addrv6)
{
msg_Warn( p_intf, "Out of memory !" );
}
/* Max size of an IPv6 address */
sprintf(psz_addrv6,"[%s%c%s]",IPV6_ADDR_1,
......@@ -317,7 +322,20 @@ static void Run( intf_thread_t *p_intf )
}
/* Closing socket */
close( socket_desc.i_handle );
if( fd )
{
if( close( fd ) )
{
msg_Warn( p_intf, "Ohoh, unable to close the socket") ;
}
}
if( fdv6 )
{
if( close( fdv6 ) )
{
msg_Warn( p_intf, "Ohoh, unable to close the socket") ;
}
}
}
/********************************************************************
......@@ -747,8 +765,19 @@ static sess_descr_t * parse_sdp( intf_thread_t * p_intf, char *p_packet )
{
sd->pp_attributes = malloc( sizeof( void * ) );
}
if( !sd->pp_attributes )
{
msg_Warn( p_intf, "Out of memory !" );
return NULL;
}
sd->pp_attributes[sd->i_attributes] =
malloc( sizeof( attr_descr_t ) );
if( ! sd->pp_attributes[sd->i_attributes])
{
msg_Warn( p_intf, "Out of memory !" );
return NULL;
}
p_packet += 2;
psz_eof = strchr( p_packet, ':');
if(psz_eof)
......@@ -779,13 +808,17 @@ static sess_descr_t * parse_sdp( intf_thread_t * p_intf, char *p_packet )
{
sd->pp_media = malloc( sizeof( void * ) );
}
if( !sd->pp_media )
{
msg_Warn( p_intf, "Out of memory !" );
return NULL;
}
sd->pp_media[sd->i_media] =
malloc( sizeof( media_descr_t ) );
sd->pp_media[sd->i_media]->psz_medianame = NULL;
sd->pp_media[sd->i_media]->psz_mediaconnection = NULL;
sd->pp_media[sd->i_media]->psz_medianame = strndup( &p_packet[2], i_field_len );
sd->pp_media[sd->i_media]->psz_medianame =
strndup( &p_packet[2], i_field_len );
sd->i_media++;
break;
......
......@@ -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.
......@@ -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