[libbluray-devel] Emit BD_EVENT_PLAYLIST_STOP when playlist playback is stopped in middle

hpi1 git at videolan.org
Thu Feb 19 19:50:24 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Feb 19 20:44:26 2015 +0200| [be8abc2ce1e694c592076c791d1ed07766de8620] | committer: hpi1

Emit BD_EVENT_PLAYLIST_STOP when playlist playback is stopped in middle

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=be8abc2ce1e694c592076c791d1ed07766de8620
---

 ChangeLog              |    7 ++++---
 src/libbluray/bluray.c |   17 +++++++++++++++++
 src/libbluray/bluray.h |    5 ++++-
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7a42e91..d345c4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
-- Add support for UDF image files and unmounted discs
-- Add UDF volume identifier to DISC_INFO
-- Fix infinite loop with some broken HDMV menus
+- Add support for UDF image files and unmounted discs.
+- Add UDF volume identifier to DISC_INFO.
+- Fix infinite loop with some broken HDMV menus.
+- Emit BD_EVENT_PLAYLIST_STOP when playlist playback is stopped in middle.
 
 2015-01-26: Version 0.7.0
 - Add player setting for BD-J persistent storage and cache paths.
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 50f7a98..23d8f35 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -2052,6 +2052,23 @@ static void _close_playlist(BLURAY *bd)
         gc_run(bd->graphics_controller, GC_CTRL_RESET, 0, NULL);
     }
 
+    /* stopping playback in middle of playlist ? */
+    if (bd->title && bd->st0.clip) {
+        if (bd->st0.clip->ref < bd->title->clip_list.count - 1) {
+            /* not last clip of playlist */
+            BD_DEBUG(DBG_BLURAY, "close playlist (not last clip)\n");
+            _queue_event(bd, BD_EVENT_PLAYLIST_STOP, 0);
+        } else {
+            /* last clip of playlist */
+            int clip_pkt = SPN(bd->st0.clip_pos);
+            int skip = bd->st0.clip->end_pkt - clip_pkt;
+            BD_DEBUG(DBG_BLURAY, "close playlist (last clip), packets skipped %d\n", skip);
+            if (skip > 100) {
+                _queue_event(bd, BD_EVENT_PLAYLIST_STOP, 0);
+            }
+        }
+    }
+
     _close_m2ts(&bd->st0);
     _close_preload(&bd->st_ig);
     _close_preload(&bd->st_textst);
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index 9ee5839..c089d07 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -660,6 +660,9 @@ typedef enum {
      * playback control
      */
 
+    /* HDMV VM or JVM stopped playlist playback. Flush all buffers. */
+    BD_EVENT_PLAYLIST_STOP          = 31,
+
     /* discontinuity in the stream (non-seamless connection). Reset demuxer PES buffers. */
     BD_EVENT_DISCONTINUITY          = 28,  /* new timestamp (45 kHz) */
 
@@ -692,7 +695,7 @@ typedef enum {
     /* 3D */
     BD_EVENT_STEREOSCOPIC_STATUS    = 27,  /* 0 - 2D, 1 - 3D */
 
-    /*BD_EVENT_LAST = 30, */
+    /*BD_EVENT_LAST = 31, */
 
 } bd_event_e;
 



More information about the libbluray-devel mailing list