[libbluray-devel] Reduce log spam (truncated m2ts files)

hpi1 git at videolan.org
Wed Apr 15 11:10:57 CEST 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Apr 10 14:51:38 2015 +0300| [e7d38ac773ebd781467c0282f6ff14969fb7123e] | committer: hpi1

Reduce log spam (truncated m2ts files)

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

 src/libbluray/bluray.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 817962b..95b6d65 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -89,6 +89,9 @@ typedef struct {
     uint16_t        ig_pid; /* pid of currently selected IG stream */
     uint16_t        pg_pid; /* pid of currently selected PG stream */
 
+    /* */
+    uint8_t         eof_hit;
+
     M2TS_FILTER    *m2ts_filter;
 } BD_STREAM;
 
@@ -540,6 +543,7 @@ static int _open_m2ts(BLURAY *bd, BD_STREAM *st)
     st->clip_size = 0;
     st->clip_pos = (uint64_t)st->clip->start_pkt * 192;
     st->clip_block_pos = (st->clip_pos / 6144) * 6144;
+    st->eof_hit = 0;
 
     if (st->fp) {
         int64_t clip_size = file_size(st->fp);
@@ -600,6 +604,7 @@ static int _read_block(BLURAY *bd, BD_STREAM *st, uint8_t *buf)
                     BD_DEBUG(DBG_STREAM | DBG_CRIT, "Read %d bytes at %"PRIu64" ; requested %d !\n", (int)read_len, st->clip_block_pos, (int)len);
                 }
                 st->clip_block_pos += len;
+                st->eof_hit = 0;
 
                 /* Check TP_extra_header Copy_permission_indicator. If != 0, unit is still encrypted. */
                 if (buf[0] & 0xc0) {
@@ -646,8 +651,6 @@ static int _read_block(BLURAY *bd, BD_STREAM *st, uint8_t *buf)
             return 0;
         }
 
-        BD_DEBUG(DBG_STREAM | DBG_CRIT, "Read past EOF !\n");
-
         /* This is caused by truncated .m2ts file or invalid clip length.
          *
          * Increase position to avoid infinite loops.
@@ -656,6 +659,11 @@ static int _read_block(BLURAY *bd, BD_STREAM *st, uint8_t *buf)
         st->clip_block_pos += len;
         st->clip_pos += len;
 
+        if (!st->eof_hit) {
+            BD_DEBUG(DBG_STREAM | DBG_CRIT, "Read past EOF !\n");
+            st->eof_hit = 1;
+        }
+
         return 0;
     }
 



More information about the libbluray-devel mailing list