diff options
author | phintuka <phintuka> | 2010-02-28 07:52:10 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2010-02-28 07:52:10 +0000 |
commit | 918cfdf30b1aa17301f80386fd2444028b5ce0c5 (patch) | |
tree | a7a903a5f8f894f323fb10249d5b04bdfb19286a | |
parent | d8569feb8b0188429d5cb89a564904710b89d766 (diff) | |
download | xineliboutput-918cfdf30b1aa17301f80386fd2444028b5ce0c5.tar.gz xineliboutput-918cfdf30b1aa17301f80386fd2444028b5ce0c5.tar.bz2 |
Rewrite PlayTs() to use cDevice::PatPmtParser() and removed m_PatPmtParser.
Dropped support for vdr-1.7.1 ... 1.7.10.
-rw-r--r-- | device.c | 75 | ||||
-rw-r--r-- | device.h | 4 |
2 files changed, 32 insertions, 47 deletions
@@ -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.99 2010-02-28 07:21:38 phintuka Exp $ + * $Id: device.c,v 1.100 2010-02-28 07:52:10 phintuka Exp $ * */ @@ -46,6 +46,10 @@ #define LOCAL_INIT_TIMEOUT 20 // seconds #define SERVER_INIT_TIMEOUT 5 // seconds +#if (VDRVERSNUM > 10700) && (VDRVERSNUM < 10711) +# error VDR versions 1.7.1 ... 1.7.10 are not supported ! +#endif + #ifdef LOG_TRICKSPEED # define LOGTRICKSPEED(x...) LOGMSG("trs: " x) #else @@ -576,10 +580,6 @@ void cXinelibDevice::SetTvMode(cChannel *Channel) TRACEF("cXinelibDevice::SetTvMode"); TRACK_TIME(250); -#if VDRVERSNUM >= 10701 - m_PatPmtParser.Reset(); -#endif - m_RadioStream = false; if (Channel && !Channel->Vpid() && (Channel->Apid(0) || Channel->Apid(1))) m_RadioStream = true; @@ -1119,47 +1119,33 @@ int cXinelibDevice::PlayAny(const uchar *buf, int length) */ int cXinelibDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly) { - if (Length > TS_SIZE) Length = TS_SIZE; + if (!Data || Length < TS_SIZE) { + TsBufferFlush(); + return cDevice::PlayTs(Data, Length, VideoOnly); + } - if (Length == TS_SIZE && TsHasPayload(Data)) { - int PayloadOffset = TsPayloadOffset(Data); - if (PayloadOffset < Length) { - int Pid = TsPid(Data); - if (Pid == 0) { -#if VDRVERSNUM >= 10708 - m_PatPmtParser.Reset(); -#endif -#if VDRVERSNUM >= 10704 - m_PatPmtParser.ParsePat(Data, Length); -#else - m_PatPmtParser.ParsePat(Data + PayloadOffset, Length - PayloadOffset); -#endif - //LOGDBG("Got PAT: PMT pid = %d", m_PatPmtParser.PmtPid()); - if (m_server) - m_server->SetHeader(Data, Length, true); - PlayTsAny(Data, Length); - } else if (Pid == m_PatPmtParser.PmtPid()) { -#if VDRVERSNUM >= 10704 - m_PatPmtParser.ParsePmt(Data, Length); -#else - m_PatPmtParser.ParsePmt(Data + PayloadOffset, Length - PayloadOffset); -#endif - m_h264 = (m_PatPmtParser.Vtype() == 0x1b); /* ISO_14496_PART10_VIDEO */ - //LOGDBG("Got PMT packet, h264 = %d", m_h264?1:0); - if (m_server) - m_server->SetHeader(Data, Length); -#ifndef NO_HACKS - ForEach(m_clients, &cXinelibThread::SetHDMode, m_h264); -#endif - PlayTsAny(Data, Length); - TsBufferFlush(); - } + /* Play single TS pack */ + int Result = cDevice::PlayTs(Data, TS_SIZE, VideoOnly); + if (Result != TS_SIZE) + return Result; + + /* Grab PAT and PMT */ + if (TsHasPayload(Data) && TsPayloadOffset(Data) < TS_SIZE) { + + int Pid = TsPid(Data); + if (Pid == 0 || Pid == PatPmtParser()->PmtPid()) { + + if (m_server) + m_server->SetHeader(Data, Result, Pid == 0); + + if (PlayTsAny(Data, Result) != Result) + LOGMSG("Lost PAT/PMT fragment !"); + + TsBufferFlush(); } - } else if (!Data) { - TsBufferFlush(); } - return cDevice::PlayTs(Data, Length, VideoOnly); + return Result; } int cXinelibDevice::TsBufferFlush(void) @@ -1221,11 +1207,12 @@ int cXinelibDevice::PlayTsVideo(const uchar *Data, int Length) if (!AcceptVideoPacket(Data, Length)) return Length; - if (m_StreamStart /*&& TS_PID(Data) == m_PatPmtParser.VPid()*/) { + if (m_StreamStart && ts_PID(Data) == PatPmtParser()->Vpid()) { if (!m_tssVideoSize) m_tssVideoSize = ts_state_init(4096); - if (ts_get_video_size(m_tssVideoSize, Data, m_VideoSize, m_h264 ? 1:0)) { + if (ts_get_video_size(m_tssVideoSize, Data, m_VideoSize, + (PatPmtParser()->Vtype() == ISO_14496_PART10_VIDEO))) { m_StreamStart = false; LOGMSG("Detected video size %dx%d", m_VideoSize->width, m_VideoSize->height); @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: device.h,v 1.53 2010-02-15 06:39:25 phintuka Exp $ + * $Id: device.h,v 1.54 2010-02-28 07:52:10 phintuka Exp $ * */ @@ -249,8 +249,6 @@ class cXinelibDevice : public cDevice virtual int PlaySubtitle(const uchar *Data, int Length); #if VDRVERSNUM >= 10701 - cPatPmtParser m_PatPmtParser; - /* join multiple TS packets to xineliboutput transport packet */ uint8_t m_TsBuf[4096]; uint m_TsBufSize; |