changeset 37186:297da727ee2b

bluray: check bd_seek result more thoroughly. Also implement GET_SIZE stream control.
author reimar
date Wed, 17 Sep 2014 17:49:55 +0000
parents 917a3c4c2d39
children db6c0aa280ff
files stream/stream_bluray.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_bluray.c	Wed Sep 17 17:49:54 2014 +0000
+++ b/stream/stream_bluray.c	Wed Sep 17 17:49:55 2014 +0000
@@ -91,8 +91,12 @@
     int64_t p;
 
     p = bd_seek(b->bd, pos);
-    if (p == -1)
+    // bd_seek does not say what happens on errors,
+    // so be extra paranoid.
+    if (p < 0 || p != pos) {
+        s->pos = bd_tell(b->bd);
         return 0;
+    }
 
     s->pos = p;
     return 1;
@@ -205,6 +209,9 @@
         *(double *)arg = ti->duration / 90000.0;
         return STREAM_OK;
     }
+    case STREAM_CTRL_GET_SIZE:
+        *(uint64_t*)arg = bd_get_title_size(b->bd);
+        return STREAM_OK;
 
     case STREAM_CTRL_GET_CURRENT_TIME:
         *(double *)arg = bd_tell_time(b->bd) / 90000.0;