From 907bc063a13369ae1ab84f92f9ffe12d511de1ec Mon Sep 17 00:00:00 2001 From: hschang Date: Tue, 27 Oct 2015 21:11:45 +0900 Subject: [PATCH] [pvrparse, tstools] fix for 16x playback H.265. --- lib/dvb/pvrparse.cpp | 17 +++++++++++++++++ lib/dvb/tstools.cpp | 6 ++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/dvb/pvrparse.cpp b/lib/dvb/pvrparse.cpp index b1c8666..9fab10c 100755 --- a/lib/dvb/pvrparse.cpp +++ b/lib/dvb/pvrparse.cpp @@ -682,6 +682,23 @@ int eMPEGStreamParserTS::processPacket(const unsigned char *pkt, off_t offset) /*eDebug("MPEG4 AVC UAD but no valid PTS value.")*/; } } + if (m_streamtype == 6) /* H.265 */ + { + int nal_unit_type = (sc >> 1); + if (nal_unit_type == 35) /* H265 NAL unit access delimiter */ + { + unsigned long long data = sc | (pkt[4] << 8); + m_streaminfo.writeStructureEntry(offset + pkt_offset, data); + + if ((pkt[4] >> 5) == 0) /* check pic_type for I-frame */ + { + if (ptsvalid) + { + m_streaminfo.m_access_points[offset] = pts; + } + } + } + } } ++pkt; } diff --git a/lib/dvb/tstools.cpp b/lib/dvb/tstools.cpp index 2c0a17c..379df9b 100755 --- a/lib/dvb/tstools.cpp +++ b/lib/dvb/tstools.cpp @@ -691,12 +691,14 @@ int eDVBTSTools::findFrame(off_t &_iframe_offset, off_t &_new_offset, size_t &le int is_start = 0; if ((data & 0xE0FF) == 0x0009) /* H.264 NAL unit access delimiter with I-frame*/ is_start =1; + else if ((data & 0xE07E) == 0x0046) /* H.265 NAL unit access delimiter with I-frame*/ + is_start = 1; else if((data & 0x3800FF) == 0x080000) /* MPEG2 picture start code with I-frame */ { is_start =1; is_mpeg =1; } - int is_frame = ((data & 0xFF) == 0x0009) || ((data & 0xFF) == 0x00); /* H.264 UAD or MPEG2 start code */ + int is_frame = ((data & 0xFF) == 0x0009) || ((data & 0x7E) == 0x0046) || ((data & 0xFF) == 0x00); /* H.264 UAD or H.265 UAD or MPEG2 start code */ if (is_frame) { @@ -747,7 +749,7 @@ int eDVBTSTools::findFrame(off_t &_iframe_offset, off_t &_new_offset, size_t &le return -1; } // eDebug("%08llx@%llu (next frame)", data, offset); - } while (((data & 0xFF) != 9) && ((data & 0xFF) != 0x00)); /* next frame */ + } while (((data & 0xFF) != 9) && ((data & 0x7E) != 0x46) && ((data & 0xFF) != 0x00)); /* next frame */ if (is_mpeg) //MPEG2 picture start code with I-frame { -- 2.7.4