summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2011-04-08 20:32:32 +0000
committerjstebbins <[email protected]>2011-04-08 20:32:32 +0000
commit40d04d0ffe6a58d07bb0e46c1fd6060edbb6e80b (patch)
tree76c32eae70f16e66c7f4e3dc726c845843927108
parent5f692a69a63f106cabe9dad4dfc85cc5c6d93cb9 (diff)
Handle boundaries between blueray clips better.
These boundaries are always discontinuities. But sometimes we were not detecting them as such and would drop frames. So set a flag in the buffer when libbluray tells us a new clip is starting and use that to trigger computation of a new scr offset. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3912 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/bd.c5
-rw-r--r--libhb/demuxmpeg.c8
-rw-r--r--libhb/internal.h1
3 files changed, 14 insertions, 0 deletions
diff --git a/libhb/bd.c b/libhb/bd.c
index 47dfe7df8..6ef53361e 100644
--- a/libhb/bd.c
+++ b/libhb/bd.c
@@ -471,6 +471,7 @@ int hb_bd_read( hb_bd_t * d, hb_buffer_t * b )
BD_EVENT event;
uint64_t pos;
+ b->discontinuity = 0;
while ( 1 )
{
if ( d->next_chap != d->chapter )
@@ -507,6 +508,10 @@ int hb_bd_read( hb_bd_t * d, hb_buffer_t * b )
d->next_chap = event.param;
break;
+ case BD_EVENT_PLAYITEM:
+ b->discontinuity = 1;
+ break;
+
default:
break;
}
diff --git a/libhb/demuxmpeg.c b/libhb/demuxmpeg.c
index 4185cb503..763f3e31a 100644
--- a/libhb/demuxmpeg.c
+++ b/libhb/demuxmpeg.c
@@ -218,6 +218,14 @@ int hb_demux_ts( hb_buffer_t *buf_ps, hb_list_t *list_es, hb_psdemux_t *state )
{
if ( state )
{
+ if ( buf_ps->discontinuity )
+ {
+ // Buffer has been flagged as a discontinuity. This happens
+ // when a blueray changes clips.
+ ++state->scr_changes;
+ state->last_scr = buf_ps->start;
+ }
+
// we're keeping track of timing (i.e., not in scan)
// check if there's a new pcr in this packet
if ( buf_ps->stop >= 0 )
diff --git a/libhb/internal.h b/libhb/internal.h
index 092a7d067..5d71cdadf 100644
--- a/libhb/internal.h
+++ b/libhb/internal.h
@@ -69,6 +69,7 @@ struct hb_buffer_s
int id; // ID of the track that the packet comes from
int64_t start; // Video and subtitle packets: start time of frame/subtitle
int64_t stop; // Video and subtitle packets: stop time of frame/subtitle
+ uint8_t discontinuity;
int new_chap; // Video packets: if non-zero, is the index of the chapter whose boundary was crossed
#define HB_FRAME_IDR 0x01