This patch shows MOD file instruments and samples in the extra meta data <br>(These are usually used by artists for description etc)<br><br>This time following the style guide more closely.<br><br>---<br> modules/demux/mod.c | 43 +++++++++++++++++++++++++++++++++++++++++++<br>
1 files changed, 43 insertions(+), 0 deletions(-)<br><br>diff --git a/modules/demux/mod.c b/modules/demux/mod.c<br>index bc7ec69..8b1726a 100644<br>--- a/modules/demux/mod.c<br>+++ b/modules/demux/mod.c<br>@@ -366,9 +366,52 @@ 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;<br>+ uint32_t i_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>+ if ( asprintf(&psz_module_info, "%i Channels, %i Patterns\n"<br>+ "%i Samples, %i Instruments\n",<br>+ i_num_channels, i_num_patterns, i_num_samples, i_num_instruments ))<br>
+ {<br>+ vlc_meta_AddExtra( p_meta, "Module Information", psz_module_info );<br>+ free( psz_module_info );<br>+ }<br>+<br>+ /* Make list of samples */<br>+ for ( 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>+ /* Make list of instruments (XM, IT, etc) */<br>+ if (i_num_instruments)<br>+ {<br>+ i_temp_index = 0;<br>
+ for ( 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> return VLC_SUCCESS;<br> }<br> <br>-- <br>1.6.0.6<br><br>