Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
cd734d3a
Commit
cd734d3a
authored
Sep 24, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: mp4: add support for
EIA-608
(fix #6775)
parent
eeb90473
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
2 deletions
+73
-2
modules/demux/mp4/libmp4.h
modules/demux/mp4/libmp4.h
+3
-0
modules/demux/mp4/mp4.c
modules/demux/mp4/mp4.c
+70
-2
No files found.
modules/demux/mp4/libmp4.h
View file @
cd734d3a
...
...
@@ -215,6 +215,9 @@
#define ATOM_tx3g VLC_FOURCC( 't', 'x', '3', 'g' )
#define ATOM_subp VLC_FOURCC( 's', 'u', 'b', 'p' )
#define ATOM_sbtl VLC_FOURCC( 's', 'b', 't', 'l' )
#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_0xa9nam VLC_FOURCC( 0xa9, 'n', 'a', 'm' )
#define ATOM_0xa9aut VLC_FOURCC( 0xa9, 'a', 'u', 't' )
...
...
modules/demux/mp4/mp4.c
View file @
cd734d3a
...
...
@@ -392,6 +392,62 @@ static void CreateTracksFromSmooBox( demux_t *p_demux )
}
}
static
block_t
*
MP4_EIA608_Convert
(
block_t
*
p_block
)
{
/* Rebuild codec data from encap */
size_t
i_copied
=
0
;
size_t
i_remaining
=
p_block
->
i_buffer
;
uint32_t
i_bytes
=
0
;
block_t
*
p_newblock
;
if
(
i_remaining
<
10
||
!
(
i_bytes
=
GetDWBE
(
p_block
->
p_buffer
))
||
(
i_bytes
+
8
>
i_remaining
)
||
memcmp
(
"cdat"
,
&
p_block
->
p_buffer
[
4
],
4
)
||
!
(
p_newblock
=
block_Alloc
(
i_remaining
*
3
-
8
))
)
{
p_block
->
i_buffer
=
0
;
return
p_block
;
}
uint8_t
*
p_write
=
p_newblock
->
p_buffer
;
uint8_t
*
p_read
=
&
p_block
->
p_buffer
[
8
];
i_bytes
-=
8
;
i_remaining
-=
8
;
do
{
p_write
[
i_copied
++
]
=
0
;
/* cc1 == field 0 */
p_write
[
i_copied
++
]
=
p_read
[
0
];
p_write
[
i_copied
++
]
=
p_read
[
1
];
p_read
+=
2
;
i_bytes
-=
2
;
i_remaining
-=
2
;
}
while
(
i_bytes
>=
2
);
if
(
i_remaining
>=
10
&&
(
i_bytes
=
GetDWBE
(
p_read
))
&&
(
i_bytes
+
8
<=
i_remaining
)
&&
!
memcmp
(
"cdt2"
,
&
p_read
[
4
],
4
)
)
{
p_read
+=
8
;
i_bytes
-=
8
;
i_remaining
-=
8
;
do
{
p_write
[
i_copied
++
]
=
0
;
/* cc1 == field 0 */
p_write
[
i_copied
++
]
=
p_read
[
0
];
p_write
[
i_copied
++
]
=
p_read
[
1
];
p_read
+=
2
;
i_bytes
-=
2
;
}
while
(
i_bytes
>=
2
);
}
block_Release
(
p_block
);
p_newblock
->
i_buffer
=
i_copied
;
return
p_newblock
;
}
static
block_t
*
MP4_Block_Read
(
demux_t
*
p_demux
,
const
mp4_track_t
*
p_track
,
int
i_size
)
{
block_t
*
p_block
=
stream_Block
(
p_demux
->
s
,
i_size
);
...
...
@@ -407,7 +463,9 @@ static block_t * MP4_Block_Read( demux_t *p_demux, const mp4_track_t *p_track, i
case
VLC_CODEC_SPU
:
/* accept as-is */
break
;
case
VLC_CODEC_EIA608_1
:
p_block
=
MP4_EIA608_Convert
(
p_block
);
break
;
default:
p_block
->
i_buffer
=
0
;
break
;
...
...
@@ -2438,7 +2496,6 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
break
;
}
/* It's a little ugly but .. there are special cases */
switch
(
p_sample
->
i_type
)
{
...
...
@@ -2516,6 +2573,12 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
p_track
->
fmt
.
i_codec
=
VLC_CODEC_H263
;
break
;
case
(
ATOM_c608
):
/* EIA608 closed captions */
//case( ATOM_c708 ): /* EIA708 closed captions */
p_track
->
fmt
.
i_codec
=
VLC_CODEC_EIA608_1
;
p_track
->
fmt
.
i_cat
=
SPU_ES
;
break
;
case
(
VLC_FOURCC
(
't'
,
'e'
,
'x'
,
't'
)
):
case
(
VLC_FOURCC
(
't'
,
'x'
,
'3'
,
'g'
)
):
{
...
...
@@ -3219,6 +3282,11 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
p_track
->
fmt
.
i_cat
=
SPU_ES
;
break
;
/* closed captions */
case
(
ATOM_clcp
):
p_track
->
fmt
.
i_cat
=
SPU_ES
;
break
;
default:
return
;
}
...
...
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