Skip to content

Commit

Permalink
don't force SI sections into a PESPacket, use the new constructor ins…
Browse files Browse the repository at this point in the history
…tead

A variant of this has been lightly tested and I'd like to get it into 0.27
as it should fix all kinds of issues down the line.

E.g. stuff related to the SI for DVB-CAM being rejected due to expecting
a CRC which they don't have

It also removes the false positive CRC errors from the logs.

Fixes #10495
Fixes #10496
  • Loading branch information
dekarl committed Jul 18, 2013
1 parent 08e471c commit 20291e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
20 changes: 5 additions & 15 deletions mythtv/libs/libmythtv/avformatdecoder.cpp
Expand Up @@ -1557,9 +1557,7 @@ void AvFormatDecoder::ScanATSCCaptionStreams(int av_index)
return;
}

const PESPacket pes = PESPacket::ViewData(ic->cur_pmt_sect);
const PSIPTable psip(pes);
const ProgramMapTable pmt(psip);
const ProgramMapTable pmt(ic->cur_pmt_sect);

uint i;
for (i = 0; i < pmt.StreamCount(); i++)
Expand Down Expand Up @@ -1684,9 +1682,7 @@ void AvFormatDecoder::ScanTeletextCaptions(int av_index)
if (!ic->cur_pmt_sect || tracks[kTrackTypeTeletextCaptions].size())
return;

const PESPacket pes = PESPacket::ViewData(ic->cur_pmt_sect);
const PSIPTable psip(pes);
const ProgramMapTable pmt(psip);
const ProgramMapTable pmt(ic->cur_pmt_sect);

for (uint i = 0; i < pmt.StreamCount(); i++)
{
Expand Down Expand Up @@ -1761,9 +1757,7 @@ void AvFormatDecoder::ScanDSMCCStreams(void)
if (!itv && ! (itv = m_parent->GetInteractiveTV()))
return;

const PESPacket pes = PESPacket::ViewData(ic->cur_pmt_sect);
const PSIPTable psip(pes);
const ProgramMapTable pmt(psip);
const ProgramMapTable pmt(ic->cur_pmt_sect);

for (uint i = 0; i < pmt.StreamCount(); i++)
{
Expand Down Expand Up @@ -2461,9 +2455,7 @@ AudioTrackType AvFormatDecoder::GetAudioTrackType(uint stream_index)

if (ic->cur_pmt_sect) // mpeg-ts
{
const PESPacket pes = PESPacket::ViewData(ic->cur_pmt_sect);
const PSIPTable psip(pes);
const ProgramMapTable pmt(psip);
const ProgramMapTable pmt(ic->cur_pmt_sect);
switch (pmt.GetAudioType(stream_index))
{
case 0x01 :
Expand Down Expand Up @@ -4853,9 +4845,7 @@ bool AvFormatDecoder::HasVideo(const AVFormatContext *ic)
{
if (ic && ic->cur_pmt_sect)
{
const PESPacket pes = PESPacket::ViewData(ic->cur_pmt_sect);
const PSIPTable psip(pes);
const ProgramMapTable pmt(psip);
const ProgramMapTable pmt(ic->cur_pmt_sect);

for (uint i = 0; i < pmt.StreamCount(); i++)
{
Expand Down
5 changes: 3 additions & 2 deletions mythtv/libs/libmythtv/mpeg/mpegtables.h
Expand Up @@ -371,8 +371,9 @@ class MTV_PUBLIC PSIPTable : public PESPacket
PSIPTable(const PESPacket& pkt, bool)
: PESPacket(reinterpret_cast<const TSPacket*>(pkt.tsheader()), false)
{ ; }
public:
/// Constructor for viewing a section, does not create it's own data
PSIPTable(const unsigned char *pesdata, bool)
PSIPTable(const unsigned char *pesdata)
: PESPacket(pesdata, false)
{
// fixup wrong assumption about length for sections without CRC
Expand Down Expand Up @@ -403,7 +404,7 @@ class MTV_PUBLIC PSIPTable : public PESPacket
{ return PSIPTable(PESPacket::View(tspacket), false); }

static const PSIPTable ViewData(const unsigned char* pesdata)
{ return PSIPTable(pesdata, false); }
{ return PSIPTable(pesdata); }

// Section Bits Start Byte sbit
// -----------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmythtv/recorders/dvbstreamhandler.cpp
Expand Up @@ -331,8 +331,7 @@ void DVBStreamHandler::RunSR(void)

readSomething = true;

const PESPacket pes = PESPacket::ViewData(buffer);
const PSIPTable psip(pes);
const PSIPTable psip(buffer);

if (psip.SectionSyntaxIndicator())
{
Expand Down

0 comments on commit 20291e6

Please sign in to comment.