From 504d50de95a784f0b49dd78fddba669e99ab0c43 Mon Sep 17 00:00:00 2001 From: phintuka Date: Fri, 6 Feb 2009 07:58:40 +0000 Subject: Fixes to PlayTs: - always call cDevice::PlayTs() (fixes channel switching and audio track selection) - reset PMT PID and flush cache when Data==NULL --- device.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'device.c') diff --git a/device.c b/device.c index 748eccb3..c5118984 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: device.c,v 1.71 2009-02-04 21:49:06 rofafor Exp $ + * $Id: device.c,v 1.72 2009-02-06 07:58:40 phintuka Exp $ * */ @@ -1122,9 +1122,7 @@ int cXinelibDevice::PlayAny(const uchar *buf, int length) */ int cXinelibDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly) { - if (Length == TS_SIZE) { - if (!TsHasPayload(Data)) - return Length; // silently ignore TS packets w/o payload + if (Length == TS_SIZE && TsHasPayload(Data)) { int PayloadOffset = TsPayloadOffset(Data); if (PayloadOffset < Length) { int Pid = TsPid(Data); @@ -1142,14 +1140,18 @@ int cXinelibDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly) #else m_PatPmtParser.ParsePmt(Data + PayloadOffset, Length - PayloadOffset); #endif - LOGMSG("Got PMT packet"); + m_h264 = (m_PatPmtParser.Vtype() == 0x1b); /* ISO_14496_PART10_VIDEO */ + LOGMSG("Got PMT packet, h264 = %d", m_h264?1:0); PlayAny(Data, Length); + TsBufferFlush(); } - - return cDevice::PlayTs(Data, Length, VideoOnly); } + } else if (!Data) { + TsBufferFlush(); + m_PatPmtParser.Reset(); } - return -1; + + return cDevice::PlayTs(Data, Length, VideoOnly); } int cXinelibDevice::PlayTsSubtitle(const uchar *Data, int Length) -- cgit v1.2.3