[pvrparse, tstools] fix for 16x playback H.265.
authorhschang <chang@dev3>
Tue, 27 Oct 2015 12:11:45 +0000 (21:11 +0900)
committerhschang <chang@dev3>
Wed, 28 Oct 2015 02:00:34 +0000 (11:00 +0900)
lib/dvb/pvrparse.cpp
lib/dvb/tstools.cpp

index b1c8666..9fab10c 100755 (executable)
@@ -682,6 +682,23 @@ int eMPEGStreamParserTS::processPacket(const unsigned char *pkt, off_t offset)
                                                /*eDebug("MPEG4 AVC UAD but no valid PTS value.")*/;
                                }
                        }
                                                /*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;
        }
                }
                ++pkt;
        }
index 2c0a17c..379df9b 100755 (executable)
@@ -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;
                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;
                }
                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)
                {
                
                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);
                        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
        {
 
        if (is_mpeg) //MPEG2 picture start code with I-frame
        {