Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
acc457d1
Commit
acc457d1
authored
Aug 16, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: improve/fix the callback prototype for config item choices
parent
04e363a9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
177 additions
and
262 deletions
+177
-262
include/vlc_configuration.h
include/vlc_configuration.h
+4
-1
modules/access/dshow/dshow.cpp
modules/access/dshow/dshow.cpp
+24
-43
modules/audio_output/alsa.c
modules/audio_output/alsa.c
+62
-77
modules/audio_output/directx.c
modules/audio_output/directx.c
+25
-45
modules/audio_output/waveout.c
modules/audio_output/waveout.c
+16
-43
modules/video_output/msw/directx.c
modules/video_output/msw/directx.c
+44
-47
src/config/core.c
src/config/core.c
+1
-5
src/modules/entry.c
src/modules/entry.c
+1
-1
No files found.
include/vlc_configuration.h
View file @
acc457d1
...
@@ -50,6 +50,9 @@ typedef union
...
@@ -50,6 +50,9 @@ typedef union
float
f
;
float
f
;
}
module_value_t
;
}
module_value_t
;
typedef
int
(
*
vlc_string_list_cb
)(
vlc_object_t
*
,
const
char
*
,
char
***
,
char
***
);
struct
module_config_t
struct
module_config_t
{
{
char
*
psz_type
;
/* Configuration subtype */
char
*
psz_type
;
/* Configuration subtype */
...
@@ -66,7 +69,7 @@ struct module_config_t
...
@@ -66,7 +69,7 @@ struct module_config_t
int
*
pi_list
;
/* Idem for integers */
int
*
pi_list
;
/* Idem for integers */
char
**
ppsz_list_text
;
/* Friendly names for list values */
char
**
ppsz_list_text
;
/* Friendly names for list values */
int
i_list
;
/* Options list size */
int
i_list
;
/* Options list size */
vlc_
callback_t
pf_update_list
;
/* Callback to initialize dropdown lists */
vlc_
string_list_cb
pf_update_list
;
uint8_t
i_type
;
/* Configuration type */
uint8_t
i_type
;
/* Configuration type */
char
i_short
;
/* Optional short option name */
char
i_short
;
/* Optional short option name */
...
...
modules/access/dshow/dshow.cpp
View file @
acc457d1
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include <inttypes.h>
#include <inttypes.h>
#include <list>
#include <list>
#include <string>
#include <string>
#include <assert.h>
#include <vlc_common.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_plugin.h>
...
@@ -71,8 +72,7 @@ static size_t EnumDeviceCaps( vlc_object_t *, IBaseFilter *,
...
@@ -71,8 +72,7 @@ static size_t EnumDeviceCaps( vlc_object_t *, IBaseFilter *,
AM_MEDIA_TYPE
*
mt
,
size_t
);
AM_MEDIA_TYPE
*
mt
,
size_t
);
static
bool
ConnectFilters
(
vlc_object_t
*
,
access_sys_t
*
,
static
bool
ConnectFilters
(
vlc_object_t
*
,
access_sys_t
*
,
IBaseFilter
*
,
CaptureFilter
*
);
IBaseFilter
*
,
CaptureFilter
*
);
static
int
FindDevicesCallback
(
vlc_object_t
*
,
char
const
*
,
static
int
FindDevices
(
vlc_object_t
*
,
const
char
*
,
char
***
,
char
***
);
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
ConfigDevicesCallback
(
vlc_object_t
*
,
char
const
*
,
static
int
ConfigDevicesCallback
(
vlc_object_t
*
,
char
const
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
vlc_value_t
,
vlc_value_t
,
void
*
);
...
@@ -222,11 +222,11 @@ vlc_module_begin ()
...
@@ -222,11 +222,11 @@ vlc_module_begin ()
set_subcategory
(
SUBCAT_INPUT_ACCESS
)
set_subcategory
(
SUBCAT_INPUT_ACCESS
)
add_string
(
CFG_PREFIX
"vdev"
,
NULL
,
VDEV_TEXT
,
VDEV_LONGTEXT
,
false
)
add_string
(
CFG_PREFIX
"vdev"
,
NULL
,
VDEV_TEXT
,
VDEV_LONGTEXT
,
false
)
change_string_cb
(
FindDevices
Callback
)
change_string_cb
(
FindDevices
)
change_action_add
(
ConfigDevicesCallback
,
N_
(
"Configure"
)
)
change_action_add
(
ConfigDevicesCallback
,
N_
(
"Configure"
)
)
add_string
(
CFG_PREFIX
"adev"
,
NULL
,
ADEV_TEXT
,
ADEV_LONGTEXT
,
false
)
add_string
(
CFG_PREFIX
"adev"
,
NULL
,
ADEV_TEXT
,
ADEV_LONGTEXT
,
false
)
change_string_cb
(
FindDevices
Callback
)
change_string_cb
(
FindDevices
)
change_action_add
(
ConfigDevicesCallback
,
N_
(
"Configure"
)
)
change_action_add
(
ConfigDevicesCallback
,
N_
(
"Configure"
)
)
add_string
(
CFG_PREFIX
"size"
,
NULL
,
SIZE_TEXT
,
SIZE_LONGTEXT
,
false
)
add_string
(
CFG_PREFIX
"size"
,
NULL
,
SIZE_TEXT
,
SIZE_LONGTEXT
,
false
)
...
@@ -2010,32 +2010,10 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
...
@@ -2010,32 +2010,10 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
/*****************************************************************************
/*****************************************************************************
* config variable callback
* config variable callback
*****************************************************************************/
*****************************************************************************/
static
int
FindDevices
Callback
(
vlc_object_t
*
p_this
,
char
const
*
psz_name
,
static
int
FindDevices
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
,
vlc_value_t
,
void
*
)
char
***
vp
,
char
***
tp
)
{
{
module_config_t
*
p_item
;
bool
b_audio
=
!
strcmp
(
psz_name
,
CFG_PREFIX
"adev"
);
bool
b_audio
=
false
;
int
i
;
p_item
=
config_FindConfig
(
p_this
,
psz_name
);
if
(
!
p_item
)
return
VLC_SUCCESS
;
if
(
!
strcmp
(
psz_name
,
CFG_PREFIX
"adev"
)
)
b_audio
=
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 */
/* Find list of devices */
list
<
string
>
list_devices
;
list
<
string
>
list_devices
;
...
@@ -2048,25 +2026,28 @@ static int FindDevicesCallback( vlc_object_t *p_this, char const *psz_name,
...
@@ -2048,25 +2026,28 @@ static int FindDevicesCallback( vlc_object_t *p_this, char const *psz_name,
/* Uninitialize OLE/COM */
/* Uninitialize OLE/COM */
CoUninitialize
();
CoUninitialize
();
if
(
list_devices
.
empty
()
)
return
VLC_SUCCESS
;
unsigned
count
=
2
+
list_devices
.
size
(),
i
=
2
;
char
**
values
=
(
char
**
)
xmalloc
(
count
*
sizeof
(
*
values
)
);
char
**
texts
=
(
char
**
)
xmalloc
(
count
*
sizeof
(
*
texts
)
);
p_item
->
ppsz_list
=
(
char
**
)
xrealloc
(
p_item
->
ppsz_list
,
values
[
0
]
=
strdup
(
""
);
(
list_devices
.
size
()
+
3
)
*
sizeof
(
char
*
)
);
texts
[
0
]
=
strdup
(
N_
(
"Default"
)
);
p_item
->
ppsz_list_text
=
(
char
**
)
xrealloc
(
p_item
->
ppsz_list_text
,
values
[
1
]
=
strdup
(
"none"
);
(
list_devices
.
size
()
+
3
)
*
sizeof
(
char
*
)
);
texts
[
1
]
=
strdup
(
N_
(
"None"
)
);
list
<
string
>::
iterator
iter
;
for
(
list
<
string
>::
iterator
iter
=
list_devices
.
begin
()
;
for
(
iter
=
list_devices
.
begin
(),
i
=
2
;
iter
!=
list_devices
.
end
();
iter
!=
list_devices
.
end
();
++
iter
,
i
++
)
++
iter
)
{
{
p_item
->
ppsz_list
[
i
]
=
strdup
(
iter
->
c_str
()
);
assert
(
i
<
count
);
p_item
->
ppsz_list_text
[
i
]
=
NULL
;
values
[
i
]
=
strdup
(
iter
->
c_str
()
);
p_item
->
i_list
++
;
texts
[
i
]
=
strdup
(
iter
->
c_str
()
);
i
++
;
}
}
p_item
->
ppsz_list
[
i
]
=
NULL
;
p_item
->
ppsz_list_text
[
i
]
=
NULL
;
return
VLC_SUCCESS
;
*
vp
=
values
;
*
tp
=
texts
;
return
count
;
}
}
static
int
ConfigDevicesCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_name
,
static
int
ConfigDevicesCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_name
,
...
...
modules/audio_output/alsa.c
View file @
acc457d1
...
@@ -54,9 +54,8 @@ struct aout_sys_t
...
@@ -54,9 +54,8 @@ struct aout_sys_t
static
int
Open
(
vlc_object_t
*
);
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
int
FindDevicesCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_name
,
static
int
EnumDevices
(
vlc_object_t
*
,
char
const
*
,
char
***
,
char
***
);
vlc_value_t
newval
,
vlc_value_t
oldval
,
void
*
p_unused
);
static
void
GetDevices
(
vlc_object_t
*
,
const
char
*
);
static
void
GetDevices
(
vlc_object_t
*
,
module_config_t
*
,
const
char
*
);
#define AUDIO_DEV_TEXT N_("Audio output device")
#define AUDIO_DEV_TEXT N_("Audio output device")
#define AUDIO_DEV_LONGTEXT N_("Audio output device (using ALSA syntax).")
#define AUDIO_DEV_LONGTEXT N_("Audio output device (using ALSA syntax).")
...
@@ -81,7 +80,7 @@ vlc_module_begin ()
...
@@ -81,7 +80,7 @@ vlc_module_begin ()
set_subcategory
(
SUBCAT_AUDIO_AOUT
)
set_subcategory
(
SUBCAT_AUDIO_AOUT
)
add_string
(
"alsa-audio-device"
,
"default"
,
add_string
(
"alsa-audio-device"
,
"default"
,
AUDIO_DEV_TEXT
,
AUDIO_DEV_LONGTEXT
,
false
)
AUDIO_DEV_TEXT
,
AUDIO_DEV_LONGTEXT
,
false
)
change_string_cb
(
FindDevicesCallback
)
change_string_cb
(
EnumDevices
)
add_integer
(
"alsa-audio-channels"
,
AOUT_CHANS_FRONT
,
add_integer
(
"alsa-audio-channels"
,
AOUT_CHANS_FRONT
,
AUDIO_CHAN_TEXT
,
AUDIO_CHAN_LONGTEXT
,
false
)
AUDIO_CHAN_TEXT
,
AUDIO_CHAN_LONGTEXT
,
false
)
change_integer_list
(
channels
,
channels_text
)
change_integer_list
(
channels
,
channels_text
)
...
@@ -540,7 +539,7 @@ static int Open (vlc_object_t *obj)
...
@@ -540,7 +539,7 @@ static int Open (vlc_object_t *obj)
text
.
psz_string
=
_
(
"Audio Device"
);
text
.
psz_string
=
_
(
"Audio Device"
);
var_Change
(
obj
,
"audio-device"
,
VLC_VAR_SETTEXT
,
&
text
,
NULL
);
var_Change
(
obj
,
"audio-device"
,
VLC_VAR_SETTEXT
,
&
text
,
NULL
);
GetDevices
(
obj
,
NULL
,
device
);
GetDevices
(
obj
,
device
);
}
}
var_AddCallback
(
obj
,
"audio-device"
,
DeviceChanged
,
NULL
);
var_AddCallback
(
obj
,
"audio-device"
,
DeviceChanged
,
NULL
);
...
@@ -733,55 +732,68 @@ static void Reorder71 (void *p, size_t n, unsigned size)
...
@@ -733,55 +732,68 @@ static void Reorder71 (void *p, size_t n, unsigned size)
}
}
/**
***************************************************************************
/**
*
config variable callback
*
Enumerates ALSA output devices.
*
****************************************************************************
/
*/
static
int
FindDevicesCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_
name
,
static
int
EnumDevices
(
vlc_object_t
*
obj
,
char
const
*
var
name
,
vlc_value_t
newval
,
vlc_value_t
oldval
,
void
*
p_unused
)
char
***
restrict
vp
,
char
***
restrict
tp
)
{
{
module_config_t
*
p_item
;
unsigned
n
=
0
;
(
void
)
newval
;
(
void
)
oldval
;
char
**
names
=
xmalloc
(
sizeof
(
*
names
));
(
void
)
p_unused
;
char
**
descs
=
xmalloc
(
sizeof
(
*
names
));
names
[
0
]
=
strdup
(
"default"
);
descs
[
0
]
=
strdup
(
N_
(
"Default"
));
n
++
;
if
(
unlikely
(
names
[
0
]
==
NULL
||
descs
[
0
]
==
NULL
))
abort
();
p_item
=
config_FindConfig
(
p_this
,
psz_name
);
void
**
hints
;
if
(
!
p_item
)
return
VLC_SUCCESS
;
if
(
snd_device_name_hint
(
-
1
,
"pcm"
,
&
hints
)
<
0
)
return
n
;
/* Clear-up the current list */
for
(
size_t
i
=
0
;
hints
[
i
]
!=
NULL
;
i
++
)
if
(
p_item
->
i_list
)
{
{
int
i
;
void
*
hint
=
hints
[
i
];
char
*
name
=
snd_device_name_get_hint
(
hint
,
"NAME"
);
if
(
unlikely
(
name
==
NULL
))
continue
;
/* Keep the first entrie */
char
*
desc
=
snd_device_name_get_hint
(
hint
,
"DESC"
);
for
(
i
=
1
;
i
<
p_item
->
i_list
;
i
++
)
if
(
desc
==
NULL
)
{
{
free
(
(
char
*
)
p_item
->
ppsz_list
[
i
]
);
free
(
name
);
free
(
(
char
*
)
p_item
->
ppsz_list_text
[
i
]
)
;
continue
;
}
}
/* TODO: Remove when no more needed */
p_item
->
ppsz_list
[
i
]
=
NULL
;
p_item
->
ppsz_list_text
[
i
]
=
NULL
;
}
p_item
->
i_list
=
1
;
GetDevices
(
p_this
,
p_item
,
"default"
);
names
=
xrealloc
(
names
,
(
n
+
1
)
*
sizeof
(
*
names
));
descs
=
xrealloc
(
descs
,
(
n
+
1
)
*
sizeof
(
*
descs
));
names
[
n
]
=
name
;
descs
[
n
]
=
desc
;
n
++
;
}
snd_device_name_free_hint
(
hints
);
return
VLC_SUCCESS
;
(
void
)
obj
;
(
void
)
varname
;
*
vp
=
names
;
*
tp
=
descs
;
return
n
;
}
}
static
void
GetDevices
(
vlc_object_t
*
obj
,
module_config_t
*
item
,
static
void
GetDevices
(
vlc_object_t
*
obj
,
const
char
*
prefs_dev
)
const
char
*
prefs_dev
)
{
{
void
**
hints
;
void
**
hints
;
bool
hinted_default
=
false
;
bool
hinted_prefs
=
!
strcmp
(
prefs_dev
,
"default"
);
msg_Dbg
(
obj
,
"Available ALSA PCM devices:"
);
msg_Dbg
(
obj
,
"Available ALSA PCM devices:"
);
if
(
snd_device_name_hint
(
-
1
,
"pcm"
,
&
hints
)
<
0
)
if
(
snd_device_name_hint
(
-
1
,
"pcm"
,
&
hints
)
<
0
)
return
;
return
;
vlc_value_t
val
,
text
;
bool
hinted_default
=
false
;
bool
hinted_prefs
=
!
strcmp
(
prefs_dev
,
"default"
);
for
(
size_t
i
=
0
;
hints
[
i
]
!=
NULL
;
i
++
)
for
(
size_t
i
=
0
;
hints
[
i
]
!=
NULL
;
i
++
)
{
{
void
*
hint
=
hints
[
i
];
void
*
hint
=
hints
[
i
];
...
@@ -801,54 +813,27 @@ static void GetDevices (vlc_object_t *obj, module_config_t *item,
...
@@ -801,54 +813,27 @@ static void GetDevices (vlc_object_t *obj, module_config_t *item,
if
(
!
strcmp
(
name
,
prefs_dev
))
if
(
!
strcmp
(
name
,
prefs_dev
))
hinted_prefs
=
true
;
hinted_prefs
=
true
;
if
(
item
!=
NULL
)
val
.
psz_string
=
name
;
{
text
.
psz_string
=
desc
;
item
->
ppsz_list
=
xrealloc
(
item
->
ppsz_list
,
var_Change
(
obj
,
"audio-device"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
(
item
->
i_list
+
2
)
*
sizeof
(
char
*
));
free
(
desc
);
item
->
ppsz_list_text
=
xrealloc
(
item
->
ppsz_list_text
,
free
(
name
);
(
item
->
i_list
+
2
)
*
sizeof
(
char
*
));
item
->
ppsz_list
[
item
->
i_list
]
=
name
;
if
(
desc
==
NULL
)
desc
=
strdup
(
name
);
item
->
ppsz_list_text
[
item
->
i_list
]
=
desc
;
item
->
i_list
++
;
}
else
{
vlc_value_t
val
,
text
;
val
.
psz_string
=
name
;
text
.
psz_string
=
desc
;
var_Change
(
obj
,
"audio-device"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
free
(
desc
);
free
(
name
);
}
}
}
snd_device_name_free_hint
(
hints
);
snd_device_name_free_hint
(
hints
);
if
(
item
!=
NULL
)
if
(
!
hinted_default
)
{
{
item
->
ppsz_list
[
item
->
i_list
]
=
NULL
;
val
.
psz_string
=
(
char
*
)
"default"
;
item
->
ppsz_list_text
[
item
->
i_list
]
=
NULL
;
text
.
psz_string
=
(
char
*
)
N_
(
"Default"
);
var_Change
(
obj
,
"audio-device"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
}
}
else
{
vlc_value_t
val
,
text
;
if
(
!
hinted_default
)
val
.
psz_string
=
(
char
*
)
prefs_dev
;
{
if
(
!
hinted_prefs
)
val
.
psz_string
=
(
char
*
)
"default"
;
{
text
.
psz_string
=
(
char
*
)
N_
(
"Default"
);
text
.
psz_string
=
(
char
*
)
N_
(
"VLC preferences"
);
var_Change
(
obj
,
"audio-device"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
var_Change
(
obj
,
"audio-device"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
}
val
.
psz_string
=
(
char
*
)
prefs_dev
;
if
(
!
hinted_prefs
)
{
text
.
psz_string
=
(
char
*
)
N_
(
"VLC preferences"
);
var_Change
(
obj
,
"audio-device"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
}
var_Change
(
obj
,
"audio-device"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
}
}
var_Change
(
obj
,
"audio-device"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
}
}
modules/audio_output/directx.c
View file @
acc457d1
...
@@ -113,8 +113,8 @@ static void DestroyDSBuffer ( audio_output_t * );
...
@@ -113,8 +113,8 @@ static void DestroyDSBuffer ( audio_output_t * );
static
void
*
DirectSoundThread
(
void
*
);
static
void
*
DirectSoundThread
(
void
*
);
static
int
FillBuffer
(
audio_output_t
*
,
int
,
block_t
*
);
static
int
FillBuffer
(
audio_output_t
*
,
int
,
block_t
*
);
static
int
ReloadDirectXDevices
(
vlc_object_t
*
,
c
har
const
*
,
static
int
ReloadDirectXDevices
(
vlc_object_t
*
,
c
onst
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
char
***
,
char
**
*
);
/* Speaker setup override options list */
/* Speaker setup override options list */
static
const
char
*
const
speaker_list
[]
=
{
"Windows default"
,
"Mono"
,
"Stereo"
,
static
const
char
*
const
speaker_list
[]
=
{
"Windows default"
,
"Mono"
,
"Stereo"
,
...
@@ -1165,12 +1165,12 @@ static void* DirectSoundThread( void *data )
...
@@ -1165,12 +1165,12 @@ static void* DirectSoundThread( void *data )
* CallBackConfigNBEnum: callback to get the number of available devices
* CallBackConfigNBEnum: callback to get the number of available devices
*****************************************************************************/
*****************************************************************************/
static
int
CALLBACK
CallBackConfigNBEnum
(
LPGUID
p_guid
,
LPCWSTR
psz_desc
,
static
int
CALLBACK
CallBackConfigNBEnum
(
LPGUID
p_guid
,
LPCWSTR
psz_desc
,
LPCWSTR
psz_mod
,
LPVOID
p_nb
)
LPCWSTR
psz_mod
,
LPVOID
data
)
{
{
VLC_UNUSED
(
psz_mod
);
VLC_UNUSED
(
psz_desc
);
VLC_UNUSED
(
p_guid
)
;
int
*
p_nb
=
data
;
int
*
a
=
(
int
*
)
p_nb
;
(
*
p_nb
)
++
;
(
*
a
)
++
;
VLC_UNUSED
(
psz_mod
);
VLC_UNUSED
(
psz_desc
);
VLC_UNUSED
(
p_guid
)
;
return
true
;
return
true
;
}
}
...
@@ -1178,15 +1178,15 @@ static int CALLBACK CallBackConfigNBEnum( LPGUID p_guid, LPCWSTR psz_desc,
...
@@ -1178,15 +1178,15 @@ static int CALLBACK CallBackConfigNBEnum( LPGUID p_guid, LPCWSTR psz_desc,
* CallBackConfigEnum: callback to add available devices to the preferences list
* CallBackConfigEnum: callback to add available devices to the preferences list
*****************************************************************************/
*****************************************************************************/
static
int
CALLBACK
CallBackConfigEnum
(
LPGUID
p_guid
,
LPCWSTR
psz_desc
,
static
int
CALLBACK
CallBackConfigEnum
(
LPGUID
p_guid
,
LPCWSTR
psz_desc
,
LPCWSTR
psz_mod
,
LPVOID
_p_item
)
LPCWSTR
psz_mod
,
LPVOID
data
)
{
{
VLC_UNUSED
(
psz_mod
);
VLC_UNUSED
(
p_guid
)
;
char
**
values
=
data
;
module_config_t
*
p_item
=
(
module_config_t
*
)
_p_item
;
while
(
*
values
!=
NULL
)
values
++
;
*
values
=
FromWide
(
psz_desc
);
p_item
->
ppsz_list
[
p_item
->
i_list
]
=
FromWide
(
psz_desc
);
VLC_UNUSED
(
psz_mod
);
VLC_UNUSED
(
p_guid
);
p_item
->
ppsz_list_text
[
p_item
->
i_list
]
=
FromWide
(
psz_desc
);
p_item
->
i_list
++
;
return
true
;
return
true
;
}
}
...
@@ -1194,54 +1194,34 @@ static int CALLBACK CallBackConfigEnum( LPGUID p_guid, LPCWSTR psz_desc,
...
@@ -1194,54 +1194,34 @@ static int CALLBACK CallBackConfigEnum( LPGUID p_guid, LPCWSTR psz_desc,
* ReloadDirectXDevices: store the list of devices in preferences
* ReloadDirectXDevices: store the list of devices in preferences
*****************************************************************************/
*****************************************************************************/
static
int
ReloadDirectXDevices
(
vlc_object_t
*
p_this
,
char
const
*
psz_name
,
static
int
ReloadDirectXDevices
(
vlc_object_t
*
p_this
,
char
const
*
psz_name
,
vlc_value_t
newval
,
vlc_value_t
oldval
,
void
*
data
)
char
***
values
,
char
***
descs
)
{
{
VLC_UNUSED
(
newval
);
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
data
)
;
int
nb_devices
=
0
;
module_config_t
*
p_item
=
config_FindConfig
(
p_this
,
psz_name
);
(
void
)
psz_name
;
if
(
!
p_item
)
return
VLC_SUCCESS
;
/* Clear-up the current list */
HANDLE
hdsound_dll
=
LoadLibrary
(
_T
(
"DSOUND.DLL"
));
if
(
p_item
->
i_list
)
{
for
(
int
i
=
0
;
i
<
p_item
->
i_list
;
i
++
)
{
free
((
char
*
)(
p_item
->
ppsz_list
[
i
])
);
free
((
char
*
)(
p_item
->
ppsz_list_text
[
i
])
);
}
}
HRESULT
(
WINAPI
*
OurDirectSoundEnumerate
)(
LPDSENUMCALLBACKW
,
LPVOID
);
HANDLE
hdsound_dll
=
LoadLibrary
(
"DSOUND.DLL"
);
if
(
hdsound_dll
==
NULL
)
if
(
hdsound_dll
==
NULL
)
{
{
msg_Warn
(
p_this
,
"cannot open DSOUND.DLL"
);
msg_Warn
(
p_this
,
"cannot open DSOUND.DLL"
);
return
VLC_SUCCESS
;
goto
error
;
}
}
/* Get DirectSoundEnumerate */
/* Get DirectSoundEnumerate */
OurDirectSoundEnumerate
=
(
void
*
)
HRESULT
(
WINAPI
*
OurDirectSoundEnumerate
)(
LPDSENUMCALLBACKW
,
LPVOID
)
=
GetProcAddress
(
hdsound_dll
,
"DirectSoundEnumerateW"
);
(
void
*
)
GetProcAddress
(
hdsound_dll
,
_T
(
"DirectSoundEnumerateW"
)
);
if
(
OurDirectSoundEnumerate
==
NULL
)
if
(
OurDirectSoundEnumerate
==
NULL
)
goto
error
;
goto
error
;
int
nb_devices
=
0
;
OurDirectSoundEnumerate
(
CallBackConfigNBEnum
,
&
nb_devices
);
OurDirectSoundEnumerate
(
CallBackConfigNBEnum
,
&
nb_devices
);
msg_Dbg
(
p_this
,
"found %d devices"
,
nb_devices
);
msg_Dbg
(
p_this
,
"found %d devices"
,
nb_devices
);
p_item
->
ppsz_list
=
xrealloc
(
p_item
->
ppsz_list
,
nb_devices
*
sizeof
(
char
*
)
);
p_item
->
ppsz_list_text
=
xrealloc
(
p_item
->
ppsz_list_text
,
nb_devices
*
sizeof
(
char
*
)
);
p_item
->
i_list
=
0
;
OurDirectSoundEnumerate
(
CallBackConfigEnum
,
p_item
);
*
values
=
xcalloc
(
nb_devices
,
sizeof
(
char
*
)
);
OurDirectSoundEnumerate
(
CallBackConfigEnum
,
*
values
);
*
descs
=
xcalloc
(
nb_devices
,
sizeof
(
char
*
)
);
OurDirectSoundEnumerate
(
CallBackConfigEnum
,
*
descs
);
error:
error:
FreeLibrary
(
hdsound_dll
);
FreeLibrary
(
hdsound_dll
);
return
nb_devices
;
return
VLC_SUCCESS
;
}
}
modules/audio_output/waveout.c
View file @
acc457d1
...
@@ -73,8 +73,8 @@ static int MuteSet( audio_output_t *, bool );
...
@@ -73,8 +73,8 @@ static int MuteSet( audio_output_t *, bool );
static
int
WaveOutClearDoneBuffers
(
aout_sys_t
*
p_sys
);
static
int
WaveOutClearDoneBuffers
(
aout_sys_t
*
p_sys
);
static
int
ReloadWaveoutDevices
(
vlc_object_t
*
,
c
har
const
*
,
static
int
ReloadWaveoutDevices
(
vlc_object_t
*
,
c
onst
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
char
***
,
char
**
*
);
static
uint32_t
findDeviceID
(
char
*
);
static
uint32_t
findDeviceID
(
char
*
);
static
const
wchar_t
device_name_fmt
[]
=
L"%ls ($%x,$%x)"
;
static
const
wchar_t
device_name_fmt
[]
=
L"%ls ($%x,$%x)"
;
...
@@ -172,11 +172,6 @@ static int Open( vlc_object_t *p_this )
...
@@ -172,11 +172,6 @@ static int Open( vlc_object_t *p_this )
p_aout
->
pf_pause
=
aout_PacketPause
;
p_aout
->
pf_pause
=
aout_PacketPause
;
p_aout
->
pf_flush
=
aout_PacketFlush
;
p_aout
->
pf_flush
=
aout_PacketFlush
;
/*
initialize/update Device selection List
*/
ReloadWaveoutDevices
(
p_this
,
"waveout-audio-device"
,
val
,
val
,
NULL
);
/*
/*
check for configured audio device!
check for configured audio device!
*/
*/
...
@@ -1041,39 +1036,20 @@ static int MuteSet( audio_output_t * p_aout, bool mute )
...
@@ -1041,39 +1036,20 @@ static int MuteSet( audio_output_t * p_aout, bool mute )
reload the configuration drop down list, of the Audio Devices
reload the configuration drop down list, of the Audio Devices
*/
*/
static
int
ReloadWaveoutDevices
(
vlc_object_t
*
p_this
,
char
const
*
psz_name
,
static
int
ReloadWaveoutDevices
(
vlc_object_t
*
p_this
,
char
const
*
psz_name
,
vlc_value_t
newval
,
vlc_value_t
oldval
,
void
*
data
)
char
***
values
,
char
***
descs
)
{
{
VLC_UNUSED
(
newval
);
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
data
);
int
n
=
0
,
nb_devices
=
waveOutGetNumDevs
();
module_config_t
*
p_item
=
config_FindConfig
(
p_this
,
psz_name
);
if
(
!
p_item
)
return
VLC_SUCCESS
;
/* Clear-up the current list */
if
(
p_item
->
i_list
)
{
int
i
;
/* Keep the first entry */
VLC_UNUSED
(
psz_name
);
for
(
i
=
1
;
i
<
p_item
->
i_list
;
i
++
)
{
free
((
char
*
)(
p_item
->
ppsz_list
[
i
])
);
free
((
char
*
)(
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
=
1
;
int
wave_devices
=
waveOutGetNumDevs
();
*
values
=
xmalloc
(
(
nb_devices
+
1
)
*
sizeof
(
char
*
)
);
*
descs
=
xmalloc
(
(
nb_devices
+
1
)
*
sizeof
(
char
*
)
);
p_item
->
ppsz_list
=
xrealloc
(
p_item
->
ppsz_list
,
(
*
values
)[
n
]
=
strdup
(
"wavemapper"
);
(
wave_devices
+
2
)
*
sizeof
(
char
*
)
);
(
*
descs
)[
n
]
=
strdup
(
_
(
"Microsoft Soundmapper"
)
);
p_item
->
ppsz_list_text
=
xrealloc
(
p_item
->
ppsz_list_text
,
n
++
;
(
wave_devices
+
2
)
*
sizeof
(
char
*
)
);
int
j
=
1
;
for
(
int
i
=
0
;
i
<
nb_devices
;
i
++
)
for
(
int
i
=
0
;
i
<
wave_devices
;
i
++
)
{
{
WAVEOUTCAPS
caps
;
WAVEOUTCAPS
caps
;
wchar_t
dev_name
[
MAXPNAMELEN
+
32
];
wchar_t
dev_name
[
MAXPNAMELEN
+
32
];
...
@@ -1083,16 +1059,13 @@ static int ReloadWaveoutDevices( vlc_object_t *p_this, char const *psz_name,
...
@@ -1083,16 +1059,13 @@ static int ReloadWaveoutDevices( vlc_object_t *p_this, char const *psz_name,
continue
;
continue
;
_snwprintf
(
dev_name
,
MAXPNAMELEN
+
32
,
device_name_fmt
,
_snwprintf
(
dev_name
,
MAXPNAMELEN
+
32
,
device_name_fmt
,
caps
.
szPname
,
caps
.
wMid
,
caps
.
wPid
);
caps
.
szPname
,
caps
.
wMid
,
caps
.
wPid
);
p_item
->
ppsz_list
[
j
]
=
FromWide
(
dev_name
);
(
*
values
)[
n
]
=
FromWide
(
dev_name
);
p_item
->
ppsz_list_text
[
j
]
=
FromWide
(
dev_name
);
(
*
descs
)[
n
]
=
strdup
(
(
*
values
)[
n
]
);
p_item
->
i_list
++
;
n
++
;
j
++
;
}
}
p_item
->
ppsz_list
[
j
]
=
NULL
;
p_item
->
ppsz_list_text
[
j
]
=
NULL
;
return
VLC_SUCCESS
;
return
n
;
}
}
/*
/*
...
...
modules/video_output/msw/directx.c
View file @
acc457d1
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
#include <vlc_plugin.h>
#include <vlc_plugin.h>
#include <vlc_vout_display.h>
#include <vlc_vout_display.h>
#include <vlc_playlist.h>
/* needed for wallpaper */
#include <vlc_playlist.h>
/* needed for wallpaper */
#include <vlc_charset.h>
#include <windows.h>
#include <windows.h>
#include <winuser.h>
#include <winuser.h>
...
@@ -87,8 +88,8 @@
...
@@ -87,8 +88,8 @@
static
int
Open
(
vlc_object_t
*
);
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
int
FindDevicesCallback
(
vlc_object_t
*
,
char
const
*
,
static
int
FindDevicesCallback
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
char
***
,
char
**
*
);
vlc_module_begin
()
vlc_module_begin
()
set_shortname
(
"DirectX"
)
set_shortname
(
"DirectX"
)
set_description
(
N_
(
"DirectX (DirectDraw) video output"
))
set_description
(
N_
(
"DirectX (DirectDraw) video output"
))
...
@@ -1404,70 +1405,66 @@ static int WallpaperCallback(vlc_object_t *object, char const *cmd,
...
@@ -1404,70 +1405,66 @@ static int WallpaperCallback(vlc_object_t *object, char const *cmd,
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
typedef
struct
{
char
**
values
;
char
**
descs
;
size_t
count
;
}
enum_context_t
;
/*****************************************************************************
/*****************************************************************************
* config variable callback
* config variable callback
*****************************************************************************/
*****************************************************************************/
static
BOOL
WINAPI
DirectXEnumCallback2
(
GUID
*
guid
,
LPTSTR
desc
,
static
BOOL
WINAPI
DirectXEnumCallback2
(
GUID
*
guid
,
LPTSTR
desc
,
LPTSTR
drivername
,
VOID
*
context
,
LPTSTR
drivername
,
VOID
*
data
,
HMONITOR
hmon
)
HMONITOR
hmon
)
{
{
VLC_UNUSED
(
guid
);
VLC_UNUSED
(
desc
);
VLC_UNUSED
(
hmon
)
;
enum_context_t
*
ctx
=
data
;
module_config_t
*
item
=
context
;
VLC_UNUSED
(
guid
);
VLC_UNUSED
(
desc
);
VLC_UNUSED
(
hmon
)
;
item
->
ppsz_list
=
xrealloc
(
item
->
ppsz_list
,
ctx
->
values
=
xrealloc
(
ctx
->
values
,
(
ctx
->
count
+
1
)
*
sizeof
(
char
*
));
(
item
->
i_list
+
2
)
*
sizeof
(
char
*
));
ctx
->
descs
=
xrealloc
(
ctx
->
descs
,
(
ctx
->
count
+
1
)
*
sizeof
(
char
*
));
item
->
ppsz_list_text
=
xrealloc
(
item
->
ppsz_list_text
,
(
item
->
i_list
+
2
)
*
sizeof
(
char
*
));
item
->
ppsz_list
[
item
->
i_list
]
=
strdup
(
drivername
);
/* TODO? Unicode APIs */
item
->
ppsz_list_text
[
item
->
i_list
]
=
NULL
;
ctx
->
values
[
ctx
->
count
]
=
FromANSI
(
drivername
);
item
->
i_list
++
;
ctx
->
descs
[
ctx
->
count
]
=
FromANSI
(
drivername
);
item
->
ppsz_list
[
item
->
i_list
]
=
NULL
;
ctx
->
count
++
;
item
->
ppsz_list_text
[
item
->
i_list
]
=
NULL
;
return
TRUE
;
/* Keep enumerating */
return
TRUE
;
/* Keep enumerating */
}
}
static
int
FindDevicesCallback
(
vlc_object_t
*
object
,
c
har
const
*
name
,
static
int
FindDevicesCallback
(
vlc_object_t
*
object
,
c
onst
char
*
name
,
vlc_value_t
newval
,
vlc_value_t
oldval
,
void
*
data
)
char
***
values
,
char
***
descs
)
{
{
VLC_UNUSED
(
newval
);
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
data
);
enum_context_t
ctx
;
module_config_t
*
item
=
config_FindConfig
(
object
,
name
);
ctx
.
values
=
xmalloc
(
sizeof
(
char
*
));
if
(
!
item
)
ctx
.
descs
=
xmalloc
(
sizeof
(
char
*
));
return
VLC_SUCCESS
;
ctx
.
values
[
0
]
=
strdup
(
""
);
ctx
.
descs
[
0
]
=
strdup
(
_
(
"Default"
));
/* Clear-up the current list */
ctx
.
count
=
1
;
if
(
item
->
i_list
>
0
)
{
int
i
;
/* Keep the first entry */
for
(
i
=
1
;
i
<
item
->
i_list
;
i
++
)
{
free
(
item
->
ppsz_list
[
i
]);
free
(
item
->
ppsz_list_text
[
i
]);
}
/* TODO: Remove when no more needed */
item
->
ppsz_list
[
i
]
=
NULL
;
item
->
ppsz_list_text
[
i
]
=
NULL
;
}
item
->
i_list
=
1
;
/* Load direct draw DLL */
/* Load direct draw DLL */
HINSTANCE
hddraw_dll
=
LoadLibrary
(
_T
(
"DDRAW.DLL"
));
HINSTANCE
hddraw_dll
=
LoadLibrary
(
_T
(
"DDRAW.DLL"
));
if
(
!
hddraw_dll
)
if
(
hddraw_dll
!=
NULL
)
return
VLC_SUCCESS
;
{
/* Enumerate displays */
/* Enumerate displays */
HRESULT
(
WINAPI
*
OurDirectDrawEnumerateEx
)(
LPDDENUMCALLBACKEXA
,
HRESULT
(
WINAPI
*
OurDirectDrawEnumerateEx
)(
LPDDENUMCALLBACKEXA
,
LPVOID
,
DWORD
)
=
LPVOID
,
DWORD
)
=
(
void
*
)
GetProcAddress
(
hddraw_dll
,
_T
(
"DirectDrawEnumerateExA"
));
(
void
*
)
GetProcAddress
(
hddraw_dll
,
_T
(
"DirectDrawEnumerateExA"
));
if
(
OurDirectDrawEnumerateEx
!=
NULL
)
if
(
OurDirectDrawEnumerateEx
)
OurDirectDrawEnumerateEx
(
DirectXEnumCallback2
,
&
ctx
,
OurDirectDrawEnumerateEx
(
DirectXEnumCallback2
,
item
,
DDENUM_ATTACHEDSECONDARYDEVICES
);
DDENUM_ATTACHEDSECONDARYDEVICES
);
FreeLibrary
(
hddraw_dll
);
}
FreeLibrary
(
hddraw_dll
);
VLC_UNUSED
(
object
);
VLC_UNUSED
(
name
);
return
VLC_SUCCESS
;
*
values
=
ctx
.
values
;
*
descs
=
ctx
.
descs
;
return
ctx
.
count
;
}
}
src/config/core.c
View file @
acc457d1
...
@@ -398,11 +398,7 @@ ssize_t config_GetPszChoices (vlc_object_t *obj, const char *name,
...
@@ -398,11 +398,7 @@ ssize_t config_GetPszChoices (vlc_object_t *obj, const char *name,
}
}
if
(
cfg
->
pf_update_list
!=
NULL
)
if
(
cfg
->
pf_update_list
!=
NULL
)
{
return
cfg
->
pf_update_list
(
obj
,
name
,
values
,
texts
);
/* FIXME: not thread-safe */
vlc_value_t
dummy
=
{
.
psz_string
=
(
char
*
)
""
};
cfg
->
pf_update_list
(
obj
,
name
,
dummy
,
dummy
,
NULL
);
}
size_t
count
=
cfg
->
i_list
;
size_t
count
=
cfg
->
i_list
;
if
(
count
==
0
)
if
(
count
==
0
)
...
...
src/modules/entry.c
View file @
acc457d1
...
@@ -422,7 +422,7 @@ static int vlc_plugin_setter (void *plugin, void *tgt, int propid, ...)
...
@@ -422,7 +422,7 @@ static int vlc_plugin_setter (void *plugin, void *tgt, int propid, ...)
}
}
case
VLC_CONFIG_LIST_CB
:
case
VLC_CONFIG_LIST_CB
:
item
->
pf_update_list
=
va_arg
(
ap
,
vlc_
callback_t
);
item
->
pf_update_list
=
va_arg
(
ap
,
vlc_
string_list_cb
);
break
;
break
;
default:
default:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment