#include <vlc_common.h>
#include <vlc_plugin.h>
-#undef vlc_module_set
-#undef vlc_config_set
#include <assert.h>
#include <stdarg.h>
#include "modules/modules.h"
#include "config/configuration.h"
#include "libvlc.h"
-#ifndef ENABLE_NLS
-# define dgettext(d, m) ((char *)(m))
-#endif
static void vlc_module_destruct (gc_object_t *obj)
{
module->submodule_count++;
/* Muahahaha! Heritage! Polymorphism! Ugliness!! */
- memcpy (submodule->pp_shortcuts, module->pp_shortcuts,
- sizeof (submodule->pp_shortcuts));
+ submodule->pp_shortcuts[0] = module->pp_shortcuts[0]; /* object name */
+ for (unsigned i = 1; i < MODULE_SHORTCUT_MAX; i++)
+ submodule->pp_shortcuts[i] = NULL;
submodule->psz_object_name = strdup( module->psz_object_name );
submodule->psz_shortname = module->psz_shortname;
return submodule;
}
-module_config_t *vlc_config_create (module_t *module, int type)
+static module_config_t *vlc_config_create (module_t *module, int type)
{
unsigned confsize = module->confsize;
module_config_t *tab = module->p_config;
va_start (ap, propid);
switch (propid)
{
+ case VLC_SUBMODULE_CREATE:
+ {
+ module_t **pp = va_arg (ap, module_t **);
+ *pp = vlc_submodule_create (module);
+ if (*pp == NULL)
+ ret = -1;
+ break;
+ }
+
+ case VLC_CONFIG_CREATE:
+ {
+ int type = va_arg (ap, int);
+ module_config_t **pp = va_arg (ap, module_config_t **);
+ *pp = vlc_config_create (module, type);
+ if (*pp == NULL)
+ ret = -1;
+ break;
+ }
+
case VLC_MODULE_CPU_REQUIREMENT:
assert (!module->b_submodule);
module->i_cpu |= va_arg (ap, int);
}
case VLC_MODULE_SHORTNAME:
- {
- const char *domain = va_arg (ap, const char *);
- if (domain == NULL)
- domain = PACKAGE;
- module->psz_shortname = dgettext (domain, va_arg (ap, char *));
+ module->psz_shortname = va_arg (ap, char *);
break;
- }
case VLC_MODULE_DESCRIPTION:
- {
- const char *domain = va_arg (ap, const char *);
- if (domain == NULL)
- domain = PACKAGE;
- module->psz_longname = dgettext (domain, va_arg (ap, char *));
+ module->psz_longname = va_arg (ap, char *);
break;
- }
case VLC_MODULE_HELP:
- {
- const char *domain = va_arg (ap, const char *);
- if (domain == NULL)
- domain = PACKAGE;
- module->psz_help = dgettext (domain, va_arg (ap, char *));
+ module->psz_help = va_arg (ap, char *);
+ break;
+
+ case VLC_MODULE_TEXTDOMAIN:
+ (void) va_arg (ap, const char *);
+ /* FIXME: not implemented */
break;
- }
case VLC_CONFIG_NAME:
{
case VLC_CONFIG_DESC:
{
- const char *domain = va_arg (ap, const char *);
const char *text = va_arg (ap, const char *);
const char *longtext = va_arg (ap, const char *);
- if (domain == NULL)
- domain = PACKAGE;
- item->psz_text = text ? strdup (dgettext (domain, text)) : NULL;
- item->psz_longtext =
- longtext ? strdup (dgettext (domain, longtext)) : NULL;
+ item->psz_text = text ? strdup (text) : NULL;
+ item->psz_longtext = longtext ? strdup (longtext) : NULL;
break;
}
case VLC_CONFIG_LIST:
{
- const char *domain = va_arg (ap, const char *);
size_t len = va_arg (ap, size_t);
/* Copy values */
item->pi_list = dst;
}
else
-#if 0
- if (IsConfigFloatType (item->i_type))
- {
- const float *src = va_arg (ap, const float *);
- float *dst = malloc (sizeof (float) * (len + 1));
-
- if (dst != NULL)
- {
- memcpy (dst, src, sizeof (float) * len);
- dst[len] = 0.;
- }
- item->pf_list = dst;
- }
- else
-#endif
if (IsConfigStringType (item->i_type))
{
const char *const *src = va_arg (ap, const char *const *);
break;
/* Copy textual descriptions */
- if (domain == NULL)
- domain = PACKAGE;
-
const char *const *text = va_arg (ap, const char *const *);
if (text != NULL)
{
if( dtext != NULL )
{
for (size_t i = 0; i < len; i++)
- dtext[i] = text[i] ?
- strdup( dgettext( domain, text[i] ) ) :
- NULL;
+ dtext[i] = text[i] ? strdup (text[i]) : NULL;
dtext[len] = NULL;
}
item->ppsz_list_text = dtext;
case VLC_CONFIG_ADD_ACTION:
{
- const char *domain = va_arg (ap, const char *);
vlc_callback_t cb = va_arg (ap, vlc_callback_t), *tabcb;
const char *name = va_arg (ap, const char *);
char **tabtext;
break;
item->ppsz_action_text = tabtext;
- if (domain == NULL)
- domain = PACKAGE;
if (name)
- tabtext[item->i_action] = strdup (dgettext (domain, name));
+ tabtext[item->i_action] = strdup (name);
else
tabtext[item->i_action] = NULL;
tabtext[item->i_action + 1] = NULL;
}
default:
- fprintf (stderr, "LibVLC: unknown module property %d", propid);
- fprintf (stderr, "LibVLC: too old to use this module?");
+ fprintf (stderr, "LibVLC: unknown module property %d\n", propid);
+ fprintf (stderr, "LibVLC: too old to use this module?\n");
ret = -1;
break;
}