[libbluray-devel] Moved chapter tracking to separate function
hpi1
git at videolan.org
Fri Apr 8 15:53:59 CEST 2011
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Apr 8 16:53:21 2011 +0300| [8c70c77387db84c78441f775bb90b4101cb0d10c] | committer: hpi1
Moved chapter tracking to separate function
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=8c70c77387db84c78441f775bb90b4101cb0d10c
---
src/libbluray/bluray.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index c33ed67..ead052c 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -276,6 +276,14 @@ static void _update_clip_psrs(BLURAY *bd, NAV_CLIP *clip)
}
}
+
+static void _update_chapter_psr(BLURAY *bd)
+{
+ uint32_t current_chapter = bd_get_current_chapter(bd);
+ bd->next_chapter_start = bd_chapter_pos(bd, current_chapter + 1);
+ bd_psr_write(bd->regs, PSR_CHAPTER, current_chapter + 1);
+}
+
/*
* clip access (BD_STREAM)
*/
@@ -899,9 +907,7 @@ static int64_t _seek_internal(BLURAY *bd,
bd->s_pos = (uint64_t)title_pkt * 192;
/* chapter tracking */
- uint32_t current_chapter = bd_get_current_chapter(bd);
- bd->next_chapter_start = bd_chapter_pos(bd, current_chapter + 1);
- bd_psr_write(bd->regs, PSR_CHAPTER, current_chapter + 1);
+ _update_chapter_psr(bd);
BD_DEBUG(DBG_BLURAY, "Seek to %"PRIu64" (%p)\n",
bd->s_pos, bd);
@@ -1201,9 +1207,7 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
/* chapter tracking */
if (bd->s_pos > bd->next_chapter_start) {
- uint32_t current_chapter = bd_get_current_chapter(bd);
- bd->next_chapter_start = bd_chapter_pos(bd, current_chapter + 1);
- bd_psr_write(bd->regs, PSR_CHAPTER, current_chapter + 1);
+ _update_chapter_psr(bd);
}
BD_DEBUG(DBG_STREAM, "%d bytes read OK! (%p)\n", out_len, bd);
More information about the libbluray-devel
mailing list