Skip to content

Commit

Permalink
libmythtv: Improved detection of streams with no video.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Kendall committed Mar 16, 2011
1 parent 850dcfb commit e951aec
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions mythtv/libs/libmythtv/avformatdecoder.cpp
Expand Up @@ -4167,27 +4167,30 @@ bool AvFormatDecoder::GetFrame(DecodeType decodetype)

bool AvFormatDecoder::HasVideo(const AVFormatContext *ic)
{
if (!ic || !ic->cur_pmt_sect)
return true;

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

bool has_video = false;
for (uint i = 0; i < pmt.StreamCount(); i++)
if (ic && ic->cur_pmt_sect)
{
// MythTV remaps OpenCable Video to normal video during recording
// so "dvb" is the safest choice for system info type, since this
// will ignore other uses of the same stream id in DVB countries.
has_video |= pmt.IsVideo(i, "dvb");
const PESPacket pes = PESPacket::ViewData(ic->cur_pmt_sect);
const PSIPTable psip(pes);
const ProgramMapTable pmt(psip);

for (uint i = 0; i < pmt.StreamCount(); i++)
{
// MythTV remaps OpenCable Video to normal video during recording
// so "dvb" is the safest choice for system info type, since this
// will ignore other uses of the same stream id in DVB countries.
if (pmt.IsVideo(i, "dvb"))
return true;

// MHEG may explicitly select a private stream as video
has_video |= ((i == (uint)selectedTrack[kTrackTypeVideo].av_stream_index) &&
(pmt.StreamType(i) == StreamID::PrivData));
// MHEG may explicitly select a private stream as video
if ((i == (uint)selectedTrack[kTrackTypeVideo].av_stream_index) &&
(pmt.StreamType(i) == StreamID::PrivData))
{
return true;
}
}
}

return has_video;
return GetTrackCount(kTrackTypeVideo);
}

bool AvFormatDecoder::GenerateDummyVideoFrame(void)
Expand Down

0 comments on commit e951aec

Please sign in to comment.