Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
f8bd3111
Commit
f8bd3111
authored
Oct 11, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Basic infrastructure for non-MIDI event
parent
1abc7e4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
17 deletions
+107
-17
modules/demux/smf.c
modules/demux/smf.c
+107
-17
No files found.
modules/demux/smf.c
View file @
f8bd3111
...
...
@@ -252,6 +252,112 @@ static int ReadDeltaTime (stream_t *s, mtrk_t *track)
}
/**
* Non-MIDI Meta events handler
*/
static
int
HandleMeta
(
demux_t
*
p_demux
,
mtrk_t
*
tr
)
{
stream_t
*
s
=
p_demux
->
s
;
uint8_t
*
payload
;
uint8_t
type
;
int32_t
length
;
if
(
stream_Read
(
s
,
&
type
,
1
)
!=
1
)
return
-
1
;
length
=
ReadVarInt
(
s
);
if
(
length
<
0
)
return
-
1
;
payload
=
malloc
(
length
+
1
);
if
((
payload
==
NULL
)
||
(
stream_Read
(
s
,
payload
,
length
)
!=
length
))
{
free
(
payload
);
return
-
1
;
}
for
(
int32_t
i
=
0
;
i
<
length
;
i
++
)
payload
[
i
]
&=
0x7f
;
payload
[
length
]
=
'\0'
;
switch
(
type
)
{
case
0x00
:
/* Sequence Number */
break
;
case
0x01
:
/* Test (comment) */
msg_Info
(
p_demux
,
"Text : %s"
,
(
char
*
)
payload
);
break
;
case
0x02
:
/* Copyright */
msg_Info
(
p_demux
,
"Copyright : %s"
,
(
char
*
)
payload
);
break
;
case
0x03
:
/* Track name */
msg_Info
(
p_demux
,
"Track name: %s"
,
(
char
*
)
payload
);
break
;
case
0x04
:
/* Instrument name */
msg_Info
(
p_demux
,
"Instrument: %s"
,
(
char
*
)
payload
);
break
;
case
0x05
:
/* Lyric (one syllable) */
break
;
case
0x06
:
/* Marker text */
msg_Info
(
p_demux
,
"Marker : %s"
,
(
char
*
)
payload
);
case
0x07
:
/* Cue point (WAVE filename) */
msg_Info
(
p_demux
,
"Cue point : %s"
,
(
char
*
)
payload
);
break
;
case
0x08
:
/* Program/Patch name */
msg_Info
(
p_demux
,
"Patch name: %s"
,
(
char
*
)
payload
);
break
;
case
0x09
:
/* MIDI port name */
msg_Dbg
(
p_demux
,
"MIDI port : %s"
,
(
char
*
)
payload
);
break
;
case
0x2F
:
/* End of track */
if
(
tr
->
end
!=
stream_Tell
(
s
))
{
msg_Err
(
p_demux
,
"misplaced end of track"
);
stream_Seek
(
s
,
tr
->
end
);
}
break
;
case
0x51
:
/* Tempo */
{
uint32_t
tempo
=
(
payload
[
0
]
<<
14
)
|
(
payload
[
1
]
<<
7
)
|
payload
[
2
];
/* FIXME: change date */
msg_Dbg
(
p_demux
,
"new tempo: %u"
,
(
unsigned
)
tempo
);
break
;
}
case
0x54
:
/* SMPTE offset */
case
0x58
:
/* Time signature */
case
0x59
:
/* Key signature */
msg_Warn
(
p_demux
,
"unimplemented SMF Meta Event type 0x%02X (%d bytes)"
,
type
,
length
);
break
;
case
0x7f
:
/* Proprietary event */
break
;
default:
msg_Warn
(
p_demux
,
"unknown SMF Meta Event type 0x%02X (%d bytes)"
,
type
,
length
);
}
free
(
payload
);
return
0
;
}
static
int
HandleMessage
(
demux_t
*
p_demux
,
mtrk_t
*
tr
)
{
...
...
@@ -285,27 +391,11 @@ int HandleMessage (demux_t *p_demux, mtrk_t *tr)
}
}
case
0xFF
:
/* SMF Meta Event */
{
uint8_t
type
;
int32_t
length
;
if
(
stream_Read
(
s
,
&
type
,
1
)
!=
1
)
if
(
HandleMeta
(
p_demux
,
tr
))
return
-
1
;
length
=
ReadVarInt
(
s
);
if
(
length
<
0
)
return
-
1
;
msg_Warn
(
p_demux
,
"unknown SMF Meta Event type 0x%02X (%d bytes)"
,
type
,
length
);
/* TODO: parse these */
if
(
stream_Read
(
s
,
NULL
,
length
)
!=
length
)
return
-
1
;
/* We MUST NOT pass this event to forward. It would be
* confused as a MIDI Reset real-time event. */
goto
skip
;
}
case
0xF1
:
case
0xF3
:
datalen
=
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment