summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2007-09-17 22:31:59 +0000
committerphintuka <phintuka>2007-09-17 22:31:59 +0000
commitc2e4f412874d34daea49f23c1b7f417996eb9a64 (patch)
treede46b6fcecb57f3e986fe7f0dd046fe6b70203fc
parent3be4fa6e1dd2dc9c7114e5e29ac40477b246f9ec (diff)
downloadxineliboutput-c2e4f412874d34daea49f23c1b7f417996eb9a64.tar.gz
xineliboutput-c2e4f412874d34daea49f23c1b7f417996eb9a64.tar.bz2
Move PTS wrap detection code to own function
-rw-r--r--xine_input_vdr.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/xine_input_vdr.c b/xine_input_vdr.c
index 8927a805..ceb6f6bd 100644
--- a/xine_input_vdr.c
+++ b/xine_input_vdr.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_input_vdr.c,v 1.95 2007-09-17 20:01:52 phelin Exp $
+ * $Id: xine_input_vdr.c,v 1.96 2007-09-17 22:31:59 phintuka Exp $
*
*/
@@ -4696,6 +4696,27 @@ static off_t vdr_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len
# include "cache_iframe.c"
#endif
+static void pts_wrap_workaround(vdr_input_plugin_t *this, buf_element_t *buf)
+{
+#if 1
+ /* PTS wrap workaround for mpeg_block demuxer */
+ int64_t pts = pts_from_pes(buf->content, buf->size);
+ if(pts >= 0) {
+ int video = ((buf->content[3] & 0xf0) == 0xe0);
+ if(video)
+ this->last_delivered_vid_pts = pts;
+ if(!video) {
+ if(pts > 0x40400000 &&
+ this->last_delivered_vid_pts < 0x40000000 &&
+ this->last_delivered_vid_pts > 0) {
+ LOGMSG("VIDEO pts wrap before AUDIO, ignoring audio pts %" PRId64, pts);
+ pes_strip_pts(buf->content, buf->size);
+ }
+ }
+ }
+#endif
+}
+
static int update_frames(vdr_input_plugin_t *this, uint8_t *data, int len)
{
int i = 8;
@@ -4886,25 +4907,7 @@ static buf_element_t *vdr_plugin_read_block (input_plugin_t *this_gen,
track_audio_stream_change(this, buf);
-#if 1
- /* PTS wrap workaround for mpeg_block demuxer */
- {
- int64_t pts = pts_from_pes(buf->content, buf->size);
- if(pts >= 0) {
- int video = ((buf->content[3] & 0xf0) == 0xe0);
- if(video)
- this->last_delivered_vid_pts = pts;
- if(!video) {
- if(pts > 0x40400000 &&
- this->last_delivered_vid_pts < 0x40000000 &&
- this->last_delivered_vid_pts > 0) {
- LOGMSG("VIDEO pts wrap before AUDIO, ignoring audio pts %" PRId64, pts);
- pes_strip_pts(buf->content, buf->size);
- }
- }
- }
- }
-#endif
+ pts_wrap_workaround(this, buf);
/* Send current PTS ? */
if(this->send_pts) {