Commit 89953037 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

SMF: demux SysEx messages

(cherry picked from commit c1c27e1d7d47ec2d1055507fd70b2bef033d4e03)
parent 4ef62f71
......@@ -473,19 +473,22 @@ int HandleMessage (demux_t *p_demux, mtrk_t *tr)
case 0xF0: /* System Exclusive */
switch (event)
{
case 0xF0: /* System Specific */
case 0xF0: /* System Specific start */
case 0xF7: /* System Specific continuation */
{
/* TODO: don't skip these */
stream_Read (s, NULL, 1); /* Manuf ID */
for (;;)
{
uint8_t c;
if (stream_Read (s, &c, 1) != 1)
/* Variable length followed by SysEx event data */
int32_t len = ReadVarInt (s);
if (len == -1)
return -1;
if (c == 0xF7)
goto skip;
}
/* never reached */
block = stream_Block (s, len);
if (block == NULL)
return -1;
block = block_Realloc (block, 1, len);
if (block == NULL)
return -1;
block->p_buffer[0] = event;
goto send;
}
case 0xFF: /* SMF Meta Event */
if (HandleMeta (p_demux, tr))
......@@ -505,9 +508,6 @@ int HandleMessage (demux_t *p_demux, mtrk_t *tr)
/* We cannot handle undefined "common" (non-real-time)
* events inside SMF, as we cannot differentiate a
* one byte delta-time (< 0x80) from event data. */
case 0xF7: /* End of sysex -> should never happen(?) */
msg_Err (p_demux, "unknown MIDI event 0x%02X", event);
return -1; /* undefined events */
default:
datalen = 0;
break;
......@@ -545,6 +545,7 @@ int HandleMessage (demux_t *p_demux, mtrk_t *tr)
stream_Read (s, block->p_buffer + 2, datalen - 1);
}
send:
block->i_dts = block->i_pts = VLC_TS_0 + date_Get (&p_demux->p_sys->pts);
es_out_Send (p_demux->out, p_demux->p_sys->es, block);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment