before_code
stringlengths
14
465k
reviewer_comment
stringlengths
16
64.5k
after_code
stringlengths
9
467k
diff_context
stringlengths
0
97k
file_path
stringlengths
5
226
comment_line
int32
0
26
language
stringclasses
37 values
quality_score
float32
0.07
1
comment_type
stringclasses
9 values
comment_length
int32
16
64.5k
before_lines
int32
1
17.2k
after_lines
int32
1
12.1k
is_negative
bool
2 classes
pr_title
stringlengths
1
308
pr_number
int32
1
299k
repo_name
stringclasses
533 values
repo_stars
int64
321
419k
repo_language
stringclasses
27 values
reviewer_username
stringlengths
0
39
author_username
stringlengths
2
39
if (aByte == traits::to_int_type('\r')) { if (m_pBuffer->sgetc() == traits::to_int_type('\n')) m_pBuffer->sbumpc(); break; } line.emplace_back(traits::to_char_type(aByte)); } return true; } try { // Read by buffer chuncks until to EOL or EOF do...
```suggestion line.insert(line.end(), bufferLine, bufferLine + length); ```
if (aByte == traits::to_int_type('\r')) { if (m_pBuffer->sgetc() == traits::to_int_type('\n')) m_pBuffer->sbumpc(); break; } line.emplace_back(traits::to_char_type(aByte)); } return true; } try { // Read by buffer chuncks until to EOL or EOF do...
@@ -765,6 +765,68 @@ int64_t CFile::GetPosition() const return -1; } +bool XFILE::CFile::ReadString(std::vector<char>& line) +{ + if (!m_pFile) + return false; + + line.clear(); + + if (m_pBuffer) + { + using traits = CFileStreamBuffer::traits_type; + CFileStreamBuffer::int_type aByte = m_pBuffer->sg...
xbmc/filesystem/File.cpp
26
C++
0.857
suggestion
83
51
51
false
[Playlist][M3U] Fix long line reading
25,798
xbmc/xbmc
17,740
C++
neo1973
CastagnaIT
{ if (m_pBuffer->sgetc() == traits::to_int_type('\r')) m_pBuffer->sbumpc(); break; } if (aByte == traits::to_int_type('\r')) { if (m_pBuffer->sgetc() == traits::to_int_type('\n')) m_pBuffer->sbumpc(); break; } line.emplace_back(tr...
```suggestion char bufferLine[1025]; if (!m_pFile->ReadString(bufferLine, sizeof(bufferLine))) // EOF or error ``` If you only want to read 1023 bytes from the file make `bufferLine` 1024. Either way the extra unused byte is confusing.
{ if (m_pBuffer->sgetc() == traits::to_int_type('\r')) m_pBuffer->sbumpc(); break; } if (aByte == traits::to_int_type('\r')) { if (m_pBuffer->sgetc() == traits::to_int_type('\n')) m_pBuffer->sbumpc(); break; } line.emplace_back(tr...
@@ -765,6 +765,68 @@ int64_t CFile::GetPosition() const return -1; } +bool XFILE::CFile::ReadString(std::vector<char>& line) +{ + if (!m_pFile) + return false; + + line.clear(); + + if (m_pBuffer) + { + using traits = CFileStreamBuffer::traits_type; + CFileStreamBuffer::int_type aByte = m_pBuffer->sg...
xbmc/filesystem/File.cpp
26
C++
1
suggestion
251
51
51
false
[Playlist][M3U] Fix long line reading
25,798
xbmc/xbmc
17,740
C++
neo1973
CastagnaIT
if (VIDEO::IsVideoDb(*item) && item->HasVideoInfoTag()) item->SetPath(item->GetVideoInfoTag()->GetPath()); } listNeedsUpdating = true; } while (needsRefresh); return listNeedsUpdating; } bool CGUIWindowVideoBase::ShowInfoAndRefresh(const CFileItemPtr& item, const ScraperPtr& info) { const...
I don't doubt this fixes the issue but the announce for videolibrary update is being done by a GUI window when it should be done by the actual library component... Any chance you can find out a proper place for the announce? Thanks for tackling some of our open issues! It's greatly appreciated
if (VIDEO::IsVideoDb(*item) && item->HasVideoInfoTag()) item->SetPath(item->GetVideoInfoTag()->GetPath()); } listNeedsUpdating = true; } while (needsRefresh); return listNeedsUpdating; } bool CGUIWindowVideoBase::ShowInfoAndRefresh(const CFileItemPtr& item, const ScraperPtr& info) { const ...
@@ -514,6 +514,11 @@ bool CGUIWindowVideoBase::ShowInfoAndRefresh(const CFileItemPtr& item, const Scr m_viewControl.SetSelectedItem(itemNumber); } + CVariant data; + data["id"] = item->GetVideoInfoTag()->m_iDbId; + data["type"] = item->GetVideoInfoTag()->m_type; + CServiceBroker::GetAnnouncementManager()-...
xbmc/video/windows/GUIWindowVideoBase.cpp
26
C++
0.571
suggestion
296
51
51
false
[Art] Fix #25601 - Refresh art after update in information dialog
25,812
xbmc/xbmc
17,740
C++
enen92
78andyp
\return count of music video IDs found. */ unsigned int GetRandomMusicVideoIDs(const std::string& strWhere, std::vector<std::pair<int, int> > &songIDs); static void VideoContentTypeToString(VideoDbContentType type, std::string& out) { switch (type) { case VideoDbContentType::MOVIES: out...
From the logical POV a setter method being `const` looks somehow wrong as "set" implies "change".
\return count of music video IDs found. */ unsigned int GetRandomMusicVideoIDs(const std::string& strWhere, std::vector<std::pair<int, int> > &songIDs); static void VideoContentTypeToString(VideoDbContentType type, std::string& out) { switch (type) { case VideoDbContentType::MOVIES: out...
@@ -979,7 +979,7 @@ class CVideoDatabase : public CDatabase } } - void SetArtForItem(int mediaId, const MediaType &mediaType, const std::string &artType, const std::string &url); + void SetArtForItem(int mediaId, const MediaType &mediaType, const std::string &artType, const std::string &url) const;
xbmc/video/VideoDatabase.h
26
C/C++
0.571
bug
98
51
51
false
[Art] Fix #25601 - Refresh art after update in information dialog
25,812
xbmc/xbmc
17,740
C++
ksooo
78andyp
const bool isSameSubLang = g_LangCodeExpander.CompareISO639Codes(ss.language, m_subLang); if (m_isPrefHearingImp) { const int checkFlags = FLAG_ORIGINAL | FLAG_HEARING_IMPAIRED; if ((ss.flags & checkFlags) == checkFlags) return false; // to consider CC streams may not have the l...
maybe if (ss.flags & (FLAG_ORIGINAL | FLAG_DEFAULT)) ? is it ok not to match the language? no else on purpose?
} const bool isSameSubLang = g_LangCodeExpander.CompareISO639Codes(ss.language, m_subLang); if (m_isPrefHearingImp) { const int checkFlags = FLAG_ORIGINAL | FLAG_HEARING_IMPAIRED; if ((ss.flags & checkFlags) == checkFlags) return false; // to consider CC streams may not have...
@@ -86,68 +86,105 @@ using namespace std::chrono_literals; class PredicateSubtitleFilter { private: - std::string audiolang; - bool original; - bool nosub; - bool onlyforced; - int currentSubStream; + std::string m_audioLang; + std::string m_subLang; + bool m_isPrefOriginal; + bool m_isPrefForced; + bool m...
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
0.286
question
112
51
51
false
[VideoPlayer] Fix and improve subtitle stream selection
25,813
xbmc/xbmc
17,740
C++
CrystalP
CastagnaIT
return false; } // fallback to regular subtitles if (isSameSubLang && (ss.flags & FLAG_FORCED) == 0) return false; return true; } if (m_isPrefOriginal) { if ((ss.flags & FLAG_ORIGINAL)) return false; } else if (m_isPrefForced) { if ((...
external + no language already covered L141
{ return false; } // fallback to regular subtitles if (isSameSubLang && (ss.flags & FLAG_FORCED) == 0) return false; return true; } if (m_isPrefOriginal) { if ((ss.flags & FLAG_ORIGINAL)) return false; } else if (m_isPrefForced) { ...
@@ -86,68 +86,105 @@ using namespace std::chrono_literals; class PredicateSubtitleFilter { private: - std::string audiolang; - bool original; - bool nosub; - bool onlyforced; - int currentSubStream; + std::string m_audioLang; + std::string m_subLang; + bool m_isPrefOriginal; + bool m_isPrefForced; + bool m...
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
0.071
suggestion
43
51
51
false
[VideoPlayer] Fix and improve subtitle stream selection
25,813
xbmc/xbmc
17,740
C++
CrystalP
CastagnaIT
} // fallback to regular subtitles if (isSameSubLang && (ss.flags & FLAG_FORCED) == 0) return false; return true; } if (m_isPrefOriginal) { if ((ss.flags & FLAG_ORIGINAL)) return false; } else if (m_isPrefForced) { if ((ss.flags & StreamFlags...
maybe a ss.flags & FLAG_DEFAULT somewhere in that if() condition? why (ss.flags & (FLAG_FORCED | FLAG_HEARING_IMPAIRED) == 0)? even with one of those flags, it's still a good sub if it was ranked the best available? maybe it's the only sub.
return false; } // fallback to regular subtitles if (isSameSubLang && (ss.flags & FLAG_FORCED) == 0) return false; return true; } if (m_isPrefOriginal) { if ((ss.flags & FLAG_ORIGINAL)) return false; } else if (m_isPrefForced) { if ((...
@@ -86,68 +86,105 @@ using namespace std::chrono_literals; class PredicateSubtitleFilter { private: - std::string audiolang; - bool original; - bool nosub; - bool onlyforced; - int currentSubStream; + std::string m_audioLang; + std::string m_subLang; + bool m_isPrefOriginal; + bool m_isPrefForced; + bool m...
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
0.357
suggestion
243
51
51
false
[VideoPlayer] Fix and improve subtitle stream selection
25,813
xbmc/xbmc
17,740
C++
CrystalP
CastagnaIT
* The priority sequence is exactly as shown by the code sequence of the operator() method. * * NOTE: Dont exists a "default" setting for subtitles, as there is for audio (media default), * so the default flag will give a priority over another only when two streams * have sam...
Unused variable: ``` /home/jenkins/jenkins-root/workspace/android-arm64-docker@4/xbmc/cores/VideoPlayer/VideoPlayer.cpp:285:16: warning: unused variable 'isSubNone' [-Wunused-variable] 285 | const bool isSubNone = StringUtils::EqualsNoCase(subLangSetting, "none"); | ^~~~~~~~~ 1 warning...
* The priority sequence is exactly as shown by the code sequence of the operator() method. * * NOTE: Dont exists a "default" setting for subtitles, as there is for audio (media default), * so the default flag will give a priority over another only when two streams * have sam...
@@ -216,91 +253,148 @@ class PredicateAudioFilter }; }; -/** \brief The class' operator() decides if the given (subtitle) SelectionStream lh is 'better than' the given (subtitle) SelectionStream rh. -* If lh is 'better than' rh the return value is true, false otherwise. -* -* A subtitle lh is 'b...
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
1
suggestion
336
51
51
false
[VideoPlayer] Fix and improve subtitle stream selection
25,813
xbmc/xbmc
17,740
C++
thexai
CastagnaIT
stream.id != m_CurrentRadioRDS.id && stream.id != m_CurrentAudioID3.id) { m_pDemuxer->EnableStream(stream.demuxerId, stream.id, false); } } } } } bool CVideoPlayer::ReadPacket(DemuxPacket*& packet, CDemuxStream*& stream) { // check if we should read from subtitle de...
Hello @CastagnaIT, what was the idea behind this removal? It made sense to force forced subs on when user has subs off by default. Those lines were not responsible for the issue #26050.
if(!valid) { CloseStream(m_CurrentAudio, true); m_processInfo->ResetAudioCodecInfo(); } // enable or disable subtitles bool visible = m_processInfo->GetVideoSettings().m_SubtitleOn; // open subtitle stream SelectionStream as = m_SelectionStreams.Get(STREAM_AUDIO, GetAudioStream()); PredicateS...
@@ -971,8 +1062,8 @@ void CVideoPlayer::OpenDefaultStreams(bool reset) valid = true; if(!psp.relevant(stream)) visible = false; - else if(stream.flags & StreamFlags::FLAG_FORCED) - visible = true; + //else if(stream.flags & StreamFlags::FLAG_FORCED) + // visible = true;
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
0.786
suggestion
185
51
51
false
[VideoPlayer] Fix and improve subtitle stream selection
25,813
xbmc/xbmc
17,740
C++
CrystalP
CastagnaIT
#define SECONDS_TO_FILETIME 10000000L static const char *DAY_NAMES[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static const char *MONTH_NAMES[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; ///////////////////////////////////////////////// // // CDateTimeSpan /...
It's simpler to use a delegating constructor like this IMO: ```cpp CDateTimeSpan::CDateTimeSpan(int day, int hour, int minute, int second) : CDateTimeSpan() { SetDateTimeSpan(day, hour, minute, second); } ```
#define SECONDS_TO_FILETIME 10000000L static const char *DAY_NAMES[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static const char *MONTH_NAMES[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; ///////////////////////////////////////////////// // // CDateTimeSpan /...
@@ -44,6 +44,8 @@ CDateTimeSpan::CDateTimeSpan(const CDateTimeSpan& span) CDateTimeSpan::CDateTimeSpan(int day, int hour, int minute, int second) { + m_timeSpan.highDateTime = 0; + m_timeSpan.lowDateTime = 0;
xbmc/XBDateTime.cpp
26
C++
1
suggestion
216
51
51
false
Fix some UB like memcpy(NULL, NULL, 0)
25,820
xbmc/xbmc
17,740
C++
neo1973
hribz
set_name_string(name, string); else usage(); } static void init_transform(transform_t* transform) { int x; memset(&transform->transform, '\0', sizeof(transform->transform)); for (x = 0; x < 3; x++) transform->transform.matrix[x][x] = XDoubleToFixed(1.0); transform->filter = ""; transform->npara...
Calling `malloc` with size 0 is implementation defined. Better change it to this for predictable behavior: ```cpp static void set_transform( transform_t* dest, XTransform* transform, char* filter, XFixed* params, int nparams) { dest->transform = *transform; dest->filter = strdup(filter); dest->nparams ...
set_name_string(name, string); else usage(); } static void init_transform(transform_t* transform) { int x; memset(&transform->transform, '\0', sizeof(transform->transform)); for (x = 0; x < 3; x++) transform->transform.matrix[x][x] = XDoubleToFixed(1.0); transform->filter = ""; transform->npara...
@@ -597,7 +597,8 @@ static void set_transform( dest->filter = strdup(filter); dest->nparams = nparams; dest->params = malloc(nparams * sizeof(XFixed)); - memcpy(dest->params, params, nparams * sizeof(XFixed)); + if (nparams) + memcpy(dest->params, params, nparams * sizeof(XFixed));
xbmc-xrandr.c
26
C
1
suggestion
513
51
51
false
Fix some UB like memcpy(NULL, NULL, 0)
25,820
xbmc/xbmc
17,740
C++
neo1973
hribz
/* ** Initialize a string accumulator */ void MysqlDatabase::mysqlStrAccumInit(StrAccum* p, char* zBase, int n, int mx) { p->zText = p->zBase = zBase; p->nChar = 0; p->nAlloc = n; p->mxAlloc = mx; p->tooBig = false; p->mallocFailed = false; } /* ** Print into memory obtained from mysql_malloc(). Omit the...
```suggestion std::string strResult = mysqlStrAccumFinish(&acc); ```
/* ** Initialize a string accumulator */ void MysqlDatabase::mysqlStrAccumInit(StrAccum* p, char* zBase, int n, int mx) { p->zText = p->zBase = zBase; p->nChar = 0; p->nAlloc = n; p->mxAlloc = mx; p->tooBig = false; p->mallocFailed = false; } /* ** Print into memory obtained from mysql_malloc(). Omit the...
@@ -1634,7 +1634,10 @@ std::string MysqlDatabase::mysql_vmprintf(const char* zFormat, va_list ap) mysqlStrAccumInit(&acc, zBase, sizeof(zBase), MYSQL_MAX_LENGTH); mysqlVXPrintf(&acc, 0, zFormat, ap); - return mysqlStrAccumFinish(&acc); + std::string strResult = std::string(mysqlStrAccumFinish(&acc));
xbmc/dbwrappers/mysqldataset.cpp
26
C++
0.857
suggestion
72
51
51
false
Fix some UB like memcpy(NULL, NULL, 0)
25,820
xbmc/xbmc
17,740
C++
neo1973
hribz
bCheckPW = profileManager->GetCurrentProfile().videoLocked(); if (!bCheckPW && !m_strMediaSourcePath.empty()) // check mediasource by path return g_passwordManager.IsMediaPathUnlocked(profileManager, "video"); break; case WINDOW_PICTURES: // Pictures bCheckPW = profileManager->...
```suggestion const auto profileManager = ```
bCheckPW = profileManager->GetCurrentProfile().videoLocked(); if (!bCheckPW && !m_strMediaSourcePath.empty()) // check mediasource by path return g_passwordManager.IsMediaPathUnlocked(profileManager, "video"); break; case WINDOW_PICTURES: // Pictures bCheckPW = profileManager->...
@@ -479,6 +479,20 @@ bool CGUIPassword::CheckMenuLock(int iWindowID) return true; } +bool CGUIPassword::IsVideoUnlocked() +{ + const std::shared_ptr<CProfileManager> profileManager =
xbmc/GUIPassword.cpp
26
C++
0.786
suggestion
49
51
51
false
[Password] Improve media lock checks (including recently added videos)
25,828
xbmc/xbmc
17,740
C++
thexai
78andyp
return playlistId; } int PlayOrQueueMedia(const std::vector<std::string>& params, bool forcePlay) { // restore to previous window if needed if( CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_SLIDESHOW || CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_FULL...
This method also handles music. Should a similar check for music be added?
return playlistId; } int PlayOrQueueMedia(const std::vector<std::string>& params, bool forcePlay) { // restore to previous window if needed if( CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_SLIDESHOW || CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_FULL...
@@ -474,6 +474,14 @@ int PlayOrQueueMedia(const std::vector<std::string>& params, bool forcePlay) // need some extended item properties to process resume successfully. Load them. item.LoadDetails(); + // Check if video sources are locked - to capture recently added videos played from the home screen + if (VID...
xbmc/interfaces/builtins/PlayerBuiltins.cpp
26
C++
0.643
question
74
51
51
false
[Password] Improve media lock checks (including recently added videos)
25,828
xbmc/xbmc
17,740
C++
ksooo
78andyp
if (list->Size() > 0) { Id playlistId = Id::TYPE_MUSIC; for (int i = 0; i < list->Size(); i++) { if (IsVideo(*list->Get(i))) { playlistId = Id::TYPE_VIDEO; break; } } ClearPlaylist(playlistId); SetCurrentP...
Not sure this method is the right place to handle json rpc as this class here is fairly generic and handles much more than json rpc. I would try to do this check somewhere in xbmc/interfaces/json-rpc
if (list->Size() > 0) { Id playlistId = Id::TYPE_MUSIC; for (int i = 0; i < list->Size(); i++) { if (IsVideo(*list->Get(i))) { playlistId = Id::TYPE_VIDEO; break; } } ClearPlaylist(playlistId); SetCurrentP...
@@ -984,7 +985,18 @@ void PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMess return; } if (MUSIC::IsAudio(*item) || IsVideo(*item)) + { + // Check if sources are locked - to capture media played via json-rpc
xbmc/PlayListPlayer.cpp
26
C++
0.786
suggestion
199
51
51
false
[Password] Improve media lock checks (including recently added videos)
25,828
xbmc/xbmc
17,740
C++
ksooo
78andyp
{ Id playlistId = Id::TYPE_MUSIC; for (int i = 0; i < list->Size(); i++) { if (IsVideo(*list->Get(i))) { playlistId = Id::TYPE_VIDEO; break; } } ClearPlaylist(playlistId); SetCurrentPlaylist(playlistId); ...
I know I'm pita, but playlistplayer code does not know anything about json-rpc and this is okay. Why reference an upper layer from a lower layer - even though it is only a comment. If at any point in time for any reason json-rpc does not call playlistplayer any more I bet this comment will be forgotten to adjust. ;-) M...
{ Id playlistId = Id::TYPE_MUSIC; for (int i = 0; i < list->Size(); i++) { if (IsVideo(*list->Get(i))) { playlistId = Id::TYPE_VIDEO; break; } } ClearPlaylist(playlistId); SetCurrentPlaylist(playlistId); ...
@@ -986,7 +986,7 @@ void PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMess } if (MUSIC::IsAudio(*item) || IsVideo(*item)) { - // Check if sources are locked - to capture media played via json-rpc + // Check if sources are locked (eg. media...
xbmc/PlayListPlayer.cpp
26
C++
0.429
suggestion
456
51
51
false
[Password] Improve media lock checks (including recently added videos)
25,828
xbmc/xbmc
17,740
C++
ksooo
78andyp
if (list->Size() > 0) { Id playlistId = Id::TYPE_MUSIC; for (int i = 0; i < list->Size(); i++) { if (IsVideo(*list->Get(i))) { playlistId = Id::TYPE_VIDEO; break; } } ClearPlaylist(playlistId); SetCurrentP...
On more: Please take a look into implementation of IsVideo() and you will see that it is quite complex, thus expensive, cpu cycle wise. I suggest to calculate it only once and to store the result in a variable.
if (list->Size() > 0) { Id playlistId = Id::TYPE_MUSIC; for (int i = 0; i < list->Size(); i++) { if (IsVideo(*list->Get(i))) { playlistId = Id::TYPE_VIDEO; break; } } ClearPlaylist(playlistId); SetCurrentP...
@@ -984,7 +985,17 @@ void PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMess return; } if (MUSIC::IsAudio(*item) || IsVideo(*item)) + { + if ((IsVideo(*item) && !g_passwordManager.IsVideoUnlocked()) ||
xbmc/PlayListPlayer.cpp
26
C++
0.571
performance
210
51
51
false
[Password] Improve media lock checks (including recently added videos)
25,828
xbmc/xbmc
17,740
C++
ksooo
78andyp
CFileItemList *list = static_cast<CFileItemList*>(pMsg->lpVoid); if (list->Size() > 0) { Id playlistId = Id::TYPE_MUSIC; for (int i = 0; i < list->Size(); i++) { if (IsVideo(*list->Get(i))) { playlistId = Id::TYPE_VIDEO; break; ...
i guess it is `VIDEO::IsVideo` being called here ```suggestion const bool isVideo{VIDEO::IsVideo(*item)}; ```
CFileItemList *list = static_cast<CFileItemList*>(pMsg->lpVoid); if (list->Size() > 0) { Id playlistId = Id::TYPE_MUSIC; for (int i = 0; i < list->Size(); i++) { if (IsVideo(*list->Get(i))) { playlistId = Id::TYPE_VIDEO; break; ...
@@ -983,8 +984,20 @@ void PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMess { return; } - if (MUSIC::IsAudio(*item) || IsVideo(*item)) + const bool isVideo{IsVideo(*item)};
xbmc/PlayListPlayer.cpp
26
C++
1
suggestion
124
51
51
false
[Password] Improve media lock checks (including recently added videos)
25,828
xbmc/xbmc
17,740
C++
howie-f
78andyp
} else { double duration = (static_cast<double>(loop_written) / m_format.m_frameSize) / m_format.m_sampleRate; m_duration_written += duration; } // just try again to care for fragmentation if (written < size) out_buf = out_buf + loop_written; ...
As commented in forum this improves a lot DTS-HD MA in RAW. Tested 4.0 divider and not improves TrueHD and broke DTS-HD MA again. Tested also 1.5 with no good results. Seems 2.0 is the best value for DTS-HD MA and anyway devices that supports TrueHD also should be able to use IEC and Kodi packer.
} } else { double duration = (static_cast<double>(loop_written) / m_format.m_frameSize) / m_format.m_sampleRate; m_duration_written += duration; } // just try again to care for fragmentation if (written < size) out_buf = out_buf + loop_wri...
@@ -927,49 +921,28 @@ unsigned int CAESinkAUDIOTRACK::AddPackets(uint8_t **data, unsigned int frames, } unsigned int written_frames = static_cast<unsigned int>(written / m_format.m_frameSize); double time_to_add_ms = 1000.0 * (CurrentHostCounter() - startTime) / CurrentHostFrequency(); + // Get Back in Sync w...
xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
26
C++
0.643
suggestion
304
51
51
false
AudioTrack: Revisit pause bursts and delay
25,829
xbmc/xbmc
17,740
C++
thexai
fritsch
#include "guilib/GUIWindowManager.h" #include "interfaces/AnnouncementManager.h" CGUISourcesAnnouncementHandler::CGUISourcesAnnouncementHandler() { CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this); } CGUISourcesAnnouncementHandler::~CGUISourcesAnnouncementHandler() { CServiceBroker::GetAnnouncementMan...
Would it make sense to introduce a new `CGUIMessage` ctor to save the call to `SetStringParam` ?
#include "guilib/GUIWindowManager.h" #include "interfaces/AnnouncementManager.h" CGUISourcesAnnouncementHandler::CGUISourcesAnnouncementHandler() { CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this); } CGUISourcesAnnouncementHandler::~CGUISourcesAnnouncementHandler() { CServiceBroker::GetAnnouncementMan...
@@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ + +#include "GUISourcesAnnouncementHandler.h" + +#include "GUIUserMessages.h" +#include "ServiceBroker.h" +#in...
xbmc/guilib/handlers/sources/GUISourcesAnnouncementHandler.cpp
26
C++
0.357
question
96
30
30
false
[GUI] Introduce GUI Announcement Handlers
25,831
xbmc/xbmc
17,740
C++
ksooo
enen92
* SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "GUISourcesAnnouncementHandler.h" #include "GUIUserMessages.h" #include "ServiceBroker.h" #include "guilib/GUIComponent.h" #include "guilib/GUIWindowManager.h" #include "interfaces/AnnouncementManager.h" CGUIS...
Do you really need the flexibility of a `CVariant`? Or would it always be the path (a string) passed in here?
* SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "GUISourcesAnnouncementHandler.h" #include "GUIUserMessages.h" #include "ServiceBroker.h" #include "guilib/GUIComponent.h" #include "guilib/GUIWindowManager.h" #include "interfaces/AnnouncementManager.h" CGUIS...
@@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ + +#include "GUISourcesAnnouncementHandler.h" + +#include "GUIUserMessages.h" +#include "ServiceBroker.h" +#in...
xbmc/guilib/handlers/sources/GUISourcesAnnouncementHandler.cpp
26
C++
0.5
question
109
39
39
false
[GUI] Introduce GUI Announcement Handlers
25,831
xbmc/xbmc
17,740
C++
ksooo
enen92
if (m_diffuse.size()) { if (m_isGLES20 && (texture->GetSwizzle() == KD_TEX_SWIZ_111R || m_diffuse.m_textures[0]->GetSwizzle() == KD_TEX_SWIZ_111R)) { if (texture->GetSwizzle() == KD_TEX_SWIZ_111R && m_diffuse.m_textures[0]->GetSwizzle() == KD_TEX_SWIZ_111R) m_...
On further thought, I need to change the UV coordinates too when doing this.
m_col[0] != 255 || m_col[1] != 255 || m_col[2] != 255 || m_col[3] != 255; if (m_diffuse.size()) { if (m_isGLES20 && (texture->GetSwizzle() == KD_TEX_SWIZ_111R || m_diffuse.m_textures[0]->GetSwizzle() == KD_TEX_SWIZ_111R)) { if (texture->GetSwizzle() == KD_TEX_SWIZ_111R &&...
@@ -65,33 +67,62 @@ void CGUITextureGLES::Begin(KODI::UTILS::COLOR::Color color) } bool hasAlpha = m_texture.m_textures[m_currentFrame]->HasAlpha() || m_col[3] < 255; + bool hasBlendColor = m_col[0] != 255 || m_col[1] != 255 || m_col[2] != 255 || m_col[3] != 255; if (m_diffuse.size()) { - if (m_col[...
xbmc/guilib/GUITextureGLES.cpp
26
C++
0.357
suggestion
76
51
51
false
GLES: Implement shader based 111R swizzle
25,855
xbmc/xbmc
17,740
C++
sarbes
sarbes
std::string strDeletePath = item->GetVideoInfoTag()->GetPath(); if (StringUtils::EqualsNoCase(URIUtils::GetFileName(strDeletePath), "VIDEO_TS.IFO")) { strDeletePath = URIUtils::GetDirectory(strDeletePath); if (StringUtils::EndsWithNoCase(strDeletePath, "video_ts/")) { URIUtils::Re...
Can you please remove that comment, here and everywhere else?
std::string strDeletePath = item->GetVideoInfoTag()->GetPath(); if (StringUtils::EqualsNoCase(URIUtils::GetFileName(strDeletePath), "VIDEO_TS.IFO")) { strDeletePath = URIUtils::GetDirectory(strDeletePath); if (StringUtils::EndsWithNoCase(strDeletePath, "video_ts/")) { URIUtils::Re...
@@ -1483,8 +1483,12 @@ bool CGUIDialogVideoInfo::DeleteVideoItem(const std::shared_ptr<CFileItem>& item item->m_bIsFolder = true; CGUIComponent *gui = CServiceBroker::GetGUI(); - if (gui && gui->ConfirmDelete(item->GetPath())) - CFileUtils::DeleteItem(item); + + if (gui) // BOAZ_N
xbmc/video/dialogs/GUIDialogVideoInfo.cpp
26
C++
0.357
question
61
51
51
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
{ strDeletePath = URIUtils::GetDirectory(strDeletePath); if (StringUtils::EndsWithNoCase(strDeletePath, "video_ts/")) { URIUtils::RemoveSlashAtEnd(strDeletePath); strDeletePath = URIUtils::GetDirectory(strDeletePath); } } if (URIUtils::HasSlashAtEnd(strDeletePath)) ...
Have you thought about adding the settings value check to `CUtils::DeleteItem` implementation so it would only be needed at a single location?
{ strDeletePath = URIUtils::GetDirectory(strDeletePath); if (StringUtils::EndsWithNoCase(strDeletePath, "video_ts/")) { URIUtils::RemoveSlashAtEnd(strDeletePath); strDeletePath = URIUtils::GetDirectory(strDeletePath); } } if (URIUtils::HasSlashAtEnd(strDeletePath)) ...
@@ -1483,8 +1483,12 @@ bool CGUIDialogVideoInfo::DeleteVideoItem(const std::shared_ptr<CFileItem>& item item->m_bIsFolder = true; CGUIComponent *gui = CServiceBroker::GetGUI(); - if (gui && gui->ConfirmDelete(item->GetPath())) - CFileUtils::DeleteItem(item); + + if (gui) // BOAZ_N +...
xbmc/video/dialogs/GUIDialogVideoInfo.cpp
26
C++
0.5
question
142
51
51
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
} } } void CGUIMediaWindow::OnDeleteItem(int iItem) { if ( iItem < 0 || iItem >= m_vecItems->Size()) return; CFileItemPtr item = m_vecItems->Get(iItem); if (PLAYLIST::IsPlayList(*item)) item->m_bIsFolder = false; const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsCom...
No need to calculate `confirm` in case `gui`is `nullptr`. Move the calculation inside the `if (gui)` block, please.
} } } void CGUIMediaWindow::OnDeleteItem(int iItem) { if ( iItem < 0 || iItem >= m_vecItems->Size()) return; CFileItemPtr item = m_vecItems->Get(iItem); if (PLAYLIST::IsPlayList(*item)) item->m_bIsFolder = false; const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsCom...
@@ -1653,7 +1653,11 @@ void CGUIMediaWindow::OnDeleteItem(int iItem) } CGUIComponent *gui = CServiceBroker::GetGUI(); - if (gui && gui->ConfirmDelete(item->GetPath())) + + bool confirm = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool( + CSettings::SETTING_FILELISTS_CONFIRMFILEDELETE); + + ...
xbmc/windows/GUIMediaWindow.cpp
26
C++
1
bug
115
51
51
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
database.Open(); CVideoInfoTag details; database.GetMusicVideoInfo("", details, database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtistString(), item->GetMusicInfoTag()->GetAlbum(), item->GetMusicInfoTag()->GetTitle())); CServiceBroker::GetAppMessenger()->PostMsg(TMSG_MEDIA_PLAY, 0, 0,...
Help the compiler to optimize code and let readers understand that the value will not change anymore in this function: `const bool confirm ...`. Here and everywhere else in your PR.
database.Open(); CVideoInfoTag details; database.GetMusicVideoInfo("", details, database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtistString(), item->GetMusicInfoTag()->GetAlbum(), item->GetMusicInfoTag()->GetTitle())); CServiceBroker::GetAppMessenger()->PostMsg(TMSG_MEDIA_PLAY, 0, 0,...
@@ -827,8 +827,14 @@ bool CGUIWindowMusicNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button) { item->m_bIsFolder = false; CGUIComponent *gui = CServiceBroker::GetGUI(); - if (gui && gui->ConfirmDelete(item->GetPath())) - CFileUtils::DeleteItem(item); + + if (gui) + { + ...
xbmc/music/windows/GUIWindowMusicNav.cpp
26
C++
0.714
performance
181
51
51
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
if (item->IsStack()) item->m_bIsFolder = true; const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager(); if (profileManager->GetCurrentProfile().getLockMode() != LOCK_MODE_EVERYONE && profileManager->GetCurrentProfile().filesLocked()) { ...
I read this exact code fragment so may times in your PR, that I think it is a good idea to add a new function to `CUtil` for that. Avoid duplicate code.
if (item->IsStack()) item->m_bIsFolder = true; const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager(); if (profileManager->GetCurrentProfile().getLockMode() != LOCK_MODE_EVERYONE && profileManager->GetCurrentProfile().filesLocked()) { ...
@@ -1060,8 +1060,15 @@ void CGUIWindowVideoBase::OnDeleteItem(const CFileItemPtr& item) CUtil::SupportsWriteFileOperations(item->GetPath())) { CGUIComponent *gui = CServiceBroker::GetGUI(); - if (gui && gui->ConfirmDelete(item->GetPath())) - CFileUtils::DeleteItem(item); + + if (gui) + ...
xbmc/video/windows/GUIWindowVideoBase.cpp
26
C++
0.714
refactor
152
51
51
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
static std::string GetFrameworksPath(bool forPython = false); static bool CanBindPrivileged(); static bool ValidatePort(int port); /*! * \brief Thread-safe random number generation */ static int GetRandomNumber(); static int64_t ConvertSecsToMilliSecs(double secs) { return static_cast<int64_t>(secs...
1) I think this function fits better into `CFileUtils`, not `CUtil`, please move it. 2) We are not short on letters. Please change function name to `DeleteWithConfirmation` 3) Change param type to `const std::shared_ptr<CFileItem>&`, please. by-ref instead by-value and use native type, not the typedef `CFileItemPtr`a...
static std::string GetFrameworksPath(bool forPython = false); static bool CanBindPrivileged(); static bool ValidatePort(int port); /*! * \brief Thread-safe random number generation */ static int GetRandomNumber(); static int64_t ConvertSecsToMilliSecs(double secs) { return static_cast<int64_t>(secs...
@@ -227,6 +227,12 @@ class CUtil const std::string& file, const std::string& destname = ""); + /*! + * \brief Delete a file with/without confirmation. + * Depends on confirmation flag in settings. + */ + static bool FileDelWithConf...
xbmc/Util.h
26
C/C++
1
suggestion
441
51
51
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
destPath = URIUtils::AddFileToFolder(strPath, file); else destPath = URIUtils::AddFileToFolder(strPath, destname); if (!CFile::Exists(destPath)) { // need to copy it across std::string srcPath = URIUtils::AddFileToFolder("special://xbmc/userdata/", file); CFile::Copy(srcPath, destPath); } }...
Logic needs to be revised a bit . Settings component works also without GUI. If we do not have a GUI and the setting is false we can just go ahead and delete the file. Should read, like: ```c++ bool deleteItem = false; if (CServiceBroker::GetSettingsComponent()->GetS... { CGUIComponent* gui = CService... ...
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "network/Network.h" #include "network/NetworkFileItemClassify.h" #include "playlists/PlayListFileItemClassify.h" #inclu...
@@ -2467,3 +2468,19 @@ void CUtil::CopyUserDataIfNeeded(const std::string& strPath, CFile::Copy(srcPath, destPath); } } + +bool CUtil::FileDelWithConfirm(CFileItemPtr pItem) +{ + CGUIComponent* gui = CServiceBroker::GetGUI(); + + if (gui) + { + const bool confirm = CServiceBroker::GetSettingsComponent()-...
xbmc/Util.cpp
26
C++
1
suggestion
487
28
2,470
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
#endif static std::string ResolveExecutablePath(); static std::string GetFrameworksPath(bool forPython = false); static bool CanBindPrivileged(); static bool ValidatePort(int port); /*! * \brief Thread-safe random number generation */ static int GetRandomNumber(); static int64_t ConvertSecsToMill...
One more time: 1) This function should be moved to `CFileUtils`. 2) Replace `CFileItemPtr` with `std::shared_ptr>CFileItem>`.
#endif static std::string ResolveExecutablePath(); static std::string GetFrameworksPath(bool forPython = false); static bool CanBindPrivileged(); static bool ValidatePort(int port); /*! * \brief Thread-safe random number generation */ static int GetRandomNumber(); static int64_t ConvertSecsToMill...
@@ -227,6 +227,10 @@ class CUtil const std::string& file, const std::string& destname = ""); + /** \brief Delete a file with confirmation unless setting is off. + */ + static bool FileDeleteWithConfirm(const CFileItemPtr& item);
xbmc/Util.h
26
C/C++
0.714
suggestion
130
51
51
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
if (rand_s(&number) == 0) return (int)number; return rand(); #endif } void CUtil::CopyUserDataIfNeeded(const std::string& strPath, const std::string& file, const std::string& destname) { std::string destPath; if (destname.empty()) destP...
Replace `CFileItemPtr` with `std::shared_ptr>CFileItem>`.
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "network/Network.h" #include "network/NetworkFileItemClassify.h" #include "playlists/PlayListFileItemClassify.h" #inclu...
@@ -2467,3 +2468,19 @@ void CUtil::CopyUserDataIfNeeded(const std::string& strPath, CFile::Copy(srcPath, destPath); } } + +bool CUtil::FileDeleteWithConfirm(const CFileItemPtr& item)
xbmc/Util.cpp
26
C++
0.571
suggestion
57
41
2,470
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
if (!dlgYesNo->IsConfirmed()) return false; // fall back to master profile if necessary if ((int)index == m_autoLoginProfile) m_autoLoginProfile = 0; // delete profile std::string strDirectory = profile->getDirectory(); m_profiles.erase(m_profiles.begin() + index); // fall back to master profil...
Revert this changes, please. This is only leftover from a previous iteration of your PR. You do not want to change profile manager.
if (!dlgYesNo->IsConfirmed()) return false; // fall back to master profile if necessary if ((int)index == m_autoLoginProfile) m_autoLoginProfile = 0; // delete profile std::string strDirectory = profile->getDirectory(); m_profiles.erase(m_profiles.begin() + index); // fall back to master profil...
@@ -513,7 +513,8 @@ bool CProfileManager::DeleteProfile(unsigned int index) item->m_bIsFolder = true; item->Select(true); - CGUIComponent *gui = CServiceBroker::GetGUI(); + CGUIComponent* gui = CServiceBroker::GetGUI(); +
xbmc/profiles/ProfileManager.cpp
26
C++
0.5
suggestion
131
51
51
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "TestUtils.h" #include "Util.h" #include "filesystem/File.h" #include "filesystem/SpecialProtocol.h" #include "platfor...
Remove this empty line. This is only a leftover from a previous iteration of the PR. You do not want to change this file.
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "TestUtils.h" #include "Util.h" #include "filesystem/File.h" #include "filesystem/SpecialProtocol.h" #include "platform...
@@ -7,6 +7,7 @@ */ #include "TestUtils.h" +
xbmc/test/TestUtils.cpp
10
C++
0.5
refactor
121
35
35
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
/* * Copyright (C) 2010-2020 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "FileUtils.h" #include "CompileInfo.h" #include "FileOperationJob.h" #include "ServiceBroker.h" #include "StringUtils.h...
Revert the removal of this line. We always keep an empty line between header include for the class implemented in the cpp file.
/* * Copyright (C) 2010-2020 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "FileUtils.h" #include "CompileInfo.h" #include "FileOperationJob.h" #include "ServiceBroker.h" #include "StringUtils....
@@ -7,7 +7,6 @@ */ #include "FileUtils.h" -
xbmc/utils/FileUtils.cpp
10
C++
0.286
suggestion
127
35
35
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
if (StringUtils::StartsWith(fullpath, whiteEntry)) return true; } return CFileUtils::RemoteAccessAllowed(fullpath); } } } #endif // if it isn't a local file, it must be a vfs entry if (! isImage) return CFileUtils::RemoteAccessAllowed(decodePath); return true;...
You could save the `confirm`variable and just write ``` if (CServiceBroker::GetSettingsComponent...) ```
{ if (StringUtils::StartsWith(fullpath, whiteEntry)) return true; } return CFileUtils::RemoteAccessAllowed(fullpath); } } } #endif // if it isn't a local file, it must be a vfs entry if (! isImage) return CFileUtils::RemoteAccessAllowed(decodePath); re...
@@ -353,3 +353,20 @@ bool CFileUtils::Exists(const std::string& strFileName, bool bUseCache) { return CFile::Exists(strFileName, bUseCache); } + + +bool CFileUtils::DeleteWithConfirm(const std::shared_ptr<CFileItem>& item) +{ + const bool confirm = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool( +...
xbmc/utils/FileUtils.cpp
26
C++
1
suggestion
109
36
34
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
/* * Copyright (C) 2010-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include <memory> #include <string> #include "FileItem.h" class CFileItem; class CDateTime; class CFileUtils { p...
No need for this include. remove it.
/* * Copyright (C) 2010-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include <memory> #include <string> class CFileItem; class CDateTime; class CFileUtils { public: static bool C...
@@ -10,6 +10,7 @@ #include <memory> #include <string> +#include "FileItem.h"
xbmc/utils/FileUtils.h
13
C/C++
0.286
suggestion
36
38
38
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
/* * Copyright (C) 2010-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include <memory> #include <string> class CFileItem; class CDateTime; class CFileUtils { public: static bool C...
bad formatting style, and since this must used only for audio/video/music you should specify it, because this class is generic ```c++ /* * \brief Deleting a file with confirmation according to settings, this applies only to audio/video/music files. */ ```
/* * Copyright (C) 2010-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include <memory> #include <string> class CFileItem; class CDateTime; class CFileUtils { public: static bool C...
@@ -21,6 +21,10 @@ class CFileUtils static bool DeleteItem(const std::shared_ptr<CFileItem>& item); static bool DeleteItem(const std::string &strPath); static bool Exists(const std::string& strFileName, bool bUseCache = true); + + /** \brief Delete a file with confirmation unless setting is off. + */
xbmc/utils/FileUtils.h
25
C/C++
1
style
264
39
38
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
CastagnaIT
bnk1
g_charsetConverter.wToUTF8(fullpathW, fullpath, false); for (const std::string& whiteEntry : whitelist) { if (StringUtils::StartsWith(fullpath, whiteEntry)) return true; } return CFileUtils::RemoteAccessAllowed(fullpath); } } } #endif // if it ...
@ksooo what worring me is that DeleteWithConfirm use CFileUtils that is generic, can be ok but this setting should not be used for files that are not library related (audio/video/music) but nowhere is it specified, and no file type check happens here anyone can use the DeleteWithConfirm method for anything else...a...
g_charsetConverter.wToUTF8(fullpathW, fullpath, false); for (const std::string& whiteEntry : whitelist) { if (StringUtils::StartsWith(fullpath, whiteEntry)) return true; } return CFileUtils::RemoteAccessAllowed(fullpath); } } } #endif // if it ...
@@ -353,3 +354,19 @@ bool CFileUtils::Exists(const std::string& strFileName, bool bUseCache) { return CFile::Exists(strFileName, bUseCache); } + +bool CFileUtils::DeleteWithConfirm(const std::shared_ptr<CFileItem>& item) +{ + const bool confirm = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool( + ...
xbmc/utils/FileUtils.cpp
26
C++
0.929
bug
447
38
36
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
CastagnaIT
bnk1
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "TestUtils.h" #include "Util.h" #include "filesystem/File.h" #include "filesystem/SpecialProtocol.h" #include "platfor...
One more time: Remove this empty line. This is only a leftover from a previous iteration of the PR. You do not want to change this file.
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "TestUtils.h" #include "Util.h" #include "filesystem/File.h" #include "filesystem/SpecialProtocol.h" #include "platform...
@@ -7,6 +7,7 @@ */ #include "TestUtils.h" +
xbmc/test/TestUtils.cpp
10
C++
0.5
refactor
136
35
35
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
std::string fullpath; g_charsetConverter.wToUTF8(fullpathW, fullpath, false); for (const std::string& whiteEntry : whitelist) { if (StringUtils::StartsWith(fullpath, whiteEntry)) return true; } return CFileUtils::RemoteAccessAllowed(fullpath); ...
```suggestion const bool confirm = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool( ```
std::string fullpath; g_charsetConverter.wToUTF8(fullpathW, fullpath, false); for (const std::string& whiteEntry : whitelist) { if (StringUtils::StartsWith(fullpath, whiteEntry)) return true; } return CFileUtils::RemoteAccessAllowed(fullpath); ...
@@ -353,3 +354,19 @@ bool CFileUtils::Exists(const std::string& strFileName, bool bUseCache) { return CFile::Exists(strFileName, bUseCache); } + +bool CFileUtils::DeleteItemWithConfirm(const std::shared_ptr<CFileItem>& item) +{ + bool confirm = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
xbmc/utils/FileUtils.cpp
26
C++
1
suggestion
105
39
37
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
g_passwordManager.IsMasterLockUnlocked(true))) { std::string strDeletePath = item->GetVideoInfoTag()->GetPath(); if (StringUtils::EqualsNoCase(URIUtils::GetFileName(strDeletePath), "VIDEO_TS.IFO")) { strDeletePath = URIUtils::GetDirectory(strDeletePath); if (StringUtils::EndsWithNoCase...
Wrong indentation. Jenkins already told you.
g_passwordManager.IsMasterLockUnlocked(true))) { std::string strDeletePath = item->GetVideoInfoTag()->GetPath(); if (StringUtils::EqualsNoCase(URIUtils::GetFileName(strDeletePath), "VIDEO_TS.IFO")) { strDeletePath = URIUtils::GetDirectory(strDeletePath); if (StringUtils::EndsWithNoCase...
@@ -1482,9 +1482,7 @@ bool CGUIDialogVideoInfo::DeleteVideoItem(const std::shared_ptr<CFileItem>& item if (item->IsStack()) item->m_bIsFolder = true; - CGUIComponent *gui = CServiceBroker::GetGUI(); - if (gui && gui->ConfirmDelete(item->GetPath())) - CFileUtils::DeleteItem(item); + ...
xbmc/video/dialogs/GUIDialogVideoInfo.cpp
26
C++
0.071
bug
44
51
51
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
case CONTEXT_BUTTON_PLAY_OTHER: { CVideoDatabase database; database.Open(); CVideoInfoTag details; database.GetMusicVideoInfo("", details, database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtistString(), item->GetMusicInfoTag()->GetAlbum(), item->GetMusicInfoTag()->GetTitle()));...
Remove this empty line, please.
case CONTEXT_BUTTON_PLAY_OTHER: { CVideoDatabase database; database.Open(); CVideoInfoTag details; database.GetMusicVideoInfo("", details, database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtistString(), item->GetMusicInfoTag()->GetAlbum(), item->GetMusicInfoTag()->GetTitle()));...
@@ -826,9 +826,8 @@ bool CGUIWindowMusicNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button) if (PLAYLIST::IsPlayList(*item) || PLAYLIST::IsSmartPlayList(*item)) { item->m_bIsFolder = false; - CGUIComponent *gui = CServiceBroker::GetGUI(); - if (gui && gui->ConfirmDelete(item->GetPath(...
xbmc/music/windows/GUIWindowMusicNav.cpp
26
C++
0.286
refactor
31
51
51
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
static constexpr auto SETTING_LOOKANDFEEL_SKINTHEME = "lookandfeel.skintheme"; static constexpr auto SETTING_LOOKANDFEEL_SKINCOLORS = "lookandfeel.skincolors"; static constexpr auto SETTING_LOOKANDFEEL_FONT = "lookandfeel.font"; static constexpr auto SETTING_LOOKANDFEEL_SKINZOOM = "lookandfeel.skinzoom"; stat...
To be consistant with naming, we should name this setting after what we have for allow file deletion! ```suggestion static constexpr auto SETTING_FILELISTS_CONFIRMFILEDELETION = "filelists.confirmfiledeletion"; ```
static constexpr auto SETTING_LOOKANDFEEL_SKINTHEME = "lookandfeel.skintheme"; static constexpr auto SETTING_LOOKANDFEEL_SKINCOLORS = "lookandfeel.skincolors"; static constexpr auto SETTING_LOOKANDFEEL_FONT = "lookandfeel.font"; static constexpr auto SETTING_LOOKANDFEEL_SKINZOOM = "lookandfeel.skinzoom"; stat...
@@ -56,6 +56,7 @@ class CSettings : public CSettingsBase, public CSettingCreator, public CSettingC static constexpr auto SETTING_FILELISTS_SHOWEXTENSIONS = "filelists.showextensions"; static constexpr auto SETTING_FILELISTS_IGNORETHEWHENSORTING = "filelists.ignorethewhensorting"; static constexpr auto SETTING_...
xbmc/settings/Settings.h
26
C/C++
1
suggestion
222
51
51
false
Enable/disable media file delete confirmation
25,857
xbmc/xbmc
17,740
C++
ksooo
bnk1
CJNIMediaCrypto crypto(uuid, std::vector<char>(m_hints.cryptoSession->sessionId.begin(), m_hints.cryptoSession->sessionId.end())); m_needSecureDecoder = crypto.requiresSecureDecoderComponent(m_mime) && (m_hints.cryptoSession->flags & DemuxCrypto...
Nitpicking: I would add a ':' after 'Open' for better readability. I had to read it two times to actually understand the content. BTW: Do you know `CLog::LogF` which automatically adds the function name to the log line?
CJNIMediaCrypto crypto(uuid, std::vector<char>(m_hints.cryptoSession->sessionId.begin(), m_hints.cryptoSession->sessionId.end())); m_needSecureDecoder = crypto.requiresSecureDecoderComponent(m_mime) && (m_hints.cryptoSession->flags & DemuxCrypto...
@@ -758,8 +758,13 @@ bool CDVDVideoCodecAndroidMediaCodec::Open(CDVDStreamInfo &hints, CDVDCodecOptio continue; m_codecname = codec_info.getName(); - if (!CServiceBroker::GetDecoderFilterManager()->isValid(m_codecname, m_hints)) + if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool( +...
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp
26
C++
0.786
question
222
51
51
false
[Android] Setting to enable/disable the Decoderfilter
25,862
xbmc/xbmc
17,740
C++
ksooo
joseluismarti
return output; } ////////////////////////////////////////////////////////////////////// // CGLSLVertexShader ////////////////////////////////////////////////////////////////////// bool CGLSLVertexShader::Compile() { GLint params[4]; Free(); m_vertexShader = glCreateShader(GL_VERTEX_SHADER); const char *p...
apparently it's possible to dynamically allocate the required size of the log by using `GL_INFO_LOG_LENGTH` with `glGetShaderiv`. Might be something worth looking into in the future instead of having a static buffer.
return output; } ////////////////////////////////////////////////////////////////////// // CGLSLVertexShader ////////////////////////////////////////////////////////////////////// bool CGLSLVertexShader::Compile() { GLint params[4]; Free(); m_vertexShader = glCreateShader(GL_VERTEX_SHADER); const char *p...
@@ -151,8 +151,13 @@ bool CGLSLVertexShader::Compile() { GLchar log[LOG_SIZE]; CLog::Log(LOGERROR, "GL: Error compiling vertex shader"); - glGetShaderInfoLog(m_vertexShader, LOG_SIZE, NULL, log); - CLog::Log(LOGERROR, "{}", log); + GLsizei length; + glGetShaderInfoLog(m_vertexShader, LOG_SIZE, ...
xbmc/guilib/Shader.cpp
26
C++
0.786
suggestion
216
51
51
false
Shut down gracefully if OpenGL context is not properly set up
25,930
xbmc/xbmc
17,740
C++
lrusak
basilgello
// Get the GL version number m_RenderVersionMajor = 0; m_RenderVersionMinor = 0; m_RenderVersion = "<none>"; const char* ver = reinterpret_cast<const char*>(glGetString(GL_VERSION)); if (ver) { sscanf(ver, "%d.%d", &m_RenderVersionMajor, &m_RenderVersionMinor); m_RenderVersion = ver; } CLog::...
more descriptive than `s`, `extension`?
// Get the GL version number m_RenderVersionMajor = 0; m_RenderVersionMinor = 0; m_RenderVersion = "<none>"; const char* ver = reinterpret_cast<const char*>(glGetString(GL_VERSION)); if (ver) { sscanf(ver, "%d.%d", &m_RenderVersionMajor, &m_RenderVersionMinor); m_RenderVersion = ver; } CLog::...
@@ -71,22 +67,25 @@ bool CRenderSystemGL::InitRenderSystem() GLint i; for (i = 0; i < n; i++) { - m_RenderExtensions += (const char*) glGetStringi(GL_EXTENSIONS, i); - m_RenderExtensions += " "; + const char* s = reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i));
xbmc/rendering/gl/RenderSystemGL.cpp
26
C++
0.286
question
39
51
51
false
Shut down gracefully if OpenGL context is not properly set up
25,930
xbmc/xbmc
17,740
C++
lrusak
basilgello
{ auto glDebugMessageCallback = CEGLUtils::GetRequiredProcAddress<PFNGLDEBUGMESSAGECALLBACKPROC>( "glDebugMessageCallback"); auto glDebugMessageControl = CEGLUtils::GetRequiredProcAddress<PFNGLDEBUGMESSAGECONTROLPROC>("glDebugMessageControl"); glEnable(GL_DEBUG_O...
```suggestion if (m_RenderVersionMajor == 0) { ```
if (IsExtSupported("GL_KHR_debug")) { auto glDebugMessageCallback = CEGLUtils::GetRequiredProcAddress<PFNGLDEBUGMESSAGECALLBACKPROC>( "glDebugMessageCallback"); auto glDebugMessageControl = CEGLUtils::GetRequiredProcAddress<PFNGLDEBUGMESSAGECONTROLPROC>("glDebugMess...
@@ -125,17 +124,23 @@ bool CRenderSystemGL::InitRenderSystem() } #endif + // Shut down gracefully if OpenGL context could not be allocated + if (!m_RenderVersionMajor) {
xbmc/rendering/gl/RenderSystemGL.cpp
26
C++
0.857
suggestion
54
51
51
false
Shut down gracefully if OpenGL context is not properly set up
25,930
xbmc/xbmc
17,740
C++
lrusak
basilgello
auto glDebugMessageControl = CEGLUtils::GetRequiredProcAddress<PFNGLDEBUGMESSAGECONTROLPROC>("glDebugMessageControl"); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); glDebugMessageCallback(KODI::UTILS::GL::GlErrorCallback, nullptr); // ignore shader compilation information glDebugMessa...
Logging should be available here, are you just wanting to print it to console?
"glDebugMessageCallback"); auto glDebugMessageControl = CEGLUtils::GetRequiredProcAddress<PFNGLDEBUGMESSAGECONTROLPROC>("glDebugMessageControl"); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); glDebugMessageCallback(KODI::UTILS::GL::GlErrorCallback, nullptr); // ignore shader c...
@@ -125,17 +124,23 @@ bool CRenderSystemGL::InitRenderSystem() } #endif + // Shut down gracefully if OpenGL context could not be allocated + if (!m_RenderVersionMajor) { + CMessagePrinter::DisplayError("ERROR: Can not initialize OpenGL context. Exiting");
xbmc/rendering/gl/RenderSystemGL.cpp
26
C++
0.357
question
78
51
51
false
Shut down gracefully if OpenGL context is not properly set up
25,930
xbmc/xbmc
17,740
C++
lrusak
basilgello
{ if (dirp == (DIR*)&dir) { emulated = true; break; } } if (!emulated) return readdir(dirp); // local dir // dirp is actually a SDirData* SDirData* dirData = reinterpret_cast<SDirData*>(dirp); if (dirData->last_entry) free(dirData->last_entry); ...
intended to slip this in as well?
{ if (dirp == (DIR*)&dir) { emulated = true; break; } } if (!emulated) return readdir(dirp); // local dir // dirp is actually a SDirData* SDirData* dirData = reinterpret_cast<SDirData*>(dirp); if (dirData->last_entry) free(dirData->last_entry); ...
@@ -990,7 +990,8 @@ extern "C" strncpy(entry->d_name, "..\0", 3); else { - strncpy(entry->d_name, dirData->items[dirData->curr_index - 2]->GetLabel().c_str(), sizeof(entry->d_name)); + strncpy(entry->d_name, dirData->items[dirData->curr_index - 2]->GetLabel().c_str(), + ...
xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
26
C++
0.071
question
33
51
51
false
LegalPath: change defines to an enum class
25,938
xbmc/xbmc
17,740
C++
fuzzard
notspiff
#define MusicDbTranslatorSize sizeof(s_musicDbTranslator) / sizeof(Translator) std::string CLegacyPathTranslation::TranslateVideoDbPath(const CURL &legacyPath) { return TranslatePath(legacyPath.Get(), s_videoDbTranslator, VideoDbTranslatorSize); } std::string CLegacyPathTranslation::TranslateMusicDbPath(const CURL...
Jenkins doing weird shit i guess with this recommendation? seems random to have in this commit
#define MusicDbTranslatorSize sizeof(s_musicDbTranslator) / sizeof(Translator) std::string CLegacyPathTranslation::TranslateVideoDbPath(const CURL &legacyPath) { return TranslatePath(legacyPath.Get(), s_videoDbTranslator, VideoDbTranslatorSize); } std::string CLegacyPathTranslation::TranslateMusicDbPath(const CURL...
@@ -89,7 +89,9 @@ std::string CLegacyPathTranslation::TranslateMusicDbPath(const std::string &lega return TranslatePath(legacyPath, s_musicDbTranslator, MusicDbTranslatorSize); } -std::string CLegacyPathTranslation::TranslatePath(const std::string &legacyPath, Translator *translationMap, size_t translationMapSize...
xbmc/utils/LegacyPathTranslation.cpp
26
C++
0.357
suggestion
94
40
38
false
LegalPath: change defines to an enum class
25,938
xbmc/xbmc
17,740
C++
fuzzard
notspiff
{ CloseAll(); CVideoPlayActionProcessor proc{m_selectedVideoAsset}; proc.ProcessDefaultAction(); } void CGUIDialogVideoManager::Remove() { const VideoAssetType assetType = GetVideoAssetType(); int titleMsgId; int textMsgId; switch (assetType) { case VideoAssetType::VERSION: titleMsgId = 400...
I guess reaching this default case would hint to a programming error? In that case maybe also trigger an `assert` here?
{ CloseAll(); CVideoPlayActionProcessor proc{m_selectedVideoAsset}; proc.ProcessDefaultAction(); } void CGUIDialogVideoManager::Remove() { const VideoAssetType assetType = GetVideoAssetType(); int titleMsgId; int textMsgId; switch (assetType) { case VideoAssetType::VERSION: titleMsgId = 400...
@@ -304,10 +304,29 @@ void CGUIDialogVideoManager::Play() void CGUIDialogVideoManager::Remove() { - // confirm to remove + const VideoAssetType assetType = GetVideoAssetType(); + int titleMsgId; + int textMsgId; + + switch (assetType) + { + case VideoAssetType::VERSION: + titleMsgId = 40018; + te...
xbmc/video/dialogs/GUIDialogVideoManager.cpp
26
C++
0.786
question
119
51
51
false
[Video] A few video extras fixes
25,945
xbmc/xbmc
17,740
C++
neo1973
CrystalP
info.codecName = "dts"; break; case DVD_AUDIO_FORMAT_SDDS: info.codecDesc = "SDDS"; break; default: info.codecDesc = "Other"; break; } switch(audio_attributes.channels + 1) { case 1: info.codecDesc += " Mono"; break; case 2: info.codecDesc += " Stereo"; break; ca...
use localized string ```suggestion info.codecDesc += StringUtils::Format(" {:d} {}", audio_attributes.channels + 1, g_localizeStrings.Get(10127)); ``` and add the file path to the relative id on addons\resource.language.en_gb\resources\strings.po
case DVD_AUDIO_FORMAT_DTS: info.codecDesc = "DTS"; info.codecName = "dts"; break; case DVD_AUDIO_FORMAT_SDDS: info.codecDesc = "SDDS"; break; default: info.codecDesc = g_localizeStrings.Get(13205); // "Unknown" CLog::LogF(LOGINFO, "unknown dvd audio codec"); break; } info.code...
@@ -1026,60 +1026,56 @@ void CDVDInputStreamNavigator::SetAudioStreamName(AudioStreamInfo &info, const a switch(audio_attributes.audio_format) { case DVD_AUDIO_FORMAT_AC3: - info.name += " AC3"; + info.codecDesc = "AC3"; info.codecName = "ac3"; break; case DVD_AUDIO_FORMAT_UNKNOWN_1: - in...
xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamNavigator.cpp
26
C++
1
suggestion
298
51
51
false
[Video] Fix Audio Codec Description for DVD Playback
25,961
xbmc/xbmc
17,740
C++
CastagnaIT
CrystalP
void CSelectionStreams::Update(const std::shared_ptr<CDVDInputStream>& input, CDVDDemux* demuxer, const std::string& filename2) { if(input && input->IsStreamType(DVDSTREAM_TYPE_DVD)) { std::shared_ptr<CDVDInputStreamNavigator> nav = std::static_poin...
this can be full removed not really needed, imo compare "dvdNavId" id to an index count could be not so good idea when there is no stream pointer is due to menu and menu interludes, imo better have just one way to get info or the demuxer, or ffmpeg, not mixed if you really want to keep it, just to get the bitra...
void CSelectionStreams::Update(const std::shared_ptr<CDVDInputStream>& input, CDVDDemux* demuxer, const std::string& filename2) { if(input && input->IsStreamType(DVDSTREAM_TYPE_DVD)) { std::shared_ptr<CDVDInputStreamNavigator> nav = std::static_poin...
@@ -439,10 +439,21 @@ void CSelectionStreams::Update(const std::shared_ptr<CDVDInputStream>& input, std::string filename = nav->GetFileName(); int source = Source(STREAM_SOURCE_NAV, filename); + std::vector<CDemuxStream*> demuxStreams; + if (demuxer) + demuxStreams = demuxer->GetStreams(); + ...
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
0.643
suggestion
455
51
51
false
[Video] Fix Audio Codec Description for DVD Playback
25,961
xbmc/xbmc
17,740
C++
CastagnaIT
CrystalP
switch( audio_attributes.code_extension ) { case DVD_AUDIO_LANG_EXT_VISUALLYIMPAIRED: info.name = g_localizeStrings.Get(37000); info.flags = StreamFlags::FLAG_VISUAL_IMPAIRED; break; case DVD_AUDIO_LANG_EXT_DIRECTORSCOMMENTS1: info.name = g_localizeStrings.Get(37001); break; ...
I think this should be a localized string.
switch( audio_attributes.code_extension ) { case DVD_AUDIO_LANG_EXT_VISUALLYIMPAIRED: info.name = g_localizeStrings.Get(37000); info.flags = StreamFlags::FLAG_VISUAL_IMPAIRED; break; case DVD_AUDIO_LANG_EXT_DIRECTORSCOMMENTS1: info.name = g_localizeStrings.Get(37001); break; ...
@@ -1026,60 +1026,56 @@ void CDVDInputStreamNavigator::SetAudioStreamName(AudioStreamInfo &info, const a switch(audio_attributes.audio_format) { case DVD_AUDIO_FORMAT_AC3: - info.name += " AC3"; + info.codecDesc = "AC3"; info.codecName = "ac3"; break; case DVD_AUDIO_FORMAT_UNKNOWN_1: - in...
xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamNavigator.cpp
26
C++
0.286
suggestion
42
51
51
false
[Video] Fix Audio Codec Description for DVD Playback
25,961
xbmc/xbmc
17,740
C++
ksooo
CrystalP
{ return stream->type == STREAM_AUDIO && stream->dvdNavId == i; }); CDemuxStreamAudio* aStream = (stream != demuxStreams.end()) ? static_cast<CDemuxStreamAudio*>(*stream) : nullptr; SelectionStream s; s.source = source; s.type = STREAM_AUDIO; s.id ...
if you want keep this mixage you have to explain the reason because to me its unclear, im running the original code without your "aStream" condition and i can get the codecDesc/channels correctly also on menu interludes an idea is to have these metadata info provided by nav, and a possible fallback from ffmpeg (aSt...
{ return stream->type == STREAM_AUDIO && stream->dvdNavId == i; }); CDemuxStreamAudio* aStream = (stream != demuxStreams.end()) ? static_cast<CDemuxStreamAudio*>(*stream) : nullptr; SelectionStream s; s.source = source; s.type = STREAM_AUDIO; s.id ...
@@ -453,9 +464,18 @@ void CSelectionStreams::Update(const std::shared_ptr<CDVDInputStream>& input, AudioStreamInfo info = nav->GetAudioStreamInfo(i); s.name = info.name; s.codec = info.codecName; - s.codecDesc = info.codecDesc; + if (aStream) + { + s.codecDesc = aStream...
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
0.643
suggestion
325
51
51
false
[Video] Fix Audio Codec Description for DVD Playback
25,961
xbmc/xbmc
17,740
C++
CastagnaIT
CrystalP
break; case DVD_AUDIO_LANG_EXT_DIRECTORSCOMMENTS2: info.name = g_localizeStrings.Get(37002); break; case DVD_AUDIO_LANG_EXT_NOTSPECIFIED: case DVD_AUDIO_LANG_EXT_NORMALCAPTIONS: default: break; } switch(audio_attributes.audio_format) { case DVD_AUDIO_FORMAT_AC3: info...
here can be also possible dont use translations just use full length name "MPEG-1" for DVD_AUDIO_FORMAT_MPEG "MPEG-2" for DVD_AUDIO_FORMAT_MPEG2_EXT
break; case DVD_AUDIO_LANG_EXT_DIRECTORSCOMMENTS2: info.name = g_localizeStrings.Get(37002); break; case DVD_AUDIO_LANG_EXT_NOTSPECIFIED: case DVD_AUDIO_LANG_EXT_NORMALCAPTIONS: default: break; } switch(audio_attributes.audio_format) { case DVD_AUDIO_FORMAT_AC3: info...
@@ -1026,60 +1026,60 @@ void CDVDInputStreamNavigator::SetAudioStreamName(AudioStreamInfo &info, const a switch(audio_attributes.audio_format) { case DVD_AUDIO_FORMAT_AC3: - info.name += " AC3"; + info.codecDesc = "AC3"; info.codecName = "ac3"; break; case DVD_AUDIO_FORMAT_UNKNOWN_1: - in...
xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamNavigator.cpp
26
C++
0.5
style
150
51
51
false
[Video] Fix Audio Codec Description for DVD Playback
25,961
xbmc/xbmc
17,740
C++
CastagnaIT
CrystalP
bool bShoutCast = false; if( StringUtils::StartsWithNoCase(strFileName, "shout://") ) { strFileName.replace(0, 8, "http://"); m_strBasePath = ""; bShoutCast = true; } else URIUtils::GetParentPath(strFileName, m_strBasePath); CFile file; if (!file.Open(strFileName) ) { file.Close(); ...
imo all these "reserve" (also on other cases shown here) are not really needed anyway keep a value of 4096 for most of time is too high, can be lowered to 1024
bool bShoutCast = false; if( StringUtils::StartsWithNoCase(strFileName, "shout://") ) { strFileName.replace(0, 8, "http://"); m_strBasePath = ""; bShoutCast = true; } else URIUtils::GetParentPath(strFileName, m_strBasePath); CFile file; if (!file.Open(strFileName) ) { file.Close(); ...
@@ -79,19 +79,18 @@ bool CPlayListPLS::Load(const std::string &strFile) return false; } - char szLine[4096]; std::string strLine; + strLine.reserve(4096);
xbmc/playlists/PlayListPLS.cpp
26
C++
0.286
suggestion
160
51
51
false
[IFile][CFile] Rework `ReadString` into `ReadLine`
25,982
xbmc/xbmc
17,740
C++
CastagnaIT
neo1973
static bool GetDirectory(const CURL& url , CFileItemList &items , const CHints &hints); static bool Create(const CURL& url); static bool Exists(const CURL& url, bool bUseCache = true); static bool Remove(const CURL& url); static bool RemoveRecursive(const...
Why is it necessary, or why is beneficial, to remove the `const` here?
static bool GetDirectory(const CURL& url , CFileItemList &items , const CHints &hints); static bool Create(const CURL& url); static bool Exists(const CURL& url, bool bUseCache = true); static bool Remove(const CURL& url); static bool RemoveRecursive(const...
@@ -69,8 +69,8 @@ class CDirectory , CFileItemList &items , const CHints &hints); - using DirectoryEnumerationCallback = std::function<void(const std::shared_ptr<CFileItem>& item)>; - using DirectoryFilter = std::function<bool(const std::shared_ptr<CFileItem>&...
xbmc/filesystem/Directory.h
26
C/C++
0.571
question
70
51
51
false
[video] Scan art for video extras
25,983
xbmc/xbmc
17,740
C++
neo1973
CrystalP
if (!m_pDB || !m_pDS) return -1; assert(m_pDB->in_transaction() == false); MediaType mediaType; if (itemType == VideoDbContentType::MOVIES) { mediaType = MediaTypeMovie; } else return -1; int idFile = AddFile(item.GetPath()); if (idFile < 0) return -1; try { BeginTransactio...
Shouldn't there be a space at the end of this string? Not sure if it's relevant.
catch (...) { CLog::Log(LOGERROR, "{} failed for video {}", __FUNCTION__, idFile); } } bool CVideoDatabase::AddVideoAsset(VideoDbContentType itemType, int dbId, int idVideoAsset, VideoAssetType videoAsset...
@@ -12618,12 +12618,15 @@ void CVideoDatabase::AddVideoAsset(VideoDbContentType itemType, m_pDS->query(PrepareSQL("SELECT idFile FROM videoversion WHERE idFile = %i", idFile)); if (m_pDS->num_rows() == 0) - m_pDS->exec(PrepareSQL("INSERT INTO videoversion VALUES(%i, %i, '%s', %i, %i)", idFile, dbId, - ...
xbmc/video/VideoDatabase.cpp
26
C++
0.357
suggestion
80
51
51
false
[video] Scan art for video extras
25,983
xbmc/xbmc
17,740
C++
neo1973
CrystalP
m_textureUploadLock.unlock(); return true; } bool CEGLContextUtils::HasContext() { return eglGetCurrentContext() != EGL_NO_CONTEXT; } void CEGLContextUtils::SetDamagedRegions(const CDirtyRegionList& dirtyRegions) { if (!m_partialUpdateSupport) return; using Rect = std::array<EGLint, 4>; if (dirtyRe...
Please initialize to 0, so when the below call fails, we still have a valid value.
m_textureUploadLock.unlock(); return true; } bool CEGLContextUtils::HasContext() { return eglGetCurrentContext() != EGL_NO_CONTEXT; } void CEGLContextUtils::SetDamagedRegions(const CDirtyRegionList& dirtyRegions) { if (!m_partialUpdateSupport) return; using Rect = std::array<EGLint, 4>; EGLBoolean ...
@@ -667,13 +667,16 @@ void CEGLContextUtils::SetDamagedRegions(const CDirtyRegionList& dirtyRegions) } else { - EGLint height = eglQuerySurface(m_eglDisplay, m_eglSurface, EGL_HEIGHT, &height); + EGLint height;
xbmc/utils/EGLUtils.cpp
26
C++
0.143
bug
82
51
51
false
Fix rendering for EGL_KHR_partial_update enabled platforms
26,007
xbmc/xbmc
17,740
C++
fritsch
sarbes
m_textureUploadLock.unlock(); return true; } bool CEGLContextUtils::HasContext() { return eglGetCurrentContext() != EGL_NO_CONTEXT; } void CEGLContextUtils::SetDamagedRegions(const CDirtyRegionList& dirtyRegions) { if (!m_partialUpdateSupport) return; using Rect = std::array<EGLint, 4>; if (dirtyReg...
What would practically happen if the call fails and region.y2 is larger than 1080?
m_textureUploadLock.unlock(); return true; } bool CEGLContextUtils::HasContext() { return eglGetCurrentContext() != EGL_NO_CONTEXT; } void CEGLContextUtils::SetDamagedRegions(const CDirtyRegionList& dirtyRegions) { if (!m_partialUpdateSupport) return; using Rect = std::array<EGLint, 4>; EGLBoolean d...
@@ -667,13 +667,16 @@ void CEGLContextUtils::SetDamagedRegions(const CDirtyRegionList& dirtyRegions) } else { - EGLint height = eglQuerySurface(m_eglDisplay, m_eglSurface, EGL_HEIGHT, &height); + EGLint height = 1080; + eglQuerySurface(m_eglDisplay, m_eglSurface, EGL_HEIGHT, &height);
xbmc/utils/EGLUtils.cpp
26
C++
0.143
bug
82
51
51
false
Fix rendering for EGL_KHR_partial_update enabled platforms
26,007
xbmc/xbmc
17,740
C++
fritsch
sarbes
m_textureUploadLock.unlock(); return true; } bool CEGLContextUtils::HasContext() { return eglGetCurrentContext() != EGL_NO_CONTEXT; } void CEGLContextUtils::SetDamagedRegions(const CDirtyRegionList& dirtyRegions) { if (!m_partialUpdateSupport) return; using Rect = std::array<EGLint, 4>; if (dirtyReg...
Is it possible to use ``` if (eglQuerySurface(m_eglDisplay, m_eglSurface, EGL_HEIGHT, &height) != EGL_TRUE) ``` or ``` if (!eglQuerySurface(m_eglDisplay, m_eglSurface, EGL_HEIGHT, &height)) ``` to prevent calling `eglGetError()`?
m_textureUploadLock.unlock(); return true; } bool CEGLContextUtils::HasContext() { return eglGetCurrentContext() != EGL_NO_CONTEXT; } void CEGLContextUtils::SetDamagedRegions(const CDirtyRegionList& dirtyRegions) { if (!m_partialUpdateSupport) return; using Rect = std::array<EGLint, 4>; EGLBoolean d...
@@ -669,6 +669,12 @@ void CEGLContextUtils::SetDamagedRegions(const CDirtyRegionList& dirtyRegions) { EGLint height = 1080; eglQuerySurface(m_eglDisplay, m_eglSurface, EGL_HEIGHT, &height);
xbmc/utils/EGLUtils.cpp
26
C++
1
question
238
51
51
false
Fix rendering for EGL_KHR_partial_update enabled platforms
26,007
xbmc/xbmc
17,740
C++
kszaq
sarbes
namespace { using namespace std::string_literals; // ATTENTION: Make sure the longer match strings go first // because the string match is performed with StringUtils::StartsWith() const auto s_videoDbTranslator = std::unordered_map<std::string,std::string> { { "videodb://1/1"s, "videodb://movies/genres"s }, { "v...
mistake i wonder if it's worth it (literals), the benefits should be limited to the compiling
#include <unordered_map> namespace { // ATTENTION: Make sure the longer match strings go first // because the string match is performed with ::starts_with() const auto s_videoDbTranslator = std::unordered_map<std::string, std::string>{ {"videodb://1/1", "videodb://movies/genres"}, {"videodb://1/2", "videodb:/...
@@ -11,95 +11,97 @@ #include "URL.h" #include "utils/StringUtils.h" -typedef struct Translator { - const char *legacyPath; - const char *newPath; -} Translator; +#include <string> +#include <unordered_map> + +namespace +{ + +using namespace std::string_literals; // ATTENTION: Make sure the longer match strings...
xbmc/utils/LegacyPathTranslation.cpp
26
C++
0.357
suggestion
93
51
51
false
LegacyPathTranslation: modernize
26,009
xbmc/xbmc
17,740
C++
CastagnaIT
notspiff
{"videodb://5", "videodb://recentlyaddedepisodes"}, {"videodb://6", "videodb://recentlyaddedmusicvideos"}}; // ATTENTION: Make sure the longer match strings go first // because the string match is performed with StringUtils::StartsWith() const auto s_musicDbTranslator = std::unordered_map<std::string, std:...
the old way was using StartsWithNoCase it was converting to lowercase both values, now you are comparing one lower string, and you assume that the other value is lowered, but imo not so correct, an oversight can cause problems on "translator" lists above there are comment "ATTENTION:...." that refer to StartsWithNo...
{"videodb://5", "videodb://recentlyaddedepisodes"}, {"videodb://6", "videodb://recentlyaddedmusicvideos"}}; // ATTENTION: Make sure the longer match strings go first // because the string match is performed with ::starts_with() const auto s_musicDbTranslator = std::unordered_map<std::string, std::string>{{...
@@ -11,95 +11,91 @@ #include "URL.h" #include "utils/StringUtils.h" -typedef struct Translator { - const char *legacyPath; - const char *newPath; -} Translator; +#include <algorithm> +#include <string> +#include <unordered_map> + +namespace +{ // ATTENTION: Make sure the longer match strings go first // becau...
xbmc/utils/LegacyPathTranslation.cpp
26
C++
0.643
suggestion
380
51
51
false
LegacyPathTranslation: modernize
26,009
xbmc/xbmc
17,740
C++
CastagnaIT
notspiff
} return true; } bool CSmartPlaylistRule::ValidateRating(const std::string &input, void *data) { char *end = NULL; std::string strRating = input; StringUtils::Trim(strRating); double rating = std::strtod(strRating.c_str(), &end); return (end == NULL || *end == '\0') && rating >= 0.0 && rating ...
You decided against an anonymous namespace by intention?
// Split the input into multiple values and validate every value separately const std::vector<std::string> values{StringUtils::Split(input, RULE_VALUE_SEPARATOR)}; return (std::all_of(values.begin(), values.end(), [data, validator](const auto& s) { return validator(s, data); })); } bool C...
@@ -290,6 +291,50 @@ bool CSmartPlaylistRule::ValidateMyRating(const std::string &input, void *data) return StringValidation::IsPositiveInteger(input, data) && rating <= 10; } +static bool StrToInt(const std::string& str, int& num)
xbmc/playlists/SmartPlayList.cpp
26
C++
0.143
question
56
51
51
false
[guilib] Smart Playlist Rule Dialog Improvements
26,010
xbmc/xbmc
17,740
C++
ksooo
CrystalP
bool CSmartPlaylistRule::ValidateRating(const std::string &input, void *data) { char *end = NULL; std::string strRating = input; StringUtils::Trim(strRating); double rating = std::strtod(strRating.c_str(), &end); return (end == NULL || *end == '\0') && rating >= 0.0 && rating <= 10.0; } bool CSmar...
A good candidate for `std::any_of` imo.
return (std::all_of(values.begin(), values.end(), [data, validator](const auto& s) { return validator(s, data); })); } bool CSmartPlaylistRule::ValidateRating(const std::string &input, void *data) { char *end = NULL; std::string strRating = input; StringUtils::Trim(strRating); double r...
@@ -290,6 +291,50 @@ bool CSmartPlaylistRule::ValidateMyRating(const std::string &input, void *data) return StringValidation::IsPositiveInteger(input, data) && rating <= 10; } +static bool StrToInt(const std::string& str, int& num) +{ + for (const auto& c : str) + if (!isdigit(c)) + return false;
xbmc/playlists/SmartPlayList.cpp
26
C++
0.286
suggestion
39
51
51
false
[guilib] Smart Playlist Rule Dialog Improvements
26,010
xbmc/xbmc
17,740
C++
ksooo
CrystalP
return false; num = stoi(str); return true; } bool CSmartPlaylistRule::ValidateDate(const std::string& input, void* data) { if (!data) return false; CSmartPlaylistRule* rule = static_cast<CSmartPlaylistRule*>(data); //! @todo implement a validation for relative dates if (rule->m_operator == CD...
https://github.com/xbmc/xbmc/blob/master/docs/CODE_GUIDELINES.md#52-multiple-declarations And I would define the vars close to where they are actually used for the first time.
{ template<typename T> std::optional<T> ToNumeric(std::string_view str) { const char* end{str.data() + str.size()}; T result{}; auto [ptr, ec] = std::from_chars(str.data(), end, result); if (ec != std::errc{} || ptr != end || result < 0) return std::nullopt; return result; } } // namespace bool CSmart...
@@ -290,6 +291,50 @@ bool CSmartPlaylistRule::ValidateMyRating(const std::string &input, void *data) return StringValidation::IsPositiveInteger(input, data) && rating <= 10; } +static bool StrToInt(const std::string& str, int& num) +{ + for (const auto& c : str) + if (!isdigit(c)) + return false; + + nu...
xbmc/playlists/SmartPlayList.cpp
26
C++
0.5
suggestion
178
51
51
false
[guilib] Smart Playlist Rule Dialog Improvements
26,010
xbmc/xbmc
17,740
C++
ksooo
CrystalP
if (data == NULL) return true; CSmartPlaylistRule *rule = static_cast<CSmartPlaylistRule*>(data); // check if there's a validator for this rule StringValidation::Validator validator = NULL; for (const translateField& field : fields) { if (rule->m_field == field.field) { validator = fie...
This + next lines: Another good candidate for `std::any_of`
} bool CSmartPlaylistRule::Validate(const std::string &input, void *data) { if (data == NULL) return true; CSmartPlaylistRule *rule = static_cast<CSmartPlaylistRule*>(data); // check if there's a validator for this rule StringValidation::Validator validator = NULL; for (const translateField& field : fi...
@@ -261,8 +261,13 @@ bool CSmartPlaylistRule::Validate(const std::string &input, void *data) return true; // split the input into multiple values and validate every value separately - std::vector<std::string> values = StringUtils::Split(input, RULE_VALUE_SEPARATOR); - for (std::vector<std::string>::const_it...
xbmc/playlists/SmartPlayList.cpp
26
C++
0.357
suggestion
59
51
51
false
[guilib] Smart Playlist Rule Dialog Improvements
26,010
xbmc/xbmc
17,740
C++
ksooo
CrystalP
class CGUIDialogSmartPlaylistRule : public CGUIDialog { public: CGUIDialogSmartPlaylistRule(void); ~CGUIDialogSmartPlaylistRule(void) override; bool OnMessage(CGUIMessage& message) override; bool OnBack(int actionID) override; void OnInitWindow() override; void OnDeinitWindow(int nextWindowID) override; ...
default init `CGUIEditControl* m_editControl{nullptr};` for safety.
public CGUIDialog { public: CGUIDialogSmartPlaylistRule(void); ~CGUIDialogSmartPlaylistRule(void) override; bool OnMessage(CGUIMessage& message) override; bool OnBack(int actionID) override; void OnInitWindow() override; void OnDeinitWindow(int nextWindowID) override; static bool EditRule(KODI::PLA...
@@ -36,4 +37,5 @@ class CGUIDialogSmartPlaylistRule : KODI::PLAYLIST::CSmartPlaylistRule m_rule; bool m_cancelled; std::string m_type; + CGUIEditControl* m_editControl;
xbmc/dialogs/GUIDialogSmartPlaylistRule.h
26
C/C++
0.643
bug
67
28
26
false
[guilib] Smart Playlist Rule Dialog Improvements
26,010
xbmc/xbmc
17,740
C++
ksooo
CrystalP
} bool CSmartPlaylistRule::ValidateRating(const std::string &input, void *data) { char *end = NULL; std::string strRating = input; StringUtils::Trim(strRating); double rating = std::strtod(strRating.c_str(), &end); return (end == NULL || *end == '\0') && rating >= 0.0 && rating <= 10.0; } bool CSm...
The function body is fine as is, but please [pass `std::string_view` by value](https://quuxplusone.github.io/blog/2021/11/09/pass-string-view-by-value/). As for the function: [`std::from_chars`](https://en.cppreference.com/w/cpp/utility/from_chars) could do all the validations for you but it's also fine as is.
bool CSmartPlaylistRule::ValidateRating(const std::string &input, void *data) { char *end = NULL; std::string strRating = input; StringUtils::Trim(strRating); double rating = std::strtod(strRating.c_str(), &end); return (end == NULL || *end == '\0') && rating >= 0.0 && rating <= 10.0; } bool CSmart...
@@ -292,6 +296,63 @@ bool CSmartPlaylistRule::ValidateMyRating(const std::string &input, void *data) return StringValidation::IsPositiveInteger(input, data) && rating <= 10; } +namespace +{ +template<class T> +std::optional<T> DigitsToNumeric(const std::string_view& str)
xbmc/playlists/SmartPlayList.cpp
26
C++
0.857
refactor
314
51
51
false
[guilib] Smart Playlist Rule Dialog Improvements
26,010
xbmc/xbmc
17,740
C++
neo1973
CrystalP
* See LICENSES/README.md for more information. */ #include "SmartPlayList.h" #include "ServiceBroker.h" #include "Util.h" #include "XBDateTime.h" #include "dbwrappers/Database.h" #include "filesystem/File.h" #include "filesystem/SmartPlaylistDirectory.h" #include "guilib/LocalizeStrings.h" #include "settings/Setti...
Please don't forget to remove this line.
* See LICENSES/README.md for more information. */ #include "SmartPlayList.h" #include "ServiceBroker.h" #include "Util.h" #include "XBDateTime.h" #include "dbwrappers/Database.h" #include "filesystem/File.h" #include "filesystem/SmartPlaylistDirectory.h" #include "guilib/LocalizeStrings.h" #include "settings/Setti...
@@ -27,8 +28,12 @@ #include "utils/XMLUtils.h" #include "utils/log.h" +//#include <algorithm>
xbmc/playlists/SmartPlayList.cpp
26
C++
0.286
refactor
40
51
51
false
[guilib] Smart Playlist Rule Dialog Improvements
26,010
xbmc/xbmc
17,740
C++
ksooo
CrystalP
#include "SmartPlayList.h" #include "ServiceBroker.h" #include "Util.h" #include "XBDateTime.h" #include "dbwrappers/Database.h" #include "filesystem/File.h" #include "filesystem/SmartPlaylistDirectory.h" #include "guilib/LocalizeStrings.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" #includ...
Please don't forget to remove this line.
#include "SmartPlayList.h" #include "ServiceBroker.h" #include "Util.h" #include "XBDateTime.h" #include "dbwrappers/Database.h" #include "filesystem/File.h" #include "filesystem/SmartPlaylistDirectory.h" #include "guilib/LocalizeStrings.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" #includ...
@@ -27,8 +28,12 @@ #include "utils/XMLUtils.h" #include "utils/log.h" +//#include <algorithm> +#include <charconv> #include <cstdlib> +//#include <limits>
xbmc/playlists/SmartPlayList.cpp
26
C++
0.286
refactor
40
51
51
false
[guilib] Smart Playlist Rule Dialog Improvements
26,010
xbmc/xbmc
17,740
C++
ksooo
CrystalP
{ if (data == NULL) return true; CSmartPlaylistRule *rule = static_cast<CSmartPlaylistRule*>(data); // check if there's a validator for this rule StringValidation::Validator validator = NULL; for (const translateField& field : fields) { if (rule->m_field == field.field) { validator = f...
I don't think we need to handle empty input special. `StringUtils::Split` won't insert anything into values and `std::all_of` on an empty range is `true`.
{ if (data == NULL) return true; CSmartPlaylistRule *rule = static_cast<CSmartPlaylistRule*>(data); // check if there's a validator for this rule StringValidation::Validator validator = NULL; for (const translateField& field : fields) { if (rule->m_field == field.field) { validator = f...
@@ -262,14 +265,14 @@ bool CSmartPlaylistRule::Validate(const std::string &input, void *data) return true; // split the input into multiple values and validate every value separately - std::vector<std::string> values = StringUtils::Split(input, RULE_VALUE_SEPARATOR); - for (std::vector<std::string>::const_i...
xbmc/playlists/SmartPlayList.cpp
26
C++
0.786
suggestion
154
51
51
false
[guilib] Smart Playlist Rule Dialog Improvements
26,010
xbmc/xbmc
17,740
C++
neo1973
CrystalP
virtual void UpdateAssetsList(); virtual int NewVideoAssetId(const CFileItem& item); virtual void Play(); virtual void Remove(); virtual void Rename(); virtual void ChooseArt(); void DisableRemove(); void EnableRemove(); void UpdateControls(); static int ChooseVideoAsset(const std::shared_ptr<CF...
Could this be an `unordered_map` ?
/* * Copyright (C) 2023 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include "guilib/GUIDialog.h" #include "video/VideoDatabase.h" #include <memory> class CFileItem; class CFileItemList...
@@ -66,6 +75,7 @@ class CGUIDialogVideoManager : public CGUIDialog std::unique_ptr<CFileItemList> m_videoAssetsList; std::shared_ptr<CFileItem> m_selectedVideoAsset; bool m_hasUpdatedItems{false}; + std::map<ManagerMessage, unsigned int> m_messages;
xbmc/video/dialogs/GUIDialogVideoManager.h
26
C/C++
0.5
question
34
34
74
false
[video] Remove unnecessary stream details extraction in version/extra addition
26,020
xbmc/xbmc
17,740
C++
ksooo
CrystalP
#include "guilib/GUIWindowManager.h" #include "guilib/LocalizeStrings.h" #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" #include "storage/MediaManager.h" #include "utils/FileExtensionProvider.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" ...
Move this to the initialzer list, please.
#include "guilib/GUIWindowManager.h" #include "guilib/LocalizeStrings.h" #include "settings/MediaSourceSettings.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" #include "storage/MediaManager.h" #include "utils/FileExtensionProvider.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" ...
@@ -39,6 +39,11 @@ static constexpr unsigned int CONTROL_BUTTON_RENAME_EXTRA = 28; CGUIDialogVideoManagerExtras::CGUIDialogVideoManagerExtras() : CGUIDialogVideoManager(WINDOW_DIALOG_MANAGE_VIDEO_EXTRAS) { + m_messages = {{ManagerMessage::ManagerTitle, 40025}, + {ManagerMessage::RemoveTitle, 40039}...
xbmc/video/dialogs/GUIDialogVideoManagerExtras.cpp
26
C++
0.286
refactor
41
51
51
false
[video] Remove unnecessary stream details extraction in version/extra addition
26,020
xbmc/xbmc
17,740
C++
ksooo
CrystalP
#include "settings/MediaSourceSettings.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" #include "storage/MediaManager.h" #include "utils/FileExtensionProvider.h" #include "utils/StringUtils.h" #include "utils/log.h" #include "video/VideoManagerTypes.h" #include "video/VideoThumbLoader.h" #inc...
Move this to the initialzer list, please.
#include "settings/MediaSourceSettings.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" #include "storage/MediaManager.h" #include "utils/FileExtensionProvider.h" #include "utils/StringUtils.h" #include "utils/log.h" #include "video/VideoManagerTypes.h" #include "video/VideoThumbLoader.h" #inc...
@@ -42,6 +42,11 @@ CGUIDialogVideoManagerVersions::CGUIDialogVideoManagerVersions() : CGUIDialogVideoManager(WINDOW_DIALOG_MANAGE_VIDEO_VERSIONS), m_defaultVideoVersion(std::make_shared<CFileItem>()) { + m_messages = {{ManagerMessage::ManagerTitle, 40024}, + {ManagerMessage::RemoveTitle, 40018}...
xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp
26
C++
0.286
refactor
41
51
51
false
[video] Remove unnecessary stream details extraction in version/extra addition
26,020
xbmc/xbmc
17,740
C++
ksooo
CrystalP
virtual void Play(); virtual void Remove(); virtual void Rename(); virtual void ChooseArt(); void DisableRemove(); void EnableRemove(); void UpdateControls(); static int ChooseVideoAsset(const std::shared_ptr<CFileItem>& item, VideoAssetType assetType, ...
Please follow our coding guidelines. struct members must start with a small letter.
virtual void Play(); virtual void Remove(); virtual void Rename(); virtual void ChooseArt(); void DisableRemove(); void EnableRemove(); void UpdateControls(); static int ChooseVideoAsset(const std::shared_ptr<CFileItem>& item, VideoAssetType assetType, ...
@@ -70,12 +61,23 @@ class CGUIDialogVideoManager : public CGUIDialog void RefreshSelectedVideoAsset(); bool AddVideoAssetFilePicker(); + struct ManagerMessages + { + // unused message id value 0 is used to detect messages not provided by derived classes + unsigned int ManagerTitleId{}; + unsigned int...
xbmc/video/dialogs/GUIDialogVideoManager.h
26
C/C++
0.143
suggestion
83
43
29
false
[video] Remove unnecessary stream details extraction in version/extra addition
26,020
xbmc/xbmc
17,740
C++
ksooo
CrystalP
} int CGUIDialogVideoManagerExtras::NewVideoAssetId(const CFileItem& item) { const std::string typeNewVideoVersion{ CGUIDialogVideoManagerExtras::GenerateVideoExtra(URIUtils::GetFileName(item.GetDynPath()))}; return m_database.AddVideoVersionType(typeNewVideoVersion, VideoAssetTypeOwner::AUTO, ...
I don't think you need the `InitializeMessages` method. Doesn't `static ManagerMessages msg{InitializeMessages{40025, 40039, 40040, 40015, 40034}};` work? Maybe you need to define a respective ctor for `ManagerMessages`.
else { CLog::LogF(LOGERROR, "unexpected asset type {}", static_cast<int>(newAsset.m_assetType)); return false; } CGUIDialogOK::ShowAndGetInput( CVariant{40015}, StringUtils::Format(g_localizeStrings.Get(msgid), newAsset.m_assetTypeName)); ...
@@ -156,3 +151,21 @@ int CGUIDialogVideoManagerExtras::NewVideoAssetId(const CFileItem& item) return m_database.AddVideoVersionType(typeNewVideoVersion, VideoAssetTypeOwner::AUTO, VideoAssetType::EXTRA); } + +CGUIDialogVideoManager::ManagerMessages CGUIDialogVideoManagerExtr...
xbmc/video/dialogs/GUIDialogVideoManagerExtras.cpp
26
C++
0.571
suggestion
223
29
51
false
[video] Remove unnecessary stream details extraction in version/extra addition
26,020
xbmc/xbmc
17,740
C++
ksooo
CrystalP
int8_t* qp_table; //< Quantization parameters, primarily used by filters int qstride; int qscale_type; int pict_type; StreamHdrType hdrType; bool hasDisplayMetadata = false; AVMasteringDisplayMetadata displayMetadata; bool hasLightMetadata = false; AVContentLightMetadata lightMetadata...
I see what you want to do, but unexpected operator behavior because it doesn't compare every attribute. With the comparison not defined in the renderer anymore, it will be easier to forget to add a new field when needed. A dedicated comparison function would be better and could call the new CompareDisplayMetadata an...
int qscale_type; int pict_type; StreamHdrType hdrType; bool hasDisplayMetadata = false; AVMasteringDisplayMetadata displayMetadata; bool hasLightMetadata = false; AVContentLightMetadata lightMetadata; AVPixelFormat pixelFormat; //< source pixel format unsigned int iWidth; unsigned int iHeight; ...
@@ -78,6 +81,18 @@ struct VideoPicture unsigned int iDisplayWidth; //< width of the picture without black bars unsigned int iDisplayHeight; //< height of the picture without black bars + bool operator==(const VideoPicture& pic) const + { + return this->iWidth == pic.iWidth && + ...
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h
26
C/C++
0.929
suggestion
668
51
51
false
RenderManager: improve VideoPicture comparison for HDR
26,028
xbmc/xbmc
17,740
C++
CrystalP
thexai
if (videoBuffer) videoBuffer->Release(); *this = pic; if (videoBuffer) videoBuffer->Acquire(); return *this; } VideoPicture& VideoPicture::SetParams(const VideoPicture &pic) { if (videoBuffer) videoBuffer->Release(); *this = pic; videoBuffer = nullptr; return *this; } bool VideoPicture::Co...
A comment explaining that this returns true because both this and pic metadata are unknown would help. or structure the tests differently please. Same remark for light metadata. A reason for this-> instead of just using the member?
if (videoBuffer) videoBuffer->Release(); *this = pic; if (videoBuffer) videoBuffer->Acquire(); return *this; } VideoPicture& VideoPicture::SetParams(const VideoPicture &pic) { if (videoBuffer) videoBuffer->Release(); *this = pic; videoBuffer = nullptr; return *this; } bool VideoPicture::Co...
@@ -81,5 +81,31 @@ VideoPicture& VideoPicture::SetParams(const VideoPicture &pic) return *this; } +bool VideoPicture::CompareDisplayMetadata(const VideoPicture& pic) const +{ + if (this->hasDisplayMetadata != pic.hasDisplayMetadata) + return false; + + if (!pic.hasDisplayMetadata) + return true;
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.cpp
26
C++
0.571
question
234
46
51
false
RenderManager: improve VideoPicture comparison for HDR
26,028
xbmc/xbmc
17,740
C++
CrystalP
thexai
} return CGUIWindow::OnMessage(message); } void CGUIWindowSystemInfo::FrameMove() { int i = 2; if (m_section == CONTROL_BT_DEFAULT) { SET_CONTROL_LABEL(40, g_localizeStrings.Get(20154)); SetControlLabel(i++, "{}: {}", 158, SYSTEM_FREE_MEMORY); SetControlLabel(i++, "{}: {}", 150, NETWORK_IP_ADDRES...
maybe set this magic number to some constexpr int with a meaningful description? Had to look into your PR description to understand the value :)
return true; } break; } return CGUIWindow::OnMessage(message); } void CGUIWindowSystemInfo::FrameMove() { int i = CONTROL_TEXT_START; if (m_section == CONTROL_BT_DEFAULT) { SET_CONTROL_LABEL(40, g_localizeStrings.Get(20154)); SetControlLabel(i++, "{}: {}", 158, SYSTEM_FREE_MEMORY); ...
@@ -109,7 +109,7 @@ void CGUIWindowSystemInfo::FrameMove() if (m_diskUsage.empty()) m_diskUsage = CServiceBroker::GetMediaManager().GetDiskUsage(); - for (size_t d = 0; d < m_diskUsage.size(); d++) + for (size_t d = 0; d < m_diskUsage.size() && d <= 13; d++)
xbmc/windows/GUIWindowSystemInfo.cpp
26
C++
0.286
suggestion
144
51
51
false
System Info: Two improvements
26,034
xbmc/xbmc
17,740
C++
enen92
garbear
} CGUIWindow::FrameMove(); } void CGUIWindowSystemInfo::ResetLabels() { for (int i = 2; i < 13; i++) { SET_CONTROL_LABEL(i, ""); } } void CGUIWindowSystemInfo::SetControlLabel(int id, const char *format, int label, int info) { std::string tmpStr = StringUtils::Format( format, g_localizeStrings.G...
This will still block the GUI in the first iteration. Maybe you can consider adding this info to `CSysInfoJob` to make it async?
else if (m_section == CONTROL_BT_POLICY) { SET_CONTROL_LABEL(40, g_localizeStrings.Get(12389)); } CGUIWindow::FrameMove(); } void CGUIWindowSystemInfo::ResetLabels() { for (int i = CONTROL_TEXT_START; i <= CONTROL_TEXT_END; ++i) { SET_CONTROL_LABEL(i, ""); } } void CGUIWindowSystemInfo::SetContr...
@@ -258,3 +257,13 @@ void CGUIWindowSystemInfo::SetControlLabel(int id, const char *format, int label CServiceBroker::GetGUI()->GetInfoManager().GetLabel(info, INFO::DEFAULT_CONTEXT)); SET_CONTROL_LABEL(id, tmpStr); } + +void CGUIWindowSystemInfo::LoadPrivacyPolicy() +{ + if (!m_privacyPolicyLoaded)
xbmc/windows/GUIWindowSystemInfo.cpp
26
C++
0.714
question
128
30
33
false
System Info: Two improvements
26,034
xbmc/xbmc
17,740
C++
enen92
garbear
/* * Copyright (C) 2010-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "DVDVideoCodec.h" #include "cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.h" #include <string> #include <vector> //***...
Sometimes having this in the cpp is the better approach. Namely, if the class has members which are forward declared, then this forward declare has to be replaced with an include in the class' header file. Otherwise the compiler does not know how to compile the function it generates. Just as a note, seems to work just ...
/* * Copyright (C) 2010-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "DVDVideoCodec.h" #include "cores/VideoPlayer/DVDCodecs/DVDFactoryCodec.h" #include <string> #include <vector> //***...
@@ -16,9 +16,6 @@ //****************************************************************************** // VideoPicture //****************************************************************************** - -VideoPicture::VideoPicture() = default; -
xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.cpp
21
C++
0.643
suggestion
368
46
46
false
DVDVideoCodec: remove some not necessary definitions in .cpp
26,037
xbmc/xbmc
17,740
C++
ksooo
thexai
case VK_LAUNCH_MEDIA_SELECT: case VK_LAUNCH_APP1: case VK_LAUNCH_APP2: return static_cast<int>(vkey); default:; } switch (mvke) { /* Distinguish between keypad and extended keys */ case VK_INSERT: return EXTKEYPAD(VK_NUMPAD0); case VK_DELETE: return EXTKEYPAD(VK_DECIMAL); case VK...
```suggestion static XBMC_keysym *TranslateKey(WPARAM vkey, UINT scancode, XBMC_keysym *keysym, int pressed) ``` this is the WinAPI-specific type here (like for vkey), so I'd rather keep it and do one cast in this function instead of at the call site
case VK_LAUNCH_MEDIA_SELECT: case VK_LAUNCH_APP1: case VK_LAUNCH_APP2: return static_cast<int>(vkey); default:; } switch (mvke) { /* Distinguish between keypad and extended keys */ case VK_INSERT: return EXTKEYPAD(VK_NUMPAD0); case VK_DELETE: return EXTKEYPAD(VK_DECIMAL); case VK...
@@ -147,14 +147,14 @@ static int XBMC_MapVirtualKey(int scancode, WPARAM vkey) } -static XBMC_keysym *TranslateKey(WPARAM vkey, UINT scancode, XBMC_keysym *keysym, int pressed) +static XBMC_keysym *TranslateKey(WPARAM vkey, uint32_t scancode, XBMC_keysym *keysym, int pressed)
xbmc/windowing/windows/WinEventsWin32.cpp
26
C++
1
suggestion
255
51
51
false
Change width of XBMC_keysym.scancode member from 8 to 32 bit
26,041
xbmc/xbmc
17,740
C++
yol
oliver
break; } } break; } return CGUIDialog::OnMessage(message); } bool CGUIDialogVideoBookmarks::OnAction(const CAction &action) { switch(action.GetID()) { case ACTION_CONTEXT_MENU: case ACTION_MOUSE_RIGHT_CLICK: { OnPopupMenu(m_viewControl.GetSelectedItem()); return true;...
Please replace the c-style cast with a static_cast
break; } } break; } return CGUIDialog::OnMessage(message); } bool CGUIDialogVideoBookmarks::OnAction(const CAction &action) { switch(action.GetID()) { case ACTION_CONTEXT_MENU: case ACTION_MOUSE_RIGHT_CLICK: { OnPopupMenu(m_viewControl.GetSelectedItem()); return true;...
@@ -161,38 +161,67 @@ bool CGUIDialogVideoBookmarks::OnAction(const CAction &action) return CGUIDialog::OnAction(action); } +int CGUIDialogVideoBookmarks::ItemToBookmarkIndex(int item) +{ + if (item < 0 || item >= (int)m_vecItems->Size())
xbmc/video/dialogs/GUIDialogVideoBookmarks.cpp
26
C++
0.643
style
50
51
51
false
[guilib] Fix bookmark deletion in presence of chapters
26,078
xbmc/xbmc
17,740
C++
ksooo
CrystalP
bool CGUIDialogVideoBookmarks::OnAction(const CAction &action) { switch(action.GetID()) { case ACTION_CONTEXT_MENU: case ACTION_MOUSE_RIGHT_CLICK: { OnPopupMenu(m_viewControl.GetSelectedItem()); return true; } } return CGUIDialog::OnAction(action); } int CGUIDialogVideoBookmarks::ItemTo...
This leads to a „potential data loss“ warning. Add `static_cast<int>(m_book…`
bool CGUIDialogVideoBookmarks::OnAction(const CAction &action) { switch(action.GetID()) { case ACTION_CONTEXT_MENU: case ACTION_MOUSE_RIGHT_CLICK: { OnPopupMenu(m_viewControl.GetSelectedItem()); return true; } } return CGUIDialog::OnAction(action); } int CGUIDialogVideoBookmarks::ItemTo...
@@ -161,38 +161,67 @@ bool CGUIDialogVideoBookmarks::OnAction(const CAction &action) return CGUIDialog::OnAction(action); } +int CGUIDialogVideoBookmarks::ItemToBookmarkIndex(int item) +{ + if (item < 0 || item >= (int)m_vecItems->Size()) + return -1; + + std::shared_ptr<CFileItem> fileItem = m_vecItems->Get...
xbmc/video/dialogs/GUIDialogVideoBookmarks.cpp
26
C++
0.643
suggestion
77
51
51
false
[guilib] Fix bookmark deletion in presence of chapters
26,078
xbmc/xbmc
17,740
C++
ksooo
CrystalP
(*m_vecItems)[item]->Select(true); CContextButtons choices; choices.Add(1, (bm.type == CBookmark::EPISODE ? 20405 : 20404)); // "Remove episode bookmark" or "Remove bookmark" const int button{CGUIDialogContextMenu::ShowAndGetChoice(choices)}; // unhighlight the i...
You should handle videodb open not succeeding. At least that’s what we’re doing in most places on our code base. There must be a reason for this.
CContextButtons choices; choices.Add(1, (bm.type == CBookmark::EPISODE ? 20405 : 20404)); // "Remove episode bookmark" or "Remove bookmark" const int button{CGUIDialogContextMenu::ShowAndGetChoice(choices)}; // unhighlight the item (*m_vecItems)[item]->Select(fal...
@@ -161,38 +161,67 @@ bool CGUIDialogVideoBookmarks::OnAction(const CAction &action) return CGUIDialog::OnAction(action); } +int CGUIDialogVideoBookmarks::ItemToBookmarkIndex(int item) +{ + if (item < 0 || item >= (int)m_vecItems->Size()) + return -1; + + std::shared_ptr<CFileItem> fileItem = m_vecItems->Get...
xbmc/video/dialogs/GUIDialogVideoBookmarks.cpp
26
C++
0.786
suggestion
146
51
51
false
[guilib] Fix bookmark deletion in presence of chapters
26,078
xbmc/xbmc
17,740
C++
ksooo
CrystalP
bool CAutorun::ExecuteAutorun(const std::string& path) { if (CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_LOGIN_SCREEN) return false; CCdInfo* pInfo = CServiceBroker::GetMediaManager().GetCdInfo(path); if ( pInfo == NULL ) return false; auto& components = CServiceBroker::G...
How about ```c++ const auto& settings = CServiceBroker::GetSettingsComponent()->GetSettings(); const auto& profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager(); ``` ```c++ const AutoCDAction action = static_cast<AutoCDAction>(settings->GetInt(CSettings::SETTING_AUDIOCDS_AU...
bool CAutorun::ExecuteAutorun(const std::string& path) { if (CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_LOGIN_SCREEN) return false; CCdInfo* pInfo = CServiceBroker::GetMediaManager().GetCdInfo(path); if ( pInfo == NULL ) return false; auto& components = CServiceBroker::G...
@@ -85,8 +85,14 @@ bool CAutorun::ExecuteAutorun(const std::string& path) bool success = false; #ifdef HAS_CDDA_RIPPER - if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_AUDIOCDS_AUTOACTION) == AUTOCD_RIP && - pInfo->IsAudio(1) && !CServiceBroker::GetSettingsComponent()->...
xbmc/Autorun.cpp
26
C++
1
suggestion
467
51
51
false
Autorun: convert AutoCDAction to enum class
26,083
xbmc/xbmc
17,740
C++
garbear
notspiff
auto getScraper = [&](const std::string& scraperID) { AddonPtr addon; if (scraperCache) { if (auto iter = scraperCache->find(scraperID); iter == scraperCache->end()) { if (CServiceBroker::GetAddonMgr().GetAddon(scraperID, addon, ADDO...
reads better this way for me: ```suggestion auto getScraper = [scraperCache](const std::string& scraperID) { if (scraperCache) if (auto iter = scraperCache->find(scraperID); iter != scraperCache->end()) return std::make_pair(true, iter->second); AddonPtr addon; const bool found = CServi...
const std::string& pathSettings) { if (scraperCache) { auto key = scraperID + pathSettings; if (auto iter = scraperCache->find(key); iter != scraperCache->end()) return std::make_pair(true, iter->second); } AddonPtr addon; const bool found = ...
@@ -8842,20 +8843,62 @@ bool CVideoDatabase::HasContent(VideoDbContentType type) return result; } -ScraperPtr CVideoDatabase::GetScraperForPath( const std::string& strPath ) +ScraperPtr CVideoDatabase::GetScraperForPath(const std::string& strPath, + ScraperCache* scrape...
xbmc/video/VideoDatabase.cpp
26
C++
1
bug
629
51
51
false
CVideoDatabase: Add possibility to cache scrapers and use that in `CVideoInfoScanner`
26,102
xbmc/xbmc
17,740
C++
CrystalP
neo1973
} ScraperPtr CVideoDatabase::GetScraperForPath(const std::string& strPath, SScanSettings& settings, bool& foundDirectly, ScraperCache* scraperCache /*= nullptr*/) { // Returns a pair...
isn't found redundant? ```suggestion if (scraper) ```
ScraperPtr CVideoDatabase::GetScraperForPath(const std::string& strPath, SScanSettings& settings, bool& foundDirectly, ScraperCache* scraperCache /*= nullptr*/) { // Returns a pair o...
@@ -8842,20 +8843,57 @@ bool CVideoDatabase::HasContent(VideoDbContentType type) return result; } -ScraperPtr CVideoDatabase::GetScraperForPath( const std::string& strPath ) +ScraperPtr CVideoDatabase::GetScraperForPath(const std::string& strPath, + ScraperCache* scrape...
xbmc/video/VideoDatabase.cpp
26
C++
0.857
question
60
51
51
false
CVideoDatabase: Add possibility to cache scrapers and use that in `CVideoInfoScanner`
26,102
xbmc/xbmc
17,740
C++
CrystalP
neo1973
return attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY) == 0; } int CWin32File::Stat(const CURL& url, struct __stat64* statData) { assert((!m_smbFile && url.GetProtocol().empty()) || (m_smbFile && url.IsProtocol("smb"))); // function suitable only for local or SMB files if (m_smbFile) ...
`--pathLength` it's a bit ugly, maybe remove and use `pathnameW.length()` in L477 and then `pathLength` declaration can be `const size_t`
return attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY) == 0; } int CWin32File::Stat(const CURL& url, struct __stat64* statData) { assert((!m_smbFile && url.GetProtocol().empty()) || (m_smbFile && url.IsProtocol("smb"))); // function suitable only for local or SMB files if (m_smbFile) ...
@@ -466,7 +466,15 @@ int CWin32File::Stat(const CURL& url, struct __stat64* statData) return -1; } - if (pathnameW.length() <= 6) // 6 is length of "\\?\x:" + size_t pathLength{pathnameW.length()}; + // stat of directories requires the removal of the trailing slash + if (pathnameW[pathLength - 1] == L'\\'...
xbmc/platform/win32/filesystem/Win32File.cpp
26
C++
0.714
suggestion
140
51
51
false
[Windows] Fix Fasthash for Movies Scan
26,104
xbmc/xbmc
17,740
C++
thexai
CrystalP
//by blindly doing a read 32bytes - seek back to where //we were before void CNfsConnection::keepAlive(const std::string& _exportPath, struct nfsfh* _pFileHandle) { uint64_t offset = 0; char buffer[32]; // this also refreshes the last accessed time for the context // true forces a cachehit regardless the contex...
Even though you did not introduce it - sizeof(buffer) would also work here.
//by blindly doing a read 32bytes - seek back to where //we were before void CNfsConnection::keepAlive(const std::string& _exportPath, struct nfsfh* _pFileHandle) { uint64_t offset = 0; char buffer[32]; // this also refreshes the last accessed time for the context // true forces a cachehit regardless the contex...
@@ -477,7 +477,11 @@ void CNfsConnection::keepAlive(const std::string& _exportPath, struct nfsfh* _pF nfs_lseek(pContext, _pFileHandle, 0, SEEK_CUR, &offset); +#ifdef LIBNFS_API_V2 + int bytes = nfs_read(pContext, _pFileHandle, buffer, sizeof(buffer)); +#else int bytes = nfs_read(pContext, _pFileHandle, 32, ...
xbmc/filesystem/NFSFile.cpp
26
C++
0.143
suggestion
75
51
51
false
[nfs][depends] Update libnfs to 6.0.2
26,110
xbmc/xbmc
17,740
C++
fritsch
sundermann
{ if (mode == ContentUtils::PlayMode::PLAY_FROM_HERE || (mode == ContentUtils::PlayMode::CHECK_AUTO_PLAY_NEXT_ITEM && IsAutoPlayNextItem(*item))) { // Add item and all its siblings to the playlist and play. Prefer videodb path if available, // because it provides more information than just...
It seems that the "true" here is `isFolder`. Since all the calls you're adding are in the "scope" of the fileitem, wouldn't it make sense to move it to the constructor itself? Likely not because it might be a folder but not a video one?
AddItemToPlayListAndPlay(item, nullptr, player); } else if (item->HasVideoInfoTag()) { if (mode == ContentUtils::PlayMode::PLAY_FROM_HERE || (mode == ContentUtils::PlayMode::CHECK_AUTO_PLAY_NEXT_ITEM && IsAutoPlayNextItem(*item))) { // Add item and all its siblings to the playlist and pl...
@@ -424,6 +427,8 @@ void PlayItem( } const auto parentItem = std::make_shared<CFileItem>(parentPath, true);
xbmc/video/guilib/VideoGUIUtils.cpp
26
C++
0.786
question
237
51
51
false
[video] Fix resume of (Non-)Videodatabase items if 'play next video automatically' is active.
26,112
xbmc/xbmc
17,740
C++
enen92
ksooo
/* * Copyright (C) 2016-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include <set> #include <string> #include <vector> class CGUIDialogProgressBarHandle; class CInfoScanner { publi...
This will not compile on Windows, because it comes with a macro named `ERROR`.
/* * Copyright (C) 2016-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include <set> #include <string> class CGUIDialogProgressBarHandle; class CInfoScanner { public: /*! \brie...
@@ -20,14 +20,14 @@ class CInfoScanner /*! \brief Return values from the information lookup functions. */ - enum INFO_RET + enum class InfoRet { - INFO_CANCELLED, - INFO_ERROR, - INFO_NOT_NEEDED, - INFO_HAVE_ALREADY, - INFO_NOT_FOUND, - INFO_ADDED + CANCELLED, + ERROR,
xbmc/InfoScanner.h
26
C/C++
0.857
suggestion
78
51
51
false
InfoScanner: convert InfoRet to enum class
26,117
xbmc/xbmc
17,740
C++
ksooo
notspiff
#include "Pipewire.h" #include "PipewireContext.h" #include "PipewireCore.h" #include "PipewireRegistry.h" #include "PipewireThreadLoop.h" #include "commons/ilog.h" #include "utils/log.h" #include <pipewire/pipewire.h> using namespace std::chrono_literals; using namespace KODI; using namespace PIPEWIRE; CPipewire:...
The problem here is though, that the ctx and the pipewire object share the mainloop. While calling Unlock might be wrong - as ctx currently does not hold the lock, but assume for a moment it did, then you would kill the ctx object under the hood of pw processing something. See in comparison to the ::Start method and...
#include "Pipewire.h" #include "PipewireContext.h" #include "PipewireCore.h" #include "PipewireRegistry.h" #include "PipewireThreadLoop.h" #include "commons/ilog.h" #include "utils/log.h" #include <pipewire/pipewire.h> using namespace std::chrono_literals; using namespace KODI; using namespace PIPEWIRE; CPipewire:...
@@ -30,10 +30,7 @@ CPipewire::CPipewire() CPipewire::~CPipewire() { if (m_loop) - { - m_loop->Unlock();
xbmc/cores/AudioEngine/Sinks/pipewire/Pipewire.cpp
26
C++
0.429
bug
1,163
51
51
false
PipeWire: fix thread loop unlock error
26,126
xbmc/xbmc
17,740
C++
fritsch
stephan49
{ const auto& mode = modes.at(path.targetInfo.modeInfoIdx); getColorInfo.header.adapterId.HighPart = mode.adapterId.HighPart; getColorInfo.header.adapterId.LowPart = mode.adapterId.LowPart; getColorInfo.header.id = mode.id; if (ERROR_SUCCESS == DisplayConfigGetDeviceInfo(...
This would break HDR detection on my system: ![advanced_color_info](https://github.com/user-attachments/assets/5a14d03d-4583-43bd-891b-efb9c723e28a) HDR is supported Sony TV and ACM is enabled. At time of screenshot HDR is disabled. This is the info with new ADVANCED_COLOR_INFO_2: ![advanced_color_info2](ht...
{ const auto& mode = modes.at(path.targetInfo.modeInfoIdx); getColorInfo.header.adapterId.HighPart = mode.adapterId.HighPart; getColorInfo.header.adapterId.LowPart = mode.adapterId.LowPart; getColorInfo.header.id = mode.id; if (ERROR_SUCCESS == DisplayConfigGetDeviceInfo(...
@@ -1565,11 +1565,27 @@ HDR_STATUS CWIN32Util::GetWindowsHDRStatus() if (ERROR_SUCCESS == DisplayConfigGetDeviceInfo(&getColorInfo.header)) { - if (getColorInfo.advancedColorEnabled) - hdrEnabled = true; - - if (getColorInfo.advancedColorSupported) + // DISPLAYC...
xbmc/platform/win32/WIN32Util.cpp
26
C++
0.643
suggestion
636
51
51
false
[Windows] Fix the detection of SDR screens for Windows 11 22H2 and 23H2
26,140
xbmc/xbmc
17,740
C++
thexai
CrystalP
double CAESinkAUDIOTRACK::GetLatency() { return 0.0; } double CAESinkAUDIOTRACK::GetCacheTotal() { // total amount that the audio sink can buffer in units of seconds return m_audiotrackbuffer_sec; } // this method is supposed to block until all frames are written to the device buffer // when it returns ActiveAE...
no underscore uses on new code ```suggestion bool forceBlock = false; ```
double CAESinkAUDIOTRACK::GetLatency() { return 0.0; } double CAESinkAUDIOTRACK::GetCacheTotal() { // total amount that the audio sink can buffer in units of seconds return m_audiotrackbuffer_sec; } // this method is supposed to block until all frames are written to the device buffer // when it returns ActiveAE...
@@ -815,23 +815,34 @@ unsigned int CAESinkAUDIOTRACK::AddPackets(uint8_t **data, unsigned int frames, if (!IsInitialized()) return INT_MAX; - // If the sink did not move twice the buffer size in time it was opened + // If the sink did not move twice the buffer size at least 400 ms in time it was opened /...
xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
26
C++
0.857
suggestion
78
51
51
false
AESinkAudioTrack: Superviseaudiodelay increase success probability
26,142
xbmc/xbmc
17,740
C++
CastagnaIT
fritsch
bool RemoveItem(CFileItemList& items, const std::shared_ptr<CFileItem>& item) { int iBefore = items.Size(); items.Remove(item.get()); return items.Size() == iBefore - 1; } bool ShouldEnableMoveItems() { if (CServiceBroker::GetFavouritesService().Size() <= 1) return false; auto& mgr = CServiceBroker::Get...
In the past I fixed a bug due to passing a std::shared_ptr<CFileItem> reference around, and the caller dropped the refcount to zero and rugpulled the pointer. Is it possible to pass by value, forcing a copy, and then do the best to elide a copy later with std::move()?
bool RemoveItem(CFileItemList& items, const std::shared_ptr<CFileItem>& item) { int iBefore = items.Size(); items.Remove(item.get()); return items.Size() == iBefore - 1; } bool ShouldEnableMoveItems() { if (CServiceBroker::GetFavouritesService().Size() <= 1) return false; auto& mgr = CServiceBroker::Get...
@@ -127,11 +127,11 @@ bool ShouldEnableMoveItems() namespace { -bool ExecuteAction(const std::string& execString) +bool ExecuteAction(const std::string& execString, const std::shared_ptr<CFileItem>& item)
xbmc/favourites/FavouritesUtils.cpp
26
C++
0.857
bug
268
51
51
false
[interfaces/builtins] If available, pass item instance to 'PlayerControl.(Play|Queue)Media' builtin function
26,150
xbmc/xbmc
17,740
C++
garbear
ksooo
AEDataFormat subFormatType; }; //! @todo //! Sample formats go from float -> 32 bit int -> 24 bit int (packed in 32) -> -> 24 bit int -> 16 bit int */ //! versions of Kodi before 14.0 had a bug which made S24NE4MSB the first format selected //! this bug worked around some driver bug of some IEC958 devices which repo...
Not seems necessary add this new member. This is used to obtain channels and channelMask and this info is already present in the struct. Should be possible do same that in GetRendererDetailsWinRT() https://github.com/xbmc/xbmc/blob/5ad9f62225b645ced2324c0402954a40dc3f4793/xbmc/cores/AudioEngine/Sinks/windows/AESi...
AEDataFormat subFormatType; }; //! @todo //! Sample formats go from float -> 32 bit int -> 24 bit int (packed in 32) -> -> 24 bit int -> 16 bit int */ //! versions of Kodi before 14.0 had a bug which made S24NE4MSB the first format selected //! this bug worked around some driver bug of some IEC958 devices which repo...
@@ -183,6 +183,7 @@ struct RendererDetail unsigned int nChannels; unsigned int uiChannelMask; bool bDefault; + WAVEFORMATEX wfx;
xbmc/cores/AudioEngine/Sinks/windows/AESinkFactoryWin.h
26
C/C++
0.643
suggestion
346
51
51
false
[Windows] Refactor Directsound Device Default and Enumeration
26,174
xbmc/xbmc
17,740
C++
thexai
CrystalP
details.strDeviceId = KODI::PLATFORM::WINDOWS::FromW(varName.pwszVal); PropVariantClear(&varName); hr = pProperty->GetValue(PKEY_AudioEndpoint_FormFactor, &varName); EXIT_ON_FAILURE(hr, "Retrieval of endpoint form factor failed.") details.strWinDevType = winEndpoints[(EndpointFormFactor)varName.ui...
If not necessary, why not remove? This is only master / pre Alpha
details.strDeviceId = KODI::PLATFORM::WINDOWS::FromW(varName.pwszVal); PropVariantClear(&varName); hr = pProperty->GetValue(PKEY_AudioEndpoint_FormFactor, &varName); EXIT_ON_FAILURE(hr, "Retrieval of endpoint form factor failed.") details.strWinDevType = winEndpoints[(EndpointFormFactor)varName.ui...
@@ -85,33 +85,66 @@ std::vector<RendererDetail> CAESinkFactoryWin::GetRendererDetails() PropVariantInit(&varName); hr = pEnumDevices->Item(i, pDevice.GetAddressOf()); - EXIT_ON_FAILURE(hr, "Retrieval of WASAPI endpoint failed.") + EXIT_ON_FAILURE(hr, "Retrieval of endpoint failed.") hr = pDevic...
xbmc/cores/AudioEngine/Sinks/windows/AESinkFactoryWin32.cpp
26
C++
0.357
suggestion
66
51
51
false
[Windows] Refactor Directsound Device Default and Enumeration
26,174
xbmc/xbmc
17,740
C++
thexai
CrystalP