[vlc-commits] demux: mp4: fix stsd v1 regression
Francois Cartegnie
git at videolan.org
Mon Mar 8 14:46:35 UTC 2021
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Mar 8 13:33:23 2021 +0100| [0c7bf0f4da90778d5784efc9b9886677d71134ca] | committer: Francois Cartegnie
demux: mp4: fix stsd v1 regression
refs #25481
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=0c7bf0f4da90778d5784efc9b9886677d71134ca
---
modules/demux/mp4/libmp4.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 2a64f4abdd..48cf23c271 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -1505,14 +1505,22 @@ static int MP4_ReadBox_urn( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 1 );
}
-static int MP4_ReadBox_LtdContainer( stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_LtdContainer( stream_t *p_stream, MP4_Box_t *p_box,
+ const uint8_t versions[2], size_t i_versions )
{
MP4_READBOX_ENTER_PARTIAL( MP4_Box_data_lcont_t, 16, NULL );
if( i_read < 8 )
MP4_READBOX_EXIT( 0 );
MP4_GETVERSIONFLAGS( p_box->data.p_lcont );
- if( p_box->data.p_lcont->i_version != 0 )
+ bool b_version_ok = true;
+ for( size_t i=0; i<i_versions; i++ )
+ {
+ b_version_ok = (p_box->data.p_lcont->i_version == versions[i]);
+ if( b_version_ok )
+ break;
+ }
+ if( !b_version_ok )
MP4_READBOX_EXIT( 0 );
MP4_GET4BYTES( p_box->data.p_lcont->i_entry_count );
@@ -1547,6 +1555,18 @@ static int MP4_ReadBox_LtdContainer( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 1 );
}
+static int MP4_ReadBox_stsd( stream_t *p_stream, MP4_Box_t *p_box )
+{
+ const uint8_t versions[] = {0, 1};
+ return MP4_ReadBox_LtdContainer( p_stream, p_box, versions, 2 );
+}
+
+static int MP4_ReadBox_dref( stream_t *p_stream, MP4_Box_t *p_box )
+{
+ const uint8_t versions[] = {0};
+ return MP4_ReadBox_LtdContainer( p_stream, p_box, versions, 1 );
+}
+
static void MP4_FreeBox_stts( MP4_Box_t *p_box )
{
FREENULL( p_box->data.p_stts->pi_sample_count );
@@ -4493,11 +4513,11 @@ static const struct
{ ATOM_alis, MP4_ReadBoxSkip, ATOM_dref },
{ ATOM_url, MP4_ReadBox_url, 0 },
{ ATOM_urn, MP4_ReadBox_urn, 0 },
- { ATOM_dref, MP4_ReadBox_LtdContainer, 0 },
+ { ATOM_dref, MP4_ReadBox_dref, 0 },
{ ATOM_stts, MP4_ReadBox_stts, ATOM_stbl },
{ ATOM_ctts, MP4_ReadBox_ctts, ATOM_stbl },
{ ATOM_cslg, MP4_ReadBox_cslg, ATOM_stbl },
- { ATOM_stsd, MP4_ReadBox_LtdContainer, ATOM_stbl },
+ { ATOM_stsd, MP4_ReadBox_stsd, ATOM_stbl },
{ ATOM_stsz, MP4_ReadBox_stsz, ATOM_stbl },
{ ATOM_stsc, MP4_ReadBox_stsc, ATOM_stbl },
{ ATOM_stco, MP4_ReadBox_stco_co64, ATOM_stbl },
More information about the vlc-commits
mailing list