Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
ab7c7713
Commit
ab7c7713
authored
Aug 16, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use callback and opaque pointer for plugin descriptors
This is more flexible and extensible.
parent
cf52eed6
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
72 deletions
+96
-72
include/vlc_plugin.h
include/vlc_plugin.h
+51
-59
src/modules/bank.c
src/modules/bank.c
+3
-5
src/modules/entry.c
src/modules/entry.c
+36
-7
src/modules/modules.h
src/modules/modules.h
+6
-1
No files found.
include/vlc_plugin.h
View file @
ab7c7713
This diff is collapsed.
Click to expand it.
src/modules/bank.c
View file @
ab7c7713
...
...
@@ -56,8 +56,6 @@ static struct
unsigned
usage
;
}
modules
=
{
VLC_STATIC_MUTEX
,
NULL
,
0
};
module_t
*
vlc_entry__main
(
void
);
/*****************************************************************************
* Local prototypes
*****************************************************************************/
...
...
@@ -467,7 +465,7 @@ static module_t *module_InitDynamic (vlc_object_t *obj,
}
/* We can now try to call the symbol */
module_t
*
module
=
entry
(
);
module_t
*
module
=
vlc_plugin_describe
(
entry
);
if
(
unlikely
(
module
==
NULL
))
{
/* With a well-written module we shouldn't have to print an
...
...
@@ -497,8 +495,8 @@ error:
static
module_t
*
module_InitStatic
(
vlc_plugin_cb
entry
)
{
/* Initializes the module */
module_t
*
module
=
entry
(
);
if
(
unlikely
(
module
==
NULL
))
module_t
*
module
=
vlc_plugin_describe
(
entry
);
if
(
unlikely
(
module
==
NULL
))
return
NULL
;
module
->
b_loaded
=
true
;
...
...
src/modules/entry.c
View file @
ab7c7713
...
...
@@ -145,8 +145,14 @@ static module_config_t *vlc_config_create (module_t *module, int type)
}
int
vlc_plugin_set
(
module_t
*
module
,
module_config_t
*
item
,
int
propid
,
...)
/**
* Callback for the plugin descriptor functions.
*/
static
int
vlc_plugin_setter
(
void
*
plugin
,
void
*
tgt
,
int
propid
,
...)
{
module_t
**
pprimary
=
plugin
;
module_t
*
module
=
tgt
;
module_config_t
*
item
=
tgt
;
va_list
ap
;
int
ret
=
0
;
...
...
@@ -155,18 +161,20 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
{
case
VLC_MODULE_CREATE
:
{
module
_t
**
pp
=
va_arg
(
ap
,
module_t
**
)
;
module
=
*
pprimary
;
module_t
*
submodule
=
vlc_module_create
(
module
);
if
(
unlikely
(
submodule
==
NULL
))
{
ret
=
-
1
;
break
;
}
*
pp
=
submodule
;
if
(
module
==
NULL
)
*
(
va_arg
(
ap
,
module_t
**
))
=
submodule
;
if
(
*
pprimary
==
NULL
)
{
*
pprimary
=
submodule
;
break
;
}
/* Inheritance. Ugly!! */
submodule
->
pp_shortcuts
=
xmalloc
(
sizeof
(
char
**
));
submodule
->
pp_shortcuts
[
0
]
=
strdup_null
(
module
->
pp_shortcuts
[
0
]);
...
...
@@ -182,9 +190,14 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
{
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
)
item
=
vlc_config_create
(
*
pprimary
,
type
);
if
(
unlikely
(
item
==
NULL
))
{
ret
=
-
1
;
break
;
}
*
pp
=
item
;
break
;
}
...
...
@@ -465,3 +478,19 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
va_end
(
ap
);
return
ret
;
}
/**
* Runs a plug-in descriptor. This loads the plug-in meta-data in memory.
*/
module_t
*
vlc_plugin_describe
(
vlc_plugin_cb
entry
)
{
module_t
*
module
=
NULL
;
if
(
entry
(
vlc_plugin_setter
,
&
module
)
!=
0
)
{
if
(
module
!=
NULL
)
/* partially initialized plug-in... */
vlc_module_destroy
(
module
);
module
=
NULL
;
}
return
module
;
}
src/modules/modules.h
View file @
ab7c7713
...
...
@@ -46,7 +46,11 @@ struct module_cache_t
/** The module handle type */
typedef
void
*
module_handle_t
;
typedef
module_t
*
(
*
vlc_plugin_cb
)
(
void
);
/** Plugin entry point prototype */
typedef
int
(
*
vlc_plugin_cb
)
(
int
(
*
)(
void
*
,
void
*
,
int
,
...),
void
*
);
/** Main module */
int
vlc_entry__main
(
int
(
*
)(
void
*
,
void
*
,
int
,
...),
void
*
);
/**
* Internal module descriptor
...
...
@@ -96,6 +100,7 @@ struct module_t
char
*
domain
;
/* gettext domain */
};
module_t
*
vlc_plugin_describe
(
vlc_plugin_cb
);
module_t
*
vlc_module_create
(
module_t
*
);
void
vlc_module_destroy
(
module_t
*
);
...
...
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