<html><head></head><body>Hi,<br><br>The name callback is used by DShow. I can't remove it. Integer callbacks were used by Xvideo until that whole plugin was removed, but there are no glaring reasons why it wouldn't get used by something else later.<br><br><div class="gmail_quote">Le 19 juillet 2019 10:17:59 GMT+03:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">On 2019-07-18 21:29, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">...out of the descriptor, to some new place with better type safety.<hr> include/vlc_plugin.h | 34 ++++++++++++++++++++------<br> modules/access/dshow/dshow.cpp | 5 ++--<br> modules/audio_output/alsa.c | 3 ++-<br> modules/audio_output/directsound.c | 4 +--<br> modules/audio_output/mmdevice.c | 3 ++-<br> modules/audio_output/waveout.c | 4 +--<br> modules/video_output/win32/direct3d9.c | 5 ++--<br> src/config/core.c | 24 ++++++++----------<br> 8 files changed, 48 insertions(+), 34 deletions(-)<br><br>diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h<br>index 4ff6e86348..d8a7fcb65b 100644<br>--- a/include/vlc_plugin.h<br>+++ b/include/vlc_plugin.h<br>@@ -244,6 +244,15 @@ EXTERN_SYMBOL typedef int (*vlc_set_cb) (void *, void *, int, ...);<br> #define vlc_module_set(...) vlc_set (opaque, module, __VA_ARGS__)<br> #define vlc_config_set(...) vlc_set (opaque, config, __VA_ARGS__)<br> <br>+EXTERN_SYMBOL DLL_SYMBOL<br>+int CDECL_SYMBOL VLC_SYMBOL(vlc_entry)(vlc_set_cb, void *);<br>+EXTERN_SYMBOL DLL_SYMBOL<br>+int CDECL_SYMBOL VLC_SYMBOL(vlc_entry_cfg_int_enum)(const char *name,<br>+ int64_t **values, char ***descs);<br>+EXTERN_SYMBOL DLL_SYMBOL<br>+int CDECL_SYMBOL VLC_SYMBOL(vlc_entry_cfg_str_enum)(const char *name,<br>+ char ***values, char ***descs);<br>+<br> /*<br> * InitModule: this function is called once and only once, when the module<br> * is looked at for the first time. We get the useful data from it, for<br>@@ -252,8 +261,6 @@ EXTERN_SYMBOL typedef int (*vlc_set_cb) (void *, void *, int, ...);<br> */<br> #define vlc_module_begin() \<br> EXTERN_SYMBOL DLL_SYMBOL \<br>-int CDECL_SYMBOL VLC_SYMBOL(vlc_entry)(vlc_set_cb, void *); \<br>-EXTERN_SYMBOL DLL_SYMBOL \<br> int CDECL_SYMBOL VLC_SYMBOL(vlc_entry)(vlc_set_cb vlc_set, void *opaque) \<br> { \<br> module_t *module; \<br>@@ -464,18 +471,12 @@ VLC_METADATA_EXPORTS<br> (const char *const *)(list), \<br> (const char *const *)(list_text));<br> <br>-#define change_string_cb( cb ) \<br>- vlc_config_set (VLC_CONFIG_LIST_CB, #cb, (void *)(cb));<br>-<br> #define change_integer_list( list, list_text ) \<br> vlc_config_set (VLC_CONFIG_LIST, \<br> (size_t)(sizeof (list) / sizeof (int)), \<br> (const int *)(list), \<br> (const char *const *)(list_text));<br> <br>-#define change_integer_cb( cb ) \<br>- vlc_config_set (VLC_CONFIG_LIST_CB, #cb, (cb));<br>-<br> #define change_integer_range( minv, maxv ) \<br> vlc_config_set (VLC_CONFIG_RANGE, (int64_t)(minv), (int64_t)(maxv));<br> <br>@@ -494,6 +495,23 @@ VLC_METADATA_EXPORTS<br> #define change_safe() \<br> vlc_config_set (VLC_CONFIG_SAFE);<br> <br>+/* Configuration item choice enumerators */<br>+#define VLC_CONFIG_INTEGER_ENUM(cb) \<br>+EXTERN_SYMBOL DLL_SYMBOL \<br>+int CDECL_SYMBOL VLC_SYMBOL(vlc_entry_cfg_int_enum)(const char *name, \<br>+ int64_t **values, char ***descs) \<br>+{ \<br>+ return (cb)(name, values, descs); \<br>+}<br>+<br>+#define VLC_CONFIG_STRING_ENUM(cb) \<br>+EXTERN_SYMBOL DLL_SYMBOL \<br>+int CDECL_SYMBOL VLC_SYMBOL(vlc_entry_cfg_str_enum)(const char *name, \<br>+ char ***values, char ***descs) \<br>+{ \<br>+ return (cb)(name, values, descs); \<br>+}<br>+<br> /* Meta data plugin exports */<br> #define VLC_META_EXPORT( name, value ) \<br> EXTERN_SYMBOL DLL_SYMBOL const char * CDECL_SYMBOL \<br>diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp<br>index 1076e64085..f5a6604d6a 100644<br>--- a/modules/access/dshow/dshow.cpp<br>+++ b/modules/access/dshow/dshow.cpp<br>@@ -70,7 +70,6 @@ static size_t EnumDeviceCaps( vlc_object_t *, IBaseFilter *,<br> AM_MEDIA_TYPE *mt, size_t, bool );<br> static bool ConnectFilters( vlc_object_t *, access_sys_t *,<br> IBaseFilter *, CaptureFilter * );<br>-static int FindDevices( const char *, char ***, char *** );<br> <br> static void ShowPropertyPage( IUnknown * );<br> static void ShowDeviceProperties( vlc_object_t *, ICaptureGraphBuilder2 *,<br>@@ -193,10 +192,8 @@ vlc_module_begin ()<br> set_category( CAT_INPUT )<br> set_subcategory( SUBCAT_INPUT_ACCESS )<br> add_string( "dshow-vdev", NULL, VDEV_TEXT, VDEV_LONGTEXT, false)<br>- change_string_cb( FindDevices )<br> <br> add_string( "dshow-adev", NULL, ADEV_TEXT, ADEV_LONGTEXT, false)<br>- change_string_cb( FindDevices )<br> <br> add_string( "dshow-size", NULL, SIZE_TEXT, SIZE_LONGTEXT, false)<br> change_safe()<br>@@ -2077,6 +2074,8 @@ static int FindDevices( const char *psz_name, char ***vp, char ***tp )<br> return count;<br> }<br> <br>+VLC_CONFIG_STRING_ENUM(FindDevices)<br>+<br> /*****************************************************************************<br> * Properties<br> *****************************************************************************/<br>diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c<br>index ccf9435b1d..63056de522 100644<br>--- a/modules/audio_output/alsa.c<br>+++ b/modules/audio_output/alsa.c<br>@@ -98,7 +98,6 @@ vlc_module_begin ()<br> set_subcategory( SUBCAT_AUDIO_AOUT )<br> add_string ("alsa-audio-device", "default",<br> AUDIO_DEV_TEXT, AUDIO_DEV_LONGTEXT, false)<br>- change_string_cb (EnumDevices)<br> add_integer ("alsa-audio-channels", AOUT_CHANS_FRONT,<br> AUDIO_CHAN_TEXT, AUDIO_CHAN_LONGTEXT, false)<br> change_integer_list (channels, channels_text)<br>@@ -804,6 +803,8 @@ static int EnumDevices(char const *varname,<br> return n;<br> }<br> <br>+VLC_CONFIG_STRING_ENUM(EnumDevices)<br>+<br> static int DeviceSelect (audio_output_t *aout, const char *id)<br> {<br> aout_sys_t *sys = aout->sys;<br>diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c<br>index 9c55b34727..45f5885734 100644<br>--- a/modules/audio_output/directsound.c<br>+++ b/modules/audio_output/directsound.c<br>@@ -46,7 +46,6 @@ static int Open( vlc_object_t * );<br> static void Close( vlc_object_t * );<br> static HRESULT StreamStart( aout_stream_t *, audio_sample_format_t *,<br> const GUID * );<br>-static int ReloadDirectXDevices( const char *, char ***, char *** );<br> static void * PlayedDataEraser( void * );<br> /* Speaker setup override options list */<br> static const char *const speaker_list[] = { "Windows default", "Mono", "Stereo",<br>@@ -75,7 +74,6 @@ vlc_module_begin ()<br> <br> add_string( "directx-audio-device", NULL,<br> DEVICE_TEXT, DEVICE_LONGTEXT, false )<br>- change_string_cb( ReloadDirectXDevices )<br> add_obsolete_string( "directx-audio-device-name")<br> add_bool( "directx-audio-float32", true, FLOAT_TEXT,<br> FLOAT_LONGTEXT, true )<br>@@ -1045,6 +1043,8 @@ static int ReloadDirectXDevices( char const *psz_name,<br> return list.count;<br> }<br> <br>+VLC_CONFIG_STRING_ENUM(ReloadDirectXDevices)<br>+<br> static int DeviceSelect (audio_output_t *aout, const char *id)<br> {<br> var_SetString(aout, "directx-audio-device", (id != NULL) ? id : "");<br>diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c<br>index de42ffd6a4..cb05f46597 100644<br>--- a/modules/audio_output/mmdevice.c<br>+++ b/modules/audio_output/mmdevice.c<br>@@ -1443,6 +1443,8 @@ error:<br> return list.count;<br> }<br> <br>+VLC_CONFIG_STRING_ENUM(ReloadAudioDevices)<br>+<br> #define MM_PASSTHROUGH_TEXT N_( \<br> "HDMI/SPDIF audio passthrough")<br> #define MM_PASSTHROUGH_LONGTEXT N_( \<br>@@ -1478,7 +1480,6 @@ vlc_module_begin()<br> change_integer_list( pi_mmdevice_passthrough_values,<br> ppsz_mmdevice_passthrough_texts )<br> add_string("mmdevice-audio-device", NULL, DEVICE_TEXT, DEVICE_LONGTEXT, false)<br>- change_string_cb(ReloadAudioDevices)<br> add_float("mmdevice-volume", 1.f, VOLUME_TEXT, VOLUME_LONGTEXT, true)<br> change_float_range( 0.f, 1.25f )<br> vlc_module_end()<br>diff --git a/modules/audio_output/waveout.c b/modules/audio_output/waveout.c<br>index 736a5f016c..990b1e8b8d 100644<br>--- a/modules/audio_output/waveout.c<br>+++ b/modules/audio_output/waveout.c<br>@@ -76,7 +76,6 @@ static void WaveOutClean( aout_sys_t * p_sys );<br> <br> static void WaveOutClearBuffer( HWAVEOUT, WAVEHDR *);<br> <br>-static int ReloadWaveoutDevices( const char *, char ***, char *** );<br> static uint32_t findDeviceID(char *);<br> static int WaveOutTimeGet(audio_output_t * , vlc_tick_t *);<br> static void WaveOutFlush( audio_output_t *);<br>@@ -154,7 +153,6 @@ vlc_module_begin ()<br> set_subcategory( SUBCAT_AUDIO_AOUT )<br> add_string( "waveout-audio-device", "wavemapper",<br> DEVICE_TEXT, DEVICE_LONG, false )<br>- change_string_cb( ReloadWaveoutDevices )<br> add_float( "waveout-volume", 1.0f, VOLUME_TEXT, NULL, true )<br> change_float_range(0.0f, 2.0f)<br> add_bool( "waveout-float32", true, FLOAT_TEXT, FLOAT_LONGTEXT, true )<br>@@ -718,6 +716,8 @@ static int ReloadWaveoutDevices( char const *psz_name,<br> return n;<br> }<br> <br>+VLC_CONFIG_STRING_ENUM(ReloadWaveoutDevices)<br>+<br> /*<br> convert devicename to device ID for output<br> if device not found return WAVE_MAPPER, so let<br>diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c<br>index a411e705cd..5372ffd465 100644<br>--- a/modules/video_output/win32/direct3d9.c<br>+++ b/modules/video_output/win32/direct3d9.c<br>@@ -96,8 +96,6 @@ static void GLConvClose(vlc_object_t *);<br> <br> #define D3D9_HELP N_("Recommended video output for Windows Vista and later versions")<br> <br>-static int FindShadersCallback(const char *, char ***, char ***);<br>-<br> vlc_module_begin ()<br> set_shortname("Direct3D9")<br> set_description(N_("Direct3D9 video output"))<br>@@ -109,7 +107,6 @@ vlc_module_begin ()<br> add_bool("directx-hw-yuv", true, HW_YUV_TEXT, HW_YUV_LONGTEXT, true)<br> <br> add_string("direct3d9-shader", "", PIXEL_SHADER_TEXT, PIXEL_SHADER_LONGTEXT, true)<br>- change_string_cb(FindShadersCallback)<br> add_loadfile("direct3d9-shader-file", NULL,<br> PIXEL_SHADER_FILE_TEXT, PIXEL_SHADER_FILE_LONGTEXT)<br> <br>@@ -1599,6 +1596,8 @@ static int FindShadersCallback(const char *name, char ***values, char ***descs)<br> <br> }<br> <br>+VLC_CONFIG_STRING_ENUM(FindShadersCallback)<br>+<br> static bool LocalSwapchainSetupDevice( void **opaque, const libvlc_video_direct3d_device_cfg_t *cfg, libvlc_video_direct3d_device_setup_t *out )<br> {<br> vout_display_t *vd = *opaque;<br>diff --git a/src/config/core.c b/src/config/core.c<br>index e2767e371c..8fb7d82fee 100644<br>--- a/src/config/core.c<br>+++ b/src/config/core.c<br>@@ -205,15 +205,13 @@ ssize_t config_GetIntChoices(const char *name,<br> size_t count = cfg->list_count;<br> if (count == 0)<br> {<br>- if (module_Map(NULL, cfg->owner))<br>- {<br>- errno = EIO;<br>- return -1;<br>- }<br>+ int (*cb)(const char *, int64_t **, char ***);<br> <br>- if (cfg->list.i_cb == NULL)<br>+ cb = module_Symbol(NULL, cfg->owner, "vlc_entry_cfg_int_enum");<br>+ if (cb == NULL)<br> return 0;<br>- return cfg->list.i_cb(name, values, texts);<br>+<br>+ return cb(name, values, texts);<br></blockquote><br>It seems the 'name' parameter is never used in any of the callbacks, so <br>we could just remove it.<br><br>And why not use vlc_integer_list_cb which already exist ?<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> }<br> <br> int64_t *vals = vlc_alloc (count, sizeof (*vals));<br>@@ -338,15 +336,13 @@ ssize_t config_GetPszChoices(const char *name,<br> size_t count = cfg->list_count;<br> if (count == 0)<br> {<br>- if (module_Map(NULL, cfg->owner))<br>- {<br>- errno = EIO;<br>- return -1;<br>- }<br>+ int (*cb)(const char *, char ***, char ***);<br></blockquote><br>Same question for vlc_string_list_cb.<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">- if (cfg->list.psz_cb == NULL)<br>+ cb = module_Symbol(NULL, cfg->owner, "vlc_entry_cfg_str_enum");<br>+ if (cb == NULL)<br> return 0;<br>- return cfg->list.psz_cb(name, values, texts);<br>+<br>+ return cb(name, values, texts);<br> }<br> <br> char **vals = malloc (sizeof (*vals) * count);<br>-- <br>2.22.0<hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>