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 @@ ...@@ -2,7 +2,7 @@
* dshow.cpp : DirectShow access module for vlc * dshow.cpp : DirectShow access module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * 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> * Author: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -53,6 +53,8 @@ static AM_MEDIA_TYPE EnumDeviceCaps( vlc_object_t *, IBaseFilter *, ...@@ -53,6 +53,8 @@ static AM_MEDIA_TYPE EnumDeviceCaps( vlc_object_t *, IBaseFilter *,
int, int, int, int, int, int ); int, int, int, int, int, int );
static bool ConnectFilters( IFilterGraph *, IBaseFilter *, IPin * ); static bool ConnectFilters( IFilterGraph *, IBaseFilter *, IPin * );
static int FindDevicesCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
#if 0 #if 0
/* Debug only, use this to find out GUIDs */ /* Debug only, use this to find out GUIDs */
unsigned char p_st[]; unsigned char p_st[];
...@@ -61,8 +63,13 @@ static bool ConnectFilters( IFilterGraph *, IBaseFilter *, IPin * ); ...@@ -61,8 +63,13 @@ static bool ConnectFilters( IFilterGraph *, IBaseFilter *, IPin * );
#endif #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_TEXT N_("Caching value in ms")
#define CACHING_LONGTEXT N_( \ #define CACHING_LONGTEXT N_( \
"Allows you to modify the default caching value for directshow streams. " \ "Allows you to modify the default caching value for directshow streams. " \
...@@ -92,9 +99,15 @@ vlc_module_begin(); ...@@ -92,9 +99,15 @@ vlc_module_begin();
add_category_hint( N_("dshow"), NULL, VLC_TRUE ); add_category_hint( N_("dshow"), NULL, VLC_TRUE );
add_integer( "dshow-caching", (mtime_t)(0.2*CLOCK_FREQ) / 1000, NULL, add_integer( "dshow-caching", (mtime_t)(0.2*CLOCK_FREQ) / 1000, NULL,
CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE ); CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
add_string( "dshow-vdev", NULL, NULL, VDEV_TEXT, VDEV_LONGTEXT, VLC_FALSE); 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); 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-size", NULL, NULL, SIZE_TEXT, SIZE_LONGTEXT, VLC_FALSE);
add_string( "dshow-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT, add_string( "dshow-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT,
VLC_TRUE ); VLC_TRUE );
add_shortcut( "dshow" ); add_shortcut( "dshow" );
...@@ -1337,3 +1350,62 @@ static int Demux( input_thread_t *p_input ) ...@@ -1337,3 +1350,62 @@ static int Demux( input_thread_t *p_input )
return 1; 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 @@ ...@@ -2,7 +2,7 @@
* preferences_widgets.h : wxWindows plugin for vlc * preferences_widgets.h : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2003 VideoLAN * 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> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
class ConfigControl: public wxPanel class ConfigControl: public wxPanel
{ {
public: public:
ConfigControl( module_config_t *, wxWindow *parent ); ConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~ConfigControl(); ~ConfigControl();
wxSizer *Sizer(); wxSizer *Sizer();
...@@ -39,6 +39,8 @@ public: ...@@ -39,6 +39,8 @@ public:
protected: protected:
wxBoxSizer *sizer; wxBoxSizer *sizer;
wxStaticText *label; wxStaticText *label;
vlc_object_t *p_this;
static int i_counter;
private: private:
wxString name; wxString name;
...@@ -52,7 +54,7 @@ ConfigControl *CreateConfigControl( vlc_object_t *, ...@@ -52,7 +54,7 @@ ConfigControl *CreateConfigControl( vlc_object_t *,
class KeyConfigControl: public ConfigControl class KeyConfigControl: public ConfigControl
{ {
public: public:
KeyConfigControl( module_config_t *p_item, wxWindow *parent ); KeyConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~KeyConfigControl(); ~KeyConfigControl();
virtual int GetIntValue(); virtual int GetIntValue();
private: private:
...@@ -65,8 +67,7 @@ private: ...@@ -65,8 +67,7 @@ private:
class ModuleConfigControl: public ConfigControl class ModuleConfigControl: public ConfigControl
{ {
public: public:
ModuleConfigControl( vlc_object_t *p_this, module_config_t *p_item, ModuleConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
wxWindow *parent );
~ModuleConfigControl(); ~ModuleConfigControl();
virtual wxString GetPszValue(); virtual wxString GetPszValue();
private: private:
...@@ -76,7 +77,7 @@ private: ...@@ -76,7 +77,7 @@ private:
class StringConfigControl: public ConfigControl class StringConfigControl: public ConfigControl
{ {
public: public:
StringConfigControl( module_config_t *p_item, wxWindow *parent ); StringConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~StringConfigControl(); ~StringConfigControl();
virtual wxString GetPszValue(); virtual wxString GetPszValue();
private: private:
...@@ -86,19 +87,28 @@ private: ...@@ -86,19 +87,28 @@ private:
class StringListConfigControl: public ConfigControl class StringListConfigControl: public ConfigControl
{ {
public: public:
StringListConfigControl( module_config_t *p_item, wxWindow *parent ); StringListConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~StringListConfigControl(); ~StringListConfigControl();
virtual wxString GetPszValue(); virtual wxString GetPszValue();
private: private:
wxComboBox *combo; 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 class FileConfigControl: public ConfigControl
{ {
public: public:
FileConfigControl( module_config_t *p_item, wxWindow *parent ); FileConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~FileConfigControl(); ~FileConfigControl();
void FileConfigControl::OnBrowse( wxCommandEvent& ); void OnBrowse( wxCommandEvent& );
virtual wxString GetPszValue(); virtual wxString GetPszValue();
private: private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
...@@ -110,7 +120,7 @@ private: ...@@ -110,7 +120,7 @@ private:
class IntegerConfigControl: public ConfigControl class IntegerConfigControl: public ConfigControl
{ {
public: public:
IntegerConfigControl( module_config_t *p_item, wxWindow *parent ); IntegerConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~IntegerConfigControl(); ~IntegerConfigControl();
virtual int GetIntValue(); virtual int GetIntValue();
private: private:
...@@ -120,17 +130,26 @@ private: ...@@ -120,17 +130,26 @@ private:
class IntegerListConfigControl: public ConfigControl class IntegerListConfigControl: public ConfigControl
{ {
public: public:
IntegerListConfigControl( module_config_t *p_item, wxWindow *parent ); IntegerListConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~IntegerListConfigControl(); ~IntegerListConfigControl();
virtual int GetIntValue(); virtual int GetIntValue();
private: private:
wxComboBox *combo; 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 class RangedIntConfigControl: public ConfigControl
{ {
public: public:
RangedIntConfigControl( module_config_t *p_item, wxWindow *parent ); RangedIntConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~RangedIntConfigControl(); ~RangedIntConfigControl();
virtual int GetIntValue(); virtual int GetIntValue();
private: private:
...@@ -140,7 +159,7 @@ private: ...@@ -140,7 +159,7 @@ private:
class FloatConfigControl: public ConfigControl class FloatConfigControl: public ConfigControl
{ {
public: public:
FloatConfigControl( module_config_t *p_item, wxWindow *parent ); FloatConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~FloatConfigControl(); ~FloatConfigControl();
virtual float GetFloatValue(); virtual float GetFloatValue();
private: private:
...@@ -150,7 +169,7 @@ private: ...@@ -150,7 +169,7 @@ private:
class BoolConfigControl: public ConfigControl class BoolConfigControl: public ConfigControl
{ {
public: public:
BoolConfigControl( module_config_t *p_item, wxWindow *parent ); BoolConfigControl( vlc_object_t *, module_config_t *, wxWindow * );
~BoolConfigControl(); ~BoolConfigControl();
virtual int GetIntValue(); virtual int GetIntValue();
private: 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