[libbluray-devel] Added bd_read_skip_still()

hpi1 git at videolan.org
Tue May 31 15:42:39 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue May 31 16:41:32 2011 +0300| [1cfc5386cff04f6960aac63de20dd1c6380df145] | committer: hpi1

Added bd_read_skip_still()
This function is used to continue reading after still mode clip.

NOTE:
Before this change bd_read() jumped to next clip automatically.
Now bd_read() continues to next clip only after call to bd_read_skip_still().

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

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

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index f989307..7f9807b 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1173,7 +1173,10 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
                         return 0;
                     }
                     if (pi->still_mode == BLURAY_STILL_TIME) {
-                        _queue_event(bd, (BD_EVENT){BD_EVENT_STILL_TIME, pi->still_time});
+                        if (bd->event_queue) {
+                            _queue_event(bd, (BD_EVENT){BD_EVENT_STILL_TIME, pi->still_time});
+                            return 0;
+                        }
                     }
 
                     // find next clip
@@ -1186,14 +1189,6 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
                     if (!_open_m2ts(bd, st)) {
                         return -1;
                     }
-
-                    // timed still mode: allow application to process BD_EVENT_STILL_TIME.
-                    // next bd_read() will return new data.
-                    if (bd->event_queue) {
-                        if (pi->still_mode == BLURAY_STILL_TIME) {
-                            return 0;
-                        }
-                    }
                 }
 
                 if (_read_block(bd, st, bd->int_buf)) {
@@ -1231,6 +1226,24 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
     return -1;
 }
 
+int bd_read_skip_still(BLURAY *bd)
+{
+    BD_STREAM *st = &bd->st0;
+
+    if (st->clip) {
+        MPLS_PI *pi = &st->clip->title->pl->play_item[st->clip->ref];
+
+        if (pi->still_mode == BLURAY_STILL_TIME) {
+            st->clip = nav_next_clip(bd->title, st->clip);
+            if (st->clip) {
+                return _open_m2ts(bd, st);
+            }
+        }
+    }
+
+    return 0;
+}
+
 /*
  * preloader for asynchronous sub paths
  */
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index bbbd257..15a6ee6 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -254,6 +254,15 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len);
 
 /**
  *
+ *  Continue reading after still mode clip
+ *
+ * @param bd  BLURAY object
+ * @return 0 on error
+ */
+int bd_read_skip_still(BLURAY *bd);
+
+/**
+ *
  *  Seek to a chapter. First chapter is 0
  *
  * @param bd  BLURAY object



More information about the libbluray-devel mailing list