summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2012-11-20 00:25:05 +0000
committerjstebbins <[email protected]>2012-11-20 00:25:05 +0000
commitb1a9af3d8f002d2e43fc7cbaf968137c0fe36dfb (patch)
treeca4545aa597edf25441367e07f86a828e0ce0748 /libhb
parent88067c60586db1b7b7a1d9d33c9178eab602aa6a (diff)
libhb: fix BD encoding
I inadvertently disabled PCR processing in BD in https://trac.handbrake.fr/changeset/5058 This caused bugs to show up in our processing of TS streams that have no PCR. So re-enable PCR processing in BD to fix the regression. And fix the problems with processing TS streams that have no PCR. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5071 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/demuxmpeg.c25
-rw-r--r--libhb/stream.c2
2 files changed, 16 insertions, 11 deletions
diff --git a/libhb/demuxmpeg.c b/libhb/demuxmpeg.c
index 916984cc4..cb896bcaa 100644
--- a/libhb/demuxmpeg.c
+++ b/libhb/demuxmpeg.c
@@ -257,6 +257,7 @@ void hb_demux_mpeg( hb_buffer_t *buf, hb_list_t *list_es, hb_psdemux_t *state )
// when a blueray changes clips.
++state->scr_changes;
state->last_scr = buf->s.start;
+ state->scr_delta = 0;
}
// we're keeping track of timing (i.e., not in scan)
@@ -302,20 +303,24 @@ void hb_demux_mpeg( hb_buffer_t *buf, hb_list_t *list_es, hb_psdemux_t *state )
// fdelta does not continually grow.
state->scr_delta = buf->s.start - state->last_scr;
}
- if ( state->last_pts >= 0 )
+ if (buf->s.type == AUDIO_BUF || buf->s.type == VIDEO_BUF)
{
- fdelta = buf->s.start - state->last_pts;
- if ( fdelta < -5 * 90000LL || fdelta > 5 * 90000LL )
+ if ( state->last_pts >= 0 )
{
- // Packet too far from last. This may be a NZ TV broadcast
- // as they like to change the PCR without sending a PCR
- // update. Since it may be a while until they actually tell
- // us the new PCR use the PTS as the PCR.
- ++state->scr_changes;
- state->last_scr = buf->s.start;
+ fdelta = buf->s.start - state->last_pts;
+ if ( fdelta < -5 * 90000LL || fdelta > 5 * 90000LL )
+ {
+ // Packet too far from last. This may be a NZ TV broadcast
+ // as they like to change the PCR without sending a PCR
+ // update. Since it may be a while until they actually tell
+ // us the new PCR use the PTS as the PCR.
+ ++state->scr_changes;
+ state->last_scr = buf->s.start;
+ state->scr_delta = 0;
+ }
}
+ state->last_pts = buf->s.start;
}
- state->last_pts = buf->s.start;
}
if ( buf->s.type == VIDEO_BUF )
diff --git a/libhb/stream.c b/libhb/stream.c
index 503e296dc..5d4f36516 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -963,7 +963,7 @@ hb_stream_t * hb_bd_stream_open( hb_title_t *title )
// We don't need to wait for a PCR when scanning. In fact, it
// trips us up on the first preview of every title since we would
// have to read quite a lot of data before finding the PCR.
- if ( !(title->flags & HBTF_SCAN_COMPLETE) )
+ if ( title->flags & HBTF_SCAN_COMPLETE )
{
/* BD has PCRs, but the BD index always points to a packet
* after a PCR packet, so we will not see the initial PCR