[vlc-devel] [PATCH] Extra meta data from mod files
Konstanty Bialkowski
konstanty at ieee.org
Mon Apr 27 13:25:40 CEST 2009
Adding of Encoded by "Tracker name" (based on file format)
Even though EncodedBy is no longer shown in the GUI - might be useful.
libmodplug currently does not have these strings in it, and ModType only
returns a bit mask.
---
modules/demux/mod.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 1 deletions(-)
diff --git a/modules/demux/mod.c b/modules/demux/mod.c
index b240444..cf66902 100644
--- a/modules/demux/mod.c
+++ b/modules/demux/mod.c
@@ -132,6 +132,37 @@ static const char *ppsz_mod_ext[] =
"psm", "abc", NULL
};
+static const char *ppsz_mod_desc[] =
+{
+ "ProTracker",
+ "Scream Tracker 3",
+ "Fast Tracker 2",
+ "OctaMed",
+ "MTM",
+ "Impulse Tracker",
+ "669 Composer / UNIS 669",
+ "ULT",
+ "Scream Tracker",
+ "Farandole",
+ "WAV",
+ "DSMI Advanced Module Format",
+ "AMS Module",
+ "DSIK Internal Format",
+ "DigiTracker",
+ "Oktalyzer",
+ "MIDI",
+ "Delusion Digital Music Fileformat (X-Tracker)",
+ "PolyTracker",
+ "DigiBooster Pro",
+ "MT2",
+ "ASYLUM Music Format V1.0",
+ "PSM",
+ "J2B",
+ "ABC draft 2.0",
+ "Gravis Ultrasound Patch",
+ "Unknown",
+ NULL
+};
/* We load the complete file in memory, put a higher bound
* of 500 Mo (which is really big anyway) */
@@ -371,7 +402,7 @@ static int Control( demux_t *p_demux, int i_query,
va_list args )
i_num_instruments = ModPlug_NumInstruments( p_sys->f );
unsigned i_num_patterns = ModPlug_NumPatterns( p_sys->f ),
i_num_channels = ModPlug_NumChannels( p_sys->f );
-// unsigned modType = ModPlug_GetModuleType( p_sys->f );
+ unsigned i_mod_type = ModPlug_GetModuleType( p_sys->f );
char psz_temp[2048]; /* 32 * 240 max, but only need start */
char *psz_module_info, *psz_instrument_info;
unsigned i_temp_index = 0;
@@ -384,6 +415,13 @@ static int Control( demux_t *p_demux, int i_query,
va_list args )
if (psz_name && *psz_name )
vlc_meta_SetDescription( p_meta, psz_name );
+ /* Encoded By / Mod Format */
+ for( int i = 0, j = i_mod_type; ppsz_mod_desc[i] != NULL && j; i++,
j>>=1 )
+ {
+ if ( j == 1 )
+ vlc_meta_SetEncodedBy( p_meta, ppsz_mod_desc[i] );
+ }
+
/* Instruments only in newer MODs - so don't show if 0 */
if ( asprintf( &psz_instrument_info, ", %i Instruments",
i_num_instruments ) )
{
--
1.6.0.6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090427/560a8713/attachment.html>
More information about the vlc-devel
mailing list