Thread Rating:
  • 0 Vote(s) - 0 Average
Patch for programs with empty audio/video streams
#1
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)
Reply
#2
Could you submit a PR on GitHub instead?
Reply
#3
(2017-08-10, 15:28)negge Wrote: Could you submit a PR on GitHub instead?
Done https://github.com/xbmc/xbmc/pull/12655
Reply
#4
Open source at its finest!
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
Patch for programs with empty audio/video streams00