changeset 37113:f5b5c7246439

bluray: add some missing stream controls. Will all exact time-based seeking and displaying the correct time and duration.
author reimar
date Tue, 27 May 2014 19:22:07 +0000
parents 608c83ef5c0c
children a4c2668dadb6
files stream/stream_bluray.c
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_bluray.c	Tue May 27 13:52:52 2014 +0000
+++ b/stream/stream_bluray.c	Tue May 27 19:22:07 2014 +0000
@@ -198,6 +198,25 @@
         return r ? 1 : STREAM_UNSUPPORTED;
     }
 
+    case STREAM_CTRL_GET_TIME_LENGTH: {
+        BLURAY_TITLE_INFO *ti = bd_get_title_info(b->bd, b->current_title, b->current_angle);
+        if (!ti)
+            return STREAM_UNSUPPORTED;
+        *(double *)arg = ti->duration / 90000.0;
+        return STREAM_OK;
+    }
+
+    case STREAM_CTRL_GET_CURRENT_TIME:
+        *(double *)arg = bd_tell_time(b->bd) / 90000.0;
+        return STREAM_OK;
+    case STREAM_CTRL_SEEK_TO_TIME: {
+        int64_t res = bd_seek_time(b->bd, *(double*)arg * 90000.0);
+        if (res < 0)
+            return STREAM_ERROR;
+        s->pos = res;
+        return 1;
+    }
+
     case STREAM_CTRL_GET_NUM_ANGLES: {
         BLURAY_TITLE_INFO *ti;