Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
99fd0668
Commit
99fd0668
authored
Sep 27, 2014
by
François Cartegnie
🤞
Browse files
demux: mp4: don't trust atom type processing stsd (fix #12285)
parent
cc79ed90
Changes
3
Hide whitespace changes
Inline
Side-by-side
modules/demux/mp4/libmp4.c
View file @
99fd0668
...
...
@@ -1690,6 +1690,7 @@ static int MP4_ReadBox_trkn( stream_t *p_stream, MP4_Box_t *p_box )
static
int
MP4_ReadBox_sample_soun
(
stream_t
*
p_stream
,
MP4_Box_t
*
p_box
)
{
p_box
->
i_handler
=
ATOM_soun
;
MP4_READBOX_ENTER
(
MP4_Box_data_sample_soun_t
);
p_box
->
data
.
p_sample_soun
->
p_qt_description
=
NULL
;
...
...
@@ -1861,6 +1862,7 @@ static void MP4_FreeBox_sample_soun( MP4_Box_t *p_box )
int
MP4_ReadBox_sample_vide
(
stream_t
*
p_stream
,
MP4_Box_t
*
p_box
)
{
p_box
->
i_handler
=
ATOM_vide
;
MP4_READBOX_ENTER
(
MP4_Box_data_sample_vide_t
);
for
(
unsigned
i
=
0
;
i
<
6
;
i
++
)
...
...
@@ -1947,6 +1949,7 @@ static int MP4_ReadBox_sample_text( stream_t *p_stream, MP4_Box_t *p_box )
{
int32_t
t
;
p_box
->
i_handler
=
ATOM_text
;
MP4_READBOX_ENTER
(
MP4_Box_data_sample_text_t
);
MP4_GET4BYTES
(
p_box
->
data
.
p_sample_text
->
i_reserved1
);
...
...
@@ -1997,6 +2000,7 @@ static int MP4_ReadBox_sample_text( stream_t *p_stream, MP4_Box_t *p_box )
static
int
MP4_ReadBox_sample_tx3g
(
stream_t
*
p_stream
,
MP4_Box_t
*
p_box
)
{
p_box
->
i_handler
=
ATOM_text
;
MP4_READBOX_ENTER
(
MP4_Box_data_sample_text_t
);
MP4_GET4BYTES
(
p_box
->
data
.
p_sample_text
->
i_reserved1
);
...
...
modules/demux/mp4/libmp4.h
View file @
99fd0668
...
...
@@ -1375,6 +1375,7 @@ typedef struct MP4_Box_s
uint32_t
i_type
;
uint32_t
i_shortsize
;
uint32_t
i_handler
;
/* stsd handler */
enum
{
...
...
modules/demux/mp4/mp4.c
View file @
99fd0668
...
...
@@ -2306,7 +2306,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
switch
(
p_track
->
fmt
.
i_cat
)
{
case
VIDEO_ES
:
if
(
!
p_sample
->
data
.
p_sample_vide
)
if
(
!
p_sample
->
data
.
p_sample_vide
||
p_sample
->
i_handler
!=
ATOM_vide
)
break
;
p_track
->
fmt
.
video
.
i_width
=
p_sample
->
data
.
p_sample_vide
->
i_width
;
p_track
->
fmt
.
video
.
i_height
=
p_sample
->
data
.
p_sample_vide
->
i_height
;
...
...
@@ -2363,7 +2363,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
break
;
case
AUDIO_ES
:
if
(
!
p_sample
->
data
.
p_sample_soun
)
if
(
!
p_sample
->
data
.
p_sample_soun
||
p_sample
->
i_handler
!=
ATOM_soun
)
break
;
p_track
->
fmt
.
audio
.
i_channels
=
p_sample
->
data
.
p_sample_soun
->
i_channelcount
;
...
...
@@ -2548,6 +2548,8 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
case
(
VLC_FOURCC
(
'r'
,
'a'
,
'w'
,
' '
)
):
case
(
VLC_FOURCC
(
'N'
,
'O'
,
'N'
,
'E'
)
):
{
if
(
p_sample
->
i_handler
!=
ATOM_soun
)
break
;
MP4_Box_data_sample_soun_t
*
p_soun
=
p_sample
->
data
.
p_sample_soun
;
if
(
p_soun
&&
(
p_soun
->
i_samplesize
+
7
)
/
8
==
1
)
...
...
@@ -2584,6 +2586,8 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
case
(
VLC_FOURCC
(
't'
,
'e'
,
'x'
,
't'
)
):
case
(
VLC_FOURCC
(
't'
,
'x'
,
'3'
,
'g'
)
):
{
if
(
p_sample
->
i_handler
!=
ATOM_text
)
break
;
p_track
->
fmt
.
i_codec
=
VLC_CODEC_TX3G
;
MP4_Box_data_sample_text_t
*
p_text
=
p_sample
->
data
.
p_sample_text
;
if
(
p_text
)
...
...
@@ -2640,6 +2644,8 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
break
;
case
VLC_CODEC_DVD_LPCM
:
{
if
(
p_sample
->
i_handler
!=
ATOM_soun
)
break
;
MP4_Box_data_sample_soun_t
*
p_soun
=
p_sample
->
data
.
p_sample_soun
;
if
(
p_soun
->
i_qt_version
==
2
)
{
...
...
@@ -2853,6 +2859,9 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
case
VLC_FOURCC
(
'V'
,
'P'
,
'3'
,
'1'
):
case
VLC_FOURCC
(
'3'
,
'I'
,
'V'
,
'1'
):
case
VLC_FOURCC
(
'Z'
,
'y'
,
'G'
,
'o'
):
{
if
(
p_sample
->
i_handler
!=
ATOM_vide
)
break
;
p_track
->
fmt
.
i_extra
=
p_sample
->
data
.
p_sample_vide
->
i_qt_image_description
;
if
(
p_track
->
fmt
.
i_extra
>
0
)
...
...
@@ -2863,6 +2872,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
p_track
->
fmt
.
i_extra
);
}
break
;
}
case
VLC_CODEC_AMR_NB
:
p_track
->
fmt
.
audio
.
i_rate
=
8000
;
...
...
@@ -2873,6 +2883,9 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
case
VLC_FOURCC
(
'Q'
,
'D'
,
'M'
,
'C'
):
case
VLC_CODEC_QDM2
:
case
VLC_CODEC_ALAC
:
{
if
(
p_sample
->
i_handler
!=
ATOM_soun
)
break
;
p_track
->
fmt
.
i_extra
=
p_sample
->
data
.
p_sample_soun
->
i_qt_description
;
if
(
p_track
->
fmt
.
i_extra
>
0
)
...
...
@@ -2888,7 +2901,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
p_track
->
fmt
.
audio
.
i_rate
=
GetDWBE
((
uint8_t
*
)
p_track
->
fmt
.
p_extra
+
52
);
}
break
;
}
case
VLC_FOURCC
(
'v'
,
'c'
,
'-'
,
'1'
):
{
MP4_Box_t
*
p_dvc1
=
MP4_BoxGet
(
p_sample
,
"dvc1"
);
...
...
@@ -2957,8 +2970,11 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
case
VLC_CODEC_ADPCM_MS
:
case
VLC_CODEC_ADPCM_IMA_WAV
:
case
VLC_CODEC_QCELP
:
p_track
->
fmt
.
audio
.
i_blockalign
=
p_sample
->
data
.
p_sample_soun
->
i_bytes_per_frame
;
{
if
(
p_sample
->
i_handler
==
ATOM_soun
)
p_track
->
fmt
.
audio
.
i_blockalign
=
p_sample
->
data
.
p_sample_soun
->
i_bytes_per_frame
;
break
;
}
default:
msg_Dbg
(
p_demux
,
"Unrecognized FourCC %4.4s"
,
(
char
*
)
&
p_sample
->
i_type
);
...
...
Write
Preview
Supports
Markdown
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