[libbluray-devel] BD_EVENT_SEEK: signal new playback time position

hpi1 git at videolan.org
Fri Jun 3 12:58:45 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Jun  1 15:03:04 2016 +0300| [2675927bfe225b34824966efcd613866c8d91157] | committer: hpi1

BD_EVENT_SEEK: signal new playback time position

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

 src/libbluray/bluray.c |   11 ++++++++---
 src/libbluray/bluray.h |    2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 833a2c2..88e815a 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1580,15 +1580,20 @@ static void _seek_internal(BLURAY *bd,
                            NAV_CLIP *clip, uint32_t title_pkt, uint32_t clip_pkt)
 {
     if (_seek_stream(bd, &bd->st0, clip, clip_pkt) >= 0) {
+        uint32_t media_time;
 
         /* update title position */
         bd->s_pos = (uint64_t)title_pkt * 192;
 
         /* Update PSR_TIME */
-        _update_time_psr_from_stream(bd);
+        media_time = _update_time_psr_from_stream(bd);
 
-        _queue_event(bd, BD_EVENT_SEEK, 0);
-        _bdj_event(bd, BDJ_EVENT_SEEK, 0);
+        /* emit notification events */
+        if (media_time >= clip->in_time) {
+            media_time = media_time - clip->in_time + clip->title_time;
+        }
+        _queue_event(bd, BD_EVENT_SEEK, media_time);
+        _bdj_event(bd, BDJ_EVENT_SEEK, media_time);
 
         /* playmark tracking */
         _find_next_playmark(bd);
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index 3cd7118..73e142c 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -742,7 +742,7 @@ typedef enum {
     BD_EVENT_DISCONTINUITY          = 28,  /* new timestamp (45 kHz) */
 
     /* HDMV VM or JVM seeked the stream. Next read() will return data from new position. Flush all buffers. */
-    BD_EVENT_SEEK                   = 21,
+    BD_EVENT_SEEK                   = 21,  /* new media time (45 kHz) */
 
     /* still playback (pause) */
     BD_EVENT_STILL                  = 22,  /* 0 - off, 1 - on */



More information about the libbluray-devel mailing list