Mercurial > mplayer.hg
comparison stream/stream_bluray.c @ 37188:32aab8a15bfc
bluray: Fix STREAM_CTRL_SEEK_TO_TIME for out-of-bound values.
author | reimar |
---|---|
date | Wed, 17 Sep 2014 18:16:22 +0000 |
parents | db6c0aa280ff |
children |
comparison
equal
deleted
inserted
replaced
37187:db6c0aa280ff | 37188:32aab8a15bfc |
---|---|
217 | 217 |
218 case STREAM_CTRL_GET_CURRENT_TIME: | 218 case STREAM_CTRL_GET_CURRENT_TIME: |
219 *(double *)arg = bd_tell_time(b->bd) / 90000.0; | 219 *(double *)arg = bd_tell_time(b->bd) / 90000.0; |
220 return STREAM_OK; | 220 return STREAM_OK; |
221 case STREAM_CTRL_SEEK_TO_TIME: { | 221 case STREAM_CTRL_SEEK_TO_TIME: { |
222 int64_t res = bd_seek_time(b->bd, *(double*)arg * 90000.0); | 222 int64_t res; |
223 double target = *(double*)arg * 90000.0; | |
224 BLURAY_TITLE_INFO *ti = bd_get_title_info(b->bd, b->current_title, b->current_angle); | |
225 // clamp to ensure that out-of-bounds seeks do not simply do nothing. | |
226 target = FFMAX(target, 0); | |
227 if (ti && ti->duration > 1) | |
228 target = FFMIN(target, ti->duration - 1); | |
229 res = bd_seek_time(b->bd, target); | |
223 if (res < 0) | 230 if (res < 0) |
224 return STREAM_ERROR; | 231 return STREAM_ERROR; |
225 s->pos = res; | 232 s->pos = res; |
226 return 1; | 233 return 1; |
227 } | 234 } |