[libbluray-devel] Validate app-provided timestamps
hpi1
git at videolan.org
Thu Apr 14 14:19:49 CEST 2016
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Apr 14 10:51:38 2016 +0300| [bdcd7548e71b65063dfa5782269d88f0fbaa7088] | committer: hpi1
Validate app-provided timestamps
This is still not enough if app provides timestamps from another clip.
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=bdcd7548e71b65063dfa5782269d88f0fbaa7088
---
src/libbluray/bluray.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index c2ea810..1614d85 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -219,6 +219,30 @@ static int _queue_event(BLURAY *bd, uint32_t event, uint32_t param)
* PSR utils
*/
+static void _update_time_psr(BLURAY *bd, uint32_t time)
+{
+ /*
+ * Update PSR8: Presentation Time
+ * The PSR8 represents presentation time in the playing interval from IN_time until OUT_time of
+ * the current PlayItem, measured in units of a 45 kHz clock.
+ */
+
+ if (!bd->title || !bd->st0.clip) {
+ return;
+ }
+ if (time < bd->st0.clip->in_time) {
+ BD_DEBUG(DBG_BLURAY | DBG_CRIT, "_update_time_psr(): timestamp before clip start\n");
+ return;
+ }
+ if (time > bd->st0.clip->out_time) {
+ BD_DEBUG(DBG_BLURAY | DBG_CRIT, "_update_time_psr(): timestamp after clip end\n");
+ return;
+ }
+
+ bd_psr_write(bd->regs, PSR_TIME, time);
+}
+
+
static void _update_stream_psr_by_lang(BD_REGISTERS *regs,
uint32_t psr_lang, uint32_t psr_stream,
uint32_t enable_flag,
@@ -2843,7 +2867,7 @@ static void _set_scr(BLURAY *bd, int64_t pts)
{
if (pts >= 0) {
uint32_t tick = (uint32_t)(((uint64_t)pts) >> 1);
- bd_psr_write(bd->regs, PSR_TIME, tick);
+ _update_time_psr(bd, tick);
}
}
More information about the libbluray-devel
mailing list