[libbluray-devel] Cut read at clip end packet (not block or read boundary).

hpi1 git at videolan.org
Mon Jun 17 11:43:39 CEST 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Jun 17 12:41:46 2013 +0300| [93daf1755f83d0fad2a9363fae3c83730cecfa60] | committer: hpi1

Cut read at clip end packet (not block or read boundary).
Fixes slide shows and probably some other problems too.

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=93daf1755f83d0fad2a9363fae3c83730cecfa60
---

 src/libbluray/bluray.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index dddb7fc..97e84b7 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1850,6 +1850,15 @@ static int _bd_read(BLURAY *bd, unsigned char *buf, int len)
             if (size > (unsigned int)6144 - st->int_buf_off) {
                 size = 6144 - st->int_buf_off;
             }
+
+            /* cut read at clip end packet */
+            uint32_t new_clip_pkt = SPN(st->clip_pos + size);
+            if (new_clip_pkt > st->clip->end_pkt) {
+                BD_DEBUG(DBG_STREAM, "cut %d bytes at end of block\n", (new_clip_pkt - st->clip->end_pkt) * 192);
+                size -= (new_clip_pkt - st->clip->end_pkt) * 192;
+            }
+
+            /* copy chunk */
             memcpy(buf, bd->int_buf + st->int_buf_off, size);
             buf += size;
             len -= size;



More information about the libbluray-devel mailing list