+ vlc_meta_AddExtra( p_meta, "Instruments", psz_temp );
+ }
+
+ /* Make list of samples */
+ for( unsigned int i = 0; i < i_num_samples && i_temp_index < sizeof(psz_temp); i++ )
+ {
+ char psz_buffer[33];
+ ModPlug_SampleName( p_sys->f, i, psz_buffer );
+ if ( !psz_buffer[0] ) continue; // don't add empty fields.
+ i_temp_index += snprintf( &psz_temp[i_temp_index], sizeof(psz_temp) - i_temp_index, "%s\n", psz_buffer );
+ }
+
+ vlc_meta_AddExtra( p_meta, "Samples", psz_temp );
+
+ return VLC_SUCCESS;
+ }
+
+ case DEMUX_GET_FPS: /* meaningless */
+ default:
+ return VLC_EGENERIC;
+ }
+}
+
+/*****************************************************************************
+ * Validate: try to ensure it is really a mod file.
+ * The tests are not robust enough to replace extension checks in the general
+ * cases.
+ * TODO: maybe it should return a score, which will be used to bypass the
+ * extension checks when high enough.
+ *****************************************************************************/
+static int Validate( demux_t *p_demux, const char *psz_ext )
+{
+ static const struct
+ {
+ int i_offset;
+ const char *psz_marker;
+ } p_marker[] = {
+ { 0, "ziRCONia" }, /* MMCMP files */
+ { 0, "Extended Module" }, /* XM */
+ { 44, "SCRM" }, /* S3M */
+ { 0, "IMPM" }, /* IT */
+ { 0, "MThd" }, /* MID */
+ { 0, "GF1PATCH110" }, /* PAT */
+ { 20, "!SCREAM!" }, /* STM */
+ { 20, "!Scream!" }, /* STM */
+ { 20, "BMOD2STM" }, /* STM */
+ { 0, "MMD0" }, /* MED v0 */
+ { 0, "MMD1" }, /* MED v1 */
+ { 0, "MMD2" }, /* MED v2 */
+ { 0, "MMD3" }, /* MED v3 */
+ { 0, "MTM" }, /* MTM */
+ { 0, "DMDL" }, /* MDL */
+ { 0, "DBM0" }, /* DBM */
+ { 0, "if" }, /* 669 */
+ { 0, "JN" }, /* 669 */
+ { 0, "FAR\xfe" }, /* FAR */
+ { 0, "Extreme" }, /* AMS */
+ { 0, "OKTASONGCMOD" }, /* OKT */
+ { 44, "PTMF" }, /* PTM */
+ { 0, "MAS_UTrack_V00" }, /* Ult */
+ { 0, "DDMF" }, /* DMF */
+ { 8, "DSMFSONG" }, /* DSM */
+ { 0, "\xc1\x83\x2a\x9e" }, /* UMX */
+ { 0, "ASYLUM Music Format V1.0" }, /* AMF Type 0 */
+ { 0, "AMF" }, /* AMF */
+ { 0, "PSM\xfe" }, /* PSM */
+ { 0, "PSM " }, /* PSM */
+ { 0, "MT20" }, /* MT2 */
+
+ { 1080, "M.K." }, /* MOD */
+ { 1080, "M!K!" },
+ { 1080, "M&K!" },
+ { 1080, "N.T." },
+ { 1080, "CD81" },
+ { 1080, "OKTA" },
+ { 1080, "16CN" },
+ { 1080, "32CN" },
+ { 1080, "FLT" },
+ { 1080, "TDZ" },
+ { 1081, "CHN" },
+ { 1082, "CH" },
+
+ { -1, NULL }
+ };
+
+ const uint8_t *p_peek;
+ const int i_peek = stream_Peek( p_demux->s, &p_peek, 2048 );
+ if( i_peek < 4 )
+ return VLC_EGENERIC;