OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / libhb / demuxmpeg.c
index 9e0a952..4185cb5 100644 (file)
@@ -73,7 +73,7 @@ int hb_demux_ps( hb_buffer_t * buf_ps, hb_list_t * list_es, hb_psdemux_t* state
                       ((uint64_t)(d[pos+2] & 3) << 13) |
                       ((uint64_t)(d[pos+3]) << 5) |
                       (d[pos+4] >> 3);
-        check_mpeg_scr( state, scr, 100 );
+        check_mpeg_scr( state, scr, 300 );
     }
 
     pos += 9;                    /* pack_header */
@@ -106,6 +106,23 @@ int hb_demux_ps( hb_buffer_t * buf_ps, hb_list_t * list_es, hb_psdemux_t* state
         id           = d[pos];
         pos               += 1;
 
+        /* pack_header */
+        if( id == 0xBA)
+        {
+            pos += 10 + (d[pos+9] & 7);
+            continue;
+        }
+
+        /* system_header */
+        if( id == 0xBB )
+        {
+            int header_length;
+
+            header_length  = ( d[pos] << 8 ) + d[pos+1];
+            pos           += 2 + header_length;
+            continue;
+        }
+
         pes_packet_length  = ( d[pos] << 8 ) + d[pos+1];
         pos               += 2;               /* pes_packet_length */
         pes_packet_end     = pos + pes_packet_length;
@@ -246,6 +263,10 @@ int hb_demux_ts( hb_buffer_t *buf_ps, hb_list_t *list_es, hb_psdemux_t *state )
 
     hb_buffer_t *buf = hb_buffer_init( buf_ps->alloc );
     hb_buffer_swap_copy( buf_ps, buf );
+    if (buf->type == VIDEO_BUF) {
+        // Consume a chapter break
+        buf_ps->new_chap = 0;
+    }
     hb_list_add( list_es, buf );
 
     return 1;