2017-08-08, 21:27
With this patch when the first program has empty audio/video stream, it will search other programs until it find a non empty audio/video stream:
Code:
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index f182509296..79c4d8e102 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -1281,9 +1281,15 @@ void CDVDDemuxFFmpeg::CreateStreams(unsigned int program)
// look for first non empty stream and discard nonselected programs
for (unsigned int i = 0; i < m_pFormatContext->nb_programs; i++)
{
- if(m_program == UINT_MAX && m_pFormatContext->programs[i]->nb_stream_indexes > 0)
+ for (unsigned int j = 0; m_program == UINT_MAX && j < m_pFormatContext->programs[i]->nb_stream_indexes; j++)
{
- m_program = i;
+ int idx = m_pFormatContext->programs[i]->stream_index[j];
+ AVStream *st = m_pFormatContext->streams[idx];
+ if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->codec_info_nb_frames > 0) ||
+ (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->codec->sample_rate > 0))
+ {
+ m_program = i;
+ }
}
if(i != m_program)