diff options
author | jstebbins <[email protected]> | 2011-09-14 16:03:52 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-09-14 16:03:52 +0000 |
commit | 3cdb1f293da7bb6e1f506c899ced038068aeeddf (patch) | |
tree | 53552ce38e0c8f23675cbf71f4dc68cc302315b7 /libhb/demuxmpeg.c | |
parent | ace57e1b754f84cad9603e7ed14aa9c6bb705461 (diff) |
Improve mpeg PS support
Adds support for MPEG-1 PS, HDDVD EVOB, and video codecs other
than mpeg1/2 in PS
Improves probing of unknown stream types by using Libav's probing
utilities
Use Libav to probe for dts profile in TS and PS files when profile is
unknown
Improves framerate detection (improved telecine detection)
Fixes preview generation for mpeg video that has only a single sequence
header
Patches Libav to handle VC-1 pulldown flags properly
Improve PS and TS stream log information
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4220 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/demuxmpeg.c')
-rw-r--r-- | libhb/demuxmpeg.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libhb/demuxmpeg.c b/libhb/demuxmpeg.c index 392736333..658bd5d39 100644 --- a/libhb/demuxmpeg.c +++ b/libhb/demuxmpeg.c @@ -36,7 +36,7 @@ static inline void check_mpeg_scr( hb_psdemux_t *state, int64_t scr, int tol ) // 'tol'ms between the last scr & this or if this scr goes back // by more than half a frame time. int64_t scr_delta = scr - state->last_scr; - if ( scr_delta > 90*tol || scr_delta < -90*10 ) + if ( state->last_scr == -1 || scr_delta > 90*tol || scr_delta < -90*10 ) { ++state->scr_changes; state->last_pts = -1; @@ -64,7 +64,7 @@ static inline void restore_chap( hb_psdemux_t *state, hb_buffer_t *buf ) /* Basic MPEG demuxer */ -void hb_demux_ps( hb_buffer_t * buf, hb_list_t * list_es, hb_psdemux_t* state ) +void hb_demux_dvd_ps( hb_buffer_t * buf, hb_list_t * list_es, hb_psdemux_t* state ) { hb_buffer_t * buf_es; int pos = 0; @@ -241,7 +241,7 @@ void hb_demux_ps( hb_buffer_t * buf, hb_list_t * list_es, hb_psdemux_t* state ) // stripped off and buf has all the info gleaned from them: id is set, // start contains the pts (if any), renderOffset contains the dts (if any) // and stop contains the pcr (if it changed). -void hb_demux_ts( hb_buffer_t *buf, hb_list_t *list_es, hb_psdemux_t *state ) +void hb_demux_mpeg( hb_buffer_t *buf, hb_list_t *list_es, hb_psdemux_t *state ) { while ( buf ) { @@ -263,6 +263,10 @@ void hb_demux_ts( hb_buffer_t *buf, hb_list_t *list_es, hb_psdemux_t *state ) // we have a new pcr check_mpeg_scr( state, buf->pcr, 300 ); buf->pcr = -1; + // Some streams have consistantly bad PCRs or SCRs + // So filter out the offset + if ( buf->start >= 0 ) + state->scr_delta = buf->start - state->last_scr; } if ( buf->start >= 0 ) { @@ -275,7 +279,7 @@ void hb_demux_ts( hb_buffer_t *buf, hb_list_t *list_es, hb_psdemux_t *state ) // We try to protect against that here by sanity checking // timestamps against the current reference clock and discarding // packets where the DTS is "too far" from its clock. - int64_t fdelta = buf->start - state->last_scr; + int64_t fdelta = buf->start - state->last_scr - state->scr_delta; if ( fdelta < -300 * 90000LL || fdelta > 300 * 90000LL ) { // packet too far behind or ahead of its clock reference @@ -328,7 +332,7 @@ void hb_demux_null( hb_buffer_t * buf, hb_list_t * list_es, hb_psdemux_t* state // if we don't have a time offset yet, // use this timestamp as the offset. if ( state->scr_changes == 0 && - ( buf->start >= 0 || buf->renderOffset >= 0 ) ) + ( buf->start != -1 || buf->renderOffset != -1 ) ) { ++state->scr_changes; state->last_scr = buf->start >= 0 ? buf->start : buf->renderOffset; @@ -347,4 +351,4 @@ void hb_demux_null( hb_buffer_t * buf, hb_list_t * list_es, hb_psdemux_t* state } } -const hb_muxer_t hb_demux[] = { hb_demux_ps, hb_demux_ts, hb_demux_null }; +const hb_muxer_t hb_demux[] = { hb_demux_dvd_ps, hb_demux_mpeg, hb_demux_null }; |