[vlc-commits] live555 : use TAB_ macro to store the tracks

Sébastien Escudier git at videolan.org
Mon Dec 5 16:32:56 CET 2011


vlc | branch: master | Sébastien Escudier <sebastien-devel at celeos.eu> | Wed Nov 30 15:18:04 2011 +0100| [fa95aef0a036d2def61cd67d840543c4d83066b4] | committer: Sébastien Escudier

live555 : use TAB_ macro to store the tracks

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

 modules/demux/live555.cpp |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
index a3357d6..7b4e874 100644
--- a/modules/demux/live555.cpp
+++ b/modules/demux/live555.cpp
@@ -189,7 +189,7 @@ struct demux_sys_t
 
     /* */
     int              i_track;
-    live_track_t     **track;   /* XXX mallocated */
+    live_track_t     **track;
 
     /* Weird formats */
     asf_header_t     asfh;
@@ -297,8 +297,7 @@ static int  Open ( vlc_object_t *p_this )
     p_sys->env = NULL;
     p_sys->ms = NULL;
     p_sys->rtsp = NULL;
-    p_sys->i_track = 0;
-    p_sys->track   = NULL;
+    TAB_INIT( p_sys->i_track, p_sys->track );
     p_sys->i_pcr = 0;
     p_sys->i_npt = 0.;
     p_sys->i_npt_start = 0.;
@@ -453,8 +452,7 @@ static void Close( vlc_object_t *p_this )
         free( tk->p_buffer );
         free( tk );
     }
-
-    if( p_sys->i_track ) free( p_sys->track );
+    TAB_CLEAN( p_sys->i_track, p_sys->track );
     if( p_sys->p_out_asf ) stream_Delete( p_sys->p_out_asf );
     delete p_sys->scheduler;
     free( p_sys->p_sdp );
@@ -1069,10 +1067,7 @@ static int SessionsSetup( demux_t *p_demux )
             if( tk->p_es || tk->b_quicktime || ( tk->b_muxed && tk->p_out_muxed ) ||
                 ( tk->b_asf && p_sys->p_out_asf ) )
             {
-                /* Append */
-                p_sys->track = (live_track_t**)xrealloc( p_sys->track,
-                            sizeof( live_track_t ) * ( p_sys->i_track + 1 ) );
-                p_sys->track[p_sys->i_track++] = tk;
+                TAB_APPEND_CAST( (live_track_t **), p_sys->i_track, p_sys->track, tk );
             }
             else
             {
@@ -1580,13 +1575,11 @@ static int RollOverTcp( demux_t *p_demux )
         free( tk->p_buffer );
         free( tk );
     }
-    if( p_sys->i_track ) free( p_sys->track );
+    TAB_CLEAN( p_sys->i_track, p_sys->track );
     if( p_sys->p_out_asf ) stream_Delete( p_sys->p_out_asf );
 
     p_sys->ms = NULL;
     p_sys->rtsp = NULL;
-    p_sys->track = NULL;
-    p_sys->i_track = 0;
     p_sys->b_no_data = true;
     p_sys->i_no_data_ti = 0;
     p_sys->p_out_asf = NULL;



More information about the vlc-commits mailing list