From 3b3e36499d18088b7b22a22063b1cd37d8e7519b Mon Sep 17 00:00:00 2001 From: ace20022 Date: Thu, 29 Sep 2016 13:32:50 +0200 Subject: [videoplayer] Refactor CUtil::GetExternalStreamDetailsFromFilename. - return an ExternalStreamInfo object instead of passing it by ref. - rename params - add doxygen --- xbmc/Util.cpp | 20 ++++++++++++-------- xbmc/Util.h | 8 +++++++- .../VideoPlayer/DVDDemuxers/DemuxMultiSource.cpp | 3 +-- xbmc/cores/VideoPlayer/DVDFileInfo.cpp | 3 +-- xbmc/cores/VideoPlayer/VideoPlayer.cpp | 6 ++---- xbmc/network/upnp/UPnPInternal.cpp | 3 +-- 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp index 6ccb8a02b7..161304a597 100644 --- a/xbmc/Util.cpp +++ b/xbmc/Util.cpp @@ -2066,25 +2066,27 @@ void CUtil::ScanForExternalSubtitles(const std::string& strMovie, std::vector& vecSubtitles ); - static void GetExternalStreamDetailsFromFilename(const std::string& strMovie, const std::string& strSubtitles, ExternalStreamInfo& info); + + /** \brief Retrieves stream info of external associated files, e.g., subtitles, for a given video. + * \param[in] videoPath The full path of the video file. + * \param[in] associatedFile A file that provides additional streams for the given video file. + * \return stream info for the given associatedFile + */ + static ExternalStreamInfo GetExternalStreamDetailsFromFilename(const std::string& videoPath, const std::string& associatedFile); static bool FindVobSubPair( const std::vector& vecSubtitles, const std::string& strIdxPath, std::string& strSubPath ); static bool IsVobSub(const std::vector& vecSubtitles, const std::string& strSubPath); static std::string GetVobSubSubFromIdx(const std::string& vobSubIdx); diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMultiSource.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMultiSource.cpp index 24c9297ae7..9cfc1a884d 100644 --- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMultiSource.cpp +++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMultiSource.cpp @@ -230,8 +230,7 @@ void CDemuxMultiSource::SetMissingStreamDetails(DemuxPtr demuxer) std::string fileName = demuxer->GetFileName(); for (auto& stream : demuxer->GetStreams()) { - ExternalStreamInfo info; - CUtil::GetExternalStreamDetailsFromFilename(baseFileName, fileName, info); + ExternalStreamInfo info = CUtil::GetExternalStreamDetailsFromFilename(baseFileName, fileName); if (stream->flags == CDemuxStream::FLAG_NONE) { diff --git a/xbmc/cores/VideoPlayer/DVDFileInfo.cpp b/xbmc/cores/VideoPlayer/DVDFileInfo.cpp index 2e47e95056..8709bbf8a0 100644 --- a/xbmc/cores/VideoPlayer/DVDFileInfo.cpp +++ b/xbmc/cores/VideoPlayer/DVDFileInfo.cpp @@ -484,8 +484,7 @@ bool CDVDFileInfo::AddExternalSubtitleToDetails(const std::string &path, CStream } CStreamDetailSubtitle *dsub = new CStreamDetailSubtitle(); - ExternalStreamInfo info; - CUtil::GetExternalStreamDetailsFromFilename(path, filename, info); + ExternalStreamInfo info = CUtil::GetExternalStreamDetailsFromFilename(path, filename); dsub->m_strLanguage = g_LangCodeExpander.ConvertToISO6392T(info.language); details.AddStream(dsub); diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index 31bcc8e680..5665dcc313 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -4725,8 +4725,7 @@ int CVideoPlayer::AddSubtitleFile(const std::string& filename, const std::string return -1; m_SelectionStreams.Update(NULL, &v, vobsubfile); - ExternalStreamInfo info; - CUtil::GetExternalStreamDetailsFromFilename(m_item.GetPath(), vobsubfile, info); + ExternalStreamInfo info = CUtil::GetExternalStreamDetailsFromFilename(m_item.GetPath(), vobsubfile); for (auto sub : v.GetStreams()) { @@ -4763,8 +4762,7 @@ int CVideoPlayer::AddSubtitleFile(const std::string& filename, const std::string s.type = STREAM_SUBTITLE; s.id = 0; s.filename = filename; - ExternalStreamInfo info; - CUtil::GetExternalStreamDetailsFromFilename(m_item.GetPath(), filename, info); + ExternalStreamInfo info = CUtil::GetExternalStreamDetailsFromFilename(m_item.GetPath(), filename); s.name = info.name; s.language = info.language; if (static_cast(info.flag) != CDemuxStream::FLAG_NONE) diff --git a/xbmc/network/upnp/UPnPInternal.cpp b/xbmc/network/upnp/UPnPInternal.cpp index 75ef283d33..26d1eb1030 100644 --- a/xbmc/network/upnp/UPnPInternal.cpp +++ b/xbmc/network/upnp/UPnPInternal.cpp @@ -655,8 +655,7 @@ BuildObject(CFileItem& item, for (unsigned int i = 0; i < subtitles.size(); i++) { - ExternalStreamInfo info; - CUtil::GetExternalStreamDetailsFromFilename(file_path.GetChars(), subtitles[i], info); + ExternalStreamInfo info = CUtil::GetExternalStreamDetailsFromFilename(file_path.GetChars(), subtitles[i]); if (preferredLanguageCode == info.language) { -- cgit v1.2.3