[mythtv] NEW MythPlugin functionality (PATCH)

Joseph A. Caputo jcaputo1 at comcast.net
Wed Apr 9 01:49:28 EDT 2003


Attached is a patch + 2 new files which add a plugin capability to
Myth.  I patched themedmenu.cpp to add invoking a plugin as a
configuration option via the PLUGIN keyword in the action.

To create a plugin, you must compile with -fPIC -shared -o
lib<plugname>.so .  Your library must export at minimum the following
symbols (via 'extern "C" { ... }'):

bool init (QSqlDatabase *, MythContext *);
void run ();

Once you've created your plugin, put your shared object in
PREFIX/share/mythtv/plugins.  You can invoke it with
'MythPluginManager::run_plugin(<plugname>)'

You must link your plugin with the same version of the Qt library as
mythfrontend (i.e., qt-mt, not 'qt').

I'm interested in feedback as to whether people think this would be
useful.  Foremost in my mind is how this might be applicable to
mythmusic.  Since the plugin is only initialized when it's first loaded,
and never unloaded (unless you explicitly do that somewhere) while
mythfrontend (or whatever the enclosing application is) is still
running, you could reduce the startup overhead for a module.  For
instance, mythmusic would only have to load the database the first time
it came up.  After that, if you exited mythmusic and went back in,
everything is still in memory.  As soon as I get some time I'm going to
try this.

Feedback appreciated.  If you think it's a stupid idea, please be kind.

-Joe C.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mythplugin.diff
Type: text/x-patch
Size: 2781 bytes
Desc: not available
Url : /pipermail/attachments/20030409/77f21652/mythplugin.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mythplugin.h
Type: text/x-c-header
Size: 1645 bytes
Desc: not available
Url : /pipermail/attachments/20030409/77f21652/mythplugin-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mythplugin.cpp
Type: text/x-c++
Size: 2274 bytes
Desc: not available
Url : /pipermail/attachments/20030409/77f21652/mythplugin-0002.bin


More information about the mythtv-dev mailing list