diff options
author | ace20022 <ace20022@ymail.com> | 2018-08-24 13:22:26 +0200 |
---|---|---|
committer | ace20022 <ace20022@ymail.com> | 2018-08-25 07:58:07 +0200 |
commit | bcbb41d85dfeae1c4ede54d57ce442b87b35405b (patch) | |
tree | e4a8f0688c2ba7beaa99e513e1ed4f35580f48cb | |
parent | d6513fd137cb2df04bd7d9366f0076188481b429 (diff) |
[vp] Rename and simplify CountSource(...).
-rw-r--r-- | xbmc/cores/VideoPlayer/VideoPlayer.cpp | 16 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/VideoPlayer.h | 2 |
2 files changed, 5 insertions, 13 deletions
diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index c5989e2809..43fff9b1bf 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -554,18 +554,10 @@ void CSelectionStreams::Update(std::shared_ptr<CDVDInputStream> input, CDVDDemux Update(input, demuxer, ""); } -int CSelectionStreams::CountSource(StreamType type, StreamSource source) const +int CSelectionStreams::CountTypeOfSource(StreamType type, StreamSource source) const { - int count = 0; - for(size_t i=0;i<m_Streams.size();i++) - { - if(type && m_Streams[i].type != type) - continue; - if (source && m_Streams[i].source != source) - continue; - count++; - } - return count; + return std::count_if(m_Streams.begin(), m_Streams.end(), + [&](const SelectionStream& stream) {return (stream.type == type) && (stream.source == source);}); } int CSelectionStreams::CountType(StreamType type) const @@ -1613,7 +1605,7 @@ void CVideoPlayer::Process() break; first = false; - if (m_pCCDemuxer->GetNrOfStreams() != m_SelectionStreams.CountSource(STREAM_SUBTITLE, STREAM_SOURCE_VIDEOMUX)) + if (m_pCCDemuxer->GetNrOfStreams() != m_SelectionStreams.CountTypeOfSource(STREAM_SUBTITLE, STREAM_SOURCE_VIDEOMUX)) { m_SelectionStreams.Clear(STREAM_SUBTITLE, STREAM_SOURCE_VIDEOMUX); m_SelectionStreams.Update(NULL, m_pCCDemuxer, ""); diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.h b/xbmc/cores/VideoPlayer/VideoPlayer.h index 8886f228b6..e8631d4417 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.h +++ b/xbmc/cores/VideoPlayer/VideoPlayer.h @@ -245,7 +245,7 @@ public: CSelectionStreams() = default; int IndexOf(StreamType type, int source, int64_t demuxerId, int id) const; - int CountSource(StreamType type, StreamSource source) const; + int CountTypeOfSource(StreamType type, StreamSource source) const; int CountType(StreamType type) const; SelectionStream& Get(StreamType type, int index); bool Get(StreamType type, StreamFlags flag, SelectionStream& out); |