[vlc-commits] demux: libmp4: add AddChild helper

Francois Cartegnie git at videolan.org
Thu Dec 18 22:39:56 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Dec 13 14:07:57 2014 +0100| [2f246ccf64b0ac5dd773baf558140f080e664294] | committer: Francois Cartegnie

demux: libmp4: add AddChild helper

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

 modules/demux/mp4/libmp4.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 48f4fdb..601de24 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -72,6 +72,15 @@ static void MP4_ConvertDate2Str( char *psz, uint64_t i_date, bool b_relative )
  *****************************************************************************/
 static MP4_Box_t *MP4_ReadBox( stream_t *p_stream, MP4_Box_t *p_father );
 
+static void MP4_BoxAddChild( MP4_Box_t *p_parent, MP4_Box_t *p_childbox )
+{
+    if( !p_parent->p_first )
+            p_parent->p_first = p_childbox;
+    else
+            p_parent->p_last->p_next = p_childbox;
+    p_parent->p_last = p_childbox;
+}
+
 
 /*****************************************************************************
  * MP4_ReadBoxCommon : Load only common parameters for all boxes
@@ -222,9 +231,7 @@ static int MP4_ReadBoxContainerChildrenIndexed( stream_t *p_stream,
         p_box->i_index = i_index;
 
         /* chain this box with the father and the other at same level */
-        if( !p_container->p_first ) p_container->p_first = p_box;
-        else p_container->p_last->p_next = p_box;
-        p_container->p_last = p_box;
+        MP4_BoxAddChild( p_container, p_box );
 
         if( p_box->i_type == i_last_child )
         {



More information about the vlc-commits mailing list