Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/justdan96/tsMuxer
Browse files Browse the repository at this point in the history
  • Loading branch information
justdan96 committed Mar 29, 2020
2 parents 9cb01b3 + f82d163 commit 2ff96ce
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 12 deletions.
2 changes: 1 addition & 1 deletion rebuild_msys2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ else
ninja && cp -u tsMuxer/tsmuxer.exe ../bin/
if [ -d $MINGW_PREFIX/qt5-static ] ; then
$MINGW_PREFIX/qt5-static/bin/qmake ../tsMuxerGUI
make && cp -u tsMuxerGUI.exe ../bin/
make release && cp -u release/tsMuxerGUI.exe ../bin/
fi
cd ..
fi
2 changes: 1 addition & 1 deletion tsMuxer/hevc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ int HevcHdrUnit::deserialize()
}
else
for (int i = 0; i < payloadSize; i++) m_reader.skipBits(8);
} while (m_reader.showBits(8) != 0x80);
} while (m_reader.getBitsLeft() > 16);

return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion tsMuxer/hevcStreamReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ int HEVCStreamReader::setDoViDescriptor(uint8_t* dstBuff)
if (m_hdr->isDVEL)
bitWriter.putBits(7, isDVBL ? 4 : 7);
else
bitWriter.putBits(7, m_hdr->DVCompatibility ? 8 : 5);
bitWriter.putBits(
7, (m_hdr->DVCompatibility == 1 || m_hdr->DVCompatibility == 2 || m_hdr->DVCompatibility == 4) ? 8 : 5);
bitWriter.putBits(6, level); // dv level
bitWriter.putBits(1, m_hdr->isDVRPU); // rpu_present_flag
bitWriter.putBits(1, m_hdr->isDVEL); // el_present_flag
Expand Down
4 changes: 1 addition & 3 deletions tsMuxer/nalUnits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1144,15 +1144,12 @@ void SPSUnit::seq_parameter_set_mvc_extension()
std::vector<int> num_anchor_refs_l0;
std::vector<int> num_anchor_refs_l1;
std::vector<int> num_non_anchor_refs_l0;
std::vector<int> non_anchor_ref_l1;
std::vector<int> num_applicable_ops_minus1;
std::vector<int> num_non_anchor_refs_l1;

num_anchor_refs_l0.resize(num_views);
num_anchor_refs_l1.resize(num_views);
num_non_anchor_refs_l0.resize(num_views);
non_anchor_ref_l1.resize(num_views);
num_applicable_ops_minus1.resize(num_views);
num_non_anchor_refs_l1.resize(num_views);

for (int i = 1; i < num_views; i++)
Expand All @@ -1172,6 +1169,7 @@ void SPSUnit::seq_parameter_set_mvc_extension()
}

int num_level_values_signalled_minus1 = extractUEGolombCode();
num_applicable_ops_minus1.resize(num_level_values_signalled_minus1 + 1);
level_idc_ext.resize(num_level_values_signalled_minus1 + 1);
for (int i = 0; i <= num_level_values_signalled_minus1; i++)
{
Expand Down
33 changes: 27 additions & 6 deletions tsMuxer/tsDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ TSDemuxer::TSDemuxer(const BufferedReaderManager& readManager, const char* strea
m_firstPTS = -1;
m_lastPTS = -1;
m_firstVideoPTS = -1;
m_lastVideoPTS = -1;
m_lastVideoDTS = -1;
m_videoDtsGap = -1;
m_firstCall = true;
m_prevFileLen = 0;
m_curFileNum = 0;
Expand Down Expand Up @@ -162,7 +165,8 @@ bool TSDemuxer::isVideoPID(uint32_t streamType)
{
return streamType == STREAM_TYPE_VIDEO_MPEG1 || streamType == STREAM_TYPE_VIDEO_MPEG2 ||
streamType == STREAM_TYPE_VIDEO_MPEG4 || streamType == STREAM_TYPE_VIDEO_H264 ||
streamType == STREAM_TYPE_VIDEO_MVC || streamType == STREAM_TYPE_VIDEO_VC1;
streamType == STREAM_TYPE_VIDEO_MVC || streamType == STREAM_TYPE_VIDEO_VC1 ||
streamType == STREAM_TYPE_VIDEO_H265;
}

// static uint64_t prevDts = 0;
Expand Down Expand Up @@ -229,12 +233,19 @@ int TSDemuxer::simpleDemuxBlock(DemuxedData& demuxedData, const PIDSet& accepted
{
if (m_curFileNum < m_mplsInfo.size())
m_prevFileLen +=
(m_mplsInfo[m_curFileNum].OUT_time - m_mplsInfo[m_curFileNum].IN_time) * 2; // in 90Khz clock
(int64_t)(m_mplsInfo[m_curFileNum].OUT_time - m_mplsInfo[m_curFileNum].IN_time) * 2; // in 90Khz clock
else
m_prevFileLen += (m_lastPTS - m_firstPTS);
{
if (m_firstVideoPTS != -1 && m_lastVideoPTS != -1)
m_prevFileLen += (m_lastVideoPTS - m_firstVideoPTS + m_videoDtsGap);
else // no video file
m_prevFileLen += (m_lastPTS - m_firstPTS);
;
}
m_firstPTS = -1;
m_lastPTS = -1;
m_firstVideoPTS = -1;
m_lastVideoPTS = -1;
m_curFileNum++;
}

Expand Down Expand Up @@ -375,11 +386,21 @@ int TSDemuxer::simpleDemuxBlock(DemuxedData& demuxedData, const PIDSet& accepted
if (m_firstPTS == -1 || curPts < m_firstPTS)
m_firstPTS = curPts;

if (streamInfo != m_pmt.pidList.end() && isVideoPID(streamInfo->second.m_streamType) &&
(m_firstVideoPTS == -1 || curPts < m_firstVideoPTS))
m_firstVideoPTS = curPts;
if (streamInfo != m_pmt.pidList.end() && isVideoPID(streamInfo->second.m_streamType))
{
if (m_firstVideoPTS == -1 || curPts < m_firstVideoPTS)
m_firstVideoPTS = curPts;
if (curPts > m_lastVideoPTS)
m_lastVideoPTS = curPts;
if (m_lastVideoDTS == -1)
m_lastVideoDTS = curDts;
if (m_videoDtsGap == -1 && curDts > m_lastVideoDTS)
m_videoDtsGap = curDts - m_lastVideoDTS;
}

if (m_firstPtsTime.find(pid) == m_firstPtsTime.end())
m_firstPtsTime[pid] = curPts;

else if (m_curFileNum == 0 && curPts < m_firstPtsTime[pid])
m_firstPtsTime[pid] = curPts;
}
Expand Down
3 changes: 3 additions & 0 deletions tsMuxer/tsDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ class TSDemuxer : public AbstractDemuxer
int64_t m_prevFileLen;
int m_curFileNum;
int64_t m_firstVideoPTS;
int64_t m_lastVideoPTS;
int64_t m_lastVideoDTS;
int64_t m_videoDtsGap;
std::vector<MPLSPlayItem> m_mplsInfo;
int64_t m_lastPCRVal;
bool m_nonMVCVideoFound;
Expand Down
1 change: 1 addition & 0 deletions tsMuxerGUI/tsmuxerwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ TsMuxerWindow::TsMuxerWindow()
const static int colWidths[] = {28, 200, 62, 38, 10};
for (unsigned i = 0u; i < sizeof(colWidths) / sizeof(int); ++i)
ui->trackLV->horizontalHeader()->resizeSection(i, colWidths[i]);
ui->trackLV->setWordWrap(false);

ui->listViewFont->horizontalHeader()->resizeSection(0, 65);
ui->listViewFont->horizontalHeader()->resizeSection(1, 185);
Expand Down

0 comments on commit 2ff96ce

Please sign in to comment.