[vlc-commits] TS demux: PIDInit(): simplify
Rafaël Carré
git at videolan.org
Mon Mar 5 10:39:52 CET 2012
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Thu Feb 16 03:18:52 2012 -0500| [c6052ba0fce7caf7ebb2fff003e9245bebd8da4f] | committer: Rafaël Carré
TS demux: PIDInit(): simplify
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c6052ba0fce7caf7ebb2fff003e9245bebd8da4f
---
modules/demux/ts.c | 43 ++++++++++++++++++-------------------------
1 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index 0f1b86d..ac6ea7c 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -1305,36 +1305,29 @@ static void PIDInit( ts_pid_t *pid, bool b_psi, ts_psi_t *p_owner )
if( p_owner )
{
ts_prg_psi_t *prg = malloc( sizeof( ts_prg_psi_t ) );
- if( prg )
- {
- /* PMT */
- prg->i_version = -1;
- prg->i_number = -1;
- prg->i_pid_pcr = -1;
- prg->i_pid_pmt = -1;
- prg->i_pcr_value= -1;
- prg->iod = NULL;
- prg->handle = NULL;
-
- TAB_APPEND( pid->psi->i_prg, pid->psi->prg, prg );
- }
+ if( !prg )
+ return;
+ /* PMT */
+ prg->i_version = -1;
+ prg->i_number = -1;
+ prg->i_pid_pcr = -1;
+ prg->i_pid_pmt = -1;
+ prg->i_pcr_value= -1;
+ prg->iod = NULL;
+ prg->handle = NULL;
+
+ TAB_APPEND( pid->psi->i_prg, pid->psi->prg, prg );
}
}
else
{
pid->psi = NULL;
- pid->es = malloc( sizeof( ts_es_t ) );
- if( pid->es )
- {
- es_format_Init( &pid->es->fmt, UNKNOWN_ES, 0 );
- pid->es->id = NULL;
- pid->es->p_pes = NULL;
- pid->es->i_pes_size= 0;
- pid->es->i_pes_gathered= 0;
- pid->es->pp_last = &pid->es->p_pes;
- pid->es->p_mpeg4desc = NULL;
- pid->es->b_gather = false;
- }
+ pid->es = calloc( 1, sizeof( ts_es_t ) );
+ if( !pid->es )
+ return;
+
+ es_format_Init( &pid->es->fmt, UNKNOWN_ES, 0 );
+ pid->es->pp_last = &pid->es->p_pes;
}
}
More information about the vlc-commits
mailing list