This patch adds additional meta data to vlc when playing MOD files (libmodplug) - Specifically Instruments and Samples are shown (as these are usually used by artists for description etc)<br><br>---<br> modules/demux/mod.c | 38 ++++++++++++++++++++++++++++++++++++++<br>
1 files changed, 38 insertions(+), 0 deletions(-)<br><br>diff --git a/modules/demux/mod.c b/modules/demux/mod.c<br>index bc7ec69..2a4b0a4 100644<br>--- a/modules/demux/mod.c<br>+++ b/modules/demux/mod.c<br>@@ -366,9 +366,47 @@ static int Control( demux_t *p_demux, int i_query, va_list args )<br>
case DEMUX_GET_META:<br> {<br> vlc_meta_t *p_meta = (vlc_meta_t *)va_arg( args, vlc_meta_t* );<br>+ uint32_t numSamples = ModPlug_NumSamples( p_sys->f ),<br>+ numInstruments = ModPlug_NumInstruments( p_sys->f );<br>
+ uint32_t numPatterns = ModPlug_NumPatterns( p_sys->f ),<br>+ numChannels = ModPlug_NumChannels( p_sys->f );<br>+// uint32_t modType = ModPlug_GetModuleType( p_sys->f );<br>+ char psz_temp[1024];<br>
+ uint32_t temp_index = 0, i;<br> const char *psz_name = ModPlug_GetName( p_sys->f );<br> if( psz_name && *psz_name )<br> vlc_meta_SetTitle( p_meta, psz_name );<br>+<br>+ snprintf(psz_temp, 99, "%i Channels, %i Patterns\n"<br>
+ "%i Samples, %i Instruments\n",<br>+ numChannels, numPatterns, numSamples, numInstruments);<br>+ vlc_meta_AddExtra( p_meta, "Module Information", psz_temp);<br>+<br>+ for ( i = 0; i< numSamples && temp_index<sizeof(psz_temp); i++) {<br>
+ char lBuffer[33];<br>+ ModPlug_SampleName( p_sys->f, i, lBuffer );<br>+ if (!lBuffer[0]) continue; // don't add empty fields.<br>+ temp_index += snprintf(&psz_temp[temp_index], sizeof(psz_temp)-temp_index,<br>
+ "%s\n", lBuffer);<br>+ }<br>+<br>+ vlc_meta_AddExtra( p_meta, "Samples", psz_temp);<br>+<br>+ if (numInstruments) {<br>+ snprintf(psz_temp, 99, "%i\n", numInstruments);<br>
+ vlc_meta_AddExtra( p_meta, "Number of Instruments", psz_temp);<br>+<br>+ temp_index = 0;<br>+ for ( i = 0; i< numInstruments && temp_index<sizeof(psz_temp); i++) {<br>+ char lBuffer[33];<br>
+ ModPlug_InstrumentName( p_sys->f, i, lBuffer );<br>+ temp_index += snprintf(&psz_temp[temp_index], sizeof(psz_temp)-temp_index,<br>+ "%s\n", lBuffer);<br>+ }<br>
+<br>+ vlc_meta_AddExtra( p_meta, "Instruments", psz_temp);<br>+ }<br>+<br> return VLC_SUCCESS;<br> }<br> <br>-- <br>1.6.0.6<br><br>