[vlc-devel] [PATCH 07/12] bluray: Nasty hack to avoid crashing when changing title.

Hugo Beauzée-Luyssen beauze.h at gmail.com
Sun Jan 22 00:31:02 CET 2012


---
 modules/access/bluray.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 30728c7..9c4484a 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -296,8 +296,22 @@ static int blurayInitTitles(demux_t *p_demux )
     return VLC_SUCCESS;
 }
 
+static void blurayResetParser( demux_t *p_demux )
+{
+    demux_sys_t *p_sys = p_demux->p_sys;
+    if ( p_sys->p_parser )
+        stream_Delete( p_sys->p_parser );
+    p_sys->p_parser = stream_DemuxNew(p_demux, "ts", p_demux->out);
+    if (!p_sys->p_parser) {
+        msg_Err(p_demux, "Failed to create TS demuxer");
+    }
+}
+
 static void blurayUpdateTitle( demux_t *p_demux, int i_title )
 {
+    blurayResetParser( p_demux );
+    if ( i_title >= p_demux->p_sys->i_title )
+        return ;
     /* read title info and init some values */
     p_demux->info.i_title = i_title;
     p_demux->info.i_seekpoint = 0;
@@ -474,13 +488,13 @@ static void     blurayHandleEvent( demux_t *p_demux, const BD_EVENT *e )
     switch ( e->event )
     {
     case    BD_EVENT_TITLE:
-        if ( e->param < p_sys->i_title )
-            blurayUpdateTitle( p_demux, e->param );
+        blurayUpdateTitle( p_demux, e->param );
         break ;
     case BD_EVENT_CHAPTER:
         p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
         p_demux->info.i_seekpoint = 0;
         break ;
+    case BD_EVENT_END_OF_TITLE:
     case BD_EVENT_PLAYITEM:
     case BD_EVENT_AUDIO_STREAM:
     case BD_EVENT_ANGLE:
-- 
1.7.8.4




More information about the vlc-devel mailing list