[vlc-commits] cdg: check ES just once
Rémi Denis-Courmont
git at videolan.org
Thu May 3 18:46:20 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May 3 19:45:58 2018 +0300| [89a09048a8f92a4860a1868e939e347359eb6141] | committer: Rémi Denis-Courmont
cdg: check ES just once
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=89a09048a8f92a4860a1868e939e347359eb6141
---
modules/demux/cdg.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/modules/demux/cdg.c b/modules/demux/cdg.c
index 2832be116c..578273efc2 100644
--- a/modules/demux/cdg.c
+++ b/modules/demux/cdg.c
@@ -88,11 +88,6 @@ static int Open( vlc_object_t * p_this )
if( unlikely(p_sys == NULL) )
return VLC_ENOMEM;
- p_demux->pf_demux = Demux;
- p_demux->pf_control = Control;
- p_demux->p_sys = p_sys;
-
- /* */
es_format_Init( &p_sys->fmt, VIDEO_ES, VLC_CODEC_CDG );
p_sys->fmt.video.i_width = 300-2*6;
p_sys->fmt.video.i_height = 216-2*12 ;
@@ -100,11 +95,16 @@ static int Open( vlc_object_t * p_this )
p_sys->fmt.video.i_visible_height = p_sys->fmt.video.i_height;
p_sys->p_es = es_out_Add( p_demux->out, &p_sys->fmt );
+ if( unlikely(p_sys->p_es == NULL) )
+ return VLC_ENOMEM;
/* There is CDG_FRAME_RATE frames per second */
date_Init( &p_sys->pts, CDG_FRAME_RATE, 1 );
date_Set( &p_sys->pts, 0 );
+ p_demux->pf_demux = Demux;
+ p_demux->pf_control = Control;
+ p_demux->p_sys = p_sys;
return VLC_SUCCESS;
}
@@ -142,12 +142,7 @@ static int Demux( demux_t *p_demux )
}
es_out_SetPCR( p_demux->out, p_block->i_pts );
-
- if( p_sys->p_es )
- es_out_Send( p_demux->out, p_sys->p_es, p_block );
- else
- block_Release( p_block );
-
+ es_out_Send( p_demux->out, p_sys->p_es, p_block );
return VLC_DEMUXER_SUCCESS;
}
More information about the vlc-commits
mailing list