1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
Created: Somewhat in 2001
Last modified: 2003-05-21
===============================================================================
This is a discription of the structures of the plugin and how it (should) work.
===============================================================================
1. General information
2. File information
1. src/ (libxmms_singit.so - main plugin)
2. src/control/ (control socket for external programs / displayers)
3. src/data/ (data files for installation)
4. src/dialogs/ (libdialogs.a)
5. src/displayers/ (libdisplayer* - displayer plugins)
6. src/editor/ (libeditor.a - lyrics editor)
7. src/include/ (displayer API)
8. src/pixmaps/ (All pixmaps in the plugin (compiled in))
9. src/sound/ (libsound.a - simple sound preprocessing)
10. src/tagger/ (libtagger.a - tag viewer)
11. src/widgets/ (libwidgets.a - karaoke widget)
4. Internal "data" flow
1. Main plugin
2. Displayer plugins
1. General information
======================
There are some header files, with the same name, one with the extension "_private"
one without. The private version is for the main plugin, the non private version
is for the displayer plugins (stored in the include directory).
2. File information
===================
2.1. src/ (libxmms_singit.so)
-----------------------------
main.c - implements the connection between xmms and
the plugin
- very simple functions
singit_main.c - Main file which controls the plugin
singit_main_check.c - Check thread (song / lyrics change)
singit_main_display.c - Thread to update the displayers
singit_main_status.c - Status structure for the plugin
- Implemented as a singleton
- Contains the current song object and the
plugin configuration
singit_singleton.c - A base class for implementing Singletons
- A Singleton is an object, where just one
instance is allowed a time
- To create a singleton subclass it and use
singleton constructor
singit_plugin_scanner.c - Connection between the main lib and the
displayer plugins (call functions / scan /
init / finish)
singit_plugin_data.c - Plugin data internally used by the scanner
especially to hold the scanner results
and handler the plugin mutexes
ltdl_wrapper.c - A wrapper for different dynamic library
loading mechanisms (xmms and libltdl)
singit_config_gen.c - General configuration class to handle XMMS
style configuration data files
singit_config_xmms.c - Extension of the xmms config file functions
and macros for easier config handling
singit_config.c - The configuration for the plugin
- funtions to handle the struct and updates
singit_file_info.c - Simpler (stat based) file change mechanism
singit_framerate_counter.c - A general frame rate counter and limiter
singit_debug.c - defines a debug function
singit_sha.c - implements the SHA hash algorithm
- used to get a better information if the
content of a file has changed
singit_tools.c - some helper funtions for various tasks
singit_song.c - implements the song structure and many
funtion to handle a song
- search, test, get, check update
singit_song_private.h - funtions to parse, load and save files
singit_song_text.c - load, parse and save text files
singit_song_id3v2xx.c - load, parse (and save) id3v2xx tags (not tested)
singit_song_midi.c - load and parse midi files (not implemented)
2.3. src/dialogs/ (libdialogs.a)
--------------------------------
dlg_input_number.c - implements a dialog to get an integer number
from the user
dlg_input_time.c - Dialog to get a time offset from the user
dlg_messagebox.c - implements a simple message box with multiple
buttons and events
dlg_multiline.c - implements a dialog to edit comma seperated
values in a text view
dlg_singit_about.c - about / help dialog
dlg_singit_config.c - implements a dialog to edit the global
configuration structure and handle the
displayer plugins
2.8. src/include
----------------
singit_config.h - defines the config structure
singit_dialogs.h - functions to show editor / config / id3 / about dialogs
singit_displayer_plugin.h - displayer plugin struct
singit_macros.h - some global macros (i18n / program name / my email / my name)
singit_song.h - defines the song structure and funtions for
create / free / time token management
singit_wgt_karaoke.h - the karaoke widget
2.9. src/widgets/ (libwidgets.a)
--------------------------------
wgt_colorbutton.[hc] - a button from gimp which allows a user to select a color and displays it
wgt_singit_karaoke.c - the main widget of the displayer
singit_karaoke_data.c - general data for karaoke widget creation (draw)
4. Internal "data" flow
=======================
Some things to mention before:
* Start the whole plugin when enabling (obvious)
* Run the scanner when opening the configue window
and just allow config and about for the displayers
* Start the threads when editor is opened from config
* Stop parts of the plugin when parts a closed
* Be carefull with the plugins (locking)
4.1. Main plugin
----------------
In this section I try to explain, how the plugin is working
At the beginning (main.c [singit_init] ->
singit_main.c [singit_main_init])
the plugin starts the main thread (singit_main.c [thread_func])
and initializes the displayer plugins (singit_plugin_scanner.c [plugins_init])
singit_main.c [thread_func]
- - - - - - - - - - - - - -
While there is no song change (time >= 0) the threads looks for a song / lyric file change.
The thread informs all enabled plugins about the current status (song / time / next token).
It sets the editors time and tells the plugins to show or hide.
The rest belongs to the different plugins.
If you are really interested to get involved in the plugin development and need more information
feel free to contact me.
4.2. Displayer plugins
----------------------
First all enabled plugins are initialized ["init" funtion].
Immediately after the init the update function of the plugin is called to
let the plugin adapt to the main configuration.
While the main thread is running the plugin may get calls to its
show / hide / toggle / update / set_time - callbacks
When the main plugin finishes it calls the finish function of all initialized
displayer plugins.
The displayer plugin can disable itself by a call of the disable callback
including its plugin struct. (expl.: plugin_struct.disable(&plugin_struct))
|