* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <vlc/vlc.h>
#include <vlc_demux.h>
#include <vlc_aout.h>
#include <vlc_charset.h>
#include <limits.h>
+#define TEMPO_MIN 20
+#define TEMPO_MAX 250 /* Beats per minute */
+
static int Open (vlc_object_t *);
static void Close (vlc_object_t *);
msg_Dbg (p_demux, "tempo: %uus/qn -> %u BPM",
(unsigned)uspqn, tempo);
- if (tempo < 20)
+ if (tempo < TEMPO_MIN)
{
- msg_Warn (p_demux, "tempo too slow -> 20 BPM");
- tempo = 20;
+ msg_Warn (p_demux, "tempo too slow -> %u BPM", TEMPO_MIN);
+ tempo = TEMPO_MIN;
}
else
- if (tempo > 240)
+ if (tempo > TEMPO_MAX)
{
- msg_Warn (p_demux, "tempo too fast -> 240 BPM");
- tempo = 240;
+ msg_Warn (p_demux, "tempo too fast -> %u BPM", TEMPO_MAX);
+ tempo = TEMPO_MAX;
}
date_Change (&p_sys->pts, p_sys->ppqn * tempo, 60);
}
case 0xFF: /* SMF Meta Event */
if (HandleMeta (p_demux, tr))
return -1;
- /* We MUST NOT pass this event to forward. It would be
+ /* We MUST NOT pass this event forward. It would be
* confused as a MIDI Reset real-time event. */
goto skip;
case 0xF1:
*****************************************************************************/
static int Control (demux_t *p_demux, int i_query, va_list args)
{
- return demux2_vaControlHelper (p_demux->s, 0, -1, 0, 1, i_query, args);
+ demux_sys_t *p_sys = p_demux->p_sys;
+
+ switch (i_query)
+ {
+ case DEMUX_GET_TIME:
+ {
+ *(va_arg (args, int64_t *)) = date_Get (&p_sys->pts);
+ return 0;
+ }
+#if 0
+ /* TODO: */
+ case DEMUX_SET_TIME:
+ case DEMUX_GET_POSITION:
+ case DEMUX_SET_POSITION:
+ case DEMUX_GET_LENGTH:
+#endif
+ }
+ return VLC_EGENERIC;
}