[vlc-commits] access: dvdnav: refactor and check alloc
Francois Cartegnie
git at videolan.org
Mon Aug 19 20:49:33 CEST 2019
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Aug 19 18:33:25 2019 +0200| [8adeaf6ba21ca915d7253494e3fcaadd63790e72] | committer: Francois Cartegnie
access: dvdnav: refactor and check alloc
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8adeaf6ba21ca915d7253494e3fcaadd63790e72
---
modules/access/dvdnav.c | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 5637454886..ddbe6ee220 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -1504,6 +1504,7 @@ static void ESNew( demux_t *p_demux, int i_id )
demux_sys_t *p_sys = p_demux->p_sys;
ps_track_t *tk = &p_sys->tk[ps_id_to_tk(i_id)];
bool b_select = false;
+ int i_lang = 0xffff;
if( tk->b_configured ) return;
@@ -1542,14 +1543,7 @@ static void ESNew( demux_t *p_demux, int i_id )
}
if( i_audio >= 0 )
{
- int i_lang = dvdnav_audio_stream_to_lang( p_sys->dvdnav, i_audio );
- if( i_lang != 0xffff )
- {
- tk->fmt.psz_language = malloc( 3 );
- tk->fmt.psz_language[0] = (i_lang >> 8)&0xff;
- tk->fmt.psz_language[1] = (i_lang )&0xff;
- tk->fmt.psz_language[2] = 0;
- }
+ i_lang = dvdnav_audio_stream_to_lang( p_sys->dvdnav, i_audio );
if( dvdnav_get_active_audio_stream( p_sys->dvdnav ) == i_audio )
{
b_select = true;
@@ -1559,14 +1553,7 @@ static void ESNew( demux_t *p_demux, int i_id )
else if( tk->fmt.i_cat == SPU_ES )
{
int32_t i_title, i_part;
- int i_lang = dvdnav_spu_stream_to_lang( p_sys->dvdnav, i_id&0x1f );
- if( i_lang != 0xffff )
- {
- tk->fmt.psz_language = malloc( 3 );
- tk->fmt.psz_language[0] = (i_lang >> 8)&0xff;
- tk->fmt.psz_language[1] = (i_lang )&0xff;
- tk->fmt.psz_language[2] = 0;
- }
+ i_lang = dvdnav_spu_stream_to_lang( p_sys->dvdnav, i_id&0x1f );
/* Palette */
tk->fmt.subs.spu.palette[0] = SPU_PALETTE_DEFINED;
@@ -1582,6 +1569,17 @@ static void ESNew( demux_t *p_demux, int i_id )
}
}
+ if( i_lang != 0xffff )
+ {
+ tk->fmt.psz_language = malloc( 3 );
+ if( tk->fmt.psz_language )
+ {
+ tk->fmt.psz_language[0] = (i_lang >> 8)&0xff;
+ tk->fmt.psz_language[1] = (i_lang )&0xff;
+ tk->fmt.psz_language[2] = 0;
+ }
+ }
+
tk->fmt.i_id = i_id;
tk->es = es_out_Add( p_demux->out, &tk->fmt );
if( b_select && tk->es )
More information about the vlc-commits
mailing list