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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(pItem->IsPlayList() && !URIUtils::HasExtension(pItem->GetPath(), ".strm")))
return INFO_NOT_NEEDED;
if (ProgressCancelled(pDlgProgress, 198, pItem->GetLabel()))
return INFO_CANCELLED;
if (m_database.HasMovieInfo(pItem->GetDynPath()))
return INFO_HAVE_ALREADY;
if (m_handle)
... | nitpick, maybe "keep some properties only if advancedsettings.xml says so" would be clearer | if (pItem->m_bIsFolder || !IsVideo(*pItem) || pItem->IsNFO() ||
(PLAYLIST::IsPlayList(*pItem) && !URIUtils::HasExtension(pItem->GetPath(), ".strm")))
return InfoRet::NOT_NEEDED;
if (ProgressCancelled(pDlgProgress, 198, pItem->GetLabel()))
return InfoRet::CANCELLED;
if (m_database.HasMo... | @@ -744,7 +745,15 @@ namespace VIDEO
if (loader)
{
pItem->GetVideoInfoTag()->Reset();
- result = loader->Load(*pItem->GetVideoInfoTag(), false);
+ CVideoInfoTag& infoTag = *pItem->GetVideoInfoTag();
+ result = loader->Load(infoTag, false);
+
+ // only import some prope... | xbmc/video/VideoInfoScanner.cpp | 26 | C++ | 0.143 | nitpick | 91 | 51 | 51 | false | [VideoInfoScanner] Honor importwatchedstate and importresumepoint from AS.xml | 24,925 | xbmc/xbmc | 17,740 | C++ | CrystalP | neo1973 |
file->iEpisode)); // Episode y
pDlgProgress->SetPercentage((int)((float)(iCurr++)/iMax*100));
pDlgProgress->Progress();
}
if (m_handle)
m_handle->SetPercentage(100.f*iCurr++/iMax);
if ((pDlgProgress && pDlgProgress->IsCancel... | Looks like this instance does not reset the InfoTag, unlike the other callers but ReadInfoTag() always resets it. |
if (m_database.GetEpisodeId(file->strPath, file->iEpisode, file->iSeason) > -1)
{
if (m_handle)
m_handle->SetText(g_localizeStrings.Get(20415));
continue;
}
CFileItem item;
if (file->item)
item = *file->item;
else
{
item.SetPath(file-... | @@ -1964,14 +1966,7 @@ namespace KODI::VIDEO
const ScraperPtr& info(scraper);
std::unique_ptr<IVideoInfoTagLoader> loader;
if (useLocal)
- {
- loader.reset(CVideoInfoTagLoaderFactory::CreateLoader(item, info, false));
- if (loader)
- {
- // no reset here on purpos... | xbmc/video/VideoInfoScanner.cpp | 26 | C++ | 0.286 | suggestion | 113 | 51 | 51 | false | [VideoInfoScanner] Honor importwatchedstate and importresumepoint from AS.xml | 24,925 | xbmc/xbmc | 17,740 | C++ | CrystalP | neo1973 |
case CONTENT_TVSHOWS:
return VideoDbContentType::EPISODES;
default:
return VideoDbContentType::UNKNOWN;
}
}
std::string CVideoInfoScanner::GetArtTypeFromSize(unsigned int width, unsigned int height)
{
std::string type = "thumb";
if (width*5 < height*4)
type = "poster... | may not make much difference, the advanced settings could be retrieved once in CVideoInfoScanner()? | else if (width*1 > height*4)
type = "banner";
return type;
}
std::pair<CVideoInfoScanner::InfoType, std::unique_ptr<IVideoInfoTagLoader>> CVideoInfoScanner::
ReadInfoTag(CFileItem& item,
const ADDON::ScraperPtr& scraper,
bool lookInFolder,
b... | @@ -1688,6 +1668,28 @@ namespace KODI::VIDEO
return type;
}
+ std::pair<CInfoScanner::INFO_TYPE, std::unique_ptr<IVideoInfoTagLoader>> CVideoInfoScanner::
+ ReadInfoTag(CFileItem& item, const ADDON::ScraperPtr& scraper, bool lookInFolder)
+ {
+ auto result = CInfoScanner::NO_NFO;
+ std::unique_pt... | xbmc/video/VideoInfoScanner.cpp | 26 | C++ | 0.357 | question | 99 | 51 | 51 | false | [VideoInfoScanner] Honor importwatchedstate and importresumepoint from AS.xml | 24,925 | xbmc/xbmc | 17,740 | C++ | CrystalP | neo1973 |
/// @brief <b>`157`</b>: Filter SMS8.
ADDON_ACTION_FILTER_SMS8 = 157,
/// @brief <b>`158`</b>: Filter SMS9.
ADDON_ACTION_FILTER_SMS9 = 158,
/// @brief <b>`159`</b>: First page.
ADDON_ACTION_FIRST_PAGE = 159,
/// @brief <b>`160`</b>: Last page.
ADDON_ACTION_LAST_PAGE = 160,
/// @brief <b>`161`</b>... | Because this gets rendered in our docs, I would suggest:
```
/// @brief <b>`165`</b>: Switch to previous subtitle of movie. Can be used in
/// the VideoFullScreen.xml window (with ID 2005).
``` |
/// @brief <b>`157`</b>: Filter SMS8.
ADDON_ACTION_FILTER_SMS8 = 157,
/// @brief <b>`158`</b>: Filter SMS9.
ADDON_ACTION_FILTER_SMS9 = 158,
/// @brief <b>`159`</b>: First page.
ADDON_ACTION_FIRST_PAGE = 159,
/// @brief <b>`160`</b>: Last page.
ADDON_ACTION_LAST_PAGE = 160,
/// @brief <b>`161`</b>... | @@ -512,6 +512,9 @@ enum ADDON_ACTION
/// @brief <b>`164`</b>: Set rating.
ADDON_ACTION_SET_RATING = 164,
+ /// @brief <b>`165`</b>: Switch to previous subtitle of movie. Can b used in videoFullScreen.xml window id=2005 | xbmc/addons/kodi-dev-kit/include/kodi/c-api/gui/input/action_ids.h | 26 | C/C++ | 1 | suggestion | 203 | 51 | 51 | false | [Video][Actions] new action: PreviousSubtitle | 24,943 | xbmc/xbmc | 17,740 | C++ | garbear | foresto |
VASurfaceID surf = inPic.videoSurface;
VAImage image;
uint8_t *buf;
if (m_DVDPic.pts != DVD_NOPTS_VALUE && inPic.DVDPic.pts != DVD_NOPTS_VALUE)
{
m_frametime = inPic.DVDPic.pts - m_DVDPic.pts;
}
m_DVDPic.SetParams(inPic.DVDPic);
bool result = false;
if (!CheckSuccess(vaSyncSurface(m_config.dpy, s... | |= else you most likely set all flags to 0. As the & condition gets "0" and that result you AND on top. | bool CFFmpegPostproc::AddPicture(CVaapiDecodedPicture &inPic)
{
VASurfaceID surf = inPic.videoSurface;
VAImage image;
uint8_t *buf;
if (m_DVDPic.pts != DVD_NOPTS_VALUE && inPic.DVDPic.pts != DVD_NOPTS_VALUE)
{
m_frametime = inPic.DVDPic.pts - m_DVDPic.pts;
}
m_DVDPic.SetParams(inPic.DVDPic);
bool re... | @@ -3068,8 +3068,10 @@ bool CFFmpegPostproc::AddPicture(CVaapiDecodedPicture &inPic)
m_pFilterFrameIn->height = m_config.vidHeight;
m_pFilterFrameIn->linesize[0] = image.pitches[0];
m_pFilterFrameIn->linesize[1] = image.pitches[1];
- m_pFilterFrameIn->interlaced_frame = (inPic.DVDPic.iFlags & DVP_FLAG_INTERLA... | xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp | 26 | C++ | 0.286 | suggestion | 103 | 51 | 51 | false | Update to ffmpeg 7.1 | 24,972 | xbmc/xbmc | 17,740 | C++ | fritsch | sundermann |
}
sideData = av_packet_side_data_get(pStream->codecpar->coded_side_data,
pStream->codecpar->nb_coded_side_data,
AV_PKT_DATA_MASTERING_DISPLAY_METADATA);
if (sideData)
{
st->masteringMetaData ... | Just noticed this, should probably be theta, the greek letter normally used for angle measurements? | pStream->codecpar->codec_tag = MKTAG('M','P','2','V');
CLog::Log(LOGERROR, "{} - AV_CODEC_ID_PROBE detected, forcing AV_CODEC_ID_MPEG2VIDEO",
__FUNCTION__);
}
}
}
if (av_dict_get(pStream->metadata, "title", NULL, 0))
st-... | @@ -1697,39 +1698,45 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx)
st->colorRange = pStream->codecpar->color_range;
st->hdr_type = DetermineHdrType(pStream);
- // https://github.com/FFmpeg/FFmpeg/blob/release/5.0/doc/APIchanges
- size_t size = 0;
- uint8_t* side_dat... | xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 26 | C++ | 0.357 | question | 99 | 51 | 51 | false | Update to ffmpeg 7.1 | 24,972 | xbmc/xbmc | 17,740 | C++ | garbear | sundermann |
jni::CJNIXBMCAudioManagerOnAudioFocusChangeListener m_audioFocusListener;
jni::CJNIXBMCDisplayManagerDisplayListener m_displayListener;
std::unique_ptr<jni::CJNIXBMCMainView> m_mainView;
std::unique_ptr<jni::CJNIXBMCMediaSession> m_mediaSession;
std::string GetFilenameFromIntent(const CJNIIntent &intent);
... | We usually start member variable names lower case after the m_ prefix. | jni::CJNIXBMCAudioManagerOnAudioFocusChangeListener m_audioFocusListener;
jni::CJNIXBMCDisplayManagerDisplayListener m_displayListener;
std::unique_ptr<jni::CJNIXBMCMainView> m_mainView;
std::unique_ptr<jni::CJNIXBMCMediaSession> m_mediaSession;
std::string GetFilenameFromIntent(const CJNIIntent &intent);
... | @@ -258,6 +258,7 @@ class CXBMCApp : public IActivityHandler,
bool m_wakeUp{false};
bool m_aeReset{false};
bool m_hdmiPlugged{true};
+ unsigned int m_MediaSessionVideoUpdateCounter = 0; | xbmc/platform/android/activity/XBMCApp.h | 26 | C/C++ | 0.143 | suggestion | 71 | 51 | 51 | false | MediaSession: Only Update when Playstate changes | 24,986 | xbmc/xbmc | 17,740 | C++ | ksooo | fritsch |
m_playback_state &= ~PLAYBACK_STATE_PLAYING;
UpdateSessionState();
RequestVisibleBehind(false);
ReleaseAudioFocus();
}
void CXBMCApp::OnPlayBackStopped()
{
CLog::Log(LOGDEBUG, "{}", __PRETTY_FUNCTION__);
m_playback_state = PLAYBACK_STATE_STOPPED;
UpdateSessionState();
m_mediaSession->activate(false);... | I've not checked if it affects and could be corrected later, `setActions()` should receive as a parameter the current actions available in this session, not a position value.
https://developer.android.com/reference/android/media/session/PlaybackState.Builder#setActions(long)
https://developer.android.com/training/t... | {
if (appPlayer->HasVideo())
m_playback_state |= PLAYBACK_STATE_VIDEO;
else
m_playback_state &= ~PLAYBACK_STATE_VIDEO;
if (appPlayer->HasAudio())
m_playback_state |= PLAYBACK_STATE_AUDIO;
else
m_playback_state &= ~PLAYBACK_STATE_AUDIO;
pos = appPlayer->GetTime();
spee... | @@ -907,9 +917,13 @@ void CXBMCApp::UpdateSessionState()
else
state = CJNIPlaybackState::STATE_STOPPED;
- builder.setState(state, pos, speed, CJNISystemClock::elapsedRealtime())
- .setActions(CJNIPlaybackState::PLAYBACK_POSITION_UNKNOWN);
- m_mediaSession->updatePlaybackState(builder.build());
+ if ((... | xbmc/platform/android/activity/XBMCApp.cpp | 26 | C++ | 0.857 | suggestion | 350 | 51 | 51 | false | MediaSession: Only Update when Playstate changes | 24,986 | xbmc/xbmc | 17,740 | C++ | joseluismarti | fritsch |
IXAudio2MasteringVoice* mMasterVoice = nullptr;
IXAudio2SourceVoice* mSourceVoice = nullptr;
Microsoft::WRL::ComPtr<IXAudio2> xaudio2;
hr = XAudio2Create(xaudio2.ReleaseAndGetAddressOf(), eflags);
if (FAILED(hr))
{
CLog::LogF(LOGDEBUG, "failed to activate XAudio for capability testing");
goto failed... | Unless I missed something, XAudio2 only accepts PCM formats. The tests for passthrough formats could be removed? | return;
}
for(RendererDetail& details : CAESinkFactoryWin::GetRendererDetails())
{
deviceInfo.m_channels.Reset();
deviceInfo.m_dataFormats.clear();
deviceInfo.m_sampleRates.clear();
deviceChannels.Reset();
for (unsigned int c = 0; c < WASAPI_SPEAKER_COUNT; c++)
{
if (details.ui... | @@ -354,8 +303,15 @@ void CAESinkXAudio::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bool fo
deviceInfo.m_channels.Reset();
deviceInfo.m_dataFormats.clear();
deviceInfo.m_sampleRates.clear();
+ deviceChannels.Reset();
+
+ for (unsigned int c = 0; c < WASAPI_SPEAKER_COUNT; c++)
+ {
+ ... | xbmc/cores/AudioEngine/Sinks/AESinkXAudio.cpp | 26 | C++ | 0.5 | question | 112 | 51 | 51 | false | [Windows] enable XAudio2 sink in Windows desktop and code improvements | 25,068 | xbmc/xbmc | 17,740 | C++ | CrystalP | thexai |
if (!m_running) //first time called, pre-fill buffer then start voice
{
m_sourceVoice->Stop();
hr = m_sourceVoice->SubmitSourceBuffer(&xbuffer);
if (FAILED(hr))
{
CLog::LogF(LOGERROR, "voice submit buffer failed due to {}", WASAPIErrToStr(hr));
delete xbuffer.pContext;
return 0;
... | per documentation, "The frequency of the performance counter is fixed at system boot and is consistent across all processors. Therefore, the frequency need only be queried upon application initialization, and the result can be cached." Would you add a commit to make it a class member, or would it be a separate PR? | m_avgTimeWaiting += (timerElapsed - m_avgTimeWaiting) * 0.5;
if (m_avgTimeWaiting < 3.0)
{
CLog::LogF(LOGDEBUG, "Possible AQ Loss: Avg. Time Waiting for Audio Driver callback : {}msec",
(int)m_avgTimeWaiting);
}
hr = m_sourceVoice->SubmitSourceBuffer(&xbuffer);
if (FAILED(hr))
{
C... | @@ -276,11 +274,9 @@ unsigned int CAESinkXAudio::AddPackets(uint8_t **data, unsigned int frames, unsi
return frames;
}
-#ifndef _DEBUG
/* Get clock time for latency checks */
QueryPerformanceFrequency(&timerFreq); | xbmc/cores/AudioEngine/Sinks/AESinkXAudio.cpp | 26 | C++ | 0.714 | performance | 315 | 51 | 51 | false | [Windows] enable XAudio2 sink in Windows desktop and code improvements | 25,068 | xbmc/xbmc | 17,740 | C++ | CrystalP | thexai |
break;
}
default:
return false;
}
DWORD lastErr = GetLastError();
if (lastErr != ERROR_SUCCESS && lastErr != IP_REQ_TIMED_OUT)
CLog::Log(LOGERROR, "{} - {} failed - {}", __FUNCTION__,
host.sa_family == AF_INET ? "IcmpSendEcho2" : "Icmp6SendEcho2",
CWIN32Util::... | ```suggestion
sockaddr sockHost = {};
```
Seems rare the use of "struct" word here. I mean struct is for define a struct but here is declare a struct already defined in Windows headers.
Same thing in `CNetworkWin32::PingHost` and `CNetworkInterfaceWin32::GetHostMacAddress` | break;
}
default:
return false;
}
DWORD lastErr = GetLastError();
if (lastErr != ERROR_SUCCESS && lastErr != IP_REQ_TIMED_OUT)
CLog::Log(LOGERROR, "{} - {} failed - {}", __FUNCTION__,
host.sa_family == AF_INET ? "IcmpSendEcho2" : "Icmp6SendEcho2",
CWIN32Util::... | @@ -248,7 +248,7 @@ bool CNetworkWin32::PingHost(const struct sockaddr& host, unsigned int timeout_m
bool CNetworkInterfaceWin32::GetHostMacAddress(unsigned long host, std::string& mac) const
{
- struct sockaddr sockHost;
+ struct sockaddr sockHost = {}; | xbmc/platform/win32/network/NetworkWin32.cpp | 26 | C++ | 1 | suggestion | 281 | 51 | 51 | false | [Windows] Fix Discovery of MAC Address | 25,111 | xbmc/xbmc | 17,740 | C++ | thexai | CrystalP |
// screen saver timer is reset only if we're not already in screensaver or
// DPMS mode
if ((!m_screensaverActive && m_iScreenSaveLock == 0) && !m_dpmsIsActive)
ResetScreenSaverTimer();
}
void CApplicationPowerHandling::ResetScreenSaverTimer()
{
m_screenSaverTimer.StartZero();
}
void CApplicationPowerHan... | Rather than polling every cycle in the main thread, wouldn't it be better to dispatch a message instead? Something like `CServiceBroker::GetAppMessenger()->PostMsg(TMSG_RESTART_RENDERING);`.
And in https://github.com/xbmc/xbmc/blob/08948981a77af5856b9a6d925e718e2277e75688/xbmc/application/Application.cpp#L1391
``... |
// screen saver timer is reset only if we're not already in screensaver or
// DPMS mode
if ((!m_screensaverActive && m_iScreenSaveLock == 0) && !m_dpmsIsActive)
ResetScreenSaverTimer();
}
void CApplicationPowerHandling::ResetScreenSaverTimer()
{
m_screenSaverTimer.StartZero();
}
void CApplicationPowerHan... | @@ -67,12 +67,6 @@ void CApplicationPowerHandling::ResetNavigationTimer()
void CApplicationPowerHandling::SetRenderGUI(bool renderGUI)
{
- if (renderGUI && !m_renderGUI) | xbmc/application/ApplicationPowerHandling.cpp | 26 | C++ | 1 | suggestion | 556 | 51 | 51 | false | Rendering: Set window dirty only on app thread | 25,121 | xbmc/xbmc | 17,740 | C++ | sarbes | enen92 |
protected:
bool OnSettingsSaving() const override;
void PlaybackCleanup();
std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> m_pAnnouncementManager;
std::unique_ptr<CGUIComponent> m_pGUI;
std::unique_ptr<CWinSystemBase> m_pWinSystem;
std::unique_ptr<ActiveAE::CActiveAE> m_pActiveAE;
std::shared_ptr<CA... | is std::optional really needed or would just a bool also do the job? | void UnlockFrameMoveGuard();
protected:
bool OnSettingsSaving() const override;
void PlaybackCleanup();
std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> m_pAnnouncementManager;
std::unique_ptr<CGUIComponent> m_pGUI;
std::unique_ptr<CWinSystemBase> m_pWinSystem;
std::unique_ptr<ActiveAE::CActiveAE> m_... | @@ -218,6 +219,7 @@ class CApplication : public IWindowManagerCallback,
std::chrono::time_point<std::chrono::steady_clock> m_lastRenderTime;
bool m_skipGuiRender = false;
+ std::optional<bool> m_guiRenderLastState; | xbmc/application/Application.h | 26 | C/C++ | 0.143 | question | 68 | 51 | 51 | false | Rendering: Set window dirty only on app thread | 25,121 | xbmc/xbmc | 17,740 | C++ | howie-f | enen92 |
if(URIUtils::GetFileName(path) == "VIDEO_TS.IFO")
path = URIUtils::GetParentPath(path);
URIUtils::RemoveSlashAtEnd(path);
if(URIUtils::GetFileName(path) == "VIDEO_TS")
path = URIUtils::GetParentPath(path);
URIUtils::RemoveSlashAtEnd(path);
#if defined(TARGET_DARWIN_OSX)
// if physical DVDs, libdvdnav... | Why is this changed to no-cache? | if(URIUtils::GetFileName(path) == "VIDEO_TS.IFO")
path = URIUtils::GetParentPath(path);
URIUtils::RemoveSlashAtEnd(path);
if(URIUtils::GetFileName(path) == "VIDEO_TS")
path = URIUtils::GetParentPath(path);
URIUtils::RemoveSlashAtEnd(path);
#if defined(TARGET_DARWIN_OSX)
// if physical DVDs, libdvdnav... | @@ -151,7 +151,7 @@ bool CDVDInputStreamNavigator::Open()
{
// if dvd image file (ISO or alike) open using libdvdnav stream callback functions
m_pstream = std::make_unique<CDVDInputStreamFile>(
- m_item, XFILE::READ_TRUNCATED | XFILE::READ_BITRATE | XFILE::READ_CHUNKED);
+ m_item, XFILE::READ... | xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamNavigator.cpp | 26 | C++ | 0.286 | performance | 32 | 51 | 51 | false | [FileSystem] deprecate use of READ_CHUNKED flag | 25,158 | xbmc/xbmc | 17,740 | C++ | arnova | thexai |
{
Close();
}
//*********************************************************************************************
bool CFile::Copy(const std::string& strFileName, const std::string& strDest, XFILE::IFileCallback* pCallback, void* pContext)
{
const CURL pathToUrl(strFileName);
const CURL pathToUrlDest(strDest);
ret... | Same: why is this changed to no-cache? | {
Close();
}
//*********************************************************************************************
bool CFile::Copy(const std::string& strFileName, const std::string& strDest, XFILE::IFileCallback* pCallback, void* pContext)
{
const CURL pathToUrl(strFileName);
const CURL pathToUrlDest(strDest);
ret... | @@ -66,7 +66,7 @@ bool CFile::Copy(const CURL& url2, const CURL& dest, XFILE::IFileCallback* pCall
CURL url(url2);
if (StringUtils::StartsWith(url.Get(), "zip://") || URIUtils::IsInAPK(url.Get()))
url.SetOptions("?cache=no");
- if (file.Open(url.Get(), READ_TRUNCATED | READ_CHUNKED))
+ if (file.Open(url.Ge... | xbmc/filesystem/File.cpp | 26 | C++ | 0.286 | performance | 39 | 51 | 51 | false | [FileSystem] deprecate use of READ_CHUNKED flag | 25,158 | xbmc/xbmc | 17,740 | C++ | arnova | thexai |
/*
* 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.
*/
#pragma once
#include <stdint.h>
namespace XFILE
{
/* indicate that caller can handle truncated reads, where function returns... | I'd either remove it all together or at least comment it out. | /*
* 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.
*/
#pragma once
#include <stdint.h>
namespace XFILE
{
/* indicate that caller can handle truncated reads, where function returns... | @@ -14,39 +14,44 @@ namespace XFILE
{
/* indicate that caller can handle truncated reads, where function returns before entire buffer has been filled */
- static const unsigned int READ_TRUNCATED = 0x01;
+static const unsigned int READ_TRUNCATED = 0x01;
-/* indicate that that caller support read in the minimum d... | xbmc/filesystem/IFileTypes.h | 25 | C/C++ | 0.357 | suggestion | 61 | 50 | 50 | false | [FileSystem] deprecate use of READ_CHUNKED flag | 25,158 | xbmc/xbmc | 17,740 | C++ | arnova | thexai |
addonInterface->toKodi->kodi_filesystem->io_control_set_cache_rate = io_control_set_cache_rate;
addonInterface->toKodi->kodi_filesystem->io_control_set_retry = io_control_set_retry;
addonInterface->toKodi->kodi_filesystem->get_property_values = get_property_values;
addonInterface->toKodi->kodi_filesystem->curl... | Doesn't this change need addon filesystem API version bump? | addonInterface->toKodi->kodi_filesystem->io_control_set_cache_rate = io_control_set_cache_rate;
addonInterface->toKodi->kodi_filesystem->io_control_set_retry = io_control_set_retry;
addonInterface->toKodi->kodi_filesystem->get_property_values = get_property_values;
addonInterface->toKodi->kodi_filesystem->curl... | @@ -137,8 +137,6 @@ unsigned int Interface_Filesystem::TranslateFileReadBitsToKodi(unsigned int addo
if (addonFlags & ADDON_READ_TRUNCATED)
kodiFlags |= READ_TRUNCATED;
- if (addonFlags & ADDON_READ_CHUNKED)
- kodiFlags |= READ_CHUNKED; | xbmc/addons/interfaces/Filesystem.cpp | 26 | C++ | 0.357 | question | 59 | 51 | 51 | false | [FileSystem] deprecate use of READ_CHUNKED flag | 25,158 | xbmc/xbmc | 17,740 | C++ | ksooo | thexai |
Update(m_vecItems->GetPath());
return true;
}
switch (button)
{
case CONTEXT_BUTTON_INFO:
OnItemInfo(itemNumber);
return true;
case CONTEXT_BUTTON_EDIT:
{
std::string playlist =
PLAYLIST::IsPlayList(*item)
? item->GetPath()
: m_vecItem... | might as well throw in a const. |
Update(m_vecItems->GetPath());
return true;
}
switch (button)
{
case CONTEXT_BUTTON_INFO:
OnItemInfo(itemNumber);
return true;
case CONTEXT_BUTTON_EDIT:
{
std::string playlist =
PLAYLIST::IsPlayList(*item)
? item->GetPath()
: m_vecItem... | @@ -517,7 +517,10 @@ bool CGUIWindowMusicBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
case CONTEXT_BUTTON_EDIT_SMART_PLAYLIST:
{
- std::string playlist = item->IsSmartPlayList() ? item->GetPath() : m_vecItems->GetPath(); // save path as activatewindow will destroy our items
+ std::st... | xbmc/music/windows/GUIWindowMusicBase.cpp | 26 | C++ | 0.071 | suggestion | 31 | 51 | 51 | false | Add playlist FileItem classify | 25,200 | xbmc/xbmc | 17,740 | C++ | CrystalP | notspiff |
* Copyright (C) 2005-2020 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "playlists/PlayListFileItemClassify.h"
#include "FileItem.h"
#include "playlists/PlayListFactory.h"
#include "utils/URIUt... | `item.GetProperty("library.smartplaylist").asBoolean(false)`? | * Copyright (C) 2005-2024 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "playlists/PlayListFileItemClassify.h"
#include "FileItem.h"
#include "playlists/PlayListFactory.h"
#include "utils/URIUt... | @@ -19,4 +21,13 @@ bool IsPlayList(const CFileItem& item)
return CPlayListFactory::IsPlaylist(item);
}
+bool IsSmartPlayList(const CFileItem& item)
+{
+ if (item.HasProperty("library.smartplaylist") &&
+ item.GetProperty("library.smartplaylist").asBoolean()) | xbmc/playlists/PlayListFileItemClassify.cpp | 26 | C++ | 0.357 | question | 61 | 33 | 32 | false | Add playlist FileItem classify | 25,200 | xbmc/xbmc | 17,740 | C++ | CrystalP | notspiff |
CVideoPlayerVideo::CVideoPlayerVideo(CDVDClock* pClock,
CDVDOverlayContainer* pOverlayContainer,
CDVDMessageQueue& parent,
CRenderManager& renderManager,
CProcessInfo& pro... | you can probably use the initializer list |
CVideoPlayerVideo::CVideoPlayerVideo(CDVDClock* pClock,
CDVDOverlayContainer* pOverlayContainer,
CDVDMessageQueue& parent,
CRenderManager& renderManager,
CProcessInfo& pro... | @@ -67,9 +67,11 @@ CVideoPlayerVideo::CVideoPlayerVideo(CDVDClock* pClock
m_iDroppedRequest = 0;
m_fForcedAspectRatio = 0;
- // 128 MB allows max bitrate of 128 Mbit/s (e.g. UHD Blu-Ray) during 8 seconds
- m_messageQueue.SetMaxDataSize(128 * 1024 * 1024);
- m_messageQueue.SetMaxTimeSize(8.0);
+ m_messageQue... | xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp | 26 | C++ | 0.286 | suggestion | 42 | 51 | 51 | false | [VideoPlayer] define message queue time size in a single place | 25,334 | xbmc/xbmc | 17,740 | C++ | enen92 | thexai |
#include "utils/CharsetConverter.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "utils/log.h"
#include <cstdlib>
#include <set>
using namespace XFILE;
// Stuff for read CUE data from different sources.
class CueReader
{
public:
virtual bool ready() const = 0;
virtual bool ReadLine(std::st... | one question, better to init `m_opened` in the member initializer list?
```cpp
explicit FileReader(const std::string& strFile) : m_opened(m_file.Open(strFile)) {}
``` | #include "utils/CharsetConverter.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "utils/log.h"
#include <cstdlib>
#include <set>
using namespace XFILE;
// Stuff for read CUE data from different sources.
class CueReader
{
public:
virtual bool ready() const = 0;
virtual bool ReadLine(std::st... | @@ -75,10 +75,7 @@ class FileReader
: public CueReader
{
public:
- explicit FileReader(const std::string &strFile) : m_szBuffer{}
- {
- m_opened = m_file.Open(strFile);
- }
+ explicit FileReader(const std::string& strFile) { m_opened = m_file.Open(strFile); } | xbmc/CueDocument.cpp | 26 | C++ | 1 | suggestion | 169 | 51 | 51 | false | [clang-tidy] fix modernize-* and performance-* warnings | 25,343 | xbmc/xbmc | 17,740 | C++ | howie-f | Rechi |
#pragma once
namespace EDL
{
constexpr int EDL_ACTION_NONE = -1;
enum class Action
{
CUT = 0,
MUTE = 1,
SCENE = 2,
COMM_BREAK = 3
};
struct Edit
{
int start = 0; // ms
int end = 0; // ms
Action action = Action::CUT;
};
/*!
* @brief Specify the search direction for an EDL edit
*/
enum class EditDirec... | ```suggestion
enum class EditDirection : bool
```
instead the default `int` | /*
* Copyright (C) 2019 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
namespace EDL
{
constexpr int EDL_ACTION_NONE = -1;
enum class Action
{
CUT = 0,
MUTE = 1,
SCENE = 2,
COMM_BR... | @@ -28,4 +28,13 @@ struct Edit
Action action = Action::CUT;
};
+/*!
+ * @brief Specify the search direction for an EDL edit
+*/
+enum class EditDirection | xbmc/cores/EdlEdit.h | 26 | C/C++ | 0.857 | suggestion | 78 | 33 | 32 | false | [EDL][Players] Cleanup FIXMEs | 25,346 | xbmc/xbmc | 17,740 | C++ | howie-f | enen92 |
IPC_SUBS_SELECT,
IPC_SUBS_EXTERNAL,
IPC_SUBS_OFFSET
};
enum ERENDERFEATURE
{
RENDERFEATURE_GAMMA,
RENDERFEATURE_BRIGHTNESS,
RENDERFEATURE_CONTRAST,
RENDERFEATURE_NOISE,
RENDERFEATURE_SHARPNESS,
RENDERFEATURE_NONLINSTRETCH,
RENDERFEATURE_ROTATION,
RENDERFEATURE_STRETCH,
RENDERFEATURE_ZOOM,
REN... | ```suggestion
enum class PlayerSeekDirection : bool
``` | IPC_SUBS_ALL,
IPC_SUBS_SELECT,
IPC_SUBS_EXTERNAL,
IPC_SUBS_OFFSET
};
enum ERENDERFEATURE
{
RENDERFEATURE_GAMMA,
RENDERFEATURE_BRIGHTNESS,
RENDERFEATURE_CONTRAST,
RENDERFEATURE_NOISE,
RENDERFEATURE_SHARPNESS,
RENDERFEATURE_NONLINSTRETCH,
RENDERFEATURE_ROTATION,
RENDERFEATURE_STRETCH,
RENDERFEA... | @@ -84,6 +84,15 @@ enum ERENDERFEATURE
RENDERFEATURE_TONEMAP
};
+/*!
+ * @brief Specify the Seek Direction
+*/
+enum class PlayerSeekDirection | xbmc/cores/IPlayer.h | 26 | C/C++ | 0.857 | suggestion | 57 | 51 | 51 | false | [EDL][Players] Cleanup FIXMEs | 25,346 | xbmc/xbmc | 17,740 | C++ | howie-f | enen92 |
std::vector<EDL::Edit> m_vecEdits;
std::vector<int> m_vecSceneMarkers;
/*!
* @brief Last processed EDL edit time (ms)
*/
int m_lastEditTime;
/*!
* @brief Last processed EDL edit action type
*/
EDL::Action m_lastEditActionType{EDL::EDL_ACTION_NONE};
bool ReadEdl(const std::string& mediaFilePat... | ```suggestion
bool ReadEdl(const std::string& mediaFilePath, float fps);
bool ReadComskip(const std::string& mediaFilePath, float fps);
bool ReadVideoReDo(const std::string& mediaFilePath);
bool ReadBeyondTV(const std::string& mediaFilePath);
bool ReadPvr(const CFileItem& fileItem);
``` | */
std::optional<int> GetNextSceneMarker(Direction direction, int clock);
static std::string MillisecondsToTimeString(int milliSeconds);
private:
// total cut time (edl cuts) in ms
int m_totalCutTime;
std::vector<EDL::Edit> m_vecEdits;
std::vector<int> m_vecSceneMarkers;
/*!
* @brief Last processe... | @@ -170,22 +161,14 @@ class CEdl
*/
EDL::Action m_lastEditActionType{EDL::EDL_ACTION_NONE};
- // FIXME: remove const modifier for fFramesPerSecond as it makes no sense as it means nothing
- // for the reader of the interface, but limits the implementation
- // to not modify the parameter on stack
- bool Rea... | xbmc/cores/VideoPlayer/Edl.h | 26 | C/C++ | 1 | suggestion | 303 | 41 | 45 | false | [EDL][Players] Cleanup FIXMEs | 25,346 | xbmc/xbmc | 17,740 | C++ | howie-f | enen92 |
int CEdl::GetLastEditTime() const
{
return m_lastEditTime;
}
void CEdl::SetLastEditTime(int editTime)
{
m_lastEditTime = editTime;
}
void CEdl::ResetLastEditTime()
{
m_lastEditTime = -1;
}
void CEdl::SetLastEditActionType(EDL::Action action)
{
m_lastEditActionType = action;
}
EDL::Action CEdl::GetLastEditAc... | Would it be possible to replace the int pointer with a reference? | int CEdl::GetLastEditTime() const
{
return m_lastEditTime;
}
void CEdl::SetLastEditTime(int editTime)
{
m_lastEditTime = editTime;
}
void CEdl::ResetLastEditTime()
{
m_lastEditTime = -1;
}
void CEdl::SetLastEditActionType(EDL::Action action)
{
m_lastEditActionType = action;
}
EDL::Action CEdl::GetLastEditAc... | @@ -882,37 +884,37 @@ EDL::Action CEdl::GetLastEditActionType() const
return m_lastEditActionType;
}
-bool CEdl::GetNextSceneMarker(bool bPlus, const int iClock, int *iSceneMarker)
+bool CEdl::GetNextSceneMarker(Direction direction, int clock, int* sceneMarker) | xbmc/cores/VideoPlayer/Edl.cpp | 26 | C++ | 0.357 | question | 65 | 51 | 51 | false | [EDL][Players] Cleanup FIXMEs | 25,346 | xbmc/xbmc | 17,740 | C++ | ksooo | enen92 |
m_CurrentTeletext(STREAM_TELETEXT, VideoPlayer_TELETEXT),
m_CurrentRadioRDS(STREAM_RADIO_RDS, VideoPlayer_RDS),
m_CurrentAudioID3(STREAM_AUDIO_ID3, VideoPlayer_ID3),
m_messenger("player"),
m_outboundEvents(std::make_unique<CJobQueue>(false, 1, CJob::PRIORITY_NORMAL)),
m_pInputStream(nullptr),
... | Same speling error as above, "seconds" | m_CurrentTeletext(STREAM_TELETEXT, VideoPlayer_TELETEXT),
m_CurrentRadioRDS(STREAM_RADIO_RDS, VideoPlayer_RDS),
m_CurrentAudioID3(STREAM_AUDIO_ID3, VideoPlayer_ID3),
m_messenger("player"),
m_outboundEvents(std::make_unique<CJobQueue>(false, 1, CJob::PRIORITY_NORMAL)),
m_pInputStream(nullptr),
... | @@ -644,7 +639,11 @@ CVideoPlayer::CVideoPlayer(IPlayerCallback& callback)
m_HasVideo = false;
m_HasAudio = false;
m_UpdateStreamDetails = false;
- m_messageQueueTimeSize = VP_MESSAGE_QUEUE_TIME_SIZE;
+
+ const int tenthsSecons = CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt( | xbmc/cores/VideoPlayer/VideoPlayer.cpp | 26 | C++ | 0.357 | suggestion | 38 | 51 | 51 | false | [VideoPlayer] Add GUI settings for audio/video playback queues | 25,360 | xbmc/xbmc | 17,740 | C++ | garbear | thexai |
return nullptr;
}
// read image metadata
auto image = Exiv2::ImageFactory::open(outputBuffer.data(), readbytes);
image->readMetadata();
CImageMetadataParser parser;
// extract metadata
parser.ExtractCommonMetadata(*image);
parser.ExtractExif(image->exifData());
parser.ExtractIPTC(image->iptcDa... | This stuff here requires exactly 0.28.2 or above not just 0.28.0 | return nullptr;
}
// read image metadata
auto image = Exiv2::ImageFactory::open(outputBuffer.data(), readbytes);
image->readMetadata();
CImageMetadataParser parser;
// extract metadata
parser.ExtractCommonMetadata(*image);
parser.ExtractExif(image->exifData());
parser.ExtractIPTC(image->iptcDa... | @@ -75,27 +83,28 @@ std::unique_ptr<ImageMetadata> CImageMetadataParser::ExtractMetadata(const std::
CImageMetadataParser parser;
// extract metadata
- parser.ExtractCommonMetadata(image);
+ parser.ExtractCommonMetadata(*image);
parser.ExtractExif(image->exifData());
parser.ExtractIPTC(image->iptcData... | xbmc/pictures/metadata/ImageMetadataParser.cpp | 26 | C++ | 0.143 | suggestion | 64 | 51 | 51 | false | Exiv2 support old API | 25,363 | xbmc/xbmc | 17,740 | C++ | enen92 | fuzzard |
CImageMetadataParser::CImageMetadataParser() : m_imageMetadata(std::make_unique<ImageMetadata>())
{
}
std::unique_ptr<ImageMetadata> CImageMetadataParser::ExtractMetadata(const std::string& picFileName)
{
// read image file to a buffer so it can be fed to libexiv2
CFile file;
std::vector<uint8_t> outputBuffer;
... | TODO above is a leftover, I can clean it later. Members were already moved out of the exif struct | CImageMetadataParser::CImageMetadataParser() : m_imageMetadata(std::make_unique<ImageMetadata>())
{
}
std::unique_ptr<ImageMetadata> CImageMetadataParser::ExtractMetadata(const std::string& picFileName)
{
// read image file to a buffer so it can be fed to libexiv2
CFile file;
std::vector<uint8_t> outputBuffer;
... | @@ -75,27 +83,28 @@ std::unique_ptr<ImageMetadata> CImageMetadataParser::ExtractMetadata(const std::
CImageMetadataParser parser;
// extract metadata
- parser.ExtractCommonMetadata(image);
+ parser.ExtractCommonMetadata(*image);
parser.ExtractExif(image->exifData());
parser.ExtractIPTC(image->iptcData... | xbmc/pictures/metadata/ImageMetadataParser.cpp | 26 | C++ | 0.357 | suggestion | 97 | 51 | 51 | false | Exiv2 support old API | 25,363 | xbmc/xbmc | 17,740 | C++ | enen92 | fuzzard |
/*
* 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 "ImageMetadataParser.h"
#include "filesystem/File.h"
#include "utils/StringUtils.h"
#include "utils/log.h"
#include <cctyp... | I would remove the braces from the defines, so the actual function calls look like function calls. Currently those look like accessing member variables.
Maybe also name the defines `EXIV_toUint32` and `EXIV_toInt64` to be more consistent with the current API names. | /*
* 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 "ImageMetadataParser.h"
#include "filesystem/File.h"
#include "utils/StringUtils.h"
#include "utils/log.h"
#include <cctyp... | @@ -16,6 +16,14 @@
#include <limits>
#include <vector>
+#if (EXIV2_MAJOR_VERSION == 0) && (EXIV2_MINOR_VERSION < 28)
+#define EXIV_UINT32 toLong() | xbmc/pictures/metadata/ImageMetadataParser.cpp | 20 | C++ | 0.786 | style | 266 | 45 | 45 | false | Exiv2 support old API | 25,363 | xbmc/xbmc | 17,740 | C++ | Rechi | fuzzard |
0x82, 0x83, 0x49, 0x80, 0x77, 0xE0};
constexpr std::array<uint8_t, 24> mat_end_code = {0xC3, 0xC2, 0xC0, 0xC4, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x11,
... | The thing with the simpification is, that we now have "no speaking" values, e.g. reader needs to know what 32 means in this context and below what data[8] >> 4 would mean, etc. | 0x82, 0x83, 0x49, 0x80, 0x77, 0xE0};
constexpr std::array<uint8_t, 24> mat_end_code = {0xC3, 0xC2, 0xC0, 0xC4, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x11,
... | @@ -57,42 +57,27 @@ CPackerMAT::CPackerMAT()
// high-bitrate streams can overshoot this size and therefor require proper handling of dynamic padding.
bool CPackerMAT::PackTrueHD(const uint8_t* data, int size)
{
- TrueHDMajorSyncInfo info;
-
- // get the ratebits and output timing from the sync frame
+ // get the ... | xbmc/cores/AudioEngine/Utils/PackerMAT.cpp | 26 | C++ | 0.286 | suggestion | 178 | 51 | 51 | false | [Audio] PackerMAT: simplify code - remove non-essential code | 25,367 | xbmc/xbmc | 17,740 | C++ | fritsch | thexai |
if (size < 32)
return false;
if (data[7] == 0xba)
m_state.ratebits = data[8] >> 4;
else if (data[7] == 0xbb)
m_state.ratebits = data[9] >> 4;
else
return false;
}
else if (!m_state.prevFrametimeValid)
{
// only start streaming on a major sync frame
return false;
... | This was quite good I think to track down seek issues - you really don't need it anymore? |
// get the ratebits from the major sync frame
if (AV_RB32(data + 4) == FORMAT_MAJOR_SYNC)
{
// read audio_sampling_frequency (high nibble after format major sync)
m_state.ratebits = data[8] >> 4;
}
else if (!m_state.prevFrametimeValid)
{
// only start streaming on a major sync frame
return ... | @@ -57,42 +57,27 @@ CPackerMAT::CPackerMAT()
// high-bitrate streams can overshoot this size and therefor require proper handling of dynamic padding.
bool CPackerMAT::PackTrueHD(const uint8_t* data, int size)
{
- TrueHDMajorSyncInfo info;
-
- // get the ratebits and output timing from the sync frame
+ // get the ... | xbmc/cores/AudioEngine/Utils/PackerMAT.cpp | 26 | C++ | 0.143 | question | 89 | 51 | 51 | false | [Audio] PackerMAT: simplify code - remove non-essential code | 25,367 | xbmc/xbmc | 17,740 | C++ | fritsch | thexai |
TEST_F(TestEdl, TestParsingMplayerTimeBasedEDL)
{
CEdl edl;
// create a dummy "media" fileitem whose corresponding edl file is testdata/mplayertimebased.edl
CFileItem mediaItem;
mediaItem.SetPath(
XBMC_REF_FILE_PATH("xbmc/cores/VideoPlayer/test/edl/testdata/mplayertimebased.mkv"));
const bool found = e... | Should there be an include in this file now?
```
#include <chrono>
``` | };
TEST_F(TestEdl, TestParsingMplayerTimeBasedEDL)
{
CEdl edl;
// create a dummy "media" fileitem whose corresponding edl file is testdata/mplayertimebased.edl
CFileItem mediaItem;
mediaItem.SetPath(
XBMC_REF_FILE_PATH("xbmc/cores/VideoPlayer/test/edl/testdata/mplayertimebased.mkv"));
const bool found... | @@ -49,16 +49,16 @@ TEST_F(TestEdl, TestParsingMplayerTimeBasedEDL)
// file has only 1 cut starting at 5.3 secs and ending at 7.1 secs
// so total cut time should be 1.8 seconds (1800 msec)
EXPECT_EQ(edl.HasCuts(), true);
- EXPECT_EQ(edl.GetTotalCutTime(), 1.8 * 1000);
+ EXPECT_EQ(edl.GetTotalCutTime(), 1800... | xbmc/cores/VideoPlayer/test/edl/TestEdl.cpp | 26 | C++ | 0.857 | suggestion | 76 | 51 | 51 | false | [EDL] Use std::chrono | 25,368 | xbmc/xbmc | 17,740 | C++ | fuzzard | enen92 |
/*
* Copyright (C) 2019 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 <chrono>
using namespace std::chrono_literals;
namespace EDL
{
constexpr int EDL_ACTION_NONE = -1;
enum cl... | Shouldn't use a `using` statement in a header. | /*
* Copyright (C) 2019 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 <chrono>
namespace EDL
{
constexpr int EDL_ACTION_NONE = -1;
enum class Action
{
CUT = 0,
MUTE = 1,
S... | @@ -8,6 +8,10 @@
#pragma once
+#include <chrono>
+
+using namespace std::chrono_literals; | xbmc/cores/EdlEdit.h | 13 | C/C++ | 0.5 | suggestion | 46 | 36 | 34 | false | [EDL] Use std::chrono | 25,368 | xbmc/xbmc | 17,740 | C++ | garbear | enen92 |
* 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 <chrono>
namespace EDL
{
constexpr int EDL_ACTION_NONE = -1;
enum class Action
{
CUT = 0,
MUTE = 1,
SCENE = 2,
COMM_BREAK = 3
};
struc... | Could this be expressed a bit easier? Just asking, don’t know.
std::chrono::milliseconds start{0}; | * 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 <chrono>
namespace EDL
{
constexpr int EDL_ACTION_NONE = -1;
enum class Action
{
CUT = 0,
MUTE = 1,
SCENE = 2,
COMM_BREAK = 3
};
struc... | @@ -23,8 +25,8 @@ enum class Action
struct Edit
{
- int start = 0; // ms
- int end = 0; // ms
+ std::chrono::milliseconds start{std::chrono::milliseconds{0}}; | xbmc/cores/EdlEdit.h | 26 | C/C++ | 0.5 | suggestion | 103 | 32 | 32 | false | [EDL] Use std::chrono | 25,368 | xbmc/xbmc | 17,740 | C++ | ksooo | enen92 |
if(current.inited == false)
return false;
const auto hasEdit =
m_Edl.InEdit(std::chrono::milliseconds(std::lround(current.dts + m_offset_pts)));
return hasEdit && hasEdit.value()->action == EDL::Action::CUT;
}
void CVideoPlayer::CheckAutoSceneSkip()
{
if (!m_Edl.HasEdits())
return;
// Check ... | Isn’t the compiler able to convert GetTime return value to the target type? |
if(current.inited == false)
return false;
const auto hasEdit =
m_Edl.InEdit(std::chrono::milliseconds(std::lround(current.dts + m_offset_pts)));
return hasEdit && hasEdit.value()->action == EDL::Action::CUT;
}
void CVideoPlayer::CheckAutoSceneSkip()
{
if (!m_Edl.HasEdits())
return;
// Check ... | @@ -2411,9 +2418,9 @@ void CVideoPlayer::CheckAutoSceneSkip()
m_CurrentVideo.inited == false)
return;
- const int64_t clock = GetTime();
+ const std::chrono::milliseconds clock = std::chrono::milliseconds(GetTime()); | xbmc/cores/VideoPlayer/VideoPlayer.cpp | 26 | C++ | 0.429 | question | 75 | 51 | 51 | false | [EDL] Use std::chrono | 25,368 | xbmc/xbmc | 17,740 | C++ | ksooo | enen92 |
m_CurrentVideo.syncState != IDVDStreamPlayer::SYNC_INSYNC)
{
double now = m_clock.GetAbsoluteClock();
if (m_playSpeed == DVD_PLAYSPEED_NORMAL &&
(now - m_State.lastSeek)/1000 < 2000 &&
!msg.GetAccurate())
{
m_processInfo->SetStateSeeking(false);
... | Not directly related, but std::lround? | m_CurrentVideo.syncState != IDVDStreamPlayer::SYNC_INSYNC)
{
double now = m_clock.GetAbsoluteClock();
if (m_playSpeed == DVD_PLAYSPEED_NORMAL &&
(now - m_State.lastSeek)/1000 < 2000 &&
!msg.GetAccurate())
{
m_processInfo->SetStateSeeking(false);
... | @@ -2700,7 +2708,9 @@ void CVideoPlayer::HandleMessages()
if (msg.GetRelative())
time = (m_clock.GetClock() + m_State.time_offset) / 1000l + time;
- time = msg.GetRestore() ? m_Edl.GetTimeAfterRestoringCuts(time) : time;
+ time = msg.GetRestore()
+ ? m_Edl.GetTimeAfterRestori... | xbmc/cores/VideoPlayer/VideoPlayer.cpp | 26 | C++ | 0.071 | question | 39 | 51 | 51 | false | [EDL] Use std::chrono | 25,368 | xbmc/xbmc | 17,740 | C++ | ksooo | enen92 |
TEST_F(TestEdl, TestParsingMplayerTimeBasedEDL)
{
CEdl edl;
// create a dummy "media" fileitem whose corresponding edl file is testdata/mplayertimebased.edl
CFileItem mediaItem;
mediaItem.SetPath(
XBMC_REF_FILE_PATH("xbmc/cores/VideoPlayer/test/edl/testdata/mplayertimebased.mkv"));
const bool found = e... | Remove the comment? Code is self-explaining now. | TEST_F(TestEdl, TestParsingMplayerTimeBasedEDL)
{
CEdl edl;
// create a dummy "media" fileitem whose corresponding edl file is testdata/mplayertimebased.edl
CFileItem mediaItem;
mediaItem.SetPath(
XBMC_REF_FILE_PATH("xbmc/cores/VideoPlayer/test/edl/testdata/mplayertimebased.mkv"));
const bool found = e... | @@ -49,16 +51,16 @@ TEST_F(TestEdl, TestParsingMplayerTimeBasedEDL)
// file has only 1 cut starting at 5.3 secs and ending at 7.1 secs
// so total cut time should be 1.8 seconds (1800 msec)
EXPECT_EQ(edl.HasCuts(), true);
- EXPECT_EQ(edl.GetTotalCutTime(), 1.8 * 1000);
+ EXPECT_EQ(edl.GetTotalCutTime(), 1800... | xbmc/cores/VideoPlayer/test/edl/TestEdl.cpp | 26 | C++ | 0.286 | suggestion | 49 | 51 | 51 | false | [EDL] Use std::chrono | 25,368 | xbmc/xbmc | 17,740 | C++ | ksooo | enen92 |
const auto hasEdit = edl.InEdit(edl.GetTimeWithoutCuts(middleOfCommbreak));
EXPECT_NE(hasEdit, std::nullopt);
const auto& edit = hasEdit.value();
EXPECT_EQ(edit->action, Action::COMM_BREAK);
EXPECT_EQ(edit->start, edl.GetTimeAfterRestoringCuts(commbreak.start));
EXPECT_EQ(edit->end, edl.GetTimeAfterRestorin... | Would it make sense to keep the math explaining where the 2.8 secs come from? | const auto hasEdit = edl.InEdit(edl.GetTimeWithoutCuts(middleOfCommbreak));
EXPECT_NE(hasEdit, std::nullopt);
const auto& edit = hasEdit.value();
EXPECT_EQ(edit->action, Action::COMM_BREAK);
EXPECT_EQ(edit->start, edl.GetTimeAfterRestoringCuts(commbreak.start));
EXPECT_EQ(edit->end, edl.GetTimeAfterRestorin... | @@ -126,9 +132,9 @@ TEST_F(TestEdl, TestParsingMplayerTimeBasedInterleavedCutsEDL)
EXPECT_EQ(edl.HasEdits(), true);
EXPECT_EQ(edl.GetCutMarkers().size(), 2);
// lets check the total cut time matches the sum of the two cut durations defined in the file
- EXPECT_EQ(edl.GetTotalCutTime(), ((7.1 - 5.3) + (19 - 18... | xbmc/cores/VideoPlayer/test/edl/TestEdl.cpp | 26 | C++ | 0.143 | question | 77 | 51 | 51 | false | [EDL] Use std::chrono | 25,368 | xbmc/xbmc | 17,740 | C++ | ksooo | enen92 |
std::vector<std::string> fieldParts = StringUtils::Split(strFields[i], '.');
if (fieldParts.size() == 1) // No ms
{
editStartEnd[i] = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::seconds(StringUtils::TimeStringToSeconds(fieldParts[0])));
}
... | Could use `std::stoi` to avoid the `c_str` call but may have to handle the possible exception. | if (strFields[i].find(':') != std::string::npos) // HH:MM:SS.sss format
{
std::vector<std::string> fieldParts = StringUtils::Split(strFields[i], '.');
if (fieldParts.size() == 1) // No ms
{
editStartEnd[i] = std::chrono::duration_cast<std::chrono::milliseconds>(
... | @@ -179,9 +180,9 @@ bool CEdl::ReadEdl(const std::string& mediaFilePath, float fps)
{
fieldParts[1] = fieldParts[1].substr(0, 3);
}
- editStartEnd[i] =
- static_cast<int64_t>(StringUtils::TimeStringToSeconds(fieldParts[0])) * 1000 +
- std::atoi(field... | xbmc/cores/VideoPlayer/Edl.cpp | 26 | C++ | 0.857 | suggestion | 94 | 51 | 51 | false | [EDL] Use std::chrono | 25,368 | xbmc/xbmc | 17,740 | C++ | lrusak | enen92 |
CDVDMsgPlayerSeek::CMode mode;
mode.time = (int)seekTarget;
mode.backward = !bPlus;
mode.accurate = false;
mode.restore = restore;
mode.trickplay = false;
mode.sync = true;
m_messenger.Put(std::make_shared<CDVDMsgPlayerSeek>(mode));
SynchronizeDemuxer();
if (seekTarget < 0)
seekTarget = 0;
m... | ```suggestion
auto clock = std::chrono::milliseconds(GetTime());
```
|
CDVDMsgPlayerSeek::CMode mode;
mode.time = (int)seekTarget;
mode.backward = !bPlus;
mode.accurate = false;
mode.restore = restore;
mode.trickplay = false;
mode.sync = true;
m_messenger.Put(std::make_shared<CDVDMsgPlayerSeek>(mode));
SynchronizeDemuxer();
if (seekTarget < 0)
seekTarget = 0;
m... | @@ -3268,19 +3279,19 @@ bool CVideoPlayer::SeekScene(Direction seekDirection)
* There is a 5 second grace period applied when seeking for scenes backwards. If there is no
* grace period applied it is impossible to go backwards past a scene marker.
*/
- int64_t clock = GetTime();
- if (seekDirection == Dir... | xbmc/cores/VideoPlayer/VideoPlayer.cpp | 26 | C++ | 0.857 | suggestion | 71 | 51 | 51 | false | [EDL] Use std::chrono | 25,368 | xbmc/xbmc | 17,740 | C++ | lrusak | enen92 |
void Window::doModal()
{
XBMC_TRACE;
if (!existingWindow)
{
bModal = true;
if(iWindowId != ACTIVE_WINDOW)
show();
while (bModal && !g_application.m_bStop)
{
//! @todo garbear added this code to the python window.cpp class and
//! commented in XBPyTh... | Maybe log more info regarding which window is actually being closed? | void Window::doModal()
{
XBMC_TRACE;
if (!existingWindow)
{
bModal = true;
if(iWindowId != ACTIVE_WINDOW)
show();
while (bModal && !g_application.m_bStop)
{
languageHook->MakePendingCalls(); // MakePendingCalls
bool stillWaiting;... | @@ -687,6 +677,14 @@ namespace XBMCAddon
DelayedCallGuard dcguard(languageHook);
stillWaiting = WaitForActionEvent(100) ? false : true;
}
+
+ // If application has quit, close the window
+ if (bModal && g_application.m_bStop)
+ {
+ ... | xbmc/interfaces/legacy/Window.cpp | 26 | C++ | 0.143 | question | 68 | 51 | 51 | false | Python: Restore close of WindowXML when application exits | 25,380 | xbmc/xbmc | 17,740 | C++ | enen92 | garbear |
const std::string set = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::uniform_int_distribution<> select(0, set.size() - 1);
return set[select(gen)];
};
std::string ret;
ret.reserve(input.size());
std::transform(input.begin(), input.end(), std::back_inserter(ret),
... | Windows test failure is related to backslash but not sure why only fails the first two. Changing to this test pass (on Windows):
```
FanartTest{"stack://#DIRECTORY#\\foo-cd1.avi , #DIRECTORY#\\foo-cd2.avi", "foo-fanart.jpg"},
FanartTest{"stack://#DIRECTORY#\\foo-cd1.avi , #DIRECTORY#\\foo-cd2.avi", "foo-cd... | const std::string set = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::uniform_int_distribution<> select(0, set.size() - 1);
return set[select(gen)];
};
std::string ret;
ret.reserve(input.size());
std::transform(input.begin(), input.end(), std::back_inserter(ret),
... | @@ -7,19 +7,75 @@
*/
#include "FileItem.h"
+#include "URL.h"
+#include "filesystem/Directory.h"
#include "platform/Filesystem.h"
#include "utils/ArtUtils.h"
#include "utils/FileUtils.h"
+#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
+#include "video/VideoInfoTag.h"
#include <array>
#include <f... | xbmc/utils/test/TestArtUtils.cpp | 26 | C++ | 0.929 | bug | 462 | 51 | 51 | false | move CFileItem::GetLocalFanart to ArtUtils | 25,416 | xbmc/xbmc | 17,740 | C++ | thexai | notspiff |
style->OutlineColour = ConvColor(subStyle->fontBorderColor, subStyle->fontOpacity);
if (subStyle->borderStyle == BorderType::OUTLINE_NO_SHADOW)
{
style->BackColour = ConvColor(COLOR::NONE, 0); // Set the shadow color
style->Shadow = 0; // Set the shadow size
}
else
{
... | when you use c++ methods add namespace
```suggestion
lineSpacing = std::fmax(subStyle->lineSpacing, 8.0 * scaleDefault);
``` | if (subStyle->borderStyle == BorderType::OUTLINE_NO_SHADOW)
{
style->BackColour = ConvColor(COLOR::NONE, 0); // Set the shadow color
style->Shadow = 0; // Set the shadow size
}
else
{
style->BackColour =
ConvColor(subStyle->shadowColor, subStyle->shadowO... | @@ -451,7 +451,7 @@ void CDVDSubtitlesLibass::ApplyStyle(const std::shared_ptr<struct style>& subSty
ConvColor(subStyle->shadowColor, subStyle->shadowOpacity); // Set the box shadow color
style->Shadow = (10.00 / 100 * subStyle->shadowSize) * scale; // Set the box shadow size
// By default a bo... | xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp | 26 | C++ | 1 | suggestion | 133 | 51 | 51 | false | Add a setting to make subtitles line spacing configurable | 25,421 | xbmc/xbmc | 17,740 | C++ | CastagnaIT | stigger |
if (subStyle->borderStyle == BorderType::OUTLINE_NO_SHADOW)
{
style->BackColour = ConvColor(COLOR::NONE, 0); // Set the shadow color
style->Shadow = 0; // Set the shadow size
}
else
{
style->BackColour =
ConvColor(subStyle->shadowColor, subStyle->shadowO... | dont remove the scale, linespacing is not scaled | if (subStyle->borderStyle == BorderType::OUTLINE_NO_SHADOW)
{
style->BackColour = ConvColor(COLOR::NONE, 0); // Set the shadow color
style->Shadow = 0; // Set the shadow size
}
else
{
style->BackColour =
ConvColor(subStyle->shadowColor, subStyle->shadowO... | @@ -450,8 +449,6 @@ void CDVDSubtitlesLibass::ApplyStyle(const std::shared_ptr<struct style>& subSty
style->BackColour =
ConvColor(subStyle->shadowColor, subStyle->shadowOpacity); // Set the box shadow color
style->Shadow = (10.00 / 100 * subStyle->shadowSize) * scale; // Set the box shadow siz... | xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp | 26 | C++ | 0.286 | suggestion | 48 | 51 | 51 | false | Add a setting to make subtitles line spacing configurable | 25,421 | xbmc/xbmc | 17,740 | C++ | CastagnaIT | stigger |
int CSubtitlesSettings::GetShadowSize()
{
return m_settings->GetInt(CSettings::SETTING_SUBTITLES_SHADOWSIZE);
}
UTILS::COLOR::Color CSubtitlesSettings::GetShadowColor()
{
return UTILS::COLOR::ConvertHexToColor(
m_settings->GetString(CSettings::SETTING_SUBTITLES_SHADOWCOLOR));
}
int CSubtitlesSettings::GetS... | kodi setting component must return the untouched value |
int CSubtitlesSettings::GetShadowSize()
{
return m_settings->GetInt(CSettings::SETTING_SUBTITLES_SHADOWSIZE);
}
UTILS::COLOR::Color CSubtitlesSettings::GetShadowColor()
{
return UTILS::COLOR::ConvertHexToColor(
m_settings->GetString(CSettings::SETTING_SUBTITLES_SHADOWCOLOR));
}
int CSubtitlesSettings::GetS... | @@ -133,6 +133,12 @@ int CSubtitlesSettings::GetBlurSize()
return m_settings->GetInt(CSettings::SETTING_SUBTITLES_BLUR);
}
+double CSubtitlesSettings::GetLineSpacing()
+{
+ return static_cast<double>(m_settings->GetInt(CSettings::SETTING_SUBTITLES_LINE_SPACING)) * 50 /
+ 100; | xbmc/settings/SubtitlesSettings.cpp | 26 | C++ | 0.143 | suggestion | 54 | 51 | 51 | false | Add a setting to make subtitles line spacing configurable | 25,421 | xbmc/xbmc | 17,740 | C++ | CastagnaIT | stigger |
style->Spacing = 0;
bool isFontBold =
(subStyle->fontStyle == FontStyle::BOLD || subStyle->fontStyle == FontStyle::BOLD_ITALIC);
bool isFontItalic =
(subStyle->fontStyle == FontStyle::ITALIC || subStyle->fontStyle == FontStyle::BOLD_ITALIC);
style->Bold = isFontBold * -1;
style->Ita... | this must be changed.
you have changed scaling by using `scale` and this is wrong, with overrided fonts will cause a wrong scaling.
this has more sense change as:
```c++
double lineSpacing;
if (subStyle->assOverrideFont)
lineSpacing = subStyle->lineSpacing * scaleDefault;
else
lineSpac... | style->Spacing = 0;
bool isFontBold =
(subStyle->fontStyle == FontStyle::BOLD || subStyle->fontStyle == FontStyle::BOLD_ITALIC);
bool isFontItalic =
(subStyle->fontStyle == FontStyle::ITALIC || subStyle->fontStyle == FontStyle::BOLD_ITALIC);
style->Bold = isFontBold * -1;
style->Ita... | @@ -420,7 +420,7 @@ void CDVDSubtitlesLibass::ApplyStyle(const std::shared_ptr<struct style>& subSty
style->SecondaryColour = ConvColor(COLOR::BLACK);
// Configure the effects
- double lineSpacing = 0.0;
+ double lineSpacing = subStyle->lineSpacing * scale; | xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp | 26 | C++ | 1 | bug | 471 | 51 | 51 | false | Add a setting to make subtitles line spacing configurable | 25,421 | xbmc/xbmc | 17,740 | C++ | CastagnaIT | stigger |
{
// This BorderStyle not support outline color/size
style->BorderStyle = ASS_BORDER_STYLE_BOX;
style->Outline = 4 * scale; // Space between the text and the box edges
style->OutlineColour =
ConvColor(subStyle->backgroundColor,
subStyle->backgroundOpacity); // S... | here there is an error
you are calculating/set the linespace with a percentage value instead of px and so its wrong,
imo a good solution is to proportion the percentage value to half the height of the playresY and rescale to half frame height, so that when is to 100% the space reaches at max the half screen
here t... | {
// This BorderStyle not support outline color/size
style->BorderStyle = ASS_BORDER_STYLE_BOX;
style->Outline = 4 * scale; // Space between the text and the box edges
style->OutlineColour =
ConvColor(subStyle->backgroundColor,
subStyle->backgroundOpacity); // S... | @@ -463,6 +460,11 @@ void CDVDSubtitlesLibass::ApplyStyle(const std::shared_ptr<struct style>& subSty
style->Shadow = 4 * scale; // Space between the text and the box edges
}
+ double lineSpacing;
+ if (subStyle->assOverrideFont)
+ lineSpacing = subStyle->lineSpacing * scaleDefault;
+ else
+... | xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp | 26 | C++ | 1 | bug | 768 | 51 | 51 | false | Add a setting to make subtitles line spacing configurable | 25,421 | xbmc/xbmc | 17,740 | C++ | CastagnaIT | stigger |
if (!CServiceBroker::GetPVRManager().IsParentalLocked(epgTag))
strValue = epgTag->OriginalTitle();
return true;
case VIDEOPLAYER_YEAR:
case LISTITEM_YEAR:
if (epgTag->Year() > 0)
{
strValue = std::to_string(epgTag->Year());
return true;
}... | Are we sure that in all languages the separator between episode number and episode part is a forward slash or should this rather be a translatable string making it possible to translate the separator? | case VIDEOPLAYER_IMDBNUMBER:
case LISTITEM_IMDBNUMBER:
strValue = epgTag->IMDBNumber();
return true;
case VIDEOPLAYER_ORIGINALTITLE:
case LISTITEM_ORIGINALTITLE:
if (!CServiceBroker::GetPVRManager().IsParentalLocked(epgTag))
strValue = epgTag->OriginalTitle();
... | @@ -775,7 +775,11 @@ bool CPVRGUIInfo::GetListItemAndPlayerLabel(const CFileItem* item,
case LISTITEM_EPISODE:
if (epgTag->EpisodeNumber() >= 0)
{
- strValue = std::to_string(epgTag->EpisodeNumber());
+ if (epgTag->EpisodePart() > 0)
+ strValue =
+ St... | xbmc/pvr/guilib/guiinfo/PVRGUIInfo.cpp | 26 | C++ | 0.571 | question | 200 | 51 | 51 | false | [PVR][Estuary] Add missing EpisodePart information | 25,439 | xbmc/xbmc | 17,740 | C++ | ksooo | emveepee |
#define LISTITEM_ORIGINALDATE (LISTITEM_START + 196)
#define LISTITEM_BPM (LISTITEM_START + 197)
#define LISTITEM_UNIQUEID (LISTITEM_START + 198)
#define LISTITEM_BITRATE (LISTITEM_START + 199)
#define LISTITEM_SAMPLERATE (LISTITEM_START + 200)
#define LISTITEM_MUSICCHA... | This value (LISTITEM_START + 221) will collide with unmerged PR#24096.
https://github.com/xbmc/xbmc/blob/affc44682761fbcbc9243b840c91d6780be8301c/xbmc/guilib/guiinfo/GUIInfoLabels.h#L992C1-L992C61 | #define LISTITEM_ORIGINALDATE (LISTITEM_START + 196)
#define LISTITEM_BPM (LISTITEM_START + 197)
#define LISTITEM_UNIQUEID (LISTITEM_START + 198)
#define LISTITEM_BITRATE (LISTITEM_START + 199)
#define LISTITEM_SAMPLERATE (LISTITEM_START + 200)
#define LISTITEM_MUSICCHA... | @@ -989,6 +990,7 @@ static constexpr unsigned int SYSTEM_LOCALE = 1012;
#define LISTITEM_PVR_INSTANCE_NAME (LISTITEM_START + 218)
#define LISTITEM_CHANNEL_LOGO (LISTITEM_START + 219)
#define LISTITEM_PVR_GROUP_ORIGIN (LISTITEM_START + 220)
+#define LISTITEM_EPISODEPART (LISTITEM_START + 221) | xbmc/guilib/guiinfo/GUIInfoLabels.h | 26 | C/C++ | 0.286 | suggestion | 199 | 47 | 49 | false | [PVR][Estuary] Add missing EpisodePart information | 25,439 | xbmc/xbmc | 17,740 | C++ | DeltaMikeCharlie | emveepee |
// add removable storage
VECSOURCES drives;
GetRemovableDrives(drives);
for (unsigned int i = 0; i < drives.size(); i++)
{
usage.clear();
if (GetStorageUsage(drives[i].strPath, usage) && !usage.empty())
result.push_back(usage);
}
return result;
}
bool CAndroidStorageProvider::PumpDriveCha... | maybe move this to constexpr in an anonymous namespace within this file? |
// add removable storage
VECSOURCES drives;
GetRemovableDrives(drives);
for (unsigned int i = 0; i < drives.size(); i++)
{
usage.clear();
if (GetStorageUsage(drives[i].strPath, usage) && !usage.empty())
result.push_back(usage);
}
return result;
}
bool CAndroidStorageProvider::PumpDriveCha... | @@ -414,3 +416,70 @@ bool CAndroidStorageProvider::PumpDriveChangeEvents(IStorageEventsCallback *call
m_removableDrives = std::move(drives);
return changed;
}
+
+bool CAndroidStorageProvider::GetStorageUsage(const std::string& path, std::string& usage)
+{
+#define GIGABYTES 1073741824 | xbmc/platform/android/storage/AndroidStorageProvider.cpp | 26 | C++ | 0.357 | refactor | 72 | 51 | 51 | false | [Android] Move GetStorageUsage function to CAndroidStorageProvider | 25,478 | xbmc/xbmc | 17,740 | C++ | enen92 | joseluismarti |
fmt << std::right << "Size";
fmt.width(12);
fmt << "Used";
fmt.width(12);
fmt << "Avail";
fmt.width(12);
fmt << "Use %";
usage = fmt.str();
return false;
}
CJNIStatFs fileStat(path);
int blockSize = fileStat.getBlockSize();
int blockCount = fileStat.getBlockCount();
in... | const it seems, same for the line below (and I think all the above) | /*
* Copyright (C) 2012-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 "AndroidStorageProvider.h"
#include "Util.h"
#include "filesystem/Directory.h"
#include "filesystem/File.h"
#include "... | @@ -414,3 +416,70 @@ bool CAndroidStorageProvider::PumpDriveChangeEvents(IStorageEventsCallback *call
m_removableDrives = std::move(drives);
return changed;
}
+
+bool CAndroidStorageProvider::GetStorageUsage(const std::string& path, std::string& usage)
+{
+#define GIGABYTES 1073741824
+#define PATH_MAXLEN 38
+
+... | xbmc/platform/android/storage/AndroidStorageProvider.cpp | 26 | C++ | 0.143 | suggestion | 67 | 51 | 454 | false | [Android] Move GetStorageUsage function to CAndroidStorageProvider | 25,478 | xbmc/xbmc | 17,740 | C++ | enen92 | joseluismarti |
fmt << "Used";
fmt.width(12);
fmt << "Avail";
fmt.width(12);
fmt << "Use %";
usage = fmt.str();
return false;
}
CJNIStatFs fileStat(path);
const int blockSize = fileStat.getBlockSize();
const int blockCount = fileStat.getBlockCount();
const int freeBlocks = fileStat.getFreeBloc... | It would be nice if instead of stringstream we could just use StringUtils::Format, the use of fmt::format is more readable.
Not required for this PR but just a suggestion. | /*
* Copyright (C) 2012-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 "AndroidStorageProvider.h"
#include "Util.h"
#include "filesystem/Directory.h"
#include "filesystem/File.h"
#include "... | @@ -414,3 +416,73 @@ bool CAndroidStorageProvider::PumpDriveChangeEvents(IStorageEventsCallback *call
m_removableDrives = std::move(drives);
return changed;
}
+
+namespace
+{
+constexpr float GIGABYTES = 1073741824;
+constexpr int PATH_MAXLEN = 38;
+} // namespace
+
+bool CAndroidStorageProvider::GetStorageUsage... | xbmc/platform/android/storage/AndroidStorageProvider.cpp | 26 | C++ | 0.5 | suggestion | 172 | 51 | 454 | false | [Android] Move GetStorageUsage function to CAndroidStorageProvider | 25,478 | xbmc/xbmc | 17,740 | C++ | lrusak | joseluismarti |
#include <androidjni/Context.h>
namespace KODI
{
namespace MEMORY
{
void* AlignedMalloc(size_t s, size_t alignTo)
{
void* p;
posix_memalign(&p, alignTo, s);
return p;
}
void AlignedFree(void* p)
{
free(p);
}
void GetMemoryStatus(MemoryStatus* buffer)
{
if (!buffer)
return;
std::unique_ptr<CJNIActi... | ```suggestion
auto activityManager = std::make_unique<CJNIActivityManager>(
```
| #include <androidjni/Context.h>
namespace KODI
{
namespace MEMORY
{
void* AlignedMalloc(size_t s, size_t alignTo)
{
void* p;
posix_memalign(&p, alignTo, s);
return p;
}
void AlignedFree(void* p)
{
free(p);
}
void GetMemoryStatus(MemoryStatus* buffer)
{
if (!buffer)
return;
auto activityManager = s... | @@ -35,16 +36,24 @@ void GetMemoryStatus(MemoryStatus* buffer)
if (!buffer)
return;
- long availMem = 0;
- long totalMem = 0;
+ std::unique_ptr<CJNIActivityManager> activityManager = std::make_unique<CJNIActivityManager>( | xbmc/platform/android/MemUtils.cpp | 26 | C++ | 0.857 | suggestion | 82 | 47 | 47 | false | [Android] Move MemoryInfo logic to MemUtils | 25,485 | xbmc/xbmc | 17,740 | C++ | lrusak | joseluismarti |
#include "LangInfo.h"
#include "ServiceBroker.h"
#include "addons/AddonManager.h"
#include "addons/Skin.h"
#include "addons/addoninfo/AddonType.h"
#include "guilib/GUIWindowManager.h"
#include "messaging/helpers/DialogHelper.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "utils/Stri... | was better readable where was before |
#include "LangInfo.h"
#include "ServiceBroker.h"
#include "addons/AddonManager.h"
#include "addons/Skin.h"
#include "addons/addoninfo/AddonType.h"
#include "guilib/GUIWindowManager.h"
#include "messaging/helpers/DialogHelper.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "utils/Stri... | @@ -29,12 +29,10 @@ namespace ADDON
{
CLanguageResource::CLanguageResource(const AddonInfoPtr& addonInfo)
- : CResource(addonInfo, AddonType::RESOURCE_LANGUAGE)
+ : CResource(addonInfo, AddonType::RESOURCE_LANGUAGE),
+ // parse <extension> attributes
+ m_locale(CLocale::FromString(Type(AddonType::RESOURCE_L... | xbmc/addons/LanguageResource.cpp | 26 | C++ | 0.286 | suggestion | 36 | 51 | 51 | false | xbmc/addons: cppcheck performance fixes | 25,515 | xbmc/xbmc | 17,740 | C++ | CastagnaIT | tobbi |
//CLog::Log(LOGINFO, "FillInDefaultIcon({})", pItem->GetLabel());
// find the default icon for a file or folder item
// for files this can be the (depending on the file type)
// default picture for photo's
// default picture for songs
// default picture for videos
// default picture for shortcuts... | Seems this is the only reason for including "PVRChannel.h" (compile time dep to PVR component). Can you ple ase put a `@todo get rid of PVR compile time dependency` and I will pick this up later? |
// find the default icon for a file or folder item
// for files this can be the (depending on the file type)
// default picture for photo's
// default picture for songs
// default picture for videos
// default picture for shortcuts
// default picture for playlists
//
// for folders
// f... | @@ -28,6 +31,126 @@ using namespace XFILE;
namespace KODI::ART
{
+void FillInDefaultIcon(CFileItem& item)
+{
+ if (URIUtils::IsPVRGuideItem(item.GetPath()))
+ {
+ // epg items never have a default icon. no need to execute this expensive method.
+ // when filling epg grid window, easily tens of thousands of ... | xbmc/utils/ArtUtils.cpp | 26 | C++ | 0.5 | question | 195 | 51 | 51 | false | changed: move CFileItem::FillInDefaultIcon to ArtUtils | 25,539 | xbmc/xbmc | 17,740 | C++ | ksooo | notspiff |
iEndOffset = static_cast<int>(item.GetEndOffset());
idSong = -1;
iTimesPlayed = 0;
idAlbum = -1;
iBPM = tag.GetBPM();
iSampleRate = tag.GetSampleRate();
iBitRate = tag.GetBitRate();
iChannels = tag.GetNoOfChannels();
songVideoURL = tag.GetSongVideoURL();
}
CSong::CSong()
{
Clear();
}
void CSong::S... | Make it static maybe?
```suggestion
static const std::vector<std::string> separators{" feat. ", " ft. ", " Feat. ", " Ft. ", ";", ":",
``` | iEndOffset = static_cast<int>(item.GetEndOffset());
idSong = -1;
iTimesPlayed = 0;
idAlbum = -1;
iBPM = tag.GetBPM();
iSampleRate = tag.GetSampleRate();
iBitRate = tag.GetBitRate();
iChannels = tag.GetNoOfChannels();
songVideoURL = tag.GetSongVideoURL();
}
CSong::CSong()
{
Clear();
}
void CSong::S... | @@ -91,12 +91,13 @@ void CSong::SetArtistCredits(const std::vector<std::string>& names, const std::v
//Split the artist sort string to try and get sort names for individual artists
std::vector<std::string> artistSort = StringUtils::Split(strArtistSort, CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()... | xbmc/music/Song.cpp | 26 | C++ | 1 | suggestion | 144 | 51 | 51 | false | [MUSIC] Fix separators so that artist sortnames split correctly | 25,553 | xbmc/xbmc | 17,740 | C++ | neo1973 | the-black-eagle |
EGLint fd = m_eglDupNativeFenceFDANDROID(m_display, m_gpuFence);
if (fd == EGL_NO_NATIVE_FENCE_FD_ANDROID)
CEGLUtils::Log(LOGERROR, "failed to duplicate EGL fence fd");
m_eglDestroySyncKHR(m_display, m_gpuFence);
return fd;
}
void CEGLFence::WaitSyncGPU()
{
if (!m_kmsFence)
return;
if (m_eglWait... | Status variable is now useless. However, some kind of log would be useful if wait fails. | EGLint fd = m_eglDupNativeFenceFDANDROID(m_display, m_gpuFence);
if (fd == EGL_NO_NATIVE_FENCE_FD_ANDROID)
CEGLUtils::Log(LOGERROR, "failed to duplicate EGL fence fd");
m_eglDestroySyncKHR(m_display, m_gpuFence);
return fd;
}
void CEGLFence::WaitSyncGPU()
{
if (!m_kmsFence)
return;
if (m_eglWait... | @@ -135,8 +135,7 @@ void CEGLFence::WaitSyncCPU()
EGLint status{EGL_FALSE};
- while (status != EGL_CONDITION_SATISFIED_KHR)
- status = m_eglClientWaitSyncKHR(m_display, m_kmsFence, 0, EGL_FOREVER_KHR);
+ status = m_eglClientWaitSyncKHR(m_display, m_kmsFence, 0, EGL_FOREVER_KHR); | xbmc/utils/EGLFence.cpp | 26 | C++ | 0.357 | bug | 88 | 31 | 28 | false | Egl async rendering fixes | 25,588 | xbmc/xbmc | 17,740 | C++ | jernejsk | hbiyik |
if (strValue.empty())
return 0;
return atoi(strValue.c_str());
}
void CPVRDatabase::FixupClientIDs()
{
// Get enabled and disabled PVR client addon infos
std::vector<ADDON::AddonInfoPtr> addonInfos;
CServiceBroker::GetAddonMgr().GetAddonInfos(addonInfos, false, ADDON::AddonType::PVRDLL);
std::vector... | You could use structured bindings in the for loop to avoid this.
```c++
for (const auto& [addonID, instanceID, addonName] : clientInfos)
```
|
if (strValue.empty())
return 0;
return atoi(strValue.c_str());
}
void CPVRDatabase::FixupClientIDs()
{
// Get enabled and disabled PVR client addon infos
std::vector<ADDON::AddonInfoPtr> addonInfos;
CServiceBroker::GetAddonMgr().GetAddonInfos(addonInfos, false, ADDON::AddonType::PVRDLL);
std::vector... | @@ -436,6 +449,117 @@ int CPVRDatabase::GetPriority(const CPVRClient& client) const
return atoi(strValue.c_str());
}
+void CPVRDatabase::FixupClientIDs()
+{
+ // Get enabled and disabled PVR client addon infos
+ std::vector<ADDON::AddonInfoPtr> addonInfos;
+ CServiceBroker::GetAddonMgr().GetAddonInfos(addonInf... | xbmc/pvr/PVRDatabase.cpp | 26 | C++ | 1 | suggestion | 141 | 51 | 51 | false | [PVR] Fix major design flaw to use std::hash value as persistent client UID | 25,590 | xbmc/xbmc | 17,740 | C++ | lrusak | ksooo |
return true;
}
bool CRepository::FetchIndex(const RepositoryDirInfo& repo,
std::string const& digest,
std::vector<AddonInfoPtr>& addons) noexcept
{
std::string response;
CFile file;
if (!file.Open(repo.info))
{
CLog::Log(LOGERROR, "CRepository: f... | To avoid copying the string into `response`:
```suggestion
response = std::move(ss).str();
``` |
return true;
}
bool CRepository::FetchIndex(const RepositoryDirInfo& repo,
std::string const& digest,
std::vector<AddonInfoPtr>& addons) noexcept
{
XFILE::CCurlFile http;
std::string response;
if (!http.Get(repo.info, response))
{
CLog::Log(LOGE... | @@ -201,15 +201,25 @@ bool CRepository::FetchIndex(const RepositoryDirInfo& repo,
std::string const& digest,
std::vector<AddonInfoPtr>& addons) noexcept
{
- XFILE::CCurlFile http;
-
std::string response;
- if (!http.Get(repo.info, response))
+ CFile fil... | xbmc/addons/Repository.cpp | 26 | C++ | 0.857 | suggestion | 99 | 51 | 51 | false | Enable file:// protocol in CURL and CCurlFile | 25,638 | xbmc/xbmc | 17,740 | C++ | neo1973 | basilgello |
m_opened = true;
m_seekable = true;
CURL url2(url);
ParseAndCorrectUrl(url2);
std::string redactPath = CURL::GetRedacted(m_url);
CLog::Log(LOGDEBUG, "CurlFile::{} - <{}>", __FUNCTION__, redactPath);
assert(!(!m_state->m_easyHandle ^ !m_state->m_multiHandle));
if( m_state->m_easyHandle == NULL )
g... | My concern with this is the history. https://github.com/xbmc/xbmc/pull/7290
it was specifically added to test specifically 0 error code due to things potentially not returning.
I dont know why this is required for this PR (i havent looked into it), but i think another solution may be necessary to take the original ... | m_opened = true;
m_seekable = true;
CURL url2(url);
ParseAndCorrectUrl(url2);
std::string redactPath = CURL::GetRedacted(m_url);
CLog::Log(LOGDEBUG, "CurlFile::{} - <{}>", __FUNCTION__, redactPath);
assert(!(!m_state->m_easyHandle ^ !m_state->m_multiHandle));
if( m_state->m_easyHandle == NULL )
g... | @@ -1097,7 +1097,7 @@ bool CCurlFile::Open(const CURL& url)
m_httpresponse = m_state->Connect(m_bufferSize);
- if (m_httpresponse <= 0 || (m_failOnError && m_httpresponse >= 400))
+ if (m_httpresponse < 0 || (m_failOnError && m_httpresponse >= 400)) | xbmc/filesystem/CurlFile.cpp | 26 | C++ | 0.929 | suggestion | 349 | 51 | 51 | false | Enable file:// protocol in CURL and CCurlFile | 25,638 | xbmc/xbmc | 17,740 | C++ | fuzzard | basilgello |
iLifetime = recording.LifeTime();
iGenreType = recording.GenreType();
iGenreSubType = recording.GenreSubType();
iPlayCount = recording.GetLocalPlayCount();
iLastPlayedPosition = std::lrint(recording.GetLocalResumePoint().timeInSeconds);
bIsDeleted = recording.IsDeleted();
iEpgEventId = recor... | Please remove this line. A member is only needed for `const char*`API struct members. | iLifetime = recording.LifeTime();
iGenreType = recording.GenreType();
iGenreSubType = recording.GenreSubType();
iPlayCount = recording.GetLocalPlayCount();
iLastPlayedPosition = std::lrint(recording.GetLocalResumePoint().timeInSeconds);
bIsDeleted = recording.IsDeleted();
iEpgEventId = recor... | @@ -175,6 +175,7 @@ class CAddonRecording : public PVR_RECORDING
const std::string m_recordingId;
const std::string m_title;
const std::string m_episodeName;
+ int m_episodePartNumber; | xbmc/pvr/addons/PVRClient.cpp | 26 | C++ | 0.571 | refactor | 85 | 51 | 51 | false | [PVR] Expose EpisodePart for recordings | 25,643 | xbmc/xbmc | 17,740 | C++ | ksooo | emveepee |
: m_recordingId(recording.ClientRecordingID()),
m_title(recording.m_strTitle),
m_episodeName(recording.m_strShowTitle),
m_directory(recording.Directory()),
m_plotOutline(recording.m_strPlotOutline),
m_plot(recording.m_strPlot),
m_genreDescription(recording.GetGenresLabel()),
... | This needs to read `iEpisodePartNumber = recording.EpisodePart();`
| : m_recordingId(recording.ClientRecordingID()),
m_title(recording.m_strTitle),
m_episodeName(recording.m_strShowTitle),
m_directory(recording.Directory()),
m_plotOutline(recording.m_strPlotOutline),
m_plot(recording.m_strPlot),
m_genreDescription(recording.GetGenresLabel()),
... | @@ -135,7 +135,7 @@ class CAddonRecording : public PVR_RECORDING
strEpisodeName = m_episodeName.c_str();
iSeriesNumber = recording.m_iSeason;
iEpisodeNumber = recording.m_iEpisode;
- iEpisodePartNumber = PVR_RECORDING_INVALID_SERIES_EPISODE; //! @todo
+ iEpisodePartNumber = m_episodePartNumber; | xbmc/pvr/addons/PVRClient.cpp | 26 | C++ | 0.357 | suggestion | 69 | 51 | 51 | false | [PVR] Expose EpisodePart for recordings | 25,643 | xbmc/xbmc | 17,740 | C++ | ksooo | emveepee |
m_originalTitle(tag.OriginalTitle()),
m_cast(tag.DeTokenize(tag.Cast())),
m_director(tag.DeTokenize(tag.Directors())),
m_writer(tag.DeTokenize(tag.Writers())),
m_IMDBNumber(tag.IMDBNumber()),
m_episodeName(tag.EpisodeName()),
m_iconPath(tag.ClientIconPath()),
m_seriesLink... | This change is wrong. Leave as it is, please. | m_cast(tag.DeTokenize(tag.Cast())),
m_director(tag.DeTokenize(tag.Directors())),
m_writer(tag.DeTokenize(tag.Writers())),
m_IMDBNumber(tag.IMDBNumber()),
m_episodeName(tag.EpisodeName()),
m_iconPath(tag.ClientIconPath()),
m_seriesLink(tag.SeriesLink()),
m_genreDescription... | @@ -280,7 +281,7 @@ class CAddonEpgTag : public EPG_TAG
iParentalRating = tag.ParentalRating();
iSeriesNumber = tag.SeriesNumber();
iEpisodeNumber = tag.EpisodeNumber();
- iEpisodePartNumber = tag.EpisodePart();
+ iEpisodePartNumber = m_episodePartNumber; | xbmc/pvr/addons/PVRClient.cpp | 26 | C++ | 0.286 | bug | 45 | 51 | 51 | false | [PVR] Expose EpisodePart for recordings | 25,643 | xbmc/xbmc | 17,740 | C++ | ksooo | emveepee |
strParentalRatingCode = m_parentalRatingCode.c_str();
strParentalRatingIcon = m_parentalRatingIcon.c_str();
strParentalRatingSource = m_parentalRatingSource.c_str();
}
virtual ~CAddonEpgTag() = default;
private:
static std::string GetFirstAired(const CPVREpgInfoTag& tag)
{
const CDateTime firs... | Please remove this line. A member is only needed for `const char*`API struct members. | strParentalRatingIcon = m_parentalRatingIcon.c_str();
strParentalRatingSource = m_parentalRatingSource.c_str();
}
virtual ~CAddonEpgTag() = default;
private:
static std::string GetFirstAired(const CPVREpgInfoTag& tag)
{
const CDateTime firstAired{tag.FirstAired()};
if (firstAired.IsValid())
... | @@ -324,6 +325,7 @@ class CAddonEpgTag : public EPG_TAG
const std::string m_writer;
const std::string m_IMDBNumber;
const std::string m_episodeName;
+ int m_episodePartNumber; | xbmc/pvr/addons/PVRClient.cpp | 26 | C++ | 0.571 | refactor | 85 | 51 | 51 | false | [PVR] Expose EpisodePart for recordings | 25,643 | xbmc/xbmc | 17,740 | C++ | ksooo | emveepee |
bool CPVRRecording::operator==(const CPVRRecording& right) const
{
std::unique_lock<CCriticalSection> lock(m_critSection);
return (this == &right) ||
(m_strRecordingId == right.m_strRecordingId && m_iClientId == right.m_iClientId &&
m_strChannelName == right.m_strChannelName && m_recordingTime ==... | Wrong indentation. Jenkins will tell you. | {
std::unique_lock<CCriticalSection> lock(m_critSection);
return (this == &right) ||
(m_strRecordingId == right.m_strRecordingId && m_iClientId == right.m_iClientId &&
m_strChannelName == right.m_strChannelName && m_recordingTime == right.m_recordingTime &&
GetDuration() == right.GetDur... | @@ -192,7 +193,8 @@ bool CPVRRecording::operator==(const CPVRRecording& right) const
m_parentalRating == right.m_parentalRating &&
m_parentalRatingCode == right.m_parentalRatingCode &&
m_parentalRatingIcon == right.m_parentalRatingIcon &&
- m_parentalRatingSource == right.m_par... | xbmc/pvr/recordings/PVRRecording.cpp | 26 | C++ | 0.071 | bug | 41 | 51 | 51 | false | [PVR] Expose EpisodePart for recordings | 25,643 | xbmc/xbmc | 17,740 | C++ | ksooo | emveepee |
int m_iClientId; /*!< ID of the backend */
std::string m_strRecordingId; /*!< unique ID of the recording on the client */
std::string m_strChannelName; /*!< name of the channel this was recorded from */
int m_iPriority; /*!< priority of this recording */
int m_iLifetime; /*!< lifetime of this recording */
... | Please do not delete the line which works as a logical separator between the different member types. Keep an empty line before `mutable CCriticalSection m_critSection;`, please. | int m_iClientId; /*!< ID of the backend */
std::string m_strRecordingId; /*!< unique ID of the recording on the client */
std::string m_strChannelName; /*!< name of the channel this was recorded from */
int m_iPriority; /*!< priority of this recording */
int m_iLifetime; /*!< lifetime of this recording */
s... | @@ -561,7 +569,7 @@ class CPVRRecording final : public CVideoInfoTag
std::string m_parentalRatingCode; /*!< Parental rating code */
std::string m_parentalRatingIcon; /*!< parental rating icon path */
std::string m_parentalRatingSource; /*!< parental rating source */
- | xbmc/pvr/recordings/PVRRecording.h | 26 | C/C++ | 0.786 | suggestion | 177 | 38 | 38 | false | [PVR] Expose EpisodePart for recordings | 25,643 | xbmc/xbmc | 17,740 | C++ | ksooo | emveepee |
std::unique_lock<CCriticalSection> lock(m_critSection);
return m_parentalRating;
}
const std::string& CPVRRecording::GetParentalRatingCode() const
{
std::unique_lock<CCriticalSection> lock(m_critSection);
return m_parentalRatingCode;
}
const std::string& CPVRRecording::GetParentalRatingIcon() const
{
std::u... | Add a mutex please.
```c++
std::unique_lock<CCriticalSection> lock(m_critSection);
return m_episodePartNumber;
``` | std::unique_lock<CCriticalSection> lock(m_critSection);
return m_parentalRating;
}
const std::string& CPVRRecording::GetParentalRatingCode() const
{
std::unique_lock<CCriticalSection> lock(m_critSection);
return m_parentalRatingCode;
}
const std::string& CPVRRecording::GetParentalRatingIcon() const
{
std::u... | @@ -746,3 +750,8 @@ const std::string& CPVRRecording::GetParentalRatingSource() const
std::unique_lock<CCriticalSection> lock(m_critSection);
return m_parentalRatingSource;
}
+
+int CPVRRecording::EpisodePart() const
+{
+ return m_episodePartNumber; | xbmc/pvr/recordings/PVRRecording.cpp | 26 | C++ | 0.786 | suggestion | 118 | 27 | 28 | false | [PVR] Expose EpisodePart for recordings | 25,643 | xbmc/xbmc | 17,740 | C++ | ksooo | emveepee |
hr = pProperty->GetValue(PKEY_AudioEndpoint_FormFactor, &varName);
if (FAILED(hr))
{
CLog::Log(LOGERROR, "Retrieval of WASAPI endpoint form factor failed.");
goto failed;
}
details.strWinDevType = winEndpoints[(EndpointFormFactor)varName.uiVal].winEndpointType;
details.eDeviceType = ... | ok to make optional, but please keep logging errors of GetValue and null enumerator string. LOGDEBUG level would be enough I think, since the value is optional. | hr = pProperty->GetValue(PKEY_AudioEndpoint_FormFactor, &varName);
if (FAILED(hr))
{
CLog::Log(LOGERROR, "Retrieval of WASAPI endpoint form factor failed.");
goto failed;
}
details.strWinDevType = winEndpoints[(EndpointFormFactor)varName.uiVal].winEndpointType;
details.eDeviceType = ... | @@ -130,14 +130,11 @@ std::vector<RendererDetail> CAESinkFactoryWin::GetRendererDetails()
PropVariantClear(&varName);
hr = pProperty->GetValue(PKEY_Device_EnumeratorName, &varName);
- if (FAILED(hr))
+ if (SUCCEEDED(hr) && varName.pwszVal != nullptr)
{
- CLog::LogF(LOGERROR, "Retrieval of en... | xbmc/cores/AudioEngine/Sinks/windows/AESinkFactoryWin32.cpp | 26 | C++ | 0.571 | bug | 160 | 51 | 51 | false | [Windows] Fix crash when audio device not has 'PKEY_Device_EnumeratorName' property | 25,648 | xbmc/xbmc | 17,740 | C++ | CrystalP | thexai |
catch (...)
{
CLog::LogF(LOGERROR, "Couldn't obtain providers for addon '{}'.", addonID);
}
}
}
}
}
}
}
int CPVRDatabase::GetClientID(const std::string& addonID, unsigned int instanceID)
{
std::unique_lock<CCriticalSection> lock(m_critSe... | Why the empty sting here? Is this because we couldn't have had this value in this version of the DB? If so, maube add a comment for future readers? | catch (...)
{
CLog::LogF(LOGERROR, "Couldn't obtain providers for addon '{}'.", addonID);
}
}
}
}
}
}
}
int CPVRDatabase::GetClientID(const std::string& addonID, unsigned int instanceID)
{
std::unique_lock<CCriticalSection> lock(m_critSe... | @@ -548,8 +582,9 @@ int CPVRDatabase::GetClientID(const std::string& addonID, unsigned int instanceI
return std::atoi(idString.c_str());
// Create a new entry with a new client id in clients table.
- sql = PrepareSQL("INSERT INTO clients (iPriority, sAddonID, iInstanceID) VALUES (%i, '%s', %i)",
- ... | xbmc/pvr/PVRDatabase.cpp | 26 | C++ | 0.5 | question | 147 | 51 | 51 | false | [PVR] Remember date and time channels were obtained from a client for… | 25,651 | xbmc/xbmc | 17,740 | C++ | phunkyfish | ksooo |
strValue = timer->ChannelIcon();
return true;
case LISTITEM_PVR_CLIENT_NAME:
strValue = CServiceBroker::GetPVRManager().GetClient(timer->ClientID())->GetClientName();
return true;
case LISTITEM_PVR_INSTANCE_NAME:
strValue = CServiceBroker::GetPVRManager().GetClient(ti... | This wrong. Please remove all four lines. First is already removed in latest master. Please rebase.
This sections is for timers only. Timers will never be played by the VideoPlayer. That's why here only LISTITEM_* makes sense. | strValue = timer->ChannelIcon();
return true;
case LISTITEM_PVR_CLIENT_NAME:
strValue = CServiceBroker::GetPVRManager().GetClient(timer->ClientID())->GetClientName();
return true;
case LISTITEM_PVR_INSTANCE_NAME:
strValue = CServiceBroker::GetPVRManager().GetClient(ti... | @@ -430,6 +430,9 @@ bool CPVRGUIInfo::GetListItemAndPlayerLabel(const CFileItem* item,
case LISTITEM_CHANNEL_NUMBER:
case LISTITEM_PREMIERED:
case VIDEOPLAYER_PARENTAL_RATING:
+ case VIDEOPLAYER_PARENTAL_RATING_CODE:
+ case VIDEOPLAYER_PARENTAL_RATING_ICON:
+ case VIDEOPLAYER_PARENTA... | xbmc/pvr/guilib/guiinfo/PVRGUIInfo.cpp | 26 | C++ | 0.571 | bug | 227 | 51 | 51 | false | [PVR][guilib][GUIInfoManager] Add support for VideoPlayer.ParentalRatingCode/Icon/Source | 25,664 | xbmc/xbmc | 17,740 | C++ | ksooo | DeltaMikeCharlie |
// Contrary to MS doc, the voice must play a buffer with end of stream flag for the voice
// SamplesPlayed counter to be reset.
// Per MS doc, Discontinuity() may not take effect until after the entire buffer queue is
// consumed, which wouldn't invoke the callback or reset the voice stats.
... | Make sure to be lower than AE's timeout for your drain, else AE will reset you. | m_sourceVoice->Stop();
return true;
}
void CAESinkXAudio::Drain()
{
if(!m_sourceVoice)
return;
if (m_running)
{
try
{
// Contrary to MS doc, the voice must play a buffer with end of stream flag for the voice
// SamplesPlayed counter to be reset.
// Per MS doc, Discontinuity() ... | @@ -843,23 +833,49 @@ void CAESinkXAudio::Drain()
if(!m_sourceVoice)
return;
- AEDelayStatus status;
- GetDelay(status);
-
- KODI::TIME::Sleep(std::chrono::milliseconds(static_cast<int>(status.GetDelay() * 500)));
-
if (m_running)
{
try
{
+ // Contrary to MS doc, the voice must play a ... | xbmc/cores/AudioEngine/Sinks/AESinkXAudio.cpp | 26 | C++ | 0.143 | suggestion | 80 | 51 | 51 | false | [AE][XAudio2] Fix Drain and Deinitialize | 25,668 | xbmc/xbmc | 17,740 | C++ | fritsch | CrystalP |
// Per MS doc, Discontinuity() may not take effect until after the entire buffer queue is
// consumed, which wouldn't invoke the callback or reset the voice stats.
// Solution: submit a 1 sample buffer with end of stream flag and wait for StreamEnd callback
// The StreamEnd event is manual reset... | If your custom eof signal comes at the end of.thr already queued buffer all fine. If it would be first, stop might cause a chop. | return true;
}
void CAESinkXAudio::Drain()
{
if(!m_sourceVoice)
return;
if (m_running)
{
try
{
// Contrary to MS doc, the voice must play a buffer with end of stream flag for the voice
// SamplesPlayed counter to be reset.
// Per MS doc, Discontinuity() may not take effect until ... | @@ -843,23 +833,49 @@ void CAESinkXAudio::Drain()
if(!m_sourceVoice)
return;
- AEDelayStatus status;
- GetDelay(status);
-
- KODI::TIME::Sleep(std::chrono::milliseconds(static_cast<int>(status.GetDelay() * 500)));
-
if (m_running)
{
try
{
+ // Contrary to MS doc, the voice must play a ... | xbmc/cores/AudioEngine/Sinks/AESinkXAudio.cpp | 26 | C++ | 0.5 | suggestion | 128 | 51 | 51 | false | [AE][XAudio2] Fix Drain and Deinitialize | 25,668 | xbmc/xbmc | 17,740 | C++ | fritsch | CrystalP |
HRESULT hr = m_sourceVoice->SubmitSourceBuffer(&xbuffer);
if (hr != S_OK)
{
CLog::LogF(LOGERROR, "SubmitSourceBuffer failed due to {:X}", hr);
delete xbuffer.pContext;
return false;
}
m_sinkFrames += frames;
m_framesInBuffers += frames;
return true;
}
XAUDIO2_BUFFER CAESinkXAudio::BuildXAu... | As this additional frame is a frame AE is unaware of, we need to make sure it is nowhere used in reporting back to AE as this would make AE's error computation problematic. If that's not the case and only used internally to track Flush / blocking drain operation all good. | ret = (str == "USB");
PropVariantClear(&varName);
if (pProperty)
pProperty->Release();
#endif
return false;
}
bool CAESinkXAudio::AddEndOfStreamPacket()
{
constexpr unsigned int frames{1};
XAUDIO2_BUFFER xbuffer = BuildXAudio2Buffer(nullptr, frames, 0);
xbuffer.Flags = XAUDIO2_END_OF_STREAM;
HRES... | @@ -887,3 +903,48 @@ bool CAESinkXAudio::IsUSBDevice()
#endif
return false;
}
+
+bool CAESinkXAudio::AddEndOfStreamPacket()
+{
+ constexpr unsigned int frames{1};
+
+ XAUDIO2_BUFFER xbuffer = BuildXAudio2Buffer(nullptr, frames, 0);
+ xbuffer.Flags = XAUDIO2_END_OF_STREAM;
+
+ HRESULT hr = m_sourceVoice->Submit... | xbmc/cores/AudioEngine/Sinks/AESinkXAudio.cpp | 26 | C++ | 0.857 | suggestion | 272 | 39 | 51 | false | [AE][XAudio2] Fix Drain and Deinitialize | 25,668 | xbmc/xbmc | 17,740 | C++ | fritsch | CrystalP |
PropVariantClear(&varName);
if (pProperty)
pProperty->Release();
#endif
return false;
}
bool CAESinkXAudio::AddEndOfStreamPacket()
{
constexpr unsigned int frames{1};
XAUDIO2_BUFFER xbuffer = BuildXAudio2Buffer(nullptr, frames, 0);
xbuffer.Flags = XAUDIO2_END_OF_STREAM;
HRESULT hr = m_sourceVoice->... | Are we really talking about frames here? Looks like one byte buffer? - Does not matter too much, but we should not interfer with what AE generates and gives us in frames vs. what we internaly do - as AE carefully tracks the frames we get, the payload they have and the playtime they have. As long as this only plays a ro... | #if 0 // TODO
IPropertyStore *pProperty = nullptr;
PROPVARIANT varName;
PropVariantInit(&varName);
bool ret = false;
HRESULT hr = m_pDevice->OpenPropertyStore(STGM_READ, &pProperty);
if (!SUCCEEDED(hr))
return ret;
hr = pProperty->GetValue(PKEY_Device_EnumeratorName, &varName);
std::string str = l... | @@ -887,3 +903,48 @@ bool CAESinkXAudio::IsUSBDevice()
#endif
return false;
}
+
+bool CAESinkXAudio::AddEndOfStreamPacket()
+{
+ constexpr unsigned int frames{1};
+
+ XAUDIO2_BUFFER xbuffer = BuildXAudio2Buffer(nullptr, frames, 0); | xbmc/cores/AudioEngine/Sinks/AESinkXAudio.cpp | 26 | C++ | 0.643 | question | 426 | 51 | 51 | false | [AE][XAudio2] Fix Drain and Deinitialize | 25,668 | xbmc/xbmc | 17,740 | C++ | fritsch | CrystalP |
/*
* Copyright (C) 2010-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif
#include "AEUtil.h"
#include "utils/log.h"
#include "utils/Time... | Seems this should be:
```c++
case AE_FMT_U8:
case AE_FMT_U8P:
```
Otherwise is comparing `AEDataFormat `with `AVSampleFormat` | default:
return AV_CHAN_NONE;
}
}
int CAEUtil::GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout)
{
AVChannelLayout ch_layout = {};
av_channel_layout_from_mask(&ch_layout, layout);
int idx = av_channel_layout_index_from_channel(&ch_layout, GetAVChannel(aechannel));
av_channel_layout_unini... | @@ -607,3 +607,25 @@ int CAEUtil::GetAVChannelIndex(enum AEChannel aechannel, uint64_t layout)
av_channel_layout_uninit(&ch_layout);
return idx;
}
+
+void CAEUtil::GenerateSilence(AEDataFormat format,
+ unsigned int frameSize,
+ void* buffer,
+ ... | xbmc/cores/AudioEngine/Utils/AEUtil.cpp | 26 | C++ | 1 | suggestion | 142 | 610 | 36 | false | [AE][XAudio2] Fix Drain and Deinitialize | 25,668 | xbmc/xbmc | 17,740 | C++ | thexai | CrystalP |
/*
* 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 "AudioLibrary.h"
#include "FileItem.h"
#include "FileItemList.h"
#include "ServiceBroker.h"
#include "Util.h"
#include... | //Start rescraping additional information for the given artist | }
JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
ITransportLayer* transport,
IClient* client,
const CVariant& parameterObject,
... | @@ -1354,6 +1356,60 @@ JSONRPC_STATUS CAudioLibrary::GetAdditionalSongDetails(const CVariant& parameter
return OK;
}
+JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
+ ITransportLayer* transport,
+ IClient... | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 26 | C++ | 0.143 | style | 62 | 1,379 | 51 | false | [MUSIC][JSON-RPC] AudioLibrary.RefreshArtist and AudioLibrary.RefreshAlbum | 25,677 | xbmc/xbmc | 17,740 | C++ | DaveTBlake | acidzab |
/*
* 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 "AudioLibrary.h"
#include "FileItem.h"
#include "FileItemList.h"
#include "ServiceBroker.h"
#include "Util.h"
#include... | Can this be done using 'musicUrl.AddOption' consistant with how you have done in RefreshArtist? I'm asking if possible not asserting it is done that way, I really can't remember the syntax details. | musicUrl.AddOption("artistid", artistID);
//executing the StartArtistScan for refreshing the artist scraped informations
CMusicLibraryQueue::GetInstance().StartArtistScan(musicUrl.ToString(), true);
return ACK;
}
JSONRPC_STATUS CAudioLibrary::RefreshAlbum(const std::string& method,
... | @@ -1354,6 +1356,60 @@ JSONRPC_STATUS CAudioLibrary::GetAdditionalSongDetails(const CVariant& parameter
return OK;
}
+JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
+ ITransportLayer* transport,
+ IClient... | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 26 | C++ | 0.286 | suggestion | 198 | 1,379 | 51 | false | [MUSIC][JSON-RPC] AudioLibrary.RefreshArtist and AudioLibrary.RefreshAlbum | 25,677 | xbmc/xbmc | 17,740 | C++ | DaveTBlake | acidzab |
/*
* 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 "AudioLibrary.h"
#include "FileItem.h"
#include "FileItemList.h"
#include "ServiceBroker.h"
#include "Util.h"
#include... | //Start rescraping additional information for the given album | //executing the StartArtistScan for refreshing the artist scraped informations
CMusicLibraryQueue::GetInstance().StartArtistScan(musicUrl.ToString(), true);
return ACK;
}
JSONRPC_STATUS CAudioLibrary::RefreshAlbum(const std::string& method,
ITransportLayer* transport,
... | @@ -1354,6 +1356,60 @@ JSONRPC_STATUS CAudioLibrary::GetAdditionalSongDetails(const CVariant& parameter
return OK;
}
+JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
+ ITransportLayer* transport,
+ IClient... | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 26 | C++ | 0.143 | style | 61 | 1,379 | 51 | false | [MUSIC][JSON-RPC] AudioLibrary.RefreshArtist and AudioLibrary.RefreshAlbum | 25,677 | xbmc/xbmc | 17,740 | C++ | DaveTBlake | acidzab |
/*
* Copyright (C) 2012-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 "GameClientProperties.h"
#include "FileItem.h"
#include "FileItemList.h"
#include "GameClient.h"
#include "ServiceBrok... | Could `std::move(item)` be senseful here? | // Get installable add-ons
VECADDONS installableAddons;
for (const std::string& dependency : addons)
{
AddonPtr addon;
if (CServiceBroker::GetAddonMgr().FindInstallableById(dependency, addon) && addon)
installableAddons.emplace_back(std::move(addon));
else
CLog::Log(LOGERROR, "Failed to ... | @@ -289,3 +320,111 @@ bool CGameClientProperties::HasProxyDll(const std::string& strLibPath) const
}
return false;
}
+
+bool CGameClientProperties::InstallDependencies(const std::vector<std::string>& addons)
+{
+ // Only proceed if we have a GUI
+ CGUIComponent* const gui = CServiceBroker::GetGUI();
+ if (gui... | xbmc/games/addons/GameClientProperties.cpp | 26 | C++ | 0.5 | question | 41 | 292 | 51 | false | Games: Offer to install missing dependencies on game launch | 25,691 | xbmc/xbmc | 17,740 | C++ | ksooo | garbear |
CVideoLibraryQueue::GetInstance().ScanLibrary(params.size() > 1 ? params[1] : "", false,
userInitiated);
}
return 0;
}
/*! \brief Open a video library search.
* \param params (ignored)
*/
static int SearchVideoLibrary(const std::vector<std::string>& par... | Could be shortened to `if (params.empty())` | CVideoLibraryQueue::GetInstance().StopLibraryScanning();
else
CVideoLibraryQueue::GetInstance().ScanLibrary(params.size() > 1 ? params[1] : "", false,
userInitiated);
}
return 0;
}
/*! \brief Open a video library search.
* \param params (ignore... | @@ -344,6 +344,36 @@ static int SearchVideoLibrary(const std::vector<std::string>& params)
return 0;
}
+/*! \brief Rescrapes additional information for a given artist
+ * \params params The parameters.
+ * \details params[0] = "artist internal url"
+ */
+static int RefreshArtist(const std::vector<std::string>& ... | xbmc/interfaces/builtins/LibraryBuiltins.cpp | 26 | C++ | 0.5 | suggestion | 43 | 51 | 51 | false | [MUSIC][JSON-RPC] Changes after code reviews for RefreshArtist and RefreshAlbum | 25,698 | xbmc/xbmc | 17,740 | C++ | ksooo | acidzab |
return 0;
}
/*! \brief Rescrapes additional information for a given artist
* \params params The parameters.
* \details params[0] = "artist internal url"
*/
static int RefreshArtist(const std::vector<std::string>& params)
{
//checking if the musicUrl is passed
if (params.size() == 0)
return -1;
//Star... | Could be shortened to `if (params.empty())` | CServiceBroker::GetGUI()->GetWindowManager().SendMessage(msg, WINDOW_VIDEO_NAV);
return 0;
}
/*! \brief Rescrapes additional information for a given artist
* \params params The parameters.
* \details params[0] = "artist id"
*/
static int RefreshArtist(const std::vector<std::string>& params)
{
// Checking i... | @@ -344,6 +344,36 @@ static int SearchVideoLibrary(const std::vector<std::string>& params)
return 0;
}
+/*! \brief Rescrapes additional information for a given artist
+ * \params params The parameters.
+ * \details params[0] = "artist internal url"
+ */
+static int RefreshArtist(const std::vector<std::string>& ... | xbmc/interfaces/builtins/LibraryBuiltins.cpp | 26 | C++ | 0.5 | suggestion | 43 | 51 | 51 | false | [MUSIC][JSON-RPC] Changes after code reviews for RefreshArtist and RefreshAlbum | 25,698 | xbmc/xbmc | 17,740 | C++ | ksooo | acidzab |
//set the artist id on the musicdb url
musicUrl.AddOption("artistid", artistID);
//Start rescraping additional information for the given artist
std::string cmd = StringUtils::Format("musiclibrary.refreshartist({})",
StringUtils::Paramify(musicUrl.ToString()));
CServic... | Is this something that can really happen? Isn't "musicdb://albums/" always a valid music db url? | StringUtils::Paramify(artistIdVariant.asString()));
CServiceBroker::GetAppMessenger()->SendMsg(TMSG_EXECUTE_BUILT_IN, -1, -1, nullptr, cmd);
return ACK;
}
JSONRPC_STATUS CAudioLibrary::RefreshAlbum(const std::string& method,
... | @@ -1397,15 +1396,22 @@ JSONRPC_STATUS CAudioLibrary::RefreshAlbum(const std::string& method,
if (!musicdatabase.Open())
return InternalError;
+ CMusicDbUrl musicUrl;
+ if (!musicUrl.FromString("musicdb://albums/"))
+ return InvalidParams; | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 26 | C++ | 0.143 | question | 96 | 51 | 51 | false | [MUSIC][JSON-RPC] Changes after code reviews for RefreshArtist and RefreshAlbum | 25,698 | xbmc/xbmc | 17,740 | C++ | ksooo | acidzab |
* \params params The parameters.
* \details params[0] = "artist internal url"
*/
static int RefreshArtist(const std::vector<std::string>& params)
{
//checking if the musicUrl is passed
if (params.size() == 0)
return -1;
//Start rescraping additional information for the given artist
CMusicLibraryQueue:... | Not 100% sure, but I think `params.front()` is faster than `params[0]`. |
/*! \brief Rescrapes additional information for a given artist
* \params params The parameters.
* \details params[0] = "artist id"
*/
static int RefreshArtist(const std::vector<std::string>& params)
{
// Checking if the artist id is passed
if (params.empty())
return -1;
// Set the artist id on the musi... | @@ -344,6 +344,36 @@ static int SearchVideoLibrary(const std::vector<std::string>& params)
return 0;
}
+/*! \brief Rescrapes additional information for a given artist
+ * \params params The parameters.
+ * \details params[0] = "artist internal url"
+ */
+static int RefreshArtist(const std::vector<std::string>& ... | xbmc/interfaces/builtins/LibraryBuiltins.cpp | 26 | C++ | 0.357 | suggestion | 71 | 51 | 51 | false | [MUSIC][JSON-RPC] Changes after code reviews for RefreshArtist and RefreshAlbum | 25,698 | xbmc/xbmc | 17,740 | C++ | ksooo | acidzab |
return OK;
}
JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
ITransportLayer* transport,
IClient* client,
const CVariant& parameterObject,
... | wrong indentation - jenkins will tell you. |
return OK;
}
JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
ITransportLayer* transport,
IClient* client,
const CVariant& parameterObject,
... | @@ -1362,23 +1362,20 @@ JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
{
int artistID = (int)parameterObject["artistid"].asInteger();
- CMusicDbUrl musicUrl;
- if (!musicUrl.FromString("musicdb://artists/"))
- return InternalError;
-
CMusicDatabase musicdatabase;
if (!musicdatab... | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 26 | C++ | 0.071 | bug | 42 | 51 | 51 | false | [MUSIC][JSON-RPC] Changes after code reviews for RefreshArtist and RefreshAlbum | 25,698 | xbmc/xbmc | 17,740 | C++ | ksooo | acidzab |
}
JSONRPC_STATUS CAudioLibrary::RefreshAlbum(const std::string& method,
ITransportLayer* transport,
IClient* client,
const CVariant& parameterObject,
... | wrong indentation - jenkins will tell you. | JSONRPC_STATUS CAudioLibrary::RefreshAlbum(const std::string& method,
ITransportLayer* transport,
IClient* client,
const CVariant& parameterObject,
... | @@ -1396,20 +1393,17 @@ JSONRPC_STATUS CAudioLibrary::RefreshAlbum(const std::string& method,
if (!musicdatabase.Open())
return InternalError;
- CMusicDbUrl musicUrl;
- if (!musicUrl.FromString("musicdb://albums/"))
- return InvalidParams;
-
- //check if albumID is a valid one
+ // Check if albumID is ... | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 26 | C++ | 0.071 | bug | 42 | 51 | 48 | false | [MUSIC][JSON-RPC] Changes after code reviews for RefreshArtist and RefreshAlbum | 25,698 | xbmc/xbmc | 17,740 | C++ | ksooo | acidzab |
if (item->GetMusicInfoTag()->GetAlbumId() > 0)
{
if (additionalProperties.find("albumartist") != additionalProperties.end() ||
additionalProperties.find("albumartistid") != additionalProperties.end() ||
additionalProperties.find("musicbrainzalbumartistid") != additionalProperties.end()... | Could you please replace the c-style cast with a c++ style cast and make the variable `const`?
`const int artistID = static_cast<int>(parameterObject["artistid"].asInteger());` | }
if (item->GetMusicInfoTag()->GetAlbumId() > 0)
{
if (additionalProperties.contains("albumartist") ||
additionalProperties.contains("albumartistid") ||
additionalProperties.contains("musicbrainzalbumartistid"))
{
musicdatabase.GetArtistsByAlbum(item->GetMusicInfoTag(... | @@ -1362,25 +1360,20 @@ JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
const CVariant& parameterObject,
CVariant& result)
{
- int artistID = (int)parameterObject["artistid"].asInteger();
-
- CMusicDbUrl ... | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 26 | C++ | 1 | question | 179 | 51 | 51 | false | [MUSIC][JSON-RPC] Changes after code reviews for RefreshArtist and RefreshAlbum | 25,698 | xbmc/xbmc | 17,740 | C++ | ksooo | acidzab |
int artistID = (int)parameterObject["artistid"].asInteger();
if (!musicdatabase.GetArtistExists(artistID))
return InvalidParams;
// Start rescraping additional information for the given artist
const std::string cmd =
StringUtils::Format("musiclibrary.refreshartist({})",
Stri... | Could you please replace the c-style cast with a c++ style cast and make the variable `const`?
`const int albumID = static_cast<int>(parameterObject["albumid"].asInteger());` | // Checking if artistID is a valid one
const CVariant artistIdVariant{parameterObject["artistid"]};
const int artistID = static_cast<int>(artistIdVariant.asInteger());
if (!musicdatabase.GetArtistExists(artistID))
return InvalidParams;
// Start rescraping additional information for the given artist
con... | @@ -1391,21 +1384,21 @@ JSONRPC_STATUS CAudioLibrary::RefreshAlbum(const std::string& method,
const CVariant& parameterObject,
CVariant& result)
{
- int albumID = (int)parameterObject["albumid"].asInteger();
-
CMusicDatabase mu... | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 26 | C++ | 1 | question | 177 | 51 | 51 | false | [MUSIC][JSON-RPC] Changes after code reviews for RefreshArtist and RefreshAlbum | 25,698 | xbmc/xbmc | 17,740 | C++ | ksooo | acidzab |
StringUtils::Paramify(parameterObject["artistid"].asString()));
CServiceBroker::GetAppMessenger()->SendMsg(TMSG_EXECUTE_BUILT_IN, -1, -1, nullptr, cmd);
return ACK;
}
JSONRPC_STATUS CAudioLibrary::RefreshAlbum(const std::string& method,
ITranspo... | For performance reasons I would introduce a variable for the albumid variant and use it at the two place where you need it in this method.
`const CVariant albumIdVariant{parameterObject["albumid"]};` | const std::string cmd = StringUtils::Format("musiclibrary.refreshartist({})",
StringUtils::Paramify(artistIdVariant.asString()));
CServiceBroker::GetAppMessenger()->SendMsg(TMSG_EXECUTE_BUILT_IN, -1, -1, nullptr, cmd);
return ACK;
}
JSONRPC_STATUS CAudioLibrary::Ref... | @@ -1391,21 +1384,21 @@ JSONRPC_STATUS CAudioLibrary::RefreshAlbum(const std::string& method,
const CVariant& parameterObject,
CVariant& result)
{
- int albumID = (int)parameterObject["albumid"].asInteger();
-
CMusicDatabase mu... | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 26 | C++ | 1 | performance | 202 | 51 | 51 | false | [MUSIC][JSON-RPC] Changes after code reviews for RefreshArtist and RefreshAlbum | 25,698 | xbmc/xbmc | 17,740 | C++ | ksooo | acidzab |
}
}
}
return OK;
}
JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
ITransportLayer* transport,
IClient* client,
const CVariant& parameterObject,
... | For performance reasons I would introduce a variable for the artistid variant and use it at the two place where you need it in this method.
`const CVariant artistIdVariant{parameterObject["artistid"]};` | musicdatabase.GetArtistsByAlbum(item->GetMusicInfoTag()->GetAlbumId(), item.get());
}
}
}
return OK;
}
JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
ITransportLayer* transport,
IClien... | @@ -1362,25 +1360,20 @@ JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
const CVariant& parameterObject,
CVariant& result)
{
- int artistID = (int)parameterObject["artistid"].asInteger();
-
- CMusicDbUrl ... | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 26 | C++ | 1 | performance | 205 | 51 | 51 | false | [MUSIC][JSON-RPC] Changes after code reviews for RefreshArtist and RefreshAlbum | 25,698 | xbmc/xbmc | 17,740 | C++ | ksooo | acidzab |
const CVariant artistIdVariant{parameterObject["artistid"]};
const std::string cmd = StringUtils::Format("musiclibrary.refreshartist({})",
StringUtils::Paramify(artistIdVariant.asString()));
CServiceBroker::GetAppMessenger()->SendMsg(TMSG_EXECUTE_BUILT_IN, -1, -1, nul... | Move this up to line 1393 and use the variable also in line „const int albumID = …“ |
// Start rescraping additional information for the given artist
const std::string cmd = StringUtils::Format("musiclibrary.refreshartist({})",
StringUtils::Paramify(artistIdVariant.asString()));
CServiceBroker::GetAppMessenger()->SendMsg(TMSG_EXECUTE_BUILT_IN, -1, -1,... | @@ -1391,21 +1384,21 @@ JSONRPC_STATUS CAudioLibrary::RefreshAlbum(const std::string& method,
const CVariant& parameterObject,
CVariant& result)
{
- int albumID = (int)parameterObject["albumid"].asInteger();
-
CMusicDatabase mu... | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 26 | C++ | 0.357 | refactor | 83 | 51 | 51 | false | [MUSIC][JSON-RPC] Changes after code reviews for RefreshArtist and RefreshAlbum | 25,698 | xbmc/xbmc | 17,740 | C++ | ksooo | acidzab |
{
musicdatabase.GetArtistsByAlbum(item->GetMusicInfoTag()->GetAlbumId(), item.get());
}
}
}
return OK;
}
JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
ITransportLayer* transport,
... | Move this up to line 1368 and use the variable also in line „const int albumID = …“ | additionalProperties.contains("musicbrainzalbumartistid"))
{
musicdatabase.GetArtistsByAlbum(item->GetMusicInfoTag()->GetAlbumId(), item.get());
}
}
}
return OK;
}
JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
I... | @@ -1362,25 +1360,20 @@ JSONRPC_STATUS CAudioLibrary::RefreshArtist(const std::string& method,
const CVariant& parameterObject,
CVariant& result)
{
- int artistID = (int)parameterObject["artistid"].asInteger();
-
- CMusicDbUrl ... | xbmc/interfaces/json-rpc/AudioLibrary.cpp | 26 | C++ | 0.357 | refactor | 83 | 51 | 51 | false | [MUSIC][JSON-RPC] Changes after code reviews for RefreshArtist and RefreshAlbum | 25,698 | xbmc/xbmc | 17,740 | C++ | ksooo | acidzab |
}
}
// Query RAW capabilities
isRaw = true;
m_info.m_deviceName = "AudioTrack (RAW)";
m_info.m_displayName = "AudioTrack (RAW)";
m_info.m_displayNameExtra = "Android IEC packer";
UpdateAvailablePCMCapabilities();
UpdateAvailablePassthroughCapabilities(isRaw);
m_info_raw = m_info;
// no need to... | ```suggestion
const bool supports_192khz = m_sink_sampleRates.find(192000) != m_sink_sampleRates.end();
```
And maybe add blank line after | }
}
// Query RAW capabilities
isRaw = true;
m_info.m_deviceName = "AudioTrack (RAW)";
m_info.m_displayName = "AudioTrack (RAW)";
m_info.m_displayNameExtra = "Android IEC packer";
UpdateAvailablePCMCapabilities();
UpdateAvailablePassthroughCapabilities(isRaw);
m_info_raw = m_info;
// no need to... | @@ -1073,6 +1080,7 @@ void CAESinkAUDIOTRACK::UpdateAvailablePassthroughCapabilities(bool isRaw)
m_info.m_wantsIECPassthrough = false;
m_info.m_dataFormats.push_back(AE_FMT_RAW);
m_info.m_streamTypes.clear();
+ bool supports_192khz = m_sink_sampleRates.find(192000) != m_sink_sampleRates.end(); | xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp | 26 | C++ | 1 | suggestion | 145 | 51 | 51 | false | AESinkAudiotrack: Use 192 khz for TrueHD / DTS-HD RAW as well | 25,710 | xbmc/xbmc | 17,740 | C++ | thexai | fritsch |
{
CDateTime now = GetCurrentPlayingTime();
return (m_startTime <= now && m_endTime > now);
}
bool CPVREpgInfoTag::WasActive() const
{
CDateTime now = GetCurrentPlayingTime();
return (m_endTime < now);
}
bool CPVREpgInfoTag::IsUpcoming() const
{
CDateTime now = GetCurrentPlayingTime();
return (m_startTime ... | I really wouldn't use `time_t` for duration. As [cppreference](https://en.cppreference.com/w/cpp/chrono/c/time_t) says, using it for anything else then seconds since 1970-01-01 would be unexpected for most people. I suggest to use [`std::chrono::seconds`](https://en.cppreference.com/w/cpp/chrono/duration) instead. Appl... | bool CPVREpgInfoTag::IsActive() const
{
CDateTime now = GetCurrentPlayingTime();
return (m_startTime <= now && m_endTime > now);
}
bool CPVREpgInfoTag::WasActive() const
{
CDateTime now = GetCurrentPlayingTime();
return (m_endTime < now);
}
bool CPVREpgInfoTag::IsUpcoming() const
{
CDateTime now = GetCurren... | @@ -245,7 +245,7 @@ float CPVREpgInfoTag::ProgressPercentage() const
CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(currentTime);
m_startTime.GetAsTime(startTime);
m_endTime.GetAsTime(endTime);
- int iDuration = endTime - startTime > 0 ? endTime - startTime : 3600;
+ time_t iDuration = endTime ... | xbmc/pvr/epg/EpgInfoTag.cpp | 26 | C++ | 0.857 | suggestion | 367 | 51 | 51 | false | Fix some CPPCheck and compiler warnings | 25,719 | xbmc/xbmc | 17,740 | C++ | neo1973 | ksooo |
else
{
item.SetArt("icon", "DefaultFolder.png");
}
}
}
// Set the icon overlays (if applicable)
if (!item.HasOverlay() && !item.HasProperty("icon_never_overlay"))
{
if (URIUtils::IsInRAR(item.GetPath()))
item.SetOverlayImage(CGUIListItem::ICON_OVERLAY_RAR);
else if (U... | Can it happen that an item is both "Stack" and "InRAR"/"InZIP" - I mean should this read `else if (URI...`? | else
{
item.SetArt("icon", "DefaultFolder.png");
}
}
}
// Set the icon overlays (if applicable)
if (!item.HasOverlay() && !item.HasProperty("icon_never_overlay"))
{
if (URIUtils::IsInRAR(item.GetPath()))
item.SetOverlayImage(CGUIListItem::ICON_OVERLAY_RAR);
else if (U... | @@ -158,11 +158,17 @@ std::string GetFolderThumb(const CFileItem& item, const std::string& folderJPG /
{
std::string strFolder = item.GetPath();
- if (item.IsStack() || URIUtils::IsInRAR(strFolder) || URIUtils::IsInZIP(strFolder))
+ if (item.IsStack())
{
URIUtils::GetParentPath(item.GetPath(), strFolder... | xbmc/utils/ArtUtils.cpp | 26 | C++ | 0.714 | question | 107 | 51 | 51 | false | fixed: GetFolderThumb for archives | 25,722 | xbmc/xbmc | 17,740 | C++ | ksooo | notspiff |
std::vector<std::string> movieSetArtTypes;
if (moviePartOfSet)
{
movieSetArtTypes = CVideoThumbLoader::GetArtTypes(MediaTypeVideoCollection);
for (const std::string& artType : movieSetArtTypes)
artTypes.push_back("set." + artType);
}
bool addAll = artLevel == CSettings::VIDEOLIBR... | Why is this line added? Maybe a comment is needed? | std::vector<std::string> movieSetArtTypes;
if (moviePartOfSet)
{
movieSetArtTypes = CVideoThumbLoader::GetArtTypes(MediaTypeVideoCollection);
for (const std::string& artType : movieSetArtTypes)
artTypes.push_back("set." + artType);
}
bool addAll = artLevel == CSettings::VIDEOLIBR... | @@ -1792,14 +1793,17 @@ namespace KODI::VIDEO
{
if (!pItem->SkipLocalArt())
{
+ bool useFolder = false;
if (bApplyToDir && (content == CONTENT_MOVIES || content == CONTENT_MUSICVIDEOS))
{
- std::string filename = pItem->GetLocalArtBaseFilename();
+ std::stri... | xbmc/video/VideoInfoScanner.cpp | 26 | C++ | 0.143 | question | 50 | 51 | 51 | false | move GetLocalArtBaseFilename to ArtUtils | 25,730 | xbmc/xbmc | 17,740 | C++ | garbear | notspiff |
/*
* Copyright (C) 2012-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include "IRetroPlayerStream.h"
#include "cores/RetroPlayer/RetroPlayerTypes.h"
extern "C"
{
#include <libavutil/... | This file (and maybe others) also need `#include <stddef>` for the use of `size_t`. Can you also check for this? | /*
* Copyright (C) 2012-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include "IRetroPlayerStream.h"
#include "cores/RetroPlayer/RetroPlayerTypes.h"
#include <cstdint>
extern "C"
{
... | @@ -11,6 +11,8 @@
#include "IRetroPlayerStream.h"
#include "cores/RetroPlayer/RetroPlayerTypes.h"
+#include <cstdint> | xbmc/cores/RetroPlayer/streams/RetroPlayerVideo.h | 14 | C/C++ | 0.714 | question | 112 | 39 | 39 | false | Include missing <cstdint> includes | 25,735 | xbmc/xbmc | 17,740 | C++ | garbear | parona-source |
switch (wfxex.Format.wBitsPerSample)
{
case 32:
if (wfxex.SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)
format.m_dataFormat = AE_FMT_FLOAT;
else if (wfxex.Samples.wValidBitsPerSample == 32)
format.m_dataFormat = AE_FMT_S32NE;
else
format.m_dataFormat =... | @fritsch I wonder if that's right - this is the same behavior as before for an unsupported number of bits, but doesn't seem right, would you agree?
Being in the default case means that the OS/audio device accepted the format but the sink doesn't fully support it.
I think that the sink should either return an error, o... | format.m_channelLayout = channelLayout;
/* Set up returned sink format for engine */
if (format.m_dataFormat != AE_FMT_RAW)
{
if (wfxex.Format.wBitsPerSample == 32)
{
if (wfxex.SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)
format.m_dataFormat = AE_FMT_FLOAT;
else if (wfxex.Samples.w... | @@ -573,19 +654,33 @@ bool CAESinkXAudio::InitializeInternal(std::string deviceId, AEAudioFormat &form
/* Set up returned sink format for engine */
if (format.m_dataFormat != AE_FMT_RAW)
{
- if (wfxex.Format.wBitsPerSample == 32)
+ switch (wfxex.Format.wBitsPerSample)
{
- if (wfxex.SubFormat ==... | xbmc/cores/AudioEngine/Sinks/AESinkXAudio.cpp | 26 | C++ | 0.929 | style | 586 | 51 | 51 | false | [Windows] Make XAudio2 work with Windows 8 and code improvements | 25,750 | xbmc/xbmc | 17,740 | C++ | CrystalP | CrystalP |
{
wfxex.Samples.wValidBitsPerSample = 24;
}
else if (p <= AE_FMT_S24NE4 && p >= AE_FMT_S24BE4)
{
// not supported
continue;
}
else
{
wfxex.Samples.wValidBitsPerSample = wfxex.Format.wBitsPerSample;
}
hr = pC... | ```suggestion
if (deviceInfo.m_dataFormats.empty() ||
``` | {
wfxex.Samples.wValidBitsPerSample = 24;
}
else if (p <= AE_FMT_S24NE4 && p >= AE_FMT_S24BE4)
{
// not supported
continue;
}
else
{
wfxex.Samples.wValidBitsPerSample = wfxex.Format.wBitsPerSample;
}
hr = pC... | @@ -592,8 +593,23 @@ void CAESinkWASAPI::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bool fo
wfxex.dwChannelMask = KSAUDIO_SPEAKER_STEREO;
wfxex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wfxex.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
- wfxex.Fo... | xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp | 26 | C++ | 0.857 | suggestion | 65 | 51 | 51 | false | [Windows][AE} WASAPI sink fixes and improvements | 25,759 | xbmc/xbmc | 17,740 | C++ | thexai | CrystalP |
/*
* Copyright (C) 2012-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 "AndroidStorageProvider.h"
#include "Util.h"
#include "filesystem/Directory.h"
#include "filesystem/File.h"
#include "... | maybe take the opportunity to split this small block of code into its own private method? The logic is duplicated here and near the end of the method (looks like GetExternalStorageFromJNIEnvironment which can "std::optionally" return a string) |
if (blockSize <= 0 || blockCount <= 0 || freeBlocks < 0)
return false;
const float totalSize = static_cast<float>(blockSize) * blockCount / GIGABYTES;
const float freeSize = static_cast<float>(blockSize) * freeBlocks / GIGABYTES;
const float usedSize = totalSize - freeSize;
const float usedPercentage = ... | @@ -451,3 +448,41 @@ bool CAndroidStorageProvider::GetStorageUsage(const std::string& path, std::stri
PATH_MAXLEN, totalSize, "G", usedSize, "G", freeSize, "G", usedPercentage, "%");
return true;
}
+
+bool CAndroidStorageProvider::GetExternalStorage(std::string& path,
+ ... | xbmc/platform/android/storage/AndroidStorageProvider.cpp | 26 | C++ | 0.357 | refactor | 243 | 454 | 51 | false | Move CXBMCApp::GetExternalStorage to CAndroidStorageProvider | 25,792 | xbmc/xbmc | 17,740 | C++ | enen92 | joseluismarti |
{
if (!m_pFile)
return -1;
if (m_pBuffer)
return m_pBuffer->pubseekoff(0, std::ios_base::cur);
try
{
return m_pFile->GetPosition();
}
XBMCCOMMONS_HANDLE_UNCHECKED
catch (...) { CLog::Log(LOGERROR, "{} - Unhandled exception", __FUNCTION__); }
return -1;
}
bool XFILE::CFile::ReadString(std:... | `using traits = CFileStreamBuffer::traits_type;` | {
if (!m_pFile)
return -1;
if (m_pBuffer)
return m_pBuffer->pubseekoff(0, std::ios_base::cur);
try
{
return m_pFile->GetPosition();
}
XBMCCOMMONS_HANDLE_UNCHECKED
catch (...) { CLog::Log(LOGERROR, "{} - Unhandled exception", __FUNCTION__); }
return -1;
}
bool XFILE::CFile::ReadString(std:... | @@ -765,6 +765,68 @@ int64_t CFile::GetPosition() const
return -1;
}
+bool XFILE::CFile::ReadString(std::vector<char>& line)
+{
+ if (!m_pFile)
+ return false;
+
+ line.clear();
+
+ if (m_pBuffer)
+ {
+ typedef CFileStreamBuffer::traits_type traits; | xbmc/filesystem/File.cpp | 26 | C++ | 0.571 | suggestion | 48 | 51 | 51 | false | [Playlist][M3U] Fix long line reading | 25,798 | xbmc/xbmc | 17,740 | C++ | enen92 | CastagnaIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.