bool Demux::get_stream_data(TSDemux::STREAM_PKT* pkt) { TSDemux::ElementaryStream* es = m_AVContext->GetPIDStream(); if (!es) return false; if (!es->GetStreamPacket(pkt)) return false; if (pkt->duration > 180000) { pkt->duration = 0; } else if (pkt->pid == m_mainStreamPID) { // Fill duration map for main stream m_curTime += pkt->duration; if (m_curTime >= m_pinTime) { m_pinTime += POSMAP_PTS_INTERVAL; if (m_curTime > m_endTime) { AV_POSMAP_ITEM item; item.av_pts = pkt->pts; item.av_pos = m_AVContext->GetPosition(); m_posmap.insert(std::make_pair(m_curTime, item)); m_endTime = m_curTime; } } // Sync main DTS & PTS m_DTS = pkt->dts; m_PTS = pkt->pts; } return true; }
bool AVInfo::get_stream_data(TSDemux::STREAM_PKT* pkt) { TSDemux::ElementaryStream* es = m_AVContext->GetPIDStream(); if (!es) return false; if (!es->GetStreamPacket(pkt)) return false; if (pkt->duration > 180000) { pkt->duration = 0; } else if (pkt->pid == m_mainStreamPID) { // Sync main DTS & PTS m_DTS = pkt->dts; m_PTS = pkt->pts; } return true; }