Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
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
Steve Lhomme
VLC
Commits
8c260b2c
Commit
8c260b2c
authored
Jan 24, 2017
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: mp4: add basic WebVTT support
parent
87777f04
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
3 deletions
+49
-3
NEWS
NEWS
+1
-2
modules/demux/mp4/essetup.c
modules/demux/mp4/essetup.c
+4
-1
modules/demux/mp4/libmp4.c
modules/demux/mp4/libmp4.c
+3
-0
modules/demux/mp4/libmp4.h
modules/demux/mp4/libmp4.h
+5
-0
modules/demux/mp4/mp4.c
modules/demux/mp4/mp4.c
+36
-0
No files found.
NEWS
View file @
8c260b2c
...
...
@@ -120,8 +120,7 @@ Demuxers:
* Support raw h265/hevc files
* Support multi-channel WAV without channel-maps
* Rewrite MKV seeking
* Rewrite of TTML demuxer
* Support for TTML in ISOBMF/MP4 and DASH
* Support for TTML and WebVTT in ISOBMF/MP4 and DASH
* Fix Quicktime Mp4 inside MKV and unpacketized VC1
Stream filter:
...
...
modules/demux/mp4/essetup.c
View file @
8c260b2c
...
...
@@ -1177,7 +1177,10 @@ int SetupSpuES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
case
VLC_FOURCC
(
's'
,
't'
,
'p'
,
'p'
):
p_track
->
fmt
.
i_codec
=
VLC_CODEC_TTML
;
break
;
case
ATOM_wvtt
:
p_track
->
fmt
.
i_codec
=
VLC_CODEC_SUBT
;
p_track
->
fmt
.
i_original_fourcc
=
ATOM_wvtt
;
break
;
case
ATOM_c608
:
/* EIA608 closed captions */
//case ATOM_c708: /* EIA708 closed captions */
p_track
->
fmt
.
i_codec
=
VLC_CODEC_EIA608_1
;
...
...
modules/demux/mp4/libmp4.c
View file @
8c260b2c
...
...
@@ -4257,6 +4257,9 @@ static const struct
{
ATOM_tx3g
,
MP4_ReadBox_sample_tx3g
,
0
},
{
ATOM_c608
,
MP4_ReadBox_sample_clcp
,
ATOM_stsd
},
//{ ATOM_text, MP4_ReadBox_sample_text, 0 },
/* In sample WebVTT subtitle atoms. No ATOM_wvtt in normal parsing */
{
ATOM_vttc
,
MP4_ReadBoxContainer
,
ATOM_wvtt
},
{
ATOM_payl
,
MP4_ReadBox_Binary
,
ATOM_vttc
},
/* for codecs */
{
ATOM_soun
,
MP4_ReadBox_sample_soun
,
ATOM_stsd
},
...
...
modules/demux/mp4/libmp4.h
View file @
8c260b2c
...
...
@@ -288,6 +288,11 @@ typedef int64_t stime_t;
#define ATOM_clcp VLC_FOURCC( 'c', 'l', 'c', 'p' )
#define ATOM_c608 VLC_FOURCC( 'c', '6', '0', '8' )
#define ATOM_c708 VLC_FOURCC( 'c', '7', '0', '8' )
#define ATOM_wvtt VLC_FOURCC( 'w', 'v', 't', 't' )
/* In sample for WebVTT */
#define ATOM_vttc VLC_FOURCC( 'v', 't', 't', 'c' )
#define ATOM_payl VLC_FOURCC( 'p', 'a', 'y', 'l' )
#define ATOM_0xa9nam VLC_FOURCC( 0xa9, 'n', 'a', 'm' )
#define ATOM_0xa9aut VLC_FOURCC( 0xa9, 'a', 'u', 't' )
...
...
modules/demux/mp4/mp4.c
View file @
8c260b2c
...
...
@@ -380,6 +380,38 @@ static int AllocateTracks( demux_t *p_demux, unsigned i_tracks )
return
VLC_SUCCESS
;
}
static
block_t
*
MP4_WebVTT_Convert
(
demux_t
*
p_demux
,
block_t
*
p_block
)
{
stream_t
*
p_stream
=
vlc_stream_MemoryNew
(
p_demux
,
p_block
->
p_buffer
,
p_block
->
i_buffer
,
true
);
if
(
p_stream
)
{
MP4_Box_t
*
p_vroot
=
MP4_BoxNew
(
ATOM_wvtt
);
if
(
p_vroot
)
{
p_vroot
->
i_size
=
p_block
->
i_buffer
;
if
(
MP4_ReadBoxContainerChildren
(
p_stream
,
p_vroot
,
NULL
)
==
1
)
{
MP4_Box_t
*
p_payl
=
MP4_BoxGet
(
p_vroot
,
"vttc/payl"
);
if
(
p_payl
&&
p_payl
->
i_size
>=
9
)
{
p_block
->
p_buffer
+=
p_payl
->
i_pos
+
8
;
p_block
->
i_buffer
=
p_payl
->
i_size
-
8
;
p_block
->
p_buffer
[
p_block
->
i_buffer
-
1
]
=
'\0'
;
}
else
p_block
->
i_buffer
=
0
;
#ifndef NDEBUG
MP4_BoxDumpStructure
(
p_stream
,
p_vroot
);
#endif
}
MP4_BoxFree
(
p_vroot
);
}
vlc_stream_Delete
(
p_stream
);
}
return
p_block
;
}
static
block_t
*
MP4_EIA608_Convert
(
block_t
*
p_block
)
{
/* Rebuild codec data from encap */
...
...
@@ -527,6 +559,10 @@ static block_t * MP4_Block_Convert( demux_t *p_demux, const mp4_track_t *p_track
case
VLC_CODEC_EIA608_1
:
p_block
=
MP4_EIA608_Convert
(
p_block
);
break
;
case
VLC_CODEC_SUBT
:
if
(
p_track
->
fmt
.
i_original_fourcc
==
ATOM_wvtt
)
p_block
=
MP4_WebVTT_Convert
(
p_demux
,
p_block
);
break
;
default:
p_block
->
i_buffer
=
0
;
break
;
...
...
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