Commit 008d355b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

modules: add/use module_need_var()

...to get the module name or module name list from an object variable.
parent e426b400
......@@ -46,6 +46,19 @@ VLC_API void vlc_module_unload( vlc_object_t *obj, module_t *,
VLC_API module_t * module_need( vlc_object_t *, const char *, const char *, bool ) VLC_USED;
#define module_need(a,b,c,d) module_need(VLC_OBJECT(a),b,c,d)
VLC_USED
static inline module_t *module_need_var(vlc_object_t *obj, const char *cap,
const char *varname)
{
char *list = var_InheritString(obj, varname);
module_t *m = module_need(obj, cap, list, false);
free(list);
return m;
}
#define module_need_var(a,b,c) module_need_var(VLC_OBJECT(a),b,c)
VLC_API void module_unneed( vlc_object_t *, module_t * );
#define module_unneed(a,b) module_unneed(VLC_OBJECT(a),b)
VLC_API bool module_exists(const char *) VLC_USED;
......
......@@ -307,7 +307,7 @@ static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, const es_format_t *p
//p_sys->p_decoder->p_cfg = p_sys->p_video_cfg;
p_sys->p_decoder->p_module =
module_need( p_sys->p_decoder, "video decoder", "$codec", false );
module_need_var( p_sys->p_decoder, "video decoder", "codec" );
if( !p_sys->p_decoder->p_module )
{
......
......@@ -194,7 +194,7 @@ static int transcode_audio_new( sout_stream_t *p_stream,
id->p_decoder->pf_aout_format_update = audio_update_format;
/* id->p_decoder->p_cfg = p_sys->p_audio_cfg; */
id->p_decoder->p_module =
module_need( id->p_decoder, "audio decoder", "$codec", false );
module_need_var( id->p_decoder, "audio decoder", "codec" );
if( !id->p_decoder->p_module )
{
msg_Err( p_stream, "cannot find audio decoder" );
......
......@@ -83,7 +83,7 @@ static int transcode_spu_new( sout_stream_t *p_stream, sout_stream_id_sys_t *id
/* id->p_decoder->p_cfg = p_sys->p_spu_cfg; */
id->p_decoder->p_module =
module_need( id->p_decoder, "spu decoder", "$codec", false );
module_need_var( id->p_decoder, "spu decoder", "codec" );
if( !id->p_decoder->p_module )
{
......
......@@ -190,7 +190,7 @@ static int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_sys_t *i
id->p_decoder->p_owner = (decoder_owner_sys_t*) p_stream;
id->p_decoder->p_module =
module_need( id->p_decoder, "video decoder", "$codec", false );
module_need_var( id->p_decoder, "video decoder", "codec" );
if( !id->p_decoder->p_module )
{
......
......@@ -654,7 +654,7 @@ opengl_init_program(vout_display_opengl_t *vgl, struct prgm *prgm,
if (desc->plane_count == 0)
{
/* Opaque chroma: load a module to handle it */
tc->p_module = module_need(tc, "glconv", "$glconv", true);
tc->p_module = module_need_var(tc, "glconv", "glconv");
}
if (tc->p_module != NULL)
......
......@@ -241,7 +241,7 @@ audio_output_t *aout_New (vlc_object_t *parent)
aout->volume_set = NULL;
aout->mute_set = NULL;
aout->device_select = NULL;
owner->module = module_need (aout, "audio output", "$aout", false);
owner->module = module_need_var(aout, "audio output", "aout");
if (owner->module == NULL)
{
msg_Err (aout, "no suitable audio output module");
......
......@@ -175,11 +175,11 @@ static int LoadDecoder( decoder_t *p_dec, bool b_packetizer,
[AUDIO_ES] = "audio decoder",
[SPU_ES] = "spu decoder",
};
p_dec->p_module = module_need( p_dec, caps[p_dec->fmt_in.i_cat],
"$codec", false );
p_dec->p_module = module_need_var( p_dec, caps[p_dec->fmt_in.i_cat],
"codec" );
}
else
p_dec->p_module = module_need( p_dec, "packetizer", "$packetizer", false );
p_dec->p_module = module_need_var( p_dec, "packetizer", "packetizer" );
if( !p_dec->p_module )
{
......
......@@ -736,7 +736,7 @@ static int vlm_ControlMediaAdd( vlm_t *p_vlm, vlm_media_t *p_cfg, int64_t *p_id
{
p_vlm->p_vod = vlc_custom_create( VLC_OBJECT(p_vlm), sizeof( vod_t ),
"vod server" );
p_vlm->p_vod->p_module = module_need( p_vlm->p_vod, "vod server", "$vod-server", false );
p_vlm->p_vod->p_module = module_need_var( p_vlm->p_vod, "vod server", "vod-server" );
if( !p_vlm->p_vod->p_module )
{
msg_Err( p_vlm, "cannot find vod server" );
......
......@@ -679,7 +679,7 @@ static decoder_t *CreateDecoder( vlc_object_t *p_this, const video_format_t *fmt
p_dec->pf_vout_buffer_new = video_new_buffer;
/* Find a suitable decoder module */
p_dec->p_module = module_need( p_dec, "video decoder", "$codec", false );
p_dec->p_module = module_need_var( p_dec, "video decoder", "codec" );
if( !p_dec->p_module )
{
msg_Err( p_dec, "no suitable decoder module for fourcc `%4.4s'. "
......
......@@ -205,7 +205,7 @@ static filter_t *SpuRenderCreateAndLoadText(spu_t *spu)
text->pf_get_attachments = spu_get_attachments;
text->p_module = module_need(text, "text renderer", "$text-renderer", false);
text->p_module = module_need_var(text, "text renderer", "text-renderer");
/* Create a few variables used for enhanced text rendering */
var_Create(text, "spu-elapsed", VLC_VAR_INTEGER);
......
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