# HG changeset patch # User reimar # Date 1410976195 0 # Node ID 297da727ee2b286954ca56d66db6d265242669e3 # Parent 917a3c4c2d39fdc6ed44d11aeb538cf24e8f1d9c bluray: check bd_seek result more thoroughly. Also implement GET_SIZE stream control. diff -r 917a3c4c2d39 -r 297da727ee2b stream/stream_bluray.c --- 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;