[vlc-devel] [PATCH 03/12] bluray: Prevent some crashes when using a special title.
Hugo Beauzée-Luyssen
beauze.h at gmail.com
Sun Jan 22 00:30:58 CET 2012
For instance, BLURAY_TITLE_FIRST_PLAY has a value of 0xFFFF.
Some title may not be parsed because they are too short, so we just ignore
the event.
---
modules/access/bluray.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 53d01f3..179c51a 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -367,7 +367,10 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
case DEMUX_GET_LENGTH:
{
int64_t *pi_length = (int64_t*)va_arg(args, int64_t *);
- *pi_length = CUR_LENGTH;
+ if ( p_demux->info.i_title < p_sys->i_title )
+ *pi_length = CUR_LENGTH;
+ else
+ *pi_length = 0;
return VLC_SUCCESS;
}
case DEMUX_SET_TIME:
@@ -386,7 +389,10 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
case DEMUX_GET_POSITION:
{
double *pf_position = (double*)va_arg( args, double * );
- *pf_position = (double)FROM_TICKS(bd_tell_time(p_sys->bluray))/CUR_LENGTH;
+ if ( p_demux->info.i_title < p_sys->i_title )
+ *pf_position = (double)FROM_TICKS(bd_tell_time(p_sys->bluray))/CUR_LENGTH;
+ else
+ *pf_position = 0.0;
return VLC_SUCCESS;
}
case DEMUX_SET_POSITION:
@@ -440,7 +446,8 @@ static void blurayHandleEvent( demux_t *p_demux, const BD_EVENT *e )
switch ( e->event )
{
case BD_EVENT_TITLE:
- blurayUpdateTitle( p_demux, e->param );
+ if ( e->param < p_sys->i_title )
+ blurayUpdateTitle( p_demux, e->param );
break ;
case BD_EVENT_PLAYITEM:
break ;
--
1.7.8.4
More information about the vlc-devel
mailing list