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
{ m_subtitleDelay = delay; } bool CMediaPipelineWebOS::Load(CDVDStreamInfo videoHint, CDVDStreamInfo audioHint) { std::scoped_lock videoLock(m_videoCriticalSection); std::scoped_lock audioLock(m_audioCriticalSection); CVariant p; if (videoHint.cryptoSession || audioHint.cryptoSession) { CryptoSession...
```suggestion const CryptoSessionSystem keySystem = videoHint.cryptoSession ? videoHint.cryptoSession->keySystem : audioHint.cryptoSession->keySystem; ```
{ std::scoped_lock videoLock(m_videoCriticalSection); std::scoped_lock audioLock(m_audioCriticalSection); CVariant p; if (videoHint.cryptoSession || audioHint.cryptoSession) { const CryptoSessionSystem keySystem = videoHint.cryptoSession ? videoHint.cryptoSe...
@@ -520,12 +530,48 @@ bool CMediaPipelineWebOS::Load(CDVDStreamInfo videoHint, CDVDStreamInfo audioHin std::scoped_lock audioLock(m_audioCriticalSection); CVariant p; - CVariant payloadArgs; if (videoHint.cryptoSession || audioHint.cryptoSession) { - CLog::LogF(LOGERROR, "CryptoSessions unsupported"...
xbmc/cores/VideoPlayer/MediaPipelineWebOS.cpp
26
C++
1
suggestion
250
51
51
false
webOS: passthrough encrypted data to secure decoder
27,157
xbmc/xbmc
17,740
C++
sundermann
cscd98
{ return m_addon ? m_addon->Profile() : ""; } CAddonVersion IAddonInstanceHandler::Version() const { return m_addon ? m_addon->Version() : CAddonVersion(); } ADDON_STATUS IAddonInstanceHandler::CreateInstance() { if (!m_addon) return ADDON_STATUS_UNKNOWN; std::unique_lock lock(m_cdSec); ADDON_STATUS s...
I don't think this makes logically sense, this obviously modifies the object.
{ return m_addon ? m_addon->Profile() : ""; } CAddonVersion IAddonInstanceHandler::Version() const { return m_addon ? m_addon->Version() : CAddonVersion(); } ADDON_STATUS IAddonInstanceHandler::CreateInstance() { if (!m_addon) return ADDON_STATUS_UNKNOWN; std::unique_lock lock(m_cdSec); ADDON_STATUS s...
@@ -124,7 +124,7 @@ ADDON_STATUS IAddonInstanceHandler::CreateInstance() return status; } -void IAddonInstanceHandler::DestroyInstance() +void IAddonInstanceHandler::DestroyInstance() const
xbmc/addons/binary-addons/AddonInstanceHandler.cpp
26
C++
0.143
suggestion
77
51
51
false
Random SonarQube findings which were introduced since August 2 2025
27,158
xbmc/xbmc
17,740
C++
neo1973
ksooo
#include <cassert> #include <climits> #include <vector> #ifdef TARGET_POSIX #include <errno.h> #include <inttypes.h> #include "platform/posix/ConvUtils.h" #endif #include "DllLibCurl.h" #include "ShoutcastFile.h" #include "utils/CharsetConverter.h" #include "utils/log.h" #include "utils/StringUtils.h" using namespac...
If you feel like it you can also switch this to our own `CMap` and make it `constexpr`: ```cpp constexpr auto proxyType2CUrlProxyType{make_map<XFILE::CCurlFile::ProxyType, int>({ {CCurlFile::ProxyType::HTTP, CURLPROXY_HTTP}, {CCurlFile::ProxyType::SOCKS4, CURLPROXY_SOCKS4}, {CCurlFile::ProxyType::SOCKS...
#include <algorithm> #include <cassert> #include <climits> #include <vector> #ifdef TARGET_POSIX #include <errno.h> #include <inttypes.h> #include "platform/posix/ConvUtils.h" #endif #include "DllLibCurl.h" #include "ShoutcastFile.h" #include "utils/CharsetConverter.h" #include "utils/log.h" #include "utils/StringUti...
@@ -44,16 +44,20 @@ using namespace std::chrono_literals; #define FITS_INT(a) (((a) <= INT_MAX) && ((a) >= INT_MIN)) -static const auto proxyType2CUrlProxyType = std::unordered_map<XFILE::CCurlFile::ProxyType, int>{ +namespace +{ +const auto proxyType2CUrlProxyType{std::unordered_map<XFILE::CCurlFile::ProxyType, i...
xbmc/filesystem/CurlFile.cpp
26
C++
1
suggestion
533
51
51
false
Random SonarQube findings which were introduced since August 2 2025
27,158
xbmc/xbmc
17,740
C++
neo1973
ksooo
#include <memory> #include <vector> class CFileItem; struct nfsdirent; namespace XFILE { class CNFSDirectory : public IDirectory { public: CNFSDirectory(void); ~CNFSDirectory(void) override; bool GetDirectory(const CURL& url, CFileItemList &items) override; CacheType GetCacheType(cons...
I think it would be clearer to make this function `static` instead of `const`.
#include <memory> #include <vector> class CFileItem; struct nfsdirent; namespace XFILE { class CNFSDirectory : public IDirectory { public: CNFSDirectory(void); ~CNFSDirectory(void) override; bool GetDirectory(const CURL& url, CFileItemList &items) override; CacheType GetCacheType(cons...
@@ -30,11 +30,12 @@ namespace XFILE bool Exists(const CURL& url) override; bool Remove(const CURL& url) override; private: - std::vector<std::shared_ptr<CFileItem>> GetServerList(); - std::vector<std::shared_ptr<CFileItem>> GetDirectoryFromExportList(const CURL& inputURL); + std::vecto...
xbmc/filesystem/NFSDirectory.h
26
C/C++
0.571
suggestion
78
30
27
false
Random SonarQube findings which were introduced since August 2 2025
27,158
xbmc/xbmc
17,740
C++
neo1973
ksooo
/* * 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 "InfoTagVideo.h" #include "AddonUtils.h" #include "ServiceBroker.h" #include "interfaces/legacy/Exception.h" #include ...
I suggest to write this in the following way: ```cpp infoTag->m_fanart.Clear(); for (const auto& dictionary : images) { auto getValue = [&](std::string_view str) -> const std::string& { const auto iter = dictionary.find(str); if (iter != dictionary.end()) ...
season); } void InfoTagVideo::setAvailableFanartRaw(CVideoInfoTag* infoTag, const std::vector<Properties>& images) { infoTag->m_fanart.Clear(); for (const auto& dictionary : images) { auto get...
@@ -1069,5 +1075,29 @@ namespace XBMCAddon infoTag->m_strPictureURL.AddParsedUrl(url, art_type, preview, referrer, cache, post, isgz, season); } + + void InfoTagVideo::setAvailableFanartRaw(CVideoInfoTag* infoTag, const std::vector<Properties>& images) + { ...
xbmc/interfaces/legacy/InfoTagVideo.cpp
26
C++
1
suggestion
1,165
1,104
30
false
Add InfoTagVideo::setAvailableFanart method for Kodi Python API
27,168
xbmc/xbmc
17,740
C++
neo1973
romanvm
{ infoTag->m_strPictureURL.AddParsedUrl(url, art_type, preview, referrer, cache, post, isgz, season); } void InfoTagVideo::setAvailableFanartRaw(CVideoInfoTag* infoTag, const std::vector<Properties>& images) ...
We can save some work if `image` is empty: ```suggestion if (const std::string& image = getValue("image"); !image.empty()) { const std::string& preview = getValue("preview"); const std::string& colors = getValue("colors"); infoTag->m_fanart.AddFanart(image, preview, c...
{ infoTag->m_strPictureURL.AddParsedUrl(url, art_type, preview, referrer, cache, post, isgz, season); } void InfoTagVideo::setAvailableFanartRaw(CVideoInfoTag* infoTag, const std::vector<Properties>& images) ...
@@ -1097,5 +1103,30 @@ namespace XBMCAddon infoTag->m_strPictureURL.AddParsedUrl(url, art_type, preview, referrer, cache, post, isgz, season); } + + void InfoTagVideo::setAvailableFanartRaw(CVideoInfoTag* infoTag, + ...
xbmc/interfaces/legacy/InfoTagVideo.cpp
26
C++
1
suggestion
343
32
32
false
Add InfoTagVideo::setAvailableFanart method for Kodi Python API
27,168
xbmc/xbmc
17,740
C++
neo1973
romanvm
{ int argc = 0; LPWSTR* argvW = CommandLineToArgvW(GetCommandLineW(), &argc); char** argv = new char*[argc]; for (int i = 0; i < argc; ++i) { int size = WideCharToMultiByte(CP_UTF8, 0, argvW[i], -1, nullptr, 0, nullptr, nullptr); if (size > 0) { argv[i] = new char[size]; WideCharToMul...
May I suggest to put this function into an unnamed namespace instead of tagging it static?
} std::shared_ptr<CAppParams> ParseCommandLine() { int argc = 0; LPWSTR* argvW = CommandLineToArgvW(GetCommandLineW(), &argc); char** argv = new char*[argc]; for (int i = 0; i < argc; ++i) { int size = WideCharToMultiByte(CP_UTF8, 0, argvW[i], -1, nullptr, 0, nullptr, nullptr); if (size > 0) { ...
@@ -88,6 +89,31 @@ static std::shared_ptr<CAppParams> ParseCommandLine() return appParamParser.GetAppParams(); } +static bool CheckAndSetFileFlag(bool usePlatformDirectories, HANDLE& handle)
xbmc/platform/win32/WinMain.cpp
26
C++
0.357
question
90
51
51
false
[Windows] Allow Running Multiple Instances Simultaneously
27,171
xbmc/xbmc
17,740
C++
ksooo
CrystalP
CAppParamParser appParamParser; appParamParser.Parse(argv, argc); for (int i = 0; i < argc; ++i) delete[] argv[i]; delete[] argv; return appParamParser.GetAppParams(); } static bool CheckAndSetFileFlag(bool usePlatformDirectories, HANDLE& handle) { const std::string file = CWIN32Util::GetProfilePath...
May I suggest to put this function into an unnamed namespace instead of tagging it static?
WideCharToMultiByte(CP_UTF8, 0, argvW[i], -1, argv[i], size, nullptr, nullptr); } } CAppParamParser appParamParser; appParamParser.Parse(argv, argc); for (int i = 0; i < argc; ++i) delete[] argv[i]; delete[] argv; return appParamParser.GetAppParams(); } /*! * \brief Detect another running...
@@ -88,6 +89,31 @@ static std::shared_ptr<CAppParams> ParseCommandLine() return appParamParser.GetAppParams(); } +static bool CheckAndSetFileFlag(bool usePlatformDirectories, HANDLE& handle) +{ + const std::string file = CWIN32Util::GetProfilePath(usePlatformDirectories) + "\\.running"; + + using KODI::PLATFORM...
xbmc/platform/win32/WinMain.cpp
26
C++
0.357
question
90
51
51
false
[Windows] Allow Running Multiple Instances Simultaneously
27,171
xbmc/xbmc
17,740
C++
ksooo
CrystalP
constexpr DWORD NO_SHARING = 0; using KODI::PLATFORM::WINDOWS::ToW; handle = CreateFile(ToW(file).c_str(), NO_DESIRED_ACCESS, NO_SHARING, nullptr, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, NULL); if (handle == INVALID_HANDLE_VALUE && GetLastError() == ERROR_FILE_EXISTS) return true; ...
This code is not much readable and even confuse because final string variable is not used and CreateMutex parameter is only wchar_t*. Why not only: ```c++ handle = CreateMutexW(nullptr, FALSE, L"Kodi Media Center"); ``` After all the name of mutex is not very important because only is used here (even if in a ...
constexpr DWORD NO_DESIRED_ACCESS = 0; constexpr DWORD NO_SHARING = 0; using KODI::PLATFORM::WINDOWS::ToW; handle = CreateFileW(ToW(file).c_str(), NO_DESIRED_ACCESS, NO_SHARING, nullptr, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, NULL); if (handle == INVALID_HANDLE_VALUE && GetLastError(...
@@ -88,6 +91,55 @@ static std::shared_ptr<CAppParams> ParseCommandLine() return appParamParser.GetAppParams(); } +/*! + * \brief Detect another running instance using the same data directory, using a flag file exclusion + * mechanism. + * + * Attempt to create the file. If it already exists, another instance usi...
xbmc/platform/win32/WinMain.cpp
26
C++
1
bug
430
51
51
false
[Windows] Allow Running Multiple Instances Simultaneously
27,171
xbmc/xbmc
17,740
C++
thexai
CrystalP
constexpr DWORD NO_DESIRED_ACCESS = 0; constexpr DWORD NO_SHARING = 0; using KODI::PLATFORM::WINDOWS::ToW; handle = CreateFileW(ToW(file).c_str(), NO_DESIRED_ACCESS, NO_SHARING, nullptr, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, NULL); if (handle == INVALID_HANDLE_VALUE && GetLastError(...
This line is not necessary now.
const std::string file = URIUtils::AddFileToFolder(CWIN32Util::GetProfilePath(usePlatformDirectories), ".running"); constexpr DWORD NO_DESIRED_ACCESS = 0; constexpr DWORD NO_SHARING = 0; using KODI::PLATFORM::WINDOWS::ToW; handle = CreateFileW(ToW(file).c_str(), NO_DESIRED_ACCESS, NO_SHARING, nullptr,...
@@ -88,6 +91,54 @@ static std::shared_ptr<CAppParams> ParseCommandLine() return appParamParser.GetAppParams(); } +/*! + * \brief Detect another running instance using the same data directory, using a flag file exclusion + * mechanism. + * + * Attempt to create the file. If it already exists, another instance usi...
xbmc/platform/win32/WinMain.cpp
26
C++
0.071
suggestion
31
51
51
false
[Windows] Allow Running Multiple Instances Simultaneously
27,171
xbmc/xbmc
17,740
C++
thexai
CrystalP
/* * 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. */ #include "WinSystemWaylandWebOS.h" #include "Connection.h" #include "OSScreenSaverWebOS.h" #include "Registry.h" #include "SeatWebOS.h" #i...
No warning log for unmapped resolution?
CVariant event; CJSONVariantParser::Parse(msg, event); IShellSurface* shellSurface = GetShellSurface(); if (event["event"] == "relaunch" && shellSurface) shellSurface->SetFullScreen(nullptr, 60.0f); return true; } void CWinSystemWaylandWebOS::UpdateResolutions() { CWinSystemWayland::UpdateResolution...
@@ -192,4 +203,21 @@ bool CWinSystemWaylandWebOS::OnAppLifecycleEvent(LSHandle* sh, LSMessage* reply) return true; } +void CWinSystemWaylandWebOS::UpdateResolutions() +{ + CWinSystemWayland::UpdateResolutions(); + + RESOLUTION_INFO& res = CDisplaySettings::GetInstance().GetResolutionInfo(RES_DESKTOP); + if (re...
xbmc/windowing/wayland/WinSystemWaylandWebOS.cpp
26
C++
0.071
question
39
196
30
false
webOS: report current video and maximum resolution to Inputstream addons
27,198
xbmc/xbmc
17,740
C++
CastagnaIT
cscd98
const std::string prop{StringUtils::ToLower(property)}; if (prop == "conditions") { return GetInfo(WEATHER_LABEL_CURRENT_COND); } else if (prop == "temperature") { return StringUtils::Format("{}{}", GetInfo(WEATHER_LABEL_CURRENT_TEMP), g_langInfo.GetTemperatureUnitStri...
CServiceBroker::GetGUI() should have a null pointer check outside of GUI code.
const std::string prop{StringUtils::ToLower(property)}; if (prop == "conditions") { return GetInfo(WEATHER_LABEL_CURRENT_COND); } else if (prop == "temperature") { return StringUtils::Format("{}{}", GetInfo(WEATHER_LABEL_CURRENT_TEMP), g_langInfo.GetTemperatureUnitStri...
@@ -47,6 +47,41 @@ CWeatherManager::~CWeatherManager() settings->GetSettingsManager()->UnregisterCallback(this); } +std::string CWeatherManager::GetProperty(const std::string& property) +{ + const std::string prop{StringUtils::ToLower(property)}; + if (prop == "conditions") + { + return GetInfo(WEATHER_LABE...
xbmc/weather/WeatherManager.cpp
26
C++
0.643
bug
78
51
51
false
[guiinfo][weather][Estuary] Introduce GUI info label 'Weather.Data' as generic interface to weather data.
27,199
xbmc/xbmc
17,740
C++
garbear
ksooo
static void DrawQuad(const CRect& coords, KODI::UTILS::COLOR::Color color, CD3DTexture* texture, const CRect* texCoords, SHADER_METHOD options = SHADER_METHOD_RENDER_TEXTURE_BLEND); static void DrawQuad(const CRect& coords,...
Does this also need to be initialized?
static void DrawQuad(const CRect& coords, KODI::UTILS::COLOR::Color color, CD3DTexture* texture, const CRect* texCoords, SHADER_METHOD options = SHADER_METHOD_RENDER_TEXTURE_BLEND); static void DrawQuad(const CRect& coords,...
@@ -157,18 +157,18 @@ class CD3DTexture : public ID3DResource // saved data BYTE* m_data;
xbmc/guilib/D3DResource.h
26
C/C++
0.071
question
38
51
51
false
[cppcheck] fix performance checks
27,228
xbmc/xbmc
17,740
C++
garbear
Rechi
bool SetResources(LPCSTR handle, ID3D11ShaderResourceView** ppSRViews, size_t count); bool SetConstantBuffer(LPCSTR handle, ID3D11Buffer *buffer); bool SetScalar(LPCSTR handle, float value); void AddIncludePath(const std::string& includePath); bool Begin(UINT *passes, DWORD flags); bool BeginPass(UINT pass)...
`ComPtr` is already initialized to nullptr by default. Here and all others.
bool SetResources(LPCSTR handle, ID3D11ShaderResourceView** ppSRViews, size_t count); bool SetConstantBuffer(LPCSTR handle, ID3D11Buffer *buffer); bool SetScalar(LPCSTR handle, float value); void AddIncludePath(const std::string& includePath); bool Begin(UINT *passes, DWORD flags); bool BeginPass(UINT pass)...
@@ -211,9 +211,9 @@ class CD3DEffect : public ID3DResource, public ID3DInclude std::string m_effectString; DefinesMap m_defines; - Microsoft::WRL::ComPtr<ID3DX11Effect> m_effect; - Microsoft::WRL::ComPtr<ID3DX11EffectTechnique> m_techniquie; - Microsoft::WRL::ComPtr<ID3DX11EffectPass> m_currentPass; + Micro...
xbmc/guilib/D3DResource.h
26
C/C++
0.643
bug
78
51
51
false
[cppcheck] fix performance checks
27,228
xbmc/xbmc
17,740
C++
thexai
Rechi
} bool addAll = artLevel == CSettings::VIDEOLIBRARY_ARTWORK_LEVEL_ALL; bool exactName = artLevel == CSettings::VIDEOLIBRARY_ARTWORK_LEVEL_BASIC; // find local art if (useLocal) { if (!pItem->SkipLocalArt()) { bool useFolder = false; if (bApplyToDir && (content == Cont...
Can the magic string be dealt with better? No big issue if that's not for this fix.
bool addAll = artLevel == CSettings::VIDEOLIBRARY_ARTWORK_LEVEL_ALL; bool exactName = artLevel == CSettings::VIDEOLIBRARY_ARTWORK_LEVEL_BASIC; // find local art if (useLocal) { if (!pItem->SkipLocalArt()) { bool useFolder = false; if (bApplyToDir && (content == ContentTyp...
@@ -2161,8 +2161,11 @@ CVideoInfoScanner::~CVideoInfoScanner() std::string path; if (content == ContentType::TVSHOWS) - path = ART::GetLocalArtBaseFilename(*pItem, useFolder, - ART::AdditionalIdentifiers::SEASON_AND_EPISODE); + path = + ...
xbmc/video/VideoInfoScanner.cpp
26
C++
0.357
suggestion
83
51
51
false
[Video] Fix episode thumbs not found if using local art.
27,233
xbmc/xbmc
17,740
C++
garbear
78andyp
CWin32Directory::CWin32Directory(void) {} CWin32Directory::~CWin32Directory(void) {} bool CWin32Directory::GetDirectory(const CURL& url, CFileItemList &items) { std::string pathWithSlash(url.Get()); if (!pathWithSlash.empty() && pathWithSlash.back() != '\\') pathWithSlash.push_back('\\'); std::wstring sea...
```suggestion itemName.starts_with('.'); // mark files starting from dot as hidden ```
HANDLE hSearch; WIN32_FIND_DATAW findData = {}; hSearch = FindFirstFileExW(searchMask.c_str(), FindExInfoBasic, &findData, FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH); if (hSearch == INVALID_HANDLE_VALUE) return GetLastError() == ERROR_FILE_NOT_FOUND ? Exists(url) : false; // return true if di...
@@ -81,35 +102,34 @@ bool CWin32Directory::GetDirectory(const CURL& url, CFileItemList &items) continue; } - CFileItemPtr pItem(new CFileItem(itemName)); - - pItem->SetFolder((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); - if (pItem->IsFolder()) - pItem->SetPath(pathWithSlash...
xbmc/platform/win32/filesystem/Win32Directory.cpp
26
C++
0.857
suggestion
96
51
51
false
[filesystem][Windows] Apply GetDirectory optimizations to Win32 filesystem
27,234
xbmc/xbmc
17,740
C++
thexai
CrystalP
if (hSearch == INVALID_HANDLE_VALUE) return GetLastError() == ERROR_FILE_NOT_FOUND ? Exists(url) : false; // return true if directory exist and empty std::vector<std::shared_ptr<CFileItem>> fileItems; do { std::wstring itemNameW(findData.cFileName); if (itemNameW == L"." || itemNameW == L"..") ...
```suggestion itemPath.push_back('\\'); ```
(findData.dwFileAttributes & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) != 0 || itemName.front() == '.'; // mark files starting from dot as hidden std::string itemPath(pathWithSlash + itemName); if (isDir) itemPath.push_back('\\'); // calculation of size and date costs a little...
@@ -81,35 +102,34 @@ bool CWin32Directory::GetDirectory(const CURL& url, CFileItemList &items) continue; } - CFileItemPtr pItem(new CFileItem(itemName)); - - pItem->SetFolder((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); - if (pItem->IsFolder()) - pItem->SetPath(pathWithSlash...
xbmc/platform/win32/filesystem/Win32Directory.cpp
26
C++
0.857
suggestion
51
51
51
false
[filesystem][Windows] Apply GetDirectory optimizations to Win32 filesystem
27,234
xbmc/xbmc
17,740
C++
thexai
CrystalP
std::vector<std::shared_ptr<CFileItem>> fileItems; do { std::wstring itemNameW(findData.cFileName); if (itemNameW == L"." || itemNameW == L"..") continue; std::string itemName; if (!g_charsetConverter.wToUTF8(itemNameW, itemName, true) || itemName.empty()) { CLog::Log(LOGERROR, "{...
```suggestion const auto& item = fileItems.emplace_back(std::make_shared<CFileItem>(itemName)); ```
if (isDir) itemPath.push_back('\\'); // calculation of size and date costs a little on win32 // so DIR_FLAG_NO_FILE_INFO flag is ignored const auto& item = fileItems.emplace_back(std::make_shared<CFileItem>(itemName)); item->SetFolder(isDir); item->SetPath(itemPath); using KODI::TIM...
@@ -81,35 +102,34 @@ bool CWin32Directory::GetDirectory(const CURL& url, CFileItemList &items) continue; } - CFileItemPtr pItem(new CFileItem(itemName)); - - pItem->SetFolder((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); - if (pItem->IsFolder()) - pItem->SetPath(pathWithSlash...
xbmc/platform/win32/filesystem/Win32Directory.cpp
26
C++
1
suggestion
105
51
51
false
[filesystem][Windows] Apply GetDirectory optimizations to Win32 filesystem
27,234
xbmc/xbmc
17,740
C++
thexai
CrystalP
continue; std::string itemName; if (!g_charsetConverter.wToUTF8(itemNameW, itemName, true) || itemName.empty()) { CLog::Log(LOGERROR, "{}: Can't convert wide string name to UTF-8 encoding", __FUNCTION__); continue; } const bool isDir = (findData.dwFileAttributes & FILE_ATTRIBUTE_...
As now time conversion is only one line of code not makes much sense create aux. function `GetEntryTime` to use only here, also `std::optional` cause a little overhead. Why not: ```c++ FileTime localTime{}; if (FileTimeToLocalFileTime(reinterpret_cast<const FileTime*>(&findData.ftLastWriteTime), ...
const auto& item = fileItems.emplace_back(std::make_shared<CFileItem>(itemName)); item->SetFolder(isDir); item->SetPath(itemPath); using KODI::TIME::FileTime; FileTime localTime{}; if (FileTimeToLocalFileTime(reinterpret_cast<const FileTime*>(&findData.ftLastWriteTime), ...
@@ -81,35 +102,34 @@ bool CWin32Directory::GetDirectory(const CURL& url, CFileItemList &items) continue; } - CFileItemPtr pItem(new CFileItem(itemName)); - - pItem->SetFolder((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); - if (pItem->IsFolder()) - pItem->SetPath(pathWithSlash...
xbmc/platform/win32/filesystem/Win32Directory.cpp
26
C++
1
suggestion
398
51
51
false
[filesystem][Windows] Apply GetDirectory optimizations to Win32 filesystem
27,234
xbmc/xbmc
17,740
C++
thexai
CrystalP
if (!g_charsetConverter.wToUTF8(itemNameW, itemName, true) || itemName.empty()) { CLog::Log(LOGERROR, "{}: Can't convert wide string name to UTF-8 encoding", __FUNCTION__); continue; } const bool isDir = (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; const bool isHidden = ...
Same here, I think is better use directly: ```c++ item->SetSize((static_cast<int64_t>(findData.nFileSizeHigh) << 32) + findData.nFileSizeLow); ```
item->SetPath(itemPath); using KODI::TIME::FileTime; FileTime localTime{}; if (FileTimeToLocalFileTime(reinterpret_cast<const FileTime*>(&findData.ftLastWriteTime), &localTime) == TRUE) item->SetDateTime(localTime); if (!isDir) item->SetSize((static_cas...
@@ -81,35 +102,34 @@ bool CWin32Directory::GetDirectory(const CURL& url, CFileItemList &items) continue; } - CFileItemPtr pItem(new CFileItem(itemName)); - - pItem->SetFolder((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); - if (pItem->IsFolder()) - pItem->SetPath(pathWithSlash...
xbmc/platform/win32/filesystem/Win32Directory.cpp
26
C++
1
suggestion
151
51
51
false
[filesystem][Windows] Apply GetDirectory optimizations to Win32 filesystem
27,234
xbmc/xbmc
17,740
C++
thexai
CrystalP
* * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include "utils/UrlOptions.h" #include <stdlib.h> #include <string> #include <string_view> #ifdef TARGET_WINDOWS #undef SetPort // WIN32INCLUDES this is defined as SetPortA in WinSpool.h which is being...
What happened to the other `operator==`?
* * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include "utils/UrlOptions.h" #include <stdlib.h> #include <string> #include <string_view> #ifdef TARGET_WINDOWS #undef SetPort // WIN32INCLUDES this is defined as SetPortA in WinSpool.h which is being...
@@ -24,10 +24,9 @@ class CURL final CURL() = default; explicit CURL(std::string strURL); - bool operator==(const CURL& url) const; + bool operator==(const CURL& url) const { return url.Get() == Get(); } // explicit equals operator for std::string comparison - friend bool operator==(const CURL& url, const ...
xbmc/URL.h
26
C/C++
0.286
question
40
51
51
false
Random SonarQube findings which were introduced since August 24 2025
27,252
xbmc/xbmc
17,740
C++
neo1973
ksooo
// Get file extensions to find addon related to it. std::string strExtension = URIUtils::GetExtension(url); StringUtils::ToLower(strExtension); if (!strExtension.empty() && CServiceBroker::IsAddonInterfaceUp()) { /*! * Scan here about audiodecoder addons. * * @note: Do not check audio dec...
At other places, for LOGINFO you removed the logging of the method signature, which I consider a good decision. INFO is normal operation not requiring this level of details. However, here you keep the log of method signature. I suggest to remove it, for consistency reasons. Or is this log rather a DEBUG (I think so)...
// Get file extensions to find addon related to it. std::string strExtension = URIUtils::GetExtension(url); StringUtils::ToLower(strExtension); if (!strExtension.empty() && CServiceBroker::IsAddonInterfaceUp()) { /*! * Scan here about audiodecoder addons. * * @note: Do not check audio dec...
@@ -87,10 +87,10 @@ IFileDirectory* CFileDirectoryFactory::Create(const CURL& url, CFileItem* pItem, std::unique_ptr<CAudioDecoder> result = std::make_unique<CAudioDecoder>(addonInfo.second); if (!result->CreateDecoder() || !result->ContainsFiles(url)) { - CLog::Log(LOGINFO, - ...
xbmc/filesystem/FileDirectoryFactory.cpp
26
C++
0.929
bug
437
51
51
false
[Logs] Update some Log calls that still using `__func__`
27,260
xbmc/xbmc
17,740
C++
ksooo
thexai
/* * Copyright (C) 2025 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 <algorithm> #include <array> #include <cassert> #include <concepts> #include <initializer_list> #include <ite...
```suggestion * When using this class, "class template argument deduction" will figure the type * and size out for you: ```
/* * Copyright (C) 2025 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 <algorithm> #include <array> #include <concepts> #include <initializer_list> #include <iterator> #include <ran...
@@ -0,0 +1,87 @@ + +/* + * Copyright (C) 2025 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 <algorithm> +#include <array> +#include <cassert> +#include <concepts> +#include...
xbmc/utils/Set.h
26
C/C++
1
suggestion
128
51
51
false
Introduce a constexpr set class, similar to `CMap`
27,261
xbmc/xbmc
17,740
C++
howie-f
neo1973
std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); if (appPort) { appPort->SetRenderGUI(false); } } - (void)windowDidEndLiveResize:(NSNotification*)notification { std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); if (appPort) { appPort->SetRend...
This code is (almost) duplicated 5 times. Could you please create a small helper function like `void SetRenderGUI(bool enable)` in an unnamed namespace in this cpp file. This would reduce number of changed code lines and improve overall readability and maintainability of the code. In addition, I think the comments a...
std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); if (appPort) appPort->OnEvent(newEvent); } } } - (void)windowWillStartLiveResize:(NSNotification*)notification { EnableRenderGUI(false); } - (void)windowDidEndLiveResize:(NSNotification*)notification { EnableRen...
@@ -99,18 +99,39 @@ - (void)windowDidEndLiveResize:(NSNotification*)notification - (void)windowDidMiniaturize:(NSNotification*)aNotification { g_application.m_AppFocused = false; + + // Disable GUI rendering when window is miniaturized to reduce CPU usage + std::shared_ptr<CAppInboundProtocol> appPort = CService...
xbmc/windowing/osx/OpenGL/WindowControllerMacOS.mm
26
Objective-C++
0.857
refactor
422
51
51
false
[OSX] Reduce CPU usage by suspending rendering when app is inactive
27,273
xbmc/xbmc
17,740
C++
ksooo
rfarina51
{ std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); if (appPort) { appPort->SetRenderGUI(true); } } - (void)windowDidMiniaturize:(NSNotification*)aNotification { g_application.m_AppFocused = false; // Disable GUI rendering when window is miniaturized to reduce CPU usage st...
This should be changed to `const std:.shared_ptr<...`
{ EnableRenderGUI(false); } - (void)windowDidEndLiveResize:(NSNotification*)notification { EnableRenderGUI(true); } - (void)windowDidMiniaturize:(NSNotification*)aNotification { g_application.m_AppFocused = false; EnableRenderGUI(false); } - (void)windowDidDeminiaturize:(NSNotification*)aNotification { g_...
@@ -99,18 +99,39 @@ - (void)windowDidEndLiveResize:(NSNotification*)notification - (void)windowDidMiniaturize:(NSNotification*)aNotification { g_application.m_AppFocused = false; + + // Disable GUI rendering when window is miniaturized to reduce CPU usage + std::shared_ptr<CAppInboundProtocol> appPort = CService...
xbmc/windowing/osx/OpenGL/WindowControllerMacOS.mm
26
Objective-C++
0.571
suggestion
53
51
51
false
[OSX] Reduce CPU usage by suspending rendering when app is inactive
27,273
xbmc/xbmc
17,740
C++
ksooo
rfarina51
appPort->SetRenderGUI(true); } } - (void)windowDidMiniaturize:(NSNotification*)aNotification { g_application.m_AppFocused = false; // Disable GUI rendering when window is miniaturized to reduce CPU usage std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); if (appPort) { ap...
I would remove the curly braces. The just make the cpp file bigger adding no real value for readability or whatever.
- (void)windowDidEndLiveResize:(NSNotification*)notification { EnableRenderGUI(true); } - (void)windowDidMiniaturize:(NSNotification*)aNotification { g_application.m_AppFocused = false; EnableRenderGUI(false); } - (void)windowDidDeminiaturize:(NSNotification*)aNotification { g_application.m_AppFocused = true...
@@ -99,18 +99,39 @@ - (void)windowDidEndLiveResize:(NSNotification*)notification - (void)windowDidMiniaturize:(NSNotification*)aNotification { g_application.m_AppFocused = false; + + // Disable GUI rendering when window is miniaturized to reduce CPU usage + std::shared_ptr<CAppInboundProtocol> appPort = CService...
xbmc/windowing/osx/OpenGL/WindowControllerMacOS.mm
26
Objective-C++
0.5
style
116
51
51
false
[OSX] Reduce CPU usage by suspending rendering when app is inactive
27,273
xbmc/xbmc
17,740
C++
ksooo
rfarina51
auto window = [[NSWindow alloc] initWithContentRect:frame styleMask:style backing:NSBackingStoreBuffered defer:YES]; window.backgroundColor = NSColor.blackColor; window.title =...
Nitpick: i would remove “ForPerformance” from the function name. A method name should reflect what the method does, not why it is called.
} // unnamed namespace @implementation XBMCWindowControllerMacOS - (nullable instancetype)initWithTitle:(NSString*)title defaultSize:(NSSize)size { auto frame = NSMakeRect(0, 0, size.width, size.height); const NSWindowStyleMask style = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | ...
@@ -53,6 +53,13 @@ - (nullable instancetype)initWithTitle:(NSString*)title defaultSize:(NSSize)size return self; } +- (void)setGUIRenderingForPerformance:(BOOL)enabled
xbmc/windowing/osx/OpenGL/WindowControllerMacOS.mm
26
Objective-C++
0.786
performance
138
51
51
false
[OSX] Reduce CPU usage by suspending rendering when app is inactive
27,273
xbmc/xbmc
17,740
C++
ksooo
rfarina51
window.backgroundColor = NSColor.blackColor; window.title = title; window.titlebarAppearsTransparent = YES; window.titleVisibility = NSWindowTitleHidden; window.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary | NSWindowCollectionBehaviorFullScreenDisallowsTiling...
Since it's a C++ call, `enabled` should be of type `bool`, not objc `BOOL`. And use true/false instead of YES/NO respectively.
- (nullable instancetype)initWithTitle:(NSString*)title defaultSize:(NSSize)size { auto frame = NSMakeRect(0, 0, size.width, size.height); const NSWindowStyleMask style = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResiza...
@@ -53,6 +53,13 @@ - (nullable instancetype)initWithTitle:(NSString*)title defaultSize:(NSSize)size return self; } +- (void)setGUIRenderingForPerformance:(BOOL)enabled +{ + const std::shared_ptr<CAppInboundProtocol> appPort = CServiceBroker::GetAppPort(); + if (appPort) + appPort->SetRenderGUI(enabled);
xbmc/windowing/osx/OpenGL/WindowControllerMacOS.mm
26
Objective-C++
1
suggestion
126
51
51
false
[OSX] Reduce CPU usage by suspending rendering when app is inactive
27,273
xbmc/xbmc
17,740
C++
kambala-decapitator
rfarina51
} } XMLUtils::GetString(pRootElement, "cputempcommand", m_cpuTempCmd); XMLUtils::GetString(pRootElement, "gputempcommand", m_gpuTempCmd); XMLUtils::GetBoolean(pRootElement, "alwaysontop", m_alwaysOnTop); const TiXmlElement* pPVR = pRootElement->FirstChildElement("pvr"); if (pPVR) { XMLUtils::Ge...
This can be made `static const`
{ const TiXmlNode* filter = filters->FirstChild("filter"); while (filter) { if (filter->FirstChild()) m_musicTagsFromFileFilters.push_back(filter->FirstChild()->ValueStr()); filter = filter->NextSibling("filter"); } } const TiXmlElement* pHostEntries = pRootElement->FirstChild...
@@ -1167,9 +1167,11 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file) { const char* XML_SORTMETHOD = "sortmethod"; const char* XML_SORTORDER = "sortorder"; - int sortMethod; - // ignore SortByTime for duration defaults - if (XMLUtils::GetInt(pSortDecription, XML_SOR...
xbmc/settings/AdvancedSettings.cpp
26
C++
0.286
suggestion
31
51
51
false
[PVR] Add missing default values to advancedsettings.xml for pvrrecordings
27,285
xbmc/xbmc
17,740
C++
garbear
emveepee
} XMLUtils::GetString(pRootElement, "cputempcommand", m_cpuTempCmd); XMLUtils::GetString(pRootElement, "gputempcommand", m_gpuTempCmd); XMLUtils::GetBoolean(pRootElement, "alwaysontop", m_alwaysOnTop); const TiXmlElement* pPVR = pRootElement->FirstChildElement("pvr"); if (pPVR) { XMLUtils::GetInt(p...
This is a good use case for our new `CSet`class: ```c++ #include "utils/Set.h" ... static constexpr CSet validSortMethods{ SortByLabel, SortByDate, SortBySize, SortByFile, SortByEpisodeNumber, SortByProvider}; ```
const TiXmlNode* filter = filters->FirstChild("filter"); while (filter) { if (filter->FirstChild()) m_musicTagsFromFileFilters.push_back(filter->FirstChild()->ValueStr()); filter = filter->NextSibling("filter"); } } const TiXmlElement* pHostEntries = pRootElement->FirstChildElem...
@@ -1167,16 +1167,19 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file) { const char* XML_SORTMETHOD = "sortmethod"; const char* XML_SORTORDER = "sortorder"; - int sortMethod; - // ignore SortByTime for duration defaults - if (XMLUtils::GetInt(pSortDecription, XML_SO...
xbmc/settings/AdvancedSettings.cpp
26
C++
1
style
226
51
51
false
[PVR] Add missing default values to advancedsettings.xml for pvrrecordings
27,285
xbmc/xbmc
17,740
C++
ksooo
emveepee
const size_t size = stream->attached_pic.size; if (art) art->emplace_back(stream->attached_pic.data, size, mimeTag->value, type); else tag.m_coverArt.emplace_back(size, mimeTag->value, type); } } if (m_metadata_stream != -1) { CNfoFile nfo; auto* data = m_fctx->strea...
idk if this is temporary and you fix this on this PR, otherwise please adjust as ```suggestion /*! @todo: Investigate if this is correct. *! The first parameter to `CNfoFile::Create` is the **path** to the NFO file. *! `content` here appears to be the __contents__ of an NFO file. *! If...
const size_t size = stream->attached_pic.size; if (art) art->emplace_back(stream->attached_pic.data, size, mimeTag->value, type); else tag.m_coverArt.emplace_back(size, mimeTag->value, type); } } if (m_metadata_stream != -1) { CNfoFile nfo; auto* data = m_fctx->strea...
@@ -191,6 +191,12 @@ CInfoScanner::InfoType CVideoTagLoaderFFmpeg::LoadMKV(CVideoInfoTag& tag, } else { + /* TODO: Investigate if this is correct. + * The first parameter to `CNfoFile::Create` is the **path** to the NFO file. + * `content` here appears to be the __contents__ of an NFO fi...
xbmc/video/tags/VideoTagLoaderFFmpeg.cpp
26
C++
1
bug
459
51
51
false
[NFO] File parsing refactor
27,321
xbmc/xbmc
17,740
C++
CastagnaIT
damienruscoe
CInfoScanner::InfoType CNfoFile::Create(const std::string& nfoPath, const ScraperPtr& info, int index) { /* `TryParsing` creates a close approximation to the desired result. * The desired result would be knowing if any valid URLs have ...
Good job clearly explaining the context in detail.
CInfoScanner::InfoType CNfoFile::Create(const std::string& nfoPath, const ScraperPtr& info, int index) { /* `TryParsing` creates a close approximation to the desired result. * The desired result would be knowing if any valid URLs have ...
@@ -27,105 +27,141 @@ using namespace XFILE; using namespace ADDON; -CInfoScanner::InfoType CNfoFile::Create(const std::string& strPath, - const ScraperPtr& info, - int index) +// Forward declarations +namespace { - m_info = info; // as...
xbmc/NfoFile.cpp
26
C++
0.143
suggestion
50
51
51
false
[NFO] File parsing refactor
27,321
xbmc/xbmc
17,740
C++
garbear
damienruscoe
bool GetDetails(T& details, const char* document = nullptr, bool prioritise = false) const { CXBMCTinyXML doc; if (document) doc.Parse(document, TIXML_ENCODING_UNKNOWN); else if (m_headPos < m_doc.size()) doc.Parse(m_doc.substr(m_headPos), TIXML_ENCODING_UNKNOWN); else return false...
Coding guidelines: Method names must start with an uppercase letter. => https://github.com/xbmc/xbmc/blob/master/docs/CODE_GUIDELINES.md#87-methods
bool GetDetails(T& details, const char* document = nullptr, bool prioritise = false) const { CXBMCTinyXML doc; if (document) doc.Parse(document, TIXML_ENCODING_UNKNOWN); else if (m_headPos < m_doc.size()) doc.Parse(m_doc.substr(m_headPos), TIXML_ENCODING_UNKNOWN); else return false...
@@ -51,17 +52,19 @@ class CNfoFile ADDON::ScraperPtr GetScraperInfo() { return m_info; } const CScraperUrl &ScraperUrl() const { return m_scurl; } - static int Scrape(const ADDON::ScraperPtr& scraper, CScraperUrl& url, const std::string& content); - - static std::vector<ADDON::ScraperPtr> GetScrapers(ADDON::A...
xbmc/NfoFile.h
26
C/C++
0.286
suggestion
147
35
35
false
[NFO] File parsing refactor
27,321
xbmc/xbmc
17,740
C++
ksooo
damienruscoe
return details.GetOverride() ? OVERRIDE : FULL; } return NONE; } bool CNfoFile::seekToMovieIndex(int index) { // Find nth <movie> tag (index is 1 based) m_headPos = m_doc.find("<movies>"); while (index-- > 0) { m_headPos = m_doc.find("<movie", m_headPos + 1); if (m_headPos == std::string::npo...
`const auto` or even better, because increased readability, use the real type instead of `auto`.
return details.GetOverride() ? OVERRIDE : FULL; } return NONE; } bool CNfoFile::SeekToMovieIndex(int index) { // Find nth <movie> tag (index is 1 based) m_headPos = m_doc.find("<movies>"); while (index-- > 0) { m_headPos = m_doc.find("<movie", m_headPos + 1); if (m_headPos == std::string::npo...
@@ -27,105 +27,141 @@ using namespace XFILE; using namespace ADDON; -CInfoScanner::InfoType CNfoFile::Create(const std::string& strPath, - const ScraperPtr& info, - int index) +// Forward declarations +namespace { - m_info = info; // as...
xbmc/NfoFile.cpp
26
C++
0.857
suggestion
96
51
51
false
[NFO] File parsing refactor
27,321
xbmc/xbmc
17,740
C++
ksooo
damienruscoe
* * | result | Could be converted to: | * | -------- | -------------------------- | * | NONE | URL NONE | * | OVERRIDE | COMBINED OVERRIDE | * | FULL | COMBINED OVERRIDE FULL | * * The following call to `searchNfoForScraperUrls` will generate the *...
`const auto` or even better, because increased readability, use the real type instead of `auto`.
* * | result | Could be converted to: | * | -------- | -------------------------- | * | NONE | URL NONE | * | OVERRIDE | COMBINED OVERRIDE | * | FULL | COMBINED OVERRIDE FULL | * * The following call to `SearchNfoForScraperUrls` will generate the *...
@@ -27,105 +27,141 @@ using namespace XFILE; using namespace ADDON; -CInfoScanner::InfoType CNfoFile::Create(const std::string& strPath, - const ScraperPtr& info, - int index) +// Forward declarations +namespace { - m_info = info; // as...
xbmc/NfoFile.cpp
26
C++
0.857
suggestion
96
51
51
false
[NFO] File parsing refactor
27,321
xbmc/xbmc
17,740
C++
ksooo
damienruscoe
m_messageQueueParent.Put( std::make_shared<CDVDMsgType<SStateMsg>>(CDVDMsg::PLAYER_REPORT_STATE, stateMsg)); } else { CLog::LogF(LOGDEBUG, "Received audio message: {}", msg->GetMessageType()); } } } } void CMediaPipelineWebOS::GetVideoResolution(unsigned int& w...
all new variables must not use underscores "_"
const unsigned int bytes = frame.nb_frames * frame.framesize / frame.planes; for (unsigned int i = 0; i < frame.planes; i++) { std::copy_n(frame.data[i], bytes, buffer->pkt->data[i]); } m_audioResample->m_inputSamples.emplace_back(buffer); ...
@@ -1343,6 +1366,38 @@ void CMediaPipelineWebOS::GetVideoResolution(unsigned int& width, unsigned int& } } +unsigned int CMediaPipelineWebOS::ParseAACSampleRate(const uint8_t* data, size_t size) +{ + if (size < 2) + return 0; + + static const int ff_mpeg4audio_sample_rates[16] = {96000, 88200, 64000, 48000, ...
xbmc/cores/VideoPlayer/MediaPipelineWebOS.cpp
26
C++
0.286
suggestion
46
51
51
false
webOS: pass AAC extradata to API as an array of ints
27,324
xbmc/xbmc
17,740
C++
CastagnaIT
cscd98
* @param type Stream type (audio or video) * @return Total number of bytes in the queue */ unsigned int GetQueuedBytes(StreamType type) const; /** * @brief Get the maximum capacity of the queue in bytes * @param type Stream type (audio or video) * @return Maximum capacity of the queue in bytes ...
can you tell me there reason why you add ParseAACSampleRate as static function and not in the unnamed namespace of .cpp?
* @return Total number of bytes in the queue */ unsigned int GetQueuedBytes(StreamType type) const; /** * @brief Get the maximum capacity of the queue in bytes * @param type Stream type (audio or video) * @return Maximum capacity of the queue in bytes */ unsigned int GetQueueCapacity(StreamType...
@@ -383,6 +383,14 @@ class CMediaPipelineWebOS final : public CThread */ unsigned int GetQueueLevel(StreamType type) const; + /** + * @brief Parse the AudioSpecificConfig to determine the sample rate + * @param data Pointer to AudioSpecificConfig data + * @param size Size of the data buffer in bytes. Mu...
xbmc/cores/VideoPlayer/MediaPipelineWebOS.h
26
C/C++
0.286
question
122
51
51
false
webOS: pass AAC extradata to API as an array of ints
27,324
xbmc/xbmc
17,740
C++
CastagnaIT
cscd98
{AV_CODEC_ID_AAC, {"AAC"}}, {AV_CODEC_ID_AAC_LATM, {"AAC"}}}; const auto ms_hdrInfoMap = std::map<AVColorTransferCharacteristic, std::string_view>({ {AVCOL_TRC_SMPTE2084, "HDR10"}, {AVCOL_TRC_ARIB_STD_B67, "HLG"}, }); unsigned int SelectTranscodingSampleRate(const unsigned int sampleRate) { switch...
"static" not needed its already static PS. ignore Claude its triggered at each change...it's quite spammy
{AV_CODEC_ID_AAC_LATM, "AAC"}}); const auto ms_hdrInfoMap = std::map<AVColorTransferCharacteristic, std::string_view>({ {AVCOL_TRC_SMPTE2084, "HDR10"}, {AVCOL_TRC_ARIB_STD_B67, "HLG"}, }); unsigned int SelectTranscodingSampleRate(const unsigned int sam...
@@ -117,6 +117,47 @@ unsigned int SelectTranscodingSampleRate(const unsigned int sampleRate) return 48000; } } + +static unsigned int ParseAACSampleRate(const uint8_t* data, size_t size)
xbmc/cores/VideoPlayer/MediaPipelineWebOS.cpp
26
C++
0.5
suggestion
108
51
51
false
webOS: pass AAC extradata to API as an array of ints
27,324
xbmc/xbmc
17,740
C++
CastagnaIT
cscd98
else if (audioHint.codec == AV_CODEC_ID_OPUS) { optInfo["opusInfo"]["channels"] = audioHint.channels; optInfo["opusInfo"]["frequency"] = audioHint.samplerate / 1000.0; optInfo["opusInfo"]["streamHeader"] = Base64::Encode(reinterpret_cast<const char*>(audioHint.extradata.GetData()), ...
I think in this case it makes more sense to store the value in audioHint.samplerate so that process info is also updated with this value
codecName = "DTSE"; if (audioHint.profile == AV_PROFILE_DTS_HD_MA_X || audioHint.profile == AV_PROFILE_DTS_HD_MA_X_IMAX) codecName = "DTSX"; } else if (audioHint.codec == AV_CODEC_ID_OPUS) { optInfo["opusInfo"]["channels"] = audioHint.channels; optInfo["opusInfo"]["frequency"] = au...
@@ -783,10 +815,34 @@ std::string CMediaPipelineWebOS::SetupAudio(CDVDStreamInfo& audioHint, CVariant& else if (audioHint.codec == AV_CODEC_ID_AAC || audioHint.codec == AV_CODEC_ID_AAC_LATM) { optInfo["aacInfo"]["channels"] = audioHint.channels; - optInfo["aacInfo"]["frequency"] = audioHint.samplerate / 1...
xbmc/cores/VideoPlayer/MediaPipelineWebOS.cpp
26
C++
0.286
suggestion
136
51
51
false
webOS: pass AAC extradata to API as an array of ints
27,324
xbmc/xbmc
17,740
C++
sundermann
cscd98
{ return StringUtils::CompareNoCase(a, b) < 0; }, &LCENTRY::name); if (it != TableISO639_1ByName.end() && StringUtils::EqualsNoCase(it->name, name)) return LongCodeToString(it->code); } { auto it = std::ranges::lower_bound( TableISO639_1_DeprByName, name, [](std::string_view a, std::st...
IMO "deprecated" and also the "non-preferred" (below on 6392) texts should be fully removed has no real meaning for end-users if an audio or subtitle track really use these, what does it matter if these are old language codes? also take in account that these lists can be used by python addons for their use cases ...
{ return StringUtils::CompareNoCase(a, b) < 0; }, &LCENTRY::name); if (it != TableISO639_1ByName.end() && StringUtils::EqualsNoCase(it->name, name)) return LongCodeToString(it->code); } { auto it = std::ranges::lower_bound( TableISO639_1_DeprByName, name, [](std::string_view a, std::st...
@@ -62,9 +62,13 @@ bool CIso639_1::ListLanguages(std::map<std::string, std::string>& langMap) [](const LCENTRY& e) { return std::make_pair(LongCodeToString(e.code), std::string{e.name}); }); - std::ranges::transform( - TableISO639_1_DeprByName, std::inserter(l...
xbmc/utils/i18n/Iso639_1.cpp
26
C++
0.643
suggestion
433
31
27
false
Fix languages lookup assert
27,357
xbmc/xbmc
17,740
C++
CastagnaIT
CrystalP
PyList tmpvec; std::unique_lock lock(m_vecPyList); for (PyList::iterator it = m_vecPyList.begin(); it != m_vecPyList.end();) { if (it->bDone) { tmpvec.push_back(*it); it = m_vecPyList.erase(it); m_vecPyList.hadSomethingRemoved = true; } else ++it; } lock.unlock(); ...
can you keep "python" just for clarity in log ```suggestion CLog::Log(LOGDEBUG, "initializing python script"); ```
PyList tmpvec; std::unique_lock lock(m_vecPyList); for (PyList::iterator it = m_vecPyList.begin(); it != m_vecPyList.end();) { if (it->bDone) { tmpvec.push_back(*it); it = m_vecPyList.erase(it); m_vecPyList.hadSomethingRemoved = true; } else ++it; } lock.unlock(); ...
@@ -470,59 +498,18 @@ bool XBPython::OnScriptInitialized(ILanguageInvoker* invoker) return false; XBMC_TRACE; - CLog::Log(LOGDEBUG, "initializing python engine."); + CLog::Log(LOGDEBUG, "initializing script");
xbmc/interfaces/python/XBPython.cpp
26
C++
1
bug
119
51
51
false
[Python] Call Py_Initialize from main thread
27,395
xbmc/xbmc
17,740
C++
CastagnaIT
sundermann
for (const CGUIString& line : lines) { if (m_lines.size() >= nMaxLines) return; if (line.m_text.empty()) // Blank line { m_lines.emplace_back(line); continue; } std::vector<character_t> tmp; tmp.reserve(line.m_text.size()); auto widthOf = [&](const std::vector<charact...
This loop could be replaced with an algorithm: ```suggestion it = std::find_if_not(it, line.m_text.end(), std::bind_front(&CGUITextLayout::CanWrapAtLetter, this)); ```
// lines can be split by last space char or if there are no spaces by character // to mimics the line behavior of word processors for (const CGUIString& line : lines) { if (m_lines.size() >= nMaxLines) return; if (line.m_text.empty()) // Blank line { m_lines.emplace_back(line); co...
@@ -579,63 +579,117 @@ void CGUITextLayout::WrapText(const vecText &text, float maxWidth) continue; } - vecText::const_iterator pos = line.m_text.begin(); - vecText::const_iterator lastBeginPos = line.m_text.begin(); - vecText::const_iterator lastSpacePos = line.m_text.end(); - vecText curLine...
xbmc/guilib/GUITextLayout.cpp
26
C++
1
suggestion
201
51
51
false
[guilib] Optimize text layout rendering by reducing font width calculation
27,403
xbmc/xbmc
17,740
C++
neo1973
sundermann
if (start == end) return 0.0f; tmp.assign(start, end); return m_font->GetTextWidth(tmp); }; auto skipLeadingSpaces = [&](vecText::const_iterator& it) { while (it != line.m_text.end() && CanWrapAtLetter(*it)) ++it; }; auto current = line.m_text.begin(); s...
This loop as well: ```suggestion const auto wordEnd = std::find_if(current, line.m_text.end(), std::bind_front(&CGUITextLayout::CanWrapAtLetter, this)); ```
const std::vector<character_t>::const_iterator end) -> float { if (start == end) return 0.0f; tmp.assign(start, end); return m_font->GetTextWidth(tmp); }; auto skipLeadingSpaces = [&](vecText::const_iterator& it) { it = std::find_if_not(it, line.m_...
@@ -579,63 +579,117 @@ void CGUITextLayout::WrapText(const vecText &text, float maxWidth) continue; } - vecText::const_iterator pos = line.m_text.begin(); - vecText::const_iterator lastBeginPos = line.m_text.begin(); - vecText::const_iterator lastSpacePos = line.m_text.end(); - vecText curLine...
xbmc/guilib/GUITextLayout.cpp
26
C++
1
suggestion
203
51
51
false
[guilib] Optimize text layout rendering by reducing font width calculation
27,403
xbmc/xbmc
17,740
C++
neo1973
sundermann
++wordEnd; const bool hasSpace = (wordEnd != line.m_text.end()); const float wordWidth = widthOf(current, wordEnd); const float spaceWidth = hasSpace ? widthOf(wordEnd, wordEnd + 1) : 0.0f; // Try to include word + trailing space if (currentWidth + wordWidth + spaceWidth <= maxWi...
Is the line 636 necessary? As we are at the end of a word isn't the next char a space and handled by `skipLeadingSpaces` anyway?
auto wordEnd = std::find_if(current, line.m_text.end(), std::bind_front(&CGUITextLayout::CanWrapAtLetter, this)); const bool hasSpace = (wordEnd != line.m_text.end()); const float wordWidth = widthOf(current, wordEnd); const float spaceWidth = hasSpace ? widthOf...
@@ -579,63 +579,117 @@ void CGUITextLayout::WrapText(const vecText &text, float maxWidth) continue; } - vecText::const_iterator pos = line.m_text.begin(); - vecText::const_iterator lastBeginPos = line.m_text.begin(); - vecText::const_iterator lastSpacePos = line.m_text.end(); - vecText curLine...
xbmc/guilib/GUITextLayout.cpp
26
C++
0.786
question
128
51
51
false
[guilib] Optimize text layout rendering by reducing font width calculation
27,403
xbmc/xbmc
17,740
C++
neo1973
sundermann
void SetRemoveDovi(bool value) { m_removeDovi = value; } void SetRemoveHdr10Plus(bool value) { m_removeHdr10Plus = value; } void SetDoviZeroLevel5(bool value) { m_setDoviZeroLevel5 = value; } static bool mpeg2_sequence_header(const uint8_t *data, const uint32_t size, mpeg2_sequence *sequence); protected...
```suggestion const DoviData* processDoviRpu(uint8_t* buf, uint32_t nalSize); ```
void SetRemoveDovi(bool value) { m_removeDovi = value; } void SetRemoveHdr10Plus(bool value) { m_removeHdr10Plus = value; } void SetDoviZeroLevel5(bool value) { m_setDoviZeroLevel5 = value; } static bool mpeg2_sequence_header(const uint8_t *data, const uint32_t size, mpeg2_sequence *sequence); protected...
@@ -123,6 +128,10 @@ class CBitstreamConverter uint32_t in_size, uint8_t nal_type); +#ifdef HAVE_LIBDOVI + const DoviData* processDoviRpu(uint8_t* buf, uint32_t nal_size);
xbmc/utils/BitstreamConverter.h
26
C/C++
0.857
suggestion
83
51
51
false
[Android] [webOS] Add Dolby Vision setting to set zero L5 metadata
27,431
xbmc/xbmc
17,740
C++
sundermann
quietvoid
fpsrate = 60000; fpsscale = 1000; break; } if (fpsscale != sequence->fps_scale || fpsrate != sequence->fps_rate) { changed = true; sequence->fps_rate = fpsrate; sequence->fps_scale = fpsscale; } } nal_start = nal_end; } return c...
```suggestion const DoviData* CBitstreamConverter::processDoviRpu(uint8_t* buf, uint32_t nalSize) ```
fpsrate = 60000; fpsscale = 1000; break; } if (fpsscale != sequence->fps_scale || fpsrate != sequence->fps_rate) { changed = true; sequence->fps_rate = fpsrate; sequence->fps_scale = fpsscale; } } nal_start = nal_end; } return c...
@@ -1334,3 +1306,50 @@ bool CBitstreamConverter::mpeg2_sequence_header(const uint8_t *data, const uint3 return changed; } +#ifdef HAVE_LIBDOVI +// Processes Dolby Vision RPU +// - Converts to profile 8.1 if `m_convert_dovi` is enabled +// - Sets level 5 metadata to 0 offsets if `m_setDoviZeroLevel5` is enable...
xbmc/utils/BitstreamConverter.cpp
26
C++
1
suggestion
101
51
51
false
[Android] [webOS] Add Dolby Vision setting to set zero L5 metadata
27,431
xbmc/xbmc
17,740
C++
sundermann
quietvoid
sequence->fps_rate = fpsrate; sequence->fps_scale = fpsscale; } } nal_start = nal_end; } return changed; } #ifdef HAVE_LIBDOVI // Processes Dolby Vision RPU // - Converts to profile 8.1 if `m_convert_dovi` is enabled // - Sets level 5 metadata to 0 offsets if `m_setDoviZeroLevel5...
```suggestion const DoviData* rpuData = NULL; ```
sequence->fps_rate = fpsrate; sequence->fps_scale = fpsscale; } } nal_start = nal_end; } return changed; } #ifdef HAVE_LIBDOVI // Processes Dolby Vision RPU // - Converts to profile 8.1 if `m_convert_dovi` is enabled // - Sets level 5 metadata to 0 offsets if `m_setDoviZeroLevel5...
@@ -1334,3 +1306,50 @@ bool CBitstreamConverter::mpeg2_sequence_header(const uint8_t *data, const uint3 return changed; } +#ifdef HAVE_LIBDOVI +// Processes Dolby Vision RPU +// - Converts to profile 8.1 if `m_convert_dovi` is enabled +// - Sets level 5 metadata to 0 offsets if `m_setDoviZeroLevel5` is enable...
xbmc/utils/BitstreamConverter.cpp
26
C++
1
suggestion
51
51
51
false
[Android] [webOS] Add Dolby Vision setting to set zero L5 metadata
27,431
xbmc/xbmc
17,740
C++
sundermann
quietvoid
data["property"]["subtitleenabled"] = m_processInfo->GetVideoSettings().m_SubtitleOn; } if (bStreamInfo) { int iStream = m_processInfo->GetVideoSettings().m_SubtitleStream; SubtitleStreamInfo info; GetSubtitleStreamInfo(iStream, info); if (info.valid) { CVariant contentEntry(CVariant...
const int stream = m_processInfo... please. Const and the type is not used as part of the variable name.
} int CVideoPlayer::GetSubtitle() { std::unique_lock lock(m_content.m_section); return m_content.m_subtitleIndex; } int CVideoPlayer::GetPrograms(std::vector<ProgramInfo>& programs) { std::unique_lock lock(m_content.m_section); programs = m_programs; return programs.size(); } void CVideoPlayer::SetProgram(...
@@ -5654,3 +5660,78 @@ void CVideoPlayer::SetUpdateStreamDetails() { m_messenger.Put(std::make_shared<CDVDMsg>(CDVDMsg::PLAYER_SET_UPDATE_STREAM_DETAILS)); } + + +void CVideoPlayer::NotifySubtitleUpdate(bool bStatus, bool bStreamInfo) +{ + CVariant data; + data["player"]["playerid"] = static_cast<int>(CServiceBr...
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
0.786
suggestion
104
51
51
false
JSON RPC : added notifications (Player.OnPropertyChanged) when video…
27,449
xbmc/xbmc
17,740
C++
CrystalP
albaintor
int iStream = m_processInfo->GetVideoSettings().m_AudioStream; GetAudioStreamInfo(iStream, info); if (info.valid) { CVariant data; data["player"]["playerid"] = static_cast<int>(CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist()); CVariant contentEntry(CVariant::VariantTypeObject); contentE...
const int stream = m_processInfo... please. Const and the type is not used as part of the variable name.
void CVideoPlayer::SetUpdateStreamDetails() { m_messenger.Put(std::make_shared<CDVDMsg>(CDVDMsg::PLAYER_SET_UPDATE_STREAM_DETAILS)); } void CVideoPlayer::NotifySubtitleUpdate(int flags) { CVariant data; data["player"]["playerid"] = m_item.GetProperty("playlist_type_hint").asInteger32(-1); if ((flags & Subtitl...
@@ -5654,3 +5660,78 @@ void CVideoPlayer::SetUpdateStreamDetails() { m_messenger.Put(std::make_shared<CDVDMsg>(CDVDMsg::PLAYER_SET_UPDATE_STREAM_DETAILS)); } + + +void CVideoPlayer::NotifySubtitleUpdate(bool bStatus, bool bStreamInfo) +{ + CVariant data; + data["player"]["playerid"] = static_cast<int>(CServiceBr...
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
0.786
suggestion
104
43
51
false
JSON RPC : added notifications (Player.OnPropertyChanged) when video…
27,449
xbmc/xbmc
17,740
C++
CrystalP
albaintor
if (bStreamInfo) { int iStream = m_processInfo->GetVideoSettings().m_SubtitleStream; SubtitleStreamInfo info; GetSubtitleStreamInfo(iStream, info); if (info.valid) { CVariant contentEntry(CVariant::VariantTypeObject); contentEntry["index"] = iStream; contentEntry["isdefault"] =...
could be just me, I prefer to structure like if (!info.valid) return; to exit early and remove an identation level. Same comment for NotifyVideoUpdate.
int CVideoPlayer::GetSubtitle() { std::unique_lock lock(m_content.m_section); return m_content.m_subtitleIndex; } int CVideoPlayer::GetPrograms(std::vector<ProgramInfo>& programs) { std::unique_lock lock(m_content.m_section); programs = m_programs; return programs.size(); } void CVideoPlayer::SetProgram(int...
@@ -5654,3 +5660,78 @@ void CVideoPlayer::SetUpdateStreamDetails() { m_messenger.Put(std::make_shared<CDVDMsg>(CDVDMsg::PLAYER_SET_UPDATE_STREAM_DETAILS)); } + + +void CVideoPlayer::NotifySubtitleUpdate(bool bStatus, bool bStreamInfo) +{ + CVariant data; + data["player"]["playerid"] = static_cast<int>(CServiceBr...
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
0.5
suggestion
156
51
51
false
JSON RPC : added notifications (Player.OnPropertyChanged) when video…
27,449
xbmc/xbmc
17,740
C++
CrystalP
albaintor
int CVideoPlayer::GetPrograms(std::vector<ProgramInfo>& programs) { std::unique_lock lock(m_content.m_section); programs = m_programs; return programs.size(); } void CVideoPlayer::SetProgram(int progId) { m_messenger.Put(std::make_shared<CDVDMsgInt>(CDVDMsg::PLAYER_SET_PROGRAM, progId)); } int CVideoPlayer::...
Given the current usage, I think there should be a single enum parameter, something like enum class SubtitleChange { STATUS_CHANGE, STREAMINFO_CHANGE, };
info.valid = false; info.language.clear(); info.flags = StreamFlags::FLAG_NONE; return; } const SelectionStream& s = m_content.m_selectionStreams.Get(StreamType::SUBTITLE, index); info.name = s.name; if (s.type == StreamType::NONE) info.name += "(Invalid)"; info.valid = true; info.lan...
@@ -5654,3 +5660,78 @@ void CVideoPlayer::SetUpdateStreamDetails() { m_messenger.Put(std::make_shared<CDVDMsg>(CDVDMsg::PLAYER_SET_UPDATE_STREAM_DETAILS)); } + + +void CVideoPlayer::NotifySubtitleUpdate(bool bStatus, bool bStreamInfo)
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
0.5
suggestion
160
51
51
false
JSON RPC : added notifications (Player.OnPropertyChanged) when video…
27,449
xbmc/xbmc
17,740
C++
CrystalP
albaintor
int stream = m_processInfo->GetVideoSettings().m_AudioStream; GetAudioStreamInfo(stream, info); if (!info.valid) return; CVariant data; data["player"]["playerid"] = static_cast<int>(CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist()); CVariant contentEntry(CVariant::VariantTypeObject); contentEntry[...
OK but this doesn't follow the standard formatting for the project (other places in the PR as well) Normally Jenkins provides a diff of the required change, I don't know why it doesn't appear for this PR. You can also run clang-format yourself on your changes.
} void CVideoPlayer::SetUpdateStreamDetails() { m_messenger.Put(std::make_shared<CDVDMsg>(CDVDMsg::PLAYER_SET_UPDATE_STREAM_DETAILS)); } void CVideoPlayer::NotifySubtitleUpdate(int flags) { CVariant data; data["player"]["playerid"] = m_item.GetProperty("playlist_type_hint").asInteger32(-1); if ((flags & Subti...
@@ -5654,3 +5660,73 @@ void CVideoPlayer::SetUpdateStreamDetails() { m_messenger.Put(std::make_shared<CDVDMsg>(CDVDMsg::PLAYER_SET_UPDATE_STREAM_DETAILS)); } + + +void CVideoPlayer::NotifySubtitleUpdate(int flags) +{ + CVariant data; + data["player"]["playerid"] = static_cast<int>(CServiceBroker::GetPlaylistPlay...
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
0.571
suggestion
262
39
51
false
JSON RPC : added notifications (Player.OnPropertyChanged) when video…
27,449
xbmc/xbmc
17,740
C++
CrystalP
albaintor
std::span<const character_t> text, uint32_t alignment, float maxPixelWidth, bool scrolling, const TransformMatrix& matrix, float scaleX, float scaleY) : m_pos(pos), m_colors(col...
Can you use `std::vector<character_t>` here?
std::span<const character_t> text, uint32_t alignment, float maxPixelWidth, bool scrolling, const TransformMatrix& matrix, float scaleX, float scaleY) : m_pos(pos), m_colors(col...
@@ -75,18 +76,23 @@ template<class Position, class Value> struct CGUIFontCacheEntry { const CGUIFontCache<Position, Value>& m_cache; - CGUIFontCacheKey<Position> m_key; + std::vector<KODI::UTILS::COLOR::Color> m_color; + vecText m_text;
xbmc/guilib/GUIFontCache.h
26
C/C++
0.5
question
44
51
51
false
[GUI] Switch font releated APIs to `std::span`
27,452
xbmc/xbmc
17,740
C++
sundermann
neo1973
{ if (!ResolveStack()) return false; m_player.clear(); restart = true; } // Ensure the MIME type has been retrieved for http:// and shout:// streams if (m_item.GetMimeType().empty()) m_item.FillInMimeType(); if (VIDEO::IsDiscStub(m_item)) return true; if (PLAYLIST::IsPlayList(m...
Small issue which I think is related to the return value here. In the original code in CApplication returned true here. I remember puzzling over this but it was needed. I think it causes this issue - which is present with this PR, but not without. 1) Enable play next video automatically for episodes. 2) Play the firs...
if (!ResolveStack()) return GatherPlaybackDetailsResult::RESULT_ERROR; m_player.clear(); restart = true; } // Ensure the MIME type has been retrieved for http:// and shout:// streams if (m_item.GetMimeType().empty()) m_item.FillInMimeType(); if (VIDEO::IsDiscStub(m_item)) return Gat...
@@ -276,37 +274,81 @@ bool ShouldGoFullScreen(PlayMediaType mediaType) settings->GetSettings()->GetBool(CSettings::SETTING_MUSICFILES_SELECTACTION); case VIDEO: return fullScreenOnMovieStart; + default: + break; } return false; // should never reach here } } // namespace -v...
xbmc/application/ApplicationPlay.cpp
26
C++
0.929
suggestion
1,155
37
36
false
[application] Refactor CApplicationPlay.
27,454
xbmc/xbmc
17,740
C++
78andyp
ksooo
return supported; } bool CAESinkAUDIOTRACK::IsSupported(int sampleRateInHz, int channelConfig, int encoding) { int ret = CJNIAudioTrack::getMinBufferSize( sampleRateInHz, channelConfig, encoding); return (ret > 0); } bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device) { // try to...
A cosmetic thing is that since now is called always Deinitialize() preventively (which is good) is is displayed the log message "CAESinkAUDIOTRACK::Deinitialize" even the first time. Maybe move the log line: CLog::Log(LOGDEBUG, "CAESinkAUDIOTRACK::Deinitialize"); after ``` if (!m_at_jni) return; ```...
return supported; } bool CAESinkAUDIOTRACK::IsSupported(int sampleRateInHz, int channelConfig, int encoding) { int ret = CJNIAudioTrack::getMinBufferSize( sampleRateInHz, channelConfig, encoding); return (ret > 0); } bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device) { // try to...
@@ -276,11 +276,8 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device) m_info = m_info_iec; m_format = format; - m_headPos = 0; + Deinitialize();
xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
26
C++
1
bug
407
51
51
false
AESinkAudiotrack: Stop potential leakage
27,464
xbmc/xbmc
17,740
C++
thexai
fritsch
} m_format.m_frames = static_cast<int>(period_size / m_format.m_frameSize); CLog::Log(LOGINFO, "Audiotrack buffer params are: period time = {:.3f} ms, period size = " "{} bytes, num periods = {}", period_time * 1000, period_size, m_min_buffer_size / per...
This seems redundant now because is only two code paths and both calls Deinitialize() anyway: 1. ~Retry path --> code reaches `continue;` go to top and call Deinitialize/Initialize again.~ 2. Error path --> "Unable to create AudioTrack" is called Deinitialize() directly.
CLog::Log(LOGINFO, "Audiotrack buffer params are: period time = {:.3f} ms, period size = " "{} bytes, num periods = {}", period_time * 1000, period_size, m_min_buffer_size / period_size); } if (m_passthrough && !m_info.m_wantsIECPassthrough) m_audiot...
@@ -555,6 +552,8 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device) if (!IsInitialized()) { + delete m_at_jni; + m_at_jni = NULL;
xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
26
C++
1
suggestion
278
51
51
false
AESinkAudiotrack: Stop potential leakage
27,464
xbmc/xbmc
17,740
C++
thexai
fritsch
// Get current playlist info const auto playlistId{CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist()}; // Determine fullscreen status based on media type and playlist using enum PlayMediaType; if (MUSIC::IsAudio(m_item) && playlistId == PLAYLIST::Id::TYPE_MUSIC) m_options.fullscreen = ShouldGoFull...
I would slightly prefer `std::string` by value and then move-assigning from it.
// Get current playlist info const auto playlistId{CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist()}; // Determine fullscreen status based on media type and playlist using enum PlayMediaType; if (MUSIC::IsAudio(m_item) && playlistId == PLAYLIST::Id::TYPE_MUSIC) m_options.fullscreen = ShouldGoFull...
@@ -309,7 +309,7 @@ void CApplicationPlay::DetermineFullScreen() } CApplicationPlay::GatherPlaybackDetailsResult CApplicationPlay::GatherPlaybackDetails( - const CFileItem& item, const std::string& player, bool restart) + const CFileItem& item, std::string_view player, bool restart)
xbmc/application/ApplicationPlay.cpp
26
C++
0.571
suggestion
79
51
51
false
Fix random SonarQube findings introduced since September 1 2025
27,509
xbmc/xbmc
17,740
C++
neo1973
ksooo
if (bytes.size() < offset + 2) throw std::out_of_range("Not enough bytes to extract a WORD"); return static_cast<uint16_t>(std::to_integer<uint16_t>(bytes[offset + 1]) | std::to_integer<uint16_t>(bytes[offset]) << 8); } constexpr uint8_t GetByte(const std::span<std::byte> bytes, ...
While you are on it, maybe change this to `std::span<std::byte> buffer`. It's supposed to be a value type like `std::string_view`.
if (bytes.size() < offset + 2) throw std::out_of_range("Not enough bytes to extract a WORD"); return static_cast<uint16_t>(std::to_integer<uint16_t>(bytes[offset + 1]) | std::to_integer<uint16_t>(bytes[offset]) << 8); } constexpr uint8_t GetByte(const std::span<std::byte> bytes, ...
@@ -84,17 +84,10 @@ inline std::string GetString(const std::span<std::byte> bytes, class BitReader { - const std::byte* data; - uint32_t size; - uint32_t offset; - uint32_t bitPosition; - public: - BitReader(const std::span<std::byte>& buffer) - : data(buffer.data()), - size(static_cast<uint32_t>(buff...
xbmc/filesystem/bluray/BitReader.h
26
C/C++
1
suggestion
130
51
51
false
Fix random SonarQube findings introduced since September 1 2025
27,509
xbmc/xbmc
17,740
C++
neo1973
ksooo
ass_renderer_done(m_renderer); ass_library_done(m_library); } void CDVDSubtitlesLibass::Configure() { CLog::Log(LOGINFO, "CDVDSubtitlesLibass: Initializing ASS library font settings"); if (!m_renderer) { CLog::Log(LOGERROR, "CDVDSubtitlesLibass: Failed to initialize ASS font settings. ASS renderer " ...
> // Use fontconfig with custom config pointing to Android system fonts. All following code is clearly a _workaround / hack_ since Libass does not currently support native Android "fontconfig", this must be clearly specified, so instead to remove in full the original comment, it must be readapted > // Fontconfig ...
ass_free_track(m_track); ass_renderer_done(m_renderer); ass_library_done(m_library); } void CDVDSubtitlesLibass::Configure() { CLog::Log(LOGINFO, "CDVDSubtitlesLibass: Initializing ASS library font settings"); if (!m_renderer) { CLog::Log(LOGERROR, "CDVDSubtitlesLibass: Failed to initialize ASS font...
@@ -92,11 +92,93 @@ void CDVDSubtitlesLibass::Configure() ass_set_margins(m_renderer, 0, 0, 0, 0); ass_set_use_margins(m_renderer, 0); - // Libass uses system font provider (like fontconfig) by default in some - // platforms (e.g. linux/windows), on some other systems like android the - // font provider is c...
xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp
26
C++
0.643
suggestion
464
51
51
false
[Android][libass] Enable fontconfig for libass to support all language scripts in subtitles
27,517
xbmc/xbmc
17,740
C++
CastagnaIT
naseef
StringUtils::Replace(escapedSystemFontsDir, "'", "&apos;"); std::string escapedCacheDir = fontconfigCacheDir; StringUtils::Replace(escapedCacheDir, "&", "&amp;"); StringUtils::Replace(escapedCacheDir, "<", "&lt;"); StringUtils::Replace(escapedCacheDir, ">", "&gt;"); StringUtils::Replace(escapedCacheDir, "\...
all XML code should be created by using the appropriate XML library and so escaping should not required (and in any case, an escape function should not be implemented here)
tinyxml2::XMLElement* eRoot = xmlDoc.NewElement("fontconfig"); xmlDoc.InsertEndChild(eRoot); auto addRootChildText = [&](const char* name, const std::string& value) { tinyxml2::XMLElement* elem = xmlDoc.NewElement(name); elem->SetText(value.c_str()); eRoot->InsertEndChild(elem); }...
@@ -92,11 +92,93 @@ void CDVDSubtitlesLibass::Configure() ass_set_margins(m_renderer, 0, 0, 0, 0); ass_set_use_margins(m_renderer, 0); - // Libass uses system font provider (like fontconfig) by default in some - // platforms (e.g. linux/windows), on some other systems like android the - // font provider is c...
xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp
26
C++
0.5
security
172
51
51
false
[Android][libass] Enable fontconfig for libass to support all language scripts in subtitles
27,517
xbmc/xbmc
17,740
C++
CastagnaIT
naseef
StringUtils::Replace(escapedSystemFontsDir, "&", "&amp;"); StringUtils::Replace(escapedSystemFontsDir, "<", "&lt;"); StringUtils::Replace(escapedSystemFontsDir, ">", "&gt;"); StringUtils::Replace(escapedSystemFontsDir, "\"", "&quot;"); StringUtils::Replace(escapedSystemFontsDir, "'", "&apos;"); std::string...
Some of these paths may not exist because brands do not always follow standards, if there is any documentation regarding these paths, it would be best to mention it
CXBMCTinyXML2 xmlDoc; xmlDoc.InsertEndChild(xmlDoc.NewDeclaration("xml version=\"1.0\"")); xmlDoc.InsertEndChild(xmlDoc.NewUnknown("DOCTYPE fontconfig SYSTEM \"fonts.dtd\"")); tinyxml2::XMLElement* eRoot = xmlDoc.NewElement("fontconfig"); xmlDoc.InsertEndChild(eRoot); auto addRootChildText = [...
@@ -92,11 +92,93 @@ void CDVDSubtitlesLibass::Configure() ass_set_margins(m_renderer, 0, 0, 0, 0); ass_set_use_margins(m_renderer, 0); - // Libass uses system font provider (like fontconfig) by default in some - // platforms (e.g. linux/windows), on some other systems like android the - // font provider is c...
xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp
26
C++
0.5
suggestion
165
51
51
false
[Android][libass] Enable fontconfig for libass to support all language scripts in subtitles
27,517
xbmc/xbmc
17,740
C++
CastagnaIT
naseef
" <dir>/product/fonts</dir>\n" " <dir>/system_ext/fonts</dir>\n" " <dir>/vendor/fonts</dir>\n" " <cachedir>" + escapedCacheDir + "</cach...
```suggestion CLog::LogF(LOGERROR, "Failed to create fontconfig configuration, falling back to ASS_FONTPROVIDER_AUTODETECT"); ```
{ if (XFILE::CDirectory::Exists(dir)) addRootChildText("dir", dir); } addRootChildText("cachedir", fontconfigCacheDir); if (xmlDoc.SaveFile(fontconfigPath)) { fontconfigConfig = fontconfigPath.c_str(); CLog::Log(LOGINFO, "CDVDSubtitlesLibass: Created fontconfig configurat...
@@ -92,11 +92,93 @@ void CDVDSubtitlesLibass::Configure() ass_set_margins(m_renderer, 0, 0, 0, 0); ass_set_use_margins(m_renderer, 0); - // Libass uses system font provider (like fontconfig) by default in some - // platforms (e.g. linux/windows), on some other systems like android the - // font provider is c...
xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp
26
C++
1
bug
137
51
51
false
[Android][libass] Enable fontconfig for libass to support all language scripts in subtitles
27,517
xbmc/xbmc
17,740
C++
CastagnaIT
naseef
StringUtils::Replace(escapedCacheDir, ">", "&gt;"); StringUtils::Replace(escapedCacheDir, "\"", "&quot;"); StringUtils::Replace(escapedCacheDir, "'", "&apos;"); std::string fontconfigXml = "<?xml version=\"1.0\"?>\n" "<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">\n" ...
```suggestion CLog::LogF(LOGINFO, "Created fontconfig configuration at {}", fontconfigPath); ```
tinyxml2::XMLElement* elem = xmlDoc.NewElement(name); elem->SetText(value.c_str()); eRoot->InsertEndChild(elem); }; // Add Android system font directories // Note: USER and SYSTEM dirs are handled by ass_set_fonts_dir below const std::vector<std::string> fontDirs = { "/system/...
@@ -92,11 +92,93 @@ void CDVDSubtitlesLibass::Configure() ass_set_margins(m_renderer, 0, 0, 0, 0); ass_set_use_margins(m_renderer, 0); - // Libass uses system font provider (like fontconfig) by default in some - // platforms (e.g. linux/windows), on some other systems like android the - // font provider is c...
xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp
26
C++
1
suggestion
121
51
51
false
[Android][libass] Enable fontconfig for libass to support all language scripts in subtitles
27,517
xbmc/xbmc
17,740
C++
CastagnaIT
naseef
throw std::runtime_error("Libass render failed to initialize"); } CDVDSubtitlesLibass::~CDVDSubtitlesLibass() { if (m_track) ass_free_track(m_track); ass_renderer_done(m_renderer); ass_library_done(m_library); } void CDVDSubtitlesLibass::Configure() { CLog::Log(LOGINFO, "CDVDSubtitlesLibass: Initializ...
i think this can be restored as it was on original code? (variable not needed)
throw std::runtime_error("Libass render failed to initialize"); } CDVDSubtitlesLibass::~CDVDSubtitlesLibass() { if (m_track) ass_free_track(m_track); ass_renderer_done(m_renderer); ass_library_done(m_library); } void CDVDSubtitlesLibass::Configure() { CLog::Log(LOGINFO, "CDVDSubtitlesLibass: Initializ...
@@ -92,11 +93,75 @@ void CDVDSubtitlesLibass::Configure() ass_set_margins(m_renderer, 0, 0, 0, 0); ass_set_use_margins(m_renderer, 0); - // Libass uses system font provider (like fontconfig) by default in some - // platforms (e.g. linux/windows), on some other systems like android the - // font provider is c...
xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp
26
C++
0.143
suggestion
78
51
51
false
[Android][libass] Enable fontconfig for libass to support all language scripts in subtitles
27,517
xbmc/xbmc
17,740
C++
CastagnaIT
naseef
eRoot->InsertEndChild(elem); }; // Add Android system font directories // Note: USER and SYSTEM dirs are handled by ass_set_fonts_dir below const std::vector<std::string> fontDirs = { "/system/fonts", // AOSP standard "/product/fonts", // AOSP vendor-specific "/system_ext/fonts" /...
now that im testing this was better as ```suggestion CLog::Log(LOGINFO, "CDVDSubtitlesLibass: Created fontconfig configuration at {}", fontconfigPath); ```
tinyxml2::XMLElement* eRoot = xmlDoc.NewElement("fontconfig"); xmlDoc.InsertEndChild(eRoot); auto addRootChildText = [&](const char* name, const std::string& value) { tinyxml2::XMLElement* elem = xmlDoc.NewElement(name); elem->SetText(value.c_str()); eRoot->InsertEndChild(elem); }...
@@ -92,10 +93,73 @@ void CDVDSubtitlesLibass::Configure() ass_set_margins(m_renderer, 0, 0, 0, 0); ass_set_use_margins(m_renderer, 0); - // Libass uses system font provider (like fontconfig) by default in some - // platforms (e.g. linux/windows), on some other systems like android the - // font provider is c...
xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp
26
C++
1
suggestion
163
51
51
false
[Android][libass] Enable fontconfig for libass to support all language scripts in subtitles
27,517
xbmc/xbmc
17,740
C++
CastagnaIT
naseef
{ tinyxml2::XMLElement* elem = xmlDoc.NewElement(name); elem->SetText(value.c_str()); eRoot->InsertEndChild(elem); }; // Add Android system font directories // Note: USER and SYSTEM dirs are handled by ass_set_fonts_dir below const std::vector<std::string> fontDirs = { "/system/fonts", // A...
...not like that, this way the above code related to xml is executed without real use, should be moved
xmlDoc.InsertEndChild(xmlDoc.NewUnknown("DOCTYPE fontconfig SYSTEM \"fonts.dtd\"")); tinyxml2::XMLElement* eRoot = xmlDoc.NewElement("fontconfig"); xmlDoc.InsertEndChild(eRoot); auto addRootChildText = [&](const char* name, const std::string& value) { tinyxml2::XMLElement* elem = xmlDoc.NewE...
@@ -92,10 +93,81 @@ void CDVDSubtitlesLibass::Configure() ass_set_margins(m_renderer, 0, 0, 0, 0); ass_set_use_margins(m_renderer, 0); - // Libass uses system font provider (like fontconfig) by default in some - // platforms (e.g. linux/windows), on some other systems like android the - // font provider is c...
xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp
26
C++
0.5
suggestion
103
51
51
false
[Android][libass] Enable fontconfig for libass to support all language scripts in subtitles
27,517
xbmc/xbmc
17,740
C++
CastagnaIT
naseef
if (!m_renderer) { CLog::Log(LOGERROR, "CDVDSubtitlesLibass: Failed to initialize ASS font settings. ASS renderer " "not initialized."); return; } ass_set_margins(m_renderer, 0, 0, 0, 0); ass_set_use_margins(m_renderer, 0); int fontProvider = ASS_FONTPROVIDER_AUTODETECT; ...
``` if (!XFILE::CDirectory::Exists(fontconfigCacheDir)) XFILE::CDirectory::Create(fontconfigCacheDir); ```
if (!m_renderer) { CLog::Log(LOGERROR, "CDVDSubtitlesLibass: Failed to initialize ASS font settings. ASS renderer " "not initialized."); return; } ass_set_margins(m_renderer, 0, 0, 0, 0); ass_set_use_margins(m_renderer, 0); int fontProvider = ASS_FONTPROVIDER_AUTODETECT; ...
@@ -92,10 +93,81 @@ void CDVDSubtitlesLibass::Configure() ass_set_margins(m_renderer, 0, 0, 0, 0); ass_set_use_margins(m_renderer, 0); - // Libass uses system font provider (like fontconfig) by default in some - // platforms (e.g. linux/windows), on some other systems like android the - // font provider is c...
xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp
26
C++
0.786
performance
111
51
51
false
[Android][libass] Enable fontconfig for libass to support all language scripts in subtitles
27,517
xbmc/xbmc
17,740
C++
CastagnaIT
naseef
if (HLunaServiceCall(LUNA_GET_CONFIG, payload.c_str(), &requestContext)) { CLog::LogF(LOGWARNING, "Luna get config request call failed"); } } int WebOSTVPlatformConfig::GetWebOSVersion() { return ms_config[PLATFORM_CODE].asInteger(); } bool WebOSTVPlatformConfig::SupportsDTS() { return ms_config[EDID_TY...
The luna request should be `multiple = true` so we get notified if the ARC status changes. So basically make the context a member variable so it's not queried again whenever the function is called.
if (HLunaServiceCall(LUNA_GET_CONFIG, payload.c_str(), &requestContext)) { CLog::LogF(LOGWARNING, "Luna get config request call failed"); } } int WebOSTVPlatformConfig::GetWebOSVersion() { return ms_config[PLATFORM_CODE].asInteger(); } bool WebOSTVPlatformConfig::SupportsDTS() { return ms_config[EDID_TY...
@@ -75,3 +81,59 @@ bool WebOSTVPlatformConfig::SupportsHDR() { return ms_config[SUPPORT_HDR].asBoolean(); } + +void WebOSTVPlatformConfig::LoadARCStatus() +{ + HContext requestContext; + requestContext.pub = true; + requestContext.multiple = false;
xbmc/platform/linux/WebOSTVPlatformConfig.cpp
26
C++
0.714
suggestion
197
51
51
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
if (caps[i].asString() == DDPLUS) { ddplusSupported = true; break; } } } } ms_config[SUPPORT_EARCDDPlus] = ddplusSupported; return true; }; std::string payload = "{}"; constexpr const char* LUNA_ARC_STATUS = "luna://com.webos.servi...
Don't query here always. Also the luna call is not guaranteed to finish synchronously so this can be potentially unsafe
/* * Copyright (C) 2025 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 "WebOSTVPlatformConfig.h" #include "utils/JSONVariantParser.h" #include "utils/JSONVariantWriter.h" #include "utils/Variant...
@@ -75,3 +81,59 @@ bool WebOSTVPlatformConfig::SupportsHDR() { return ms_config[SUPPORT_HDR].asBoolean(); } + +void WebOSTVPlatformConfig::LoadARCStatus() +{ + HContext requestContext; + requestContext.pub = true; + requestContext.multiple = false; + requestContext.callback = [](LSHandle* sh, LSMessage* msg, v...
xbmc/platform/linux/WebOSTVPlatformConfig.cpp
26
C++
0.286
suggestion
119
29
125
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
const std::string arcActivation = parsed[EARC_ACTIVATION].asString(); bool ddplusSupported = false; if (arcActivation == EARC) { const CVariant& caps = parsed[EARC_CAPABILITY]; if (caps.isArray()) { for (unsigned int i = 0; i < caps.size(); ++i) { if (caps[i]...
Put into anonymous namespace with the other luna URL
/* * Copyright (C) 2025 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 "WebOSTVPlatformConfig.h" #include "utils/JSONVariantParser.h" #include "utils/JSONVariantWriter.h" #include "utils/Variant...
@@ -75,3 +81,59 @@ bool WebOSTVPlatformConfig::SupportsHDR() { return ms_config[SUPPORT_HDR].asBoolean(); } + +void WebOSTVPlatformConfig::LoadARCStatus() +{ + HContext requestContext; + requestContext.pub = true; + requestContext.multiple = false; + requestContext.callback = [](LSHandle* sh, LSMessage* msg, v...
xbmc/platform/linux/WebOSTVPlatformConfig.cpp
26
C++
0.143
suggestion
52
39
125
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
if (arcActivation == EARC) { const CVariant& caps = parsed[EARC_CAPABILITY]; if (caps.isArray()) { for (unsigned int i = 0; i < caps.size(); ++i) { if (caps[i].asString() == DDPLUS) { ddplusSupported = true; break; } ...
```suggestion if (HLunaServiceCall(LUNA_ARC_STATUS, "{}", &requestContext)) ```
/* * Copyright (C) 2025 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 "WebOSTVPlatformConfig.h" #include "utils/JSONVariantParser.h" #include "utils/JSONVariantWriter.h" #include "utils/Variant...
@@ -75,3 +81,59 @@ bool WebOSTVPlatformConfig::SupportsHDR() { return ms_config[SUPPORT_HDR].asBoolean(); } + +void WebOSTVPlatformConfig::LoadARCStatus() +{ + HContext requestContext; + requestContext.pub = true; + requestContext.multiple = false; + requestContext.callback = [](LSHandle* sh, LSMessage* msg, v...
xbmc/platform/linux/WebOSTVPlatformConfig.cpp
26
C++
0.857
suggestion
81
37
125
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
std::string message = HLunaServiceMessage(msg); CLog::LogF(LOGDEBUG, "ARC controller: {}", message); CVariant parsed; if (!CJSONVariantParser::Parse(message, parsed)) { CLog::LogF(LOGERROR, "Failed to parse ARC controller JSON"); return false; } const std::string arcActivation ...
~~Can this not use `std::ranges::contains`?~~ Use `std::find` in C++20
std::string message = HLunaServiceMessage(msg); CLog::LogF(LOGDEBUG, "ARC controller: {}", message); CVariant parsed; if (!CJSONVariantParser::Parse(message, parsed)) { CLog::LogF(LOGERROR, "Failed to parse ARC controller JSON"); return false; } const std::string arcActivation ...
@@ -75,3 +81,59 @@ bool WebOSTVPlatformConfig::SupportsHDR() { return ms_config[SUPPORT_HDR].asBoolean(); } + +void WebOSTVPlatformConfig::LoadARCStatus() +{ + HContext requestContext; + requestContext.pub = true; + requestContext.multiple = false; + requestContext.callback = [](LSHandle* sh, LSMessage* msg, v...
xbmc/platform/linux/WebOSTVPlatformConfig.cpp
26
C++
0.571
suggestion
70
49
34
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
if (!CJSONVariantParser::Parse(message, parsed)) { CLog::LogF(LOGERROR, "Failed to parse ARC controller JSON"); return false; } const std::string arcActivation = parsed[EARC_ACTIVATION].asString(); bool ddplusSupported = false; if (arcActivation == EARC) { const CVariant&...
Please don't use `ms_config` and parse into a dedicated member `std::atomic<bool>`
if (!CJSONVariantParser::Parse(message, parsed)) { CLog::LogF(LOGERROR, "Failed to parse ARC controller JSON"); return false; } const std::string arcActivation = parsed[ARC_ACTIVATION].asString(); if (arcActivation == EARC) { const CVariant& caps = parsed[EARC_CAPABILITY]; ...
@@ -75,3 +81,59 @@ bool WebOSTVPlatformConfig::SupportsHDR() { return ms_config[SUPPORT_HDR].asBoolean(); } + +void WebOSTVPlatformConfig::LoadARCStatus() +{ + HContext requestContext; + requestContext.pub = true; + requestContext.multiple = false; + requestContext.callback = [](LSHandle* sh, LSMessage* msg, v...
xbmc/platform/linux/WebOSTVPlatformConfig.cpp
26
C++
0.571
suggestion
82
45
30
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
std::atomic<bool> m_needsTranscode{false}; std::atomic<std::chrono::nanoseconds> m_pts{std::chrono::nanoseconds(0)}; VideoPicture m_picture{}; std::unique_ptr<StarfishMediaAPIs> m_mediaAPIs; CDVDStreamInfo m_audioHint; CDVDStreamInfo m_videoHint; std::unique_ptr<CBitstreamConverter> m_bitstream{nullptr}; ...
Is it necessary caching this here?
std::atomic<bool> m_needsTranscode{false}; std::atomic<std::chrono::nanoseconds> m_pts{std::chrono::nanoseconds(0)}; VideoPicture m_picture{}; std::unique_ptr<StarfishMediaAPIs> m_mediaAPIs; CDVDStreamInfo m_audioHint; CDVDStreamInfo m_videoHint; std::unique_ptr<CBitstreamConverter> m_bitstream{nullptr}; ...
@@ -417,6 +417,7 @@ class CMediaPipelineWebOS final : public CThread CDVDClock& m_clock; CDVDOverlayContainer& m_overlayContainer; bool m_hasAudio{true}; + bool m_eARCSupported{false};
xbmc/cores/VideoPlayer/MediaPipelineWebOS.h
26
C/C++
0.071
question
34
37
36
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
layout.Reset(); if (ffmap & AV_CH_FRONT_LEFT ) layout += AE_CH_FL ; if (ffmap & AV_CH_FRONT_RIGHT ) layout += AE_CH_FR ; if (ffmap & AV_CH_FRONT_CENTER ) layout += AE_CH_FC ; if (ffmap & AV_CH_LOW_FREQUENCY ) layout += AE_CH_LFE ; if (ffmap & AV_CH_BACK_LEFT )...
Can we carry this information instead in `format.m_streamInfo`? If set, it should overrule any setting like `SETTING_AUDIOOUTPUT_AC3PASSTHROUGH` or `SETTING_AUDIOOUTPUT_EAC3PASSTHROUGH` because we can actually query for support on webOS.
layout.Reset(); if (ffmap & AV_CH_FRONT_LEFT ) layout += AE_CH_FL ; if (ffmap & AV_CH_FRONT_RIGHT ) layout += AE_CH_FR ; if (ffmap & AV_CH_FRONT_CENTER ) layout += AE_CH_FC ; if (ffmap & AV_CH_LOW_FREQUENCY ) layout += AE_CH_LFE ; if (ffmap & AV_CH_BACK_LEFT )...
@@ -85,17 +86,29 @@ unsigned int CAEEncoderFFmpeg::BuildChannelLayout(const int64_t ffmap, CAEChanne return layout.Count(); } -bool CAEEncoderFFmpeg::Initialize(AEAudioFormat &format, bool allow_planar_input) +bool CAEEncoderFFmpeg::Initialize(AEAudioFormat& format, + bool allow_p...
xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp
26
C++
0.786
question
237
51
51
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
/* * Copyright (C) 2025 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 "WebOSTVPlatformConfig.h" #include "utils/JSONVariantParser.h" #include "utils/JSONVariantWriter.h" #include "utils/Variant...
For a proper cleanup we need to call `HUnregisterServiceCallback` when finished. The easiest way would be to wrap this in a `std::unique_ptr` with a custom destructor that calls the function. Also declare as static inline to avoid the definition
/* * Copyright (C) 2025 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 "WebOSTVPlatformConfig.h" #include "utils/JSONVariantParser.h" #include "utils/JSONVariantWriter.h" #include "utils/Variant...
@@ -13,7 +13,8 @@ #include "utils/Variant.h" #include "utils/log.h" -#include <webos-helpers/libhelpers.h> +HContext WebOSTVPlatformConfig::m_requestContextARC{};
xbmc/platform/linux/WebOSTVPlatformConfig.cpp
16
C++
0.786
suggestion
245
41
41
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
/* * Copyright (C) 2025 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 "WebOSTVPlatformConfig.h" #include "utils/JSONVariantParser.h" #include "utils/JSONVariantWriter.h" #include "utils/Variant...
I think you can declare the variable inline static and get rid of the additional definition from C++17 onwards
/* * Copyright (C) 2025 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 "WebOSTVPlatformConfig.h" #include "utils/JSONVariantParser.h" #include "utils/JSONVariantWriter.h" #include "utils/Variant...
@@ -13,7 +13,8 @@ #include "utils/Variant.h" #include "utils/log.h" -#include <webos-helpers/libhelpers.h> +HContext WebOSTVPlatformConfig::m_requestContextARC{}; +std::atomic<bool> WebOSTVPlatformConfig::m_ddPlusSupported{false};
xbmc/platform/linux/WebOSTVPlatformConfig.cpp
17
C++
0.286
suggestion
110
42
42
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
{ auto* self = static_cast<WebOSTVPlatformConfig*>(ctx); std::string message = HLunaServiceMessage(msg); CLog::LogF(LOGDEBUG, "ARC controller: {}", message); CVariant parsed; if (!CJSONVariantParser::Parse(message, parsed)) { CLog::LogF(LOGERROR, "Failed to parse ARC controller JSON"); ...
```suggestion self->m_ddPlusSupported = caps.isArray() && std::any_of(caps.begin_array(), caps.end_array(), [](const CVariant& v) { return v.asString() == DDPLUS; }); ```
CLog::LogF(LOGDEBUG, "ARC controller: {}", message); CVariant parsed; if (!CJSONVariantParser::Parse(message, parsed)) { CLog::LogF(LOGERROR, "Failed to parse ARC controller JSON"); return false; } const std::string arcActivation = parsed[ARC_ACTIVATION].asString(); if (arcAct...
@@ -75,3 +84,50 @@ bool WebOSTVPlatformConfig::SupportsHDR() { return ms_config[SUPPORT_HDR].asBoolean(); } + +void WebOSTVPlatformConfig::LoadARCStatus() +{ + m_requestContextARC.pub = true; + m_requestContextARC.multiple = true; + m_requestContextARC.callback = [](LSHandle* sh, LSMessage* msg, void* ctx) -> b...
xbmc/platform/linux/WebOSTVPlatformConfig.cpp
26
C++
1
suggestion
223
42
33
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
const std::string arcActivation = parsed[ARC_ACTIVATION].asString(); if (arcActivation == EARC) { const CVariant& caps = parsed[EARC_CAPABILITY]; if (caps.isArray()) { auto it = std::find_if(caps.begin_array(), caps.end_array(), [](const CVariant& v)...
Can you rename `DDPlus` into `EAC3` here and in the other places to match the existing naming? I'd also consider dropping the EARC part.
/* * Copyright (C) 2025 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 "WebOSTVPlatformConfig.h" #include "utils/JSONVariantParser.h" #include "utils/JSONVariantWriter.h" #include "utils/Variant...
@@ -75,3 +84,50 @@ bool WebOSTVPlatformConfig::SupportsHDR() { return ms_config[SUPPORT_HDR].asBoolean(); } + +void WebOSTVPlatformConfig::LoadARCStatus() +{ + m_requestContextARC.pub = true; + m_requestContextARC.multiple = true; + m_requestContextARC.callback = [](LSHandle* sh, LSMessage* msg, void* ctx) -> b...
xbmc/platform/linux/WebOSTVPlatformConfig.cpp
26
C++
0.714
suggestion
136
30
125
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
if (ffmap & AV_CH_BACK_LEFT ) layout += AE_CH_BL ; if (ffmap & AV_CH_BACK_RIGHT ) layout += AE_CH_BR ; if (ffmap & AV_CH_FRONT_LEFT_OF_CENTER ) layout += AE_CH_FLOC; if (ffmap & AV_CH_FRONT_RIGHT_OF_CENTER) layout += AE_CH_FROC; if (ffmap & AV_CH_BACK_CENTER ) layout += AE_CH_B...
This does not work. `ActiveAE` is not set up for eac3 transcoding. So this breaks on every platform that is not webOS and uses transcoding. What I meant is that you should not use `SETTING_AUDIOOUTPUT_EAC3PASSTHROUGH` at all and also for the ac3 case check in `format.m_streamInfo.m_type` because the `CSettings::SETTIN...
if (ffmap & AV_CH_BACK_LEFT ) layout += AE_CH_BL ; if (ffmap & AV_CH_BACK_RIGHT ) layout += AE_CH_BR ; if (ffmap & AV_CH_FRONT_LEFT_OF_CENTER ) layout += AE_CH_FLOC; if (ffmap & AV_CH_FRONT_RIGHT_OF_CENTER) layout += AE_CH_FROC; if (ffmap & AV_CH_BACK_CENTER ) layout += AE_CH_B...
@@ -85,17 +86,27 @@ unsigned int CAEEncoderFFmpeg::BuildChannelLayout(const int64_t ffmap, CAEChanne return layout.Count(); } -bool CAEEncoderFFmpeg::Initialize(AEAudioFormat &format, bool allow_planar_input) +bool CAEEncoderFFmpeg::Initialize(AEAudioFormat& format, bool allow_planar_input) { Reset(); - bo...
xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp
26
C++
1
style
411
51
51
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
std::shared_ptr<CDVDMsg> msg = nullptr; int priority = 0; m_messageQueueAudio.Get(msg, 10ms, priority); if (msg) { if (msg->IsType(CDVDMsg::DEMUXER_PACKET)) { const DemuxPacket* packet = std::static_pointer_cast<CDVDMsgDemuxerPacket>(msg)->GetPacket(); if (m_a...
```suggestion : CAEStreamInfo::DataType::STREAM_TYPE_AC3; ```
std::shared_ptr<CDVDMsg> msg = nullptr; int priority = 0; m_messageQueueAudio.Get(msg, 10ms, priority); if (msg) { if (msg->IsType(CDVDMsg::DEMUXER_PACKET)) { const DemuxPacket* packet = std::static_pointer_cast<CDVDMsgDemuxerPacket>(msg)->GetPacket(); if (m_a...
@@ -1298,6 +1324,9 @@ void CMediaPipelineWebOS::ProcessAudio() AEAudioFormat dstFormat = m_audioCodec->GetFormat(); dstFormat.m_sampleRate = SelectTranscodingSampleRate(dstFormat.m_sampleRate); dstFormat.m_dataFormat = AE_FMT_FLOATP; + dstFormat.m_streamInfo.m_t...
xbmc/cores/VideoPlayer/MediaPipelineWebOS.cpp
26
C++
1
suggestion
111
51
51
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
if (ffmap & AV_CH_TOP_FRONT_CENTER ) layout += AE_CH_TFC ; if (ffmap & AV_CH_TOP_FRONT_RIGHT ) layout += AE_CH_TFR ; if (ffmap & AV_CH_TOP_BACK_LEFT ) layout += AE_CH_TBL ; if (ffmap & AV_CH_TOP_BACK_CENTER ) layout += AE_CH_TBC ; if (ffmap & AV_CH_TOP_BACK_RIGHT ) layout += AE_CH_T...
```suggestion else if (ac3 || format.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_AC3) ```
if (ffmap & AV_CH_TOP_FRONT_CENTER ) layout += AE_CH_TFC ; if (ffmap & AV_CH_TOP_FRONT_RIGHT ) layout += AE_CH_TFR ; if (ffmap & AV_CH_TOP_BACK_LEFT ) layout += AE_CH_TBL ; if (ffmap & AV_CH_TOP_BACK_CENTER ) layout += AE_CH_TBC ; if (ffmap & AV_CH_TOP_BACK_RIGHT ) layout += AE_CH_T...
@@ -85,17 +86,25 @@ unsigned int CAEEncoderFFmpeg::BuildChannelLayout(const int64_t ffmap, CAEChanne return layout.Count(); } -bool CAEEncoderFFmpeg::Initialize(AEAudioFormat &format, bool allow_planar_input) +bool CAEEncoderFFmpeg::Initialize(AEAudioFormat& format, bool allow_planar_input) { Reset(); - bo...
xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp
26
C++
1
suggestion
97
51
51
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
if (ffmap & AV_CH_TOP_BACK_LEFT ) layout += AE_CH_TBL ; if (ffmap & AV_CH_TOP_BACK_CENTER ) layout += AE_CH_TBC ; if (ffmap & AV_CH_TOP_BACK_RIGHT ) layout += AE_CH_TBR ; return layout.Count(); } bool CAEEncoderFFmpeg::Initialize(AEAudioFormat& format, bool allow_planar_input) { Reset(); ...
Remove this comment because it clearly doesn't reflect the current state of the Encoder, at least the DTS part of it
if (ffmap & AV_CH_TOP_BACK_LEFT ) layout += AE_CH_TBL ; if (ffmap & AV_CH_TOP_BACK_CENTER ) layout += AE_CH_TBC ; if (ffmap & AV_CH_TOP_BACK_RIGHT ) layout += AE_CH_TBR ; return layout.Count(); } bool CAEEncoderFFmpeg::Initialize(AEAudioFormat& format, bool allow_planar_input) { Reset(); ...
@@ -85,17 +86,25 @@ unsigned int CAEEncoderFFmpeg::BuildChannelLayout(const int64_t ffmap, CAEChanne return layout.Count(); } -bool CAEEncoderFFmpeg::Initialize(AEAudioFormat &format, bool allow_planar_input) +bool CAEEncoderFFmpeg::Initialize(AEAudioFormat& format, bool allow_planar_input) { Reset(); - bo...
xbmc/cores/AudioEngine/Encoders/AEEncoderFFmpeg.cpp
26
C++
0.5
refactor
116
51
51
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
/* * Copyright (C) 2025 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 <atomic> #include <memory> #include <webos-helpers/libhelpers.h> class CVariant; struct HContextDeleter { ...
This is not necessary, as the destructor is only called if the unique_ptr is not null
/* * Copyright (C) 2025 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 <atomic> #include <memory> #include <webos-helpers/libhelpers.h> class CVariant; struct HContextDeleter { ...
@@ -8,13 +8,33 @@ #pragma once +#include <atomic> +#include <memory> + +#include <webos-helpers/libhelpers.h> + class CVariant; +struct HContextDeleter +{ + void operator()(HContext* ctx) const noexcept + { + if (ctx)
xbmc/platform/linux/WebOSTVPlatformConfig.h
22
C/C++
0.429
suggestion
85
41
37
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
* See LICENSES/README.md for more information. */ #pragma once #include <atomic> #include <memory> #include <webos-helpers/libhelpers.h> class CVariant; struct HContextDeleter { void operator()(HContext* ctx) const noexcept { if (ctx) HUnregisterServiceCallback(ctx); } }; class WebOSTVPlatformC...
Initialize with `false` for clarity, even though it's not strictly necessary ```suggestion static inline std::atomic<bool> m_eAC3Supported{false}; ```
* See LICENSES/README.md for more information. */ #pragma once #include <atomic> #include <memory> #include <webos-helpers/libhelpers.h> class CVariant; struct HContextDeleter { void operator()(HContext* ctx) const noexcept { HUnregisterServiceCallback(ctx); } }; class WebOSTVPlatformConfig { private: stat...
@@ -8,13 +8,33 @@ #pragma once +#include <atomic> +#include <memory> + +#include <webos-helpers/libhelpers.h> + class CVariant; +struct HContextDeleter +{ + void operator()(HContext* ctx) const noexcept + { + if (ctx) + HUnregisterServiceCallback(ctx); + } +}; + class WebOSTVPlatformConfig { +priva...
xbmc/platform/linux/WebOSTVPlatformConfig.h
26
C/C++
1
suggestion
152
36
32
false
webOS: transcode to DD+ instead of DD if eARC supported and enabled
27,541
xbmc/xbmc
17,740
C++
sundermann
cscd98
m_CurrentSubtitle(StreamType::SUBTITLE, VideoPlayer_SUBTITLE), m_CurrentTeletext(StreamType::TELETEXT, VideoPlayer_TELETEXT), m_CurrentRadioRDS(StreamType::RADIO_RDS, VideoPlayer_RDS), m_CurrentAudioID3(StreamType::AUDIO_ID3, VideoPlayer_ID3), m_messenger("player"), m_outboundEvents(std::make_un...
No need to initialize the two members here because you have defined a default member initializer with exact the value you assign here.
m_CurrentTeletext(StreamType::TELETEXT, VideoPlayer_TELETEXT), m_CurrentRadioRDS(StreamType::RADIO_RDS, VideoPlayer_RDS), m_CurrentAudioID3(StreamType::AUDIO_ID3, VideoPlayer_ID3), m_messenger("player"), m_outboundEvents(std::make_unique<CJobQueue>(false, 1, CJob::PRIORITY_NORMAL)), m_pInputStre...
@@ -748,7 +748,8 @@ CVideoPlayer::CVideoPlayer(IPlayerCallback& callback) m_caching = CACHESTATE_DONE; m_HasVideo = false; m_HasAudio = false; - m_UpdateStreamDetails = false; + m_updateStreamDetails = false; + m_saveStreamDetails = false;
xbmc/cores/VideoPlayer/VideoPlayer.cpp
26
C++
0.5
suggestion
134
51
51
false
[Video] Fix repetitive calls to UpdateFileItemStreamDetails().
27,543
xbmc/xbmc
17,740
C++
ksooo
78andyp
virtual int GetStreamLength() { return 0; } /* * returns the stream or nullptr on error */ virtual CDemuxStream* GetStream(int64_t demuxerId, int iStreamId) const { return GetStream(iStreamId); }; virtual std::vector<CDemuxStream*> GetStreams() const = 0; /* * return nr of streams, 0 if no...
I think ResetStreamsUpdated() would be clearer
virtual int GetStreamLength() { return 0; } /* * returns the stream or nullptr on error */ virtual CDemuxStream* GetStream(int64_t demuxerId, int iStreamId) const { return GetStream(iStreamId); }; virtual std::vector<CDemuxStream*> GetStreams() const = 0; /* * return nr of streams, 0 if no...
@@ -318,6 +318,16 @@ class CDVDDemux */ virtual int GetNrOfStreams() const = 0; + /*! + * \brief return true if streams have been updated, false otherwise + */ + virtual bool GetStreamsUpdated() { return false; } + + /*! + * \brief reset stream update flag + */ + virtual void SetStreamsUpdated() {}
xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h
26
C/C++
0.071
suggestion
46
51
51
false
[Video] Fix repetitive calls to UpdateFileItemStreamDetails().
27,543
xbmc/xbmc
17,740
C++
CrystalP
78andyp
std::chrono::milliseconds duration{std::chrono::milliseconds::zero()}; std::chrono::milliseconds watchedTime{std::chrono::milliseconds::zero()}; std::chrono::milliseconds position{std::chrono::milliseconds::zero()}; CStreamDetails details; }; /*! \brief Saves the current state of the current stre...
Thanks for adding the documentation. This would be clearer if the functions hadn't moved down a bit under the definition of struct PlayListInformation.
virtual void SaveCurrentState(const CStreamDetails& details) {} /*! \brief Updates the given fileitem with the state and streamdetails of what is decided to be the main (ie. main movie) title \param item fileitem to update \param time current playback time \param closed sets closed to indicate if the strea...
@@ -234,15 +227,54 @@ class CDVDInputStream CStreamDetails details; }; + /*! + \brief Saves the current state of the current stream (including stream details) + \param details streamdetails of the current playing stream + */ + virtual void SaveCurrentState(const CStreamDetails& details) {} + + /*! + \b...
xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStream.h
26
C/C++
0.5
style
151
51
51
false
[Video] Fix repetitive calls to UpdateFileItemStreamDetails().
27,543
xbmc/xbmc
17,740
C++
CrystalP
78andyp
// Return the chapters list of the running video switch (GetPlayer(parameterObject["playerid"])) { case Video: break; default: return InvalidParams; } auto& components = CServiceBroker::GetAppComponents(); const auto appPlayer = components.GetComponent<CApplicationPlayer>(); if (!appPlayer-...
The description says one based but you are zero based here. I'd suggest to make the whole loop one based: ```cpp for (int i = 1; i <= chapterCount; ++i) ```
IClient* client, const CVariant& parameterObject, CVariant& result) { // Return the chapters list of the running video or empty list if none switch (GetPlayer(parameterObject["pl...
@@ -2244,3 +2244,42 @@ std::shared_ptr<CPVREpgInfoTag> CPlayerOperations::GetCurrentEpg() return currentChannel->GetEPGNow(); } + +JSONRPC_STATUS CPlayerOperations::GetChapters(const std::string& method, ITransportLayer* transport, IClient* client, const CVariant& parameterObject, CVariant& result) +{ + // Retur...
xbmc/interfaces/json-rpc/PlayerOperations.cpp
26
C++
1
suggestion
157
37
43
false
JSON RPC : added Player.GetChapters method
27,560
xbmc/xbmc
17,740
C++
neo1973
albaintor
const auto appPlayer = components.GetComponent<CApplicationPlayer>(); if (!appPlayer->IsPlayingVideo()) return FailedToExecute; // No running video // Extract chapters from CApplicationPlayer int chapterCount = appPlayer->GetChapterCount(); CVariant chapters(CVariant::VariantTypeArray); for (int i = ...
```suggestion result["chapters"] = std::move(chapters); ```
break; default: return InvalidParams; } auto& components = CServiceBroker::GetAppComponents(); const auto appPlayer = components.GetComponent<CApplicationPlayer>(); if (!appPlayer->IsPlayingVideo()) return FailedToExecute; // No running video // Extract chapters from CApplicationPlayer ...
@@ -2244,3 +2244,42 @@ std::shared_ptr<CPVREpgInfoTag> CPlayerOperations::GetCurrentEpg() return currentChannel->GetEPGNow(); } + +JSONRPC_STATUS CPlayerOperations::GetChapters(const std::string& method, ITransportLayer* transport, IClient* client, const CVariant& parameterObject, CVariant& result) +{ + // Retur...
xbmc/interfaces/json-rpc/PlayerOperations.cpp
26
C++
0.857
suggestion
61
29
35
false
JSON RPC : added Player.GetChapters method
27,560
xbmc/xbmc
17,740
C++
neo1973
albaintor
return {}; const std::shared_ptr<const CPVRChannel> currentChannel = state->GetPlayingChannel(); if (!currentChannel) return {}; return currentChannel->GetEPGNow(); } JSONRPC_STATUS CPlayerOperations::GetChapters(const std::string& method, ITransportLayer* transport, IClient* client, const CVariant& pa...
```suggestion const int chapterCount = appPlayer->GetChapterCount(); ```
return {}; const std::shared_ptr<const CPVRChannel> currentChannel = state->GetPlayingChannel(); if (!currentChannel) return {}; return currentChannel->GetEPGNow(); } JSONRPC_STATUS CPlayerOperations::GetChapters(const std::string& method, ITransportLayer* ...
@@ -2244,3 +2244,42 @@ std::shared_ptr<CPVREpgInfoTag> CPlayerOperations::GetCurrentEpg() return currentChannel->GetEPGNow(); } + +JSONRPC_STATUS CPlayerOperations::GetChapters(const std::string& method, ITransportLayer* transport, IClient* client, const CVariant& parameterObject, CVariant& result) +{ + // Retur...
xbmc/interfaces/json-rpc/PlayerOperations.cpp
26
C++
0.857
suggestion
74
48
51
false
JSON RPC : added Player.GetChapters method
27,560
xbmc/xbmc
17,740
C++
neo1973
albaintor
{ return; } } } std::uint32_t utf32{m_keymap->UnicodeCodepointForKeycode(xkbCode)}; if (utf32 > std::numeric_limits<std::uint16_t>::max()) { // Kodi event system only supports UTF16, so ignore the codepoint if // it does not fit utf32 = 0; } // flush composer if set (af...
Reduce the log level here: ```suggestion CLog::Log(LOGDEBUG, LOGWINDOWING, "Key event ignored (scancode: {})", scancode); ```
{ return; } } } std::uint32_t utf32{m_keymap->UnicodeCodepointForKeycode(xkbCode)}; if (utf32 > std::numeric_limits<std::uint16_t>::max()) { // Kodi event system only supports UTF16, so ignore the codepoint if // it does not fit utf32 = 0; } // flush composer if set (af...
xbmc/windowing/wayland/InputProcessorKeyboard.cpp
26
C++
1
bug
134
51
51
false
Fix wayland keymapping is not possible when the key id is unconventional
27,563
xbmc/xbmc
17,740
C++
sundermann
hbiyik
data["position"] = pos; CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Playlist, "OnAdd", item, data); } void CPlayList::Add(const std::shared_ptr<CFileItem>& item, int iPosition, int iOrder) { int iOldSize = size(); if (iPosition < 0 || iPosition >= iOldSize) iPosition = iOldSize; if (...
tested but there is a problem the CPlayList::Add method is used also when playback starts, this cause to delete the "BasePath" property value: <img width="705" height="84" alt="immagine" src="https://github.com/user-attachments/assets/f292da02-7b6c-464b-838d-31cfa1523f92" /> a solution could be ```suggestion i...
data["position"] = pos; CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Playlist, "OnAdd", item, data); } void CPlayList::Add(const std::shared_ptr<CFileItem>& item, int iPosition, int iOrder) { int iOldSize = size(); if (iPosition < 0 || iPosition >= iOldSize) iPosition = iOldSize; if (...
@@ -95,6 +95,9 @@ void CPlayList::Add(const std::shared_ptr<CFileItem>& item, int iPosition, int i // set 'IsPlayable' property - needed for properly handling plugin:// URLs item->SetProperty("IsPlayable", true); + // set 'BasePath' property - needed for properly handling browse for subtitles + item->SetPrope...
xbmc/playlists/PlayList.cpp
26
C++
1
suggestion
410
51
51
false
[playlists][video] Fix browse for subtitles for items contained in playlists and strm files.
27,593
xbmc/xbmc
17,740
C++
CastagnaIT
ksooo
double pts, std::set<double>& forcedStartTimes) { // Remove non-forced overlays that have expired if (!overlay->bForced && overlay->iPTSStopTime <= pts && overlay->iPTSStopTime != 0.0) return true; // Remove forced overlays replaced by newer ones if (overlay->b...
This is not O(n) as claimed in the PR but O(n log n). Not sure how large the set is going to be but if it does have a lot of elements `std::unordered_set` can be worth it, for small sets though it is often slower.
void CDVDOverlayContainer::CleanUp(double pts) { std::unique_lock lock(*this); auto it = m_overlays.begin(); while (it != m_overlays.end()) { const std::shared_ptr<CDVDOverlay>& pOverlay = *it; // never delete forced overlays, they are used in menu's // clear takes care of removing them // als...
@@ -13,106 +13,91 @@ #include <memory> #include <mutex> +#include <ranges> +#include <vector> CDVDOverlayContainer::~CDVDOverlayContainer() { Clear(); } -void CDVDOverlayContainer::ProcessAndAddOverlayIfValid(const std::shared_ptr<CDVDOverlay>& pOverlay) +void CDVDOverlayContainer::ProcessAndAddOverlayIfV...
xbmc/cores/VideoPlayer/DVDOverlayContainer.cpp
26
C++
0.571
performance
213
51
51
false
[Video] Fix #27121 broke Bluray menus.
27,595
xbmc/xbmc
17,740
C++
sundermann
78andyp
*/ bool IsOverlayContainerFlushable() const { return m_overlayContainerFlushable; } /* * \brief Specify if the margins are handled by the subtitle codec/parser. */ void SetForcedMargins(bool setForcedMargins) { m_setForcedMargins = setForcedMargins; } /* * \brief Return true if the margins are han...
constructors/destructors/operators usually go at the top of the class (line 56 for example)
/* * \brief Allow/Disallow the overlay container to flush the overlay. */ void SetOverlayContainerFlushable(bool isFlushable) { m_overlayContainerFlushable = isFlushable; } /* * \brief Return true when the overlay container can flush the overlay on flush events. */ bool IsOverlayContainerFlushable...
@@ -103,6 +101,14 @@ class CDVDOverlay : public std::enable_shared_from_this<CDVDOverlay> bool replace; // replace by next nomatter what stoptime it has unsigned long m_textureid; + bool operator==(const CDVDOverlay& other) const + { + constexpr double epsilon{0.1}; + return std::abs(iPTSStartTime - oth...
xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlay.h
26
C/C++
0.143
suggestion
91
50
50
false
[Video] Fix #27121 broke Bluray menus.
27,595
xbmc/xbmc
17,740
C++
CrystalP
78andyp
overlays, [startTime = newOverlay->iPTSStartTime](const std::shared_ptr<CDVDOverlay>& overlay) { overlay->iPTSStopTime = startTime; }); m_overlays.emplace_back(newOverlay); } VecOverlays* CDVDOverlayContainer::GetOverlays() { return &m_overlays; } namespace { bool IsOverlayFinished(const std::shared_...
I think preserving that part of the comment is important. The previous part is outdated and can go. What little information is available should be preserved
} VecOverlays* CDVDOverlayContainer::GetOverlays() { return &m_overlays; } VecOverlays::iterator CDVDOverlayContainer::Remove(VecOverlays::iterator itOverlay) { std::unique_lock lock(*this); return m_overlays.erase(itOverlay); } void CDVDOverlayContainer::CleanUp(double pts) { std::unique_lock lock(*this); ...
@@ -13,106 +13,92 @@ #include <memory> #include <mutex> +#include <ranges> +#include <set> +#include <vector> CDVDOverlayContainer::~CDVDOverlayContainer() { Clear(); } -void CDVDOverlayContainer::ProcessAndAddOverlayIfValid(const std::shared_ptr<CDVDOverlay>& pOverlay) +void CDVDOverlayContainer::Process...
xbmc/cores/VideoPlayer/DVDOverlayContainer.cpp
26
C++
0.5
suggestion
156
51
51
false
[Video] Fix #27121 broke Bluray menus.
27,595
xbmc/xbmc
17,740
C++
CrystalP
78andyp
m_sink_sampleRate, atChannelMask, m_encoding); int min_buffer = CJNIAudioTrack::getMinBufferSize(m_sink_sampleRate, atChannelMask, m_encoding); if (min_buffer < 0) { CLog::L...
To avoid magic numbers seems better replace 0.04 with: `2 * m_format.m_streamInfo.GetDuration() / 1000;` Also for me seems more clear simply define only 61440 number. I mean: ```c++ const unsigned int TRUEHD_SIZE = 61440; m_min_buffer_size = 2 * TRUEHD_SIZE; m_format.m_frames = TRUEHD_SIZE; rawlength_in_...
int min_buffer = CJNIAudioTrack::getMinBufferSize(m_sink_sampleRate, atChannelMask, m_encoding); if (min_buffer < 0) { CLog::Log(LOGERROR, "Minimum Buffer Size was: {} - d...
@@ -422,14 +421,14 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device) switch (m_format.m_streamInfo.m_type) { case CAEStreamInfo::STREAM_TYPE_TRUEHD: - m_min_buffer_size = MAX_RAW_AUDIO_BUFFER_HD; - m_format.m_frames = m_min_buffer_size; - ...
xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
26
C++
1
style
455
51
51
false
AESinkAudioTrack: Simplify RAW - buffer did not work anyways
27,621
xbmc/xbmc
17,740
C++
thexai
fritsch
const uint32_t minwrapvalue = UINT32_MAX - m_sink_sampleRate / 10; const uint32_t remain = static_cast<uint32_t>(m_headPos & UINT64_LOWER_BYTES); if ((remain > head_pos) && (remain >= minwrapvalue)) m_headPos += (1ULL << 32); // add wraparound, e.g. 0x0000 FFFF FFFF -> 0x0001 FFFF FFFF // clear lower 32 bit...
```suggestion const int latency = m_at_jni->getLatency(); ```
const uint32_t minwrapvalue = UINT32_MAX - m_sink_sampleRate / 10; const uint32_t remain = static_cast<uint32_t>(m_headPos & UINT64_LOWER_BYTES); if ((remain > head_pos) && (remain >= minwrapvalue)) m_headPos += (1ULL << 32); // add wraparound, e.g. 0x0000 FFFF FFFF -> 0x0001 FFFF FFFF // clear lower 32 bit...
@@ -672,85 +672,95 @@ void CAESinkAUDIOTRACK::GetDelay(AEDelayStatus& status) double delay = m_duration_written - gone; - if (m_stampTimer.IsTimePast()) + // latency works way better but is not available everyhwere + int latency = m_at_jni->getLatency();
xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
26
C++
0.857
performance
65
51
51
false
AESinkAudiotrack: Implement GetLatency API
27,638
xbmc/xbmc
17,740
C++
thexai
fritsch
// check if sink is stuck if (m_headPos == m_headPosOld) m_stuckCounter++; else { m_stuckCounter = 0; m_headPosOld = m_headPos; } double gone = static_cast<double>(m_headPos) / m_sink_sampleRate; // if sink is run dry without buffer time written anymore if (gone > m_duration_written) g...
```suggestion const int atbuffer = m_at_jni->getBufferSizeInFrames(); ```
// check if sink is stuck if (m_headPos == m_headPosOld) m_stuckCounter++; else { m_stuckCounter = 0; m_headPosOld = m_headPos; } double gone = static_cast<double>(m_headPos) / m_sink_sampleRate; // if sink is run dry without buffer time written anymore if (gone > m_duration_written) g...
@@ -672,85 +672,95 @@ void CAESinkAUDIOTRACK::GetDelay(AEDelayStatus& status) double delay = m_duration_written - gone; - if (m_stampTimer.IsTimePast()) + // latency works way better but is not available everyhwere + int latency = m_at_jni->getLatency(); + const bool isRawPt = m_passthrough && !m_info.m_want...
xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
26
C++
0.857
suggestion
79
51
51
false
AESinkAudiotrack: Implement GetLatency API
27,638
xbmc/xbmc
17,740
C++
thexai
fritsch
if (m_headPos == m_headPosOld) m_stuckCounter++; else { m_stuckCounter = 0; m_headPosOld = m_headPos; } double gone = static_cast<double>(m_headPos) / m_sink_sampleRate; // if sink is run dry without buffer time written anymore if (gone > m_duration_written) gone = m_duration_written; ...
```suggestion const double buffertime = static_cast<double>(atbuffer) / m_sink_sampleRate; ```
if (m_headPos == m_headPosOld) m_stuckCounter++; else { m_stuckCounter = 0; m_headPosOld = m_headPos; } double gone = static_cast<double>(m_headPos) / m_sink_sampleRate; // if sink is run dry without buffer time written anymore if (gone > m_duration_written) gone = m_duration_written; ...
@@ -672,85 +672,95 @@ void CAESinkAUDIOTRACK::GetDelay(AEDelayStatus& status) double delay = m_duration_written - gone; - if (m_stampTimer.IsTimePast()) + // latency works way better but is not available everyhwere + int latency = m_at_jni->getLatency(); + const bool isRawPt = m_passthrough && !m_info.m_want...
xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
26
C++
1
suggestion
100
51
51
false
AESinkAudiotrack: Implement GetLatency API
27,638
xbmc/xbmc
17,740
C++
thexai
fritsch