[libbluray-devel] Add bd_set_rate()

hpi1 git at videolan.org
Tue May 17 13:08:51 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue May 17 10:15:43 2016 +0300| [e7e8d09f27ed31b21c95447c6b09f3d40c9fe4ed] | committer: hpi1

Add bd_set_rate()

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

 src/libbluray/bluray.c |   26 ++++++++++++++++++++++++++
 src/libbluray/bluray.h |   17 +++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index eadcf71..b7598b9 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -3508,6 +3508,32 @@ void bd_set_scr(BLURAY *bd, int64_t pts)
     bd_mutex_unlock(&bd->mutex);
 }
 
+static int _set_rate(BLURAY *bd, uint32_t rate)
+{
+    if (!bd->title) {
+        return -1;
+    }
+
+#ifdef USING_BDJAVA
+    if (bd->title_type == title_bdj) {
+        return _bdj_event(bd, BDJ_EVENT_RATE, rate);
+    }
+#endif
+
+    return 0;
+}
+
+int bd_set_rate(BLURAY *bd, uint32_t rate)
+{
+    int result;
+
+    bd_mutex_lock(&bd->mutex);
+    result = _set_rate(bd, rate);
+    bd_mutex_unlock(&bd->mutex);
+
+    return result;
+}
+
 int bd_mouse_select(BLURAY *bd, int64_t pts, uint16_t x, uint16_t y)
 {
     uint32_t param = (x << 16) | y;
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index cbf16fc..3cd7118 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -977,6 +977,23 @@ void bd_set_scr(BLURAY *bd, int64_t pts);
 
 /**
  *
+ *  Set current playback rate.
+ *
+ *  Notify BD-J media player when user changes playback rate
+ *  (ex. pauses playback).
+ *  Changing rate may fail if corresponding UO is masked or
+ *  playlist is not playing.
+ *
+ * @param bd  BLURAY object
+ * @param rate current playback rate * 90000 (0 = paused, 90000 = normal)
+ * @return <0 on error, 0 on success
+ */
+#define BLURAY_RATE_PAUSED  0
+#define BLURAY_RATE_NORMAL  90000
+int bd_set_rate(BLURAY *bd, uint32_t rate);
+
+/**
+ *
  *  Pass user input to graphics controller.
  *  Keys are defined in libbluray/keys.h.
  *  Current pts can be updated by using BD_VK_NONE key. This is required for animated menus.



More information about the libbluray-devel mailing list