[vlc-commits] demux: heif: handle container sized references

Francois Cartegnie git at videolan.org
Wed Jun 17 19:55:31 CEST 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jun 17 18:08:52 2020 +0200| [f1118eb9c3b911e7abd1e98cdf688dc007370d52] | committer: Francois Cartegnie

demux: heif: handle container sized references

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f1118eb9c3b911e7abd1e98cdf688dc007370d52
---

 modules/demux/mp4/heif.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mp4/heif.c b/modules/demux/mp4/heif.c
index 0f752068d1..bcd7aec6bd 100644
--- a/modules/demux/mp4/heif.c
+++ b/modules/demux/mp4/heif.c
@@ -256,15 +256,27 @@ static block_t *ReadItemExtents( demux_t *p_demux, uint32_t i_item_id,
 
             if( BOXDATA(p_iloc)->p_items[i].i_construction_method < 2 )
             {
-                /* Extents are in 1:file, 2:idat */
+                /* Extents are in 0:file, 1:idat */
                 if( BOXDATA(p_iloc)->p_items[i].i_construction_method == 1 )
                 {
                     MP4_Box_t *idat = MP4_BoxGet( p_sys->p_root, "meta/idat" );
                     if(!idat)
                         break;
                     i_offset += idat->i_pos + mp4_box_headersize(idat);
+                    if( i_length == 0 ) /* Entire container */
+                        i_length = idat->i_size - mp4_box_headersize(idat);
+                }
+                else
+                {
+                    if( i_length == 0 ) /* Entire container == file */
+                    {
+                        if( vlc_stream_GetSize( p_demux->s, &i_length )
+                                == VLC_SUCCESS && i_length > i_offset )
+                            i_length -= i_offset;
+                        else
+                            i_length = 0;
+                    }
                 }
-
                 if( vlc_stream_Seek( p_demux->s, i_offset ) != VLC_SUCCESS )
                     break;
                 *pp_append = vlc_stream_Block( p_demux->s, i_length );



More information about the vlc-commits mailing list