[vlc-commits] demux: libmp4: fix reading signed cslg
Francois Cartegnie
git at videolan.org
Fri Feb 5 14:35:45 UTC 2021
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jan 26 09:54:05 2021 +0100| [34ba6ab03b4594ad4e4bfd518e0cb982cc1bb369] | committer: Francois Cartegnie
demux: libmp4: fix reading signed cslg
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=34ba6ab03b4594ad4e4bfd518e0cb982cc1bb369
---
modules/demux/mp4/libmp4.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 16a9d8ac20..4d01935699 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -1649,17 +1649,22 @@ static int MP4_ReadBox_cslg( stream_t *p_stream, MP4_Box_t *p_box )
if( i_version > 1 )
MP4_READBOX_EXIT( 0 );
-#define READ_CSLG(readbytes) {\
- readbytes( p_box->data.p_cslg->ct_to_dts_shift );\
- readbytes( p_box->data.p_cslg->i_least_delta );\
- readbytes( p_box->data.p_cslg->i_max_delta );\
- readbytes( p_box->data.p_cslg->i_composition_starttime );\
- readbytes( p_box->data.p_cslg->i_composition_endtime ); }
+ union { int32_t s; uint32_t u; } u32;
+ union { int64_t s; uint64_t u; } u64;
+#define DOREAD_CSLG( readbytes, temp, member ) \
+ { readbytes( temp.u ); member = temp.s; }
+
+#define READ_CSLG( readbytes, temp ) {\
+ DOREAD_CSLG( readbytes, temp, p_box->data.p_cslg->ct_to_dts_shift );\
+ DOREAD_CSLG( readbytes, temp, p_box->data.p_cslg->i_least_delta );\
+ DOREAD_CSLG( readbytes, temp, p_box->data.p_cslg->i_max_delta );\
+ DOREAD_CSLG( readbytes, temp, p_box->data.p_cslg->i_composition_starttime );\
+ DOREAD_CSLG( readbytes, temp, p_box->data.p_cslg->i_composition_endtime ); }
if( i_version == 0 )
- READ_CSLG(MP4_GET4BYTES)
+ READ_CSLG( MP4_GET4BYTES, u32 )
else
- READ_CSLG(MP4_GET8BYTES)
+ READ_CSLG( MP4_GET8BYTES, u64 )
MP4_READBOX_EXIT( 1 );
}
More information about the vlc-commits
mailing list