Commit 93de8cf8 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/preferences_widgets.*: added a refresh button for...

* modules/gui/wxwindows/preferences_widgets.*: added a refresh button for config vars with choices lists which have a pf_list_update callback.
* modules/access/dshow/dshow.cpp: provide a callback to update the devices lists.
parent b380a994
......@@ -2,7 +2,7 @@
* dshow.cpp : DirectShow access module for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: dshow.cpp,v 1.12 2003/11/03 20:22:21 gbazin Exp $
* $Id: dshow.cpp,v 1.13 2003/11/05 02:43:55 gbazin Exp $
*
* Author: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -53,6 +53,8 @@ static AM_MEDIA_TYPE EnumDeviceCaps( vlc_object_t *, IBaseFilter *,
int, int, int, int, int, int );
static bool ConnectFilters( IFilterGraph *, IBaseFilter *, IPin * );
static int FindDevicesCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
#if 0
/* Debug only, use this to find out GUIDs */
unsigned char p_st[];
......@@ -61,8 +63,13 @@ static bool ConnectFilters( IFilterGraph *, IBaseFilter *, IPin * );
#endif
/*****************************************************************************
* Module descriptior
* Module descriptor
*****************************************************************************/
static char *ppsz_vdev[] = { "", "none" };
static char *ppsz_vdev_text[] = { N_("Default"), N_("None") };
static char *ppsz_adev[] = { "", "none" };
static char *ppsz_adev_text[] = { N_("Default"), N_("None") };
#define CACHING_TEXT N_("Caching value in ms")
#define CACHING_LONGTEXT N_( \
"Allows you to modify the default caching value for directshow streams. " \
......@@ -92,9 +99,15 @@ vlc_module_begin();
add_category_hint( N_("dshow"), NULL, VLC_TRUE );
add_integer( "dshow-caching", (mtime_t)(0.2*CLOCK_FREQ) / 1000, NULL,
CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
add_string( "dshow-vdev", NULL, NULL, VDEV_TEXT, VDEV_LONGTEXT, VLC_FALSE);
change_string_list( ppsz_vdev, ppsz_vdev_text, FindDevicesCallback );
add_string( "dshow-adev", NULL, NULL, ADEV_TEXT, ADEV_LONGTEXT, VLC_FALSE);
change_string_list( ppsz_adev, ppsz_adev_text, FindDevicesCallback );
add_string( "dshow-size", NULL, NULL, SIZE_TEXT, SIZE_LONGTEXT, VLC_FALSE);
add_string( "dshow-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT,
VLC_TRUE );
add_shortcut( "dshow" );
......@@ -1337,3 +1350,62 @@ static int Demux( input_thread_t *p_input )
return 1;
}
/*****************************************************************************
* config variable callback
*****************************************************************************/
static int FindDevicesCallback( vlc_object_t *p_this, char const *psz_name,
vlc_value_t newval, vlc_value_t oldval, void * )
{
module_t *p_module;
module_config_t *p_item;
vlc_bool_t b_audio = VLC_FALSE;
int i;
p_item = config_FindConfig( p_this, psz_name );
if( !p_item ) return VLC_SUCCESS;
if( !strcmp( psz_name, "dshow-adev" ) ) b_audio = VLC_TRUE;
/* Clear-up the current list */
if( p_item->i_list )
{
/* Keep the 2 first entries */
for( i = 2; i < p_item->i_list; i++ )
{
free( p_item->ppsz_list[i] );
free( p_item->ppsz_list_text[i] );
}
/* TODO: Remove when no more needed */
p_item->ppsz_list[i] = NULL;
p_item->ppsz_list_text[i] = NULL;
}
p_item->i_list = 2;
/* Find list of devices */
list<string> list_devices;
FindCaptureDevice( p_this, NULL, &list_devices, b_audio );
if( !list_devices.size() ) return VLC_SUCCESS;
p_item->ppsz_list =
(char **)realloc( p_item->ppsz_list,
(list_devices.size()+3) * sizeof(char *) );
p_item->ppsz_list_text =
(char **)realloc( p_item->ppsz_list_text,
(list_devices.size()+3) * sizeof(char *) );
list<string>::iterator iter;
for( iter = list_devices.begin(), i = 2; iter != list_devices.end();
iter++, i++ )
{
p_item->ppsz_list[i] = strdup( iter->c_str() );
p_item->ppsz_list_text[i] = strdup( iter->c_str() );
p_item->i_list++;
}
p_item->ppsz_list[i] = NULL;
p_item->ppsz_list_text[i] = NULL;
return VLC_SUCCESS;
}
......@@ -2,7 +2,7 @@
* preferences_widgets.h : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2003 VideoLAN
* $Id: preferences_widgets.h,v 1.4 2003/11/05 00:39:16 gbazin Exp $
* $Id: preferences_widgets.h,v 1.5 2003/11/05 02:43:55 gbazin Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -24,7 +24,7 @@
class ConfigControl: public wxPanel
{
public:
ConfigControl( module_config_t *, wxWindow *parent );
ConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~ConfigControl();
wxSizer *Sizer();
......@@ -39,6 +39,8 @@ public:
protected:
wxBoxSizer *sizer;
wxStaticText *label;
vlc_object_t *p_this;
static int i_counter;
private:
wxString name;
......@@ -52,7 +54,7 @@ ConfigControl *CreateConfigControl( vlc_object_t *,
class KeyConfigControl: public ConfigControl
{
public:
KeyConfigControl( module_config_t *p_item, wxWindow *parent );
KeyConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~KeyConfigControl();
virtual int GetIntValue();
private:
......@@ -65,8 +67,7 @@ private:
class ModuleConfigControl: public ConfigControl
{
public:
ModuleConfigControl( vlc_object_t *p_this, module_config_t *p_item,
wxWindow *parent );
ModuleConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~ModuleConfigControl();
virtual wxString GetPszValue();
private:
......@@ -76,7 +77,7 @@ private:
class StringConfigControl: public ConfigControl
{
public:
StringConfigControl( module_config_t *p_item, wxWindow *parent );
StringConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~StringConfigControl();
virtual wxString GetPszValue();
private:
......@@ -86,19 +87,28 @@ private:
class StringListConfigControl: public ConfigControl
{
public:
StringListConfigControl( module_config_t *p_item, wxWindow *parent );
StringListConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~StringListConfigControl();
virtual wxString GetPszValue();
private:
wxComboBox *combo;
void OnRefresh( wxCommandEvent& );
char *psz_name;
vlc_object_t *p_this;
vlc_callback_t pf_list_update;
void UpdateCombo( module_config_t *p_item );
DECLARE_EVENT_TABLE()
};
class FileConfigControl: public ConfigControl
{
public:
FileConfigControl( module_config_t *p_item, wxWindow *parent );
FileConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~FileConfigControl();
void FileConfigControl::OnBrowse( wxCommandEvent& );
void OnBrowse( wxCommandEvent& );
virtual wxString GetPszValue();
private:
DECLARE_EVENT_TABLE()
......@@ -110,7 +120,7 @@ private:
class IntegerConfigControl: public ConfigControl
{
public:
IntegerConfigControl( module_config_t *p_item, wxWindow *parent );
IntegerConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~IntegerConfigControl();
virtual int GetIntValue();
private:
......@@ -120,17 +130,26 @@ private:
class IntegerListConfigControl: public ConfigControl
{
public:
IntegerListConfigControl( module_config_t *p_item, wxWindow *parent );
IntegerListConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~IntegerListConfigControl();
virtual int GetIntValue();
private:
wxComboBox *combo;
void OnRefresh( wxCommandEvent& );
char *psz_name;
vlc_object_t *p_this;
vlc_callback_t pf_list_update;
void UpdateCombo( module_config_t *p_item );
DECLARE_EVENT_TABLE()
};
class RangedIntConfigControl: public ConfigControl
{
public:
RangedIntConfigControl( module_config_t *p_item, wxWindow *parent );
RangedIntConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~RangedIntConfigControl();
virtual int GetIntValue();
private:
......@@ -140,7 +159,7 @@ private:
class FloatConfigControl: public ConfigControl
{
public:
FloatConfigControl( module_config_t *p_item, wxWindow *parent );
FloatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~FloatConfigControl();
virtual float GetFloatValue();
private:
......@@ -150,7 +169,7 @@ private:
class BoolConfigControl: public ConfigControl
{
public:
BoolConfigControl( module_config_t *p_item, wxWindow *parent );
BoolConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~BoolConfigControl();
virtual int GetIntValue();
private:
......
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