This patch adds meta data to the MOD playing, including Comment/Description (it), Instruments (xm,it) and Samples.<br>These fields are used by module artists for description, credit etc.<br><br>This is a revised version of yesterday's patch.<br>
<br>---<br> modules/demux/mod.c |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++<br> 1 files changed, 55 insertions(+), 0 deletions(-)<br><br>diff --git a/modules/demux/mod.c b/modules/demux/mod.c<br>index 725f0ad..1e3dfd6 100644<br>
--- a/modules/demux/mod.c<br>+++ b/modules/demux/mod.c<br>@@ -5,6 +5,7 @@<br>  * $Id$<br>  *<br>  * Authors: Laurent Aimar <<a href="mailto:fenrir@via.ecp.fr">fenrir@via.ecp.fr</a>><br>+ * Konstanty Bialkowski <<a href="mailto:konstanty@ieee.org">konstanty@ieee.org</a>><br>
  *<br>  * This program is free software; you can redistribute it and/or modify<br>  * it under the terms of the GNU General Public License as published by<br>@@ -366,9 +367,63 @@ 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>+        unsigned i_num_samples = ModPlug_NumSamples( p_sys->f ),<br>+            i_num_instruments = ModPlug_NumInstruments( p_sys->f );<br>
+        uint32_t i_num_patterns = ModPlug_NumPatterns( p_sys->f ),<br>+            i_num_channels = ModPlug_NumChannels( p_sys->f );<br>+//      uint32_t modType = ModPlug_GetModuleType( p_sys->f );<br>+        char psz_temp[2048]; /* 32 * 240 max, but only need start  */<br>
+        char *psz_module_info, *psz_instrument_info;<br>+        uint32_t i_temp_index = 0;<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>+    /* Comment field from artist - not in every type of MOD */<br>+    psz_name = ModPlug_GetMessage( p_sys->f );<br>+    if (psz_name && *psz_name )<br>+        vlc_meta_SetDescription( p_meta, psz_name );<br>
+<br>+        /* Instruments only in newer MODs - so don't show if 0 */<br>+    if ( asprintf( &psz_instrument_info, ", %i Instruments", i_num_instruments ) )<br>+    {<br>+            if ( asprintf( &psz_module_info, "%i Channels, %i Patterns\n"<br>
+                "%i Samples%s\n",<br>+                i_num_channels, i_num_patterns, i_num_samples, ( i_num_instruments ? psz_instrument_info : "" ) ))<br>+            {<br>+                vlc_meta_AddExtra( p_meta, "Module Information", psz_module_info );<br>
+                free( psz_module_info );<br>+            }<br>+<br>+            free( psz_instrument_info );<br>+        }<br>+<br>+        /* Make list of instruments (XM, IT, etc) */<br>+        if ( i_num_instruments )<br>
+        {<br>+            i_temp_index = 0;<br>+            for ( int i = 0; i < i_num_instruments && i_temp_index < sizeof(psz_temp); i++ )<br>+            {<br>+                char lBuffer[33];<br>+                ModPlug_InstrumentName( p_sys->f, i, lBuffer );<br>
+                if ( !lBuffer[0] ) continue; // don't add empty fields.<br>+                i_temp_index += snprintf( &psz_temp[i_temp_index], sizeof(psz_temp) - i_temp_index, "%s\n", lBuffer );<br>+            }<br>
+<br>+            vlc_meta_AddExtra( p_meta, "Instruments", psz_temp );<br>+        }<br>+<br>+        /* Make list of samples */<br>+        for ( int i = 0; i < i_num_samples && i_temp_index < sizeof(psz_temp); i++ )<br>
+        {<br>+            char lBuffer[33];<br>+            ModPlug_SampleName( p_sys->f, i, lBuffer );<br>+            if ( !lBuffer[0] ) continue; // don't add empty fields.<br>+            i_temp_index += snprintf( &psz_temp[i_temp_index], sizeof(psz_temp) - i_temp_index, "%s\n", lBuffer );<br>
+        }<br>+<br>+        vlc_meta_AddExtra( p_meta, "Samples", psz_temp );<br>+<br>         return VLC_SUCCESS;<br>     }<br> <br>-- <br>1.6.0.6<br><br>