Skip to content

Commit

Permalink
Merge pull request #16680 from phunkyfish/pvr-16677-fiuxp
Browse files Browse the repository at this point in the history
[pvr] refactoring - review fixup after merge of 16677
  • Loading branch information
ksooo committed Oct 1, 2019
2 parents 39def32 + 3d297b4 commit 31c550b
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 75 deletions.
8 changes: 4 additions & 4 deletions xbmc/FileItem.h
Expand Up @@ -46,10 +46,10 @@ namespace GAME

namespace PVR
{
class CPVRChannel;
class CPVREpgInfoTag;
class CPVRRecording;
class CPVRTimerInfoTag;
class CPVRChannel;
class CPVREpgInfoTag;
class CPVRRecording;
class CPVRTimerInfoTag;
}

class CAlbum;
Expand Down
12 changes: 6 additions & 6 deletions xbmc/addons/PVRClient.cpp
Expand Up @@ -1479,14 +1479,14 @@ void CPVRClient::cb_transfer_channel_group_member(void* kodiInstance, const ADDO
}

CPVRClient* client = static_cast<CPVRClient*>(kodiInstance);
CPVRChannelGroup* group = static_cast<CPVRChannelGroup *>(handle->dataAddress);
CPVRChannelGroup* group = static_cast<CPVRChannelGroup*>(handle->dataAddress);
if (!member || !client || !group)
{
CLog::LogF(LOGERROR, "Invalid handler data");
return;
}

std::shared_ptr<CPVRChannel> channel = CServiceBroker::GetPVRManager().ChannelGroups()->GetByUniqueID(member->iChannelUniqueId, client->GetID());
std::shared_ptr<CPVRChannel> channel = CServiceBroker::GetPVRManager().ChannelGroups()->GetByUniqueID(member->iChannelUniqueId, client->GetID());
if (!channel)
{
CLog::LogF(LOGERROR, "Cannot find group '%s' or channel '%d'", member->strGroupName, member->iChannelUniqueId);
Expand All @@ -1507,7 +1507,7 @@ void CPVRClient::cb_transfer_epg_entry(void* kodiInstance, const ADDON_HANDLE ha
}

CPVRClient* client = static_cast<CPVRClient*>(kodiInstance);
CPVREpg* kodiEpg = static_cast<CPVREpg *>(handle->dataAddress);
CPVREpg* kodiEpg = static_cast<CPVREpg*>(handle->dataAddress);
if (!epgentry || !client || !kodiEpg)
{
CLog::LogF(LOGERROR, "Invalid handler data");
Expand All @@ -1527,7 +1527,7 @@ void CPVRClient::cb_transfer_channel_entry(void* kodiInstance, const ADDON_HANDL
}

CPVRClient* client = static_cast<CPVRClient*>(kodiInstance);
CPVRChannelGroupInternal* kodiChannels = static_cast<CPVRChannelGroupInternal *>(handle->dataAddress);
CPVRChannelGroupInternal* kodiChannels = static_cast<CPVRChannelGroupInternal*>(handle->dataAddress);
if (!channel || !client || !kodiChannels)
{
CLog::LogF(LOGERROR, "Invalid handler data");
Expand All @@ -1548,7 +1548,7 @@ void CPVRClient::cb_transfer_recording_entry(void* kodiInstance, const ADDON_HAN
}

CPVRClient* client = static_cast<CPVRClient*>(kodiInstance);
CPVRRecordings* kodiRecordings = static_cast<CPVRRecordings *>(handle->dataAddress);
CPVRRecordings* kodiRecordings = static_cast<CPVRRecordings*>(handle->dataAddress);
if (!recording || !client || !kodiRecordings)
{
CLog::LogF(LOGERROR, "Invalid handler data");
Expand All @@ -1569,7 +1569,7 @@ void CPVRClient::cb_transfer_timer_entry(void* kodiInstance, const ADDON_HANDLE
}

CPVRClient* client = static_cast<CPVRClient*>(kodiInstance);
CPVRTimersContainer* kodiTimers = static_cast<CPVRTimersContainer *>(handle->dataAddress);
CPVRTimersContainer* kodiTimers = static_cast<CPVRTimersContainer*>(handle->dataAddress);
if (!timer || !client || !kodiTimers)
{
CLog::LogF(LOGERROR, "Invalid handler data");
Expand Down
6 changes: 3 additions & 3 deletions xbmc/cores/VideoPlayer/VideoPlayerRadioRDS.h
Expand Up @@ -21,8 +21,8 @@ class CDVDStreamInfo;

namespace PVR
{
class CPVRChannel;
class CPVRRadioRDSInfoTag;
class CPVRChannel;
class CPVRRadioRDSInfoTag;
}

/// --- CDVDRadioRDSData ------------------------------------------------------------
Expand Down Expand Up @@ -88,7 +88,7 @@ class CDVDRadioRDSData : public CThread, public IDVDStreamPlayer
void SetRadioStyle(std::string genre);

std::shared_ptr<PVR::CPVRRadioRDSInfoTag> m_currentInfoTag;
std::shared_ptr<PVR::CPVRChannel> m_currentChannel;
std::shared_ptr<PVR::CPVRChannel> m_currentChannel;
bool m_currentFileUpdate;
int m_speed;
CCriticalSection m_critSection;
Expand Down
4 changes: 2 additions & 2 deletions xbmc/interfaces/json-rpc/PlayerOperations.h
Expand Up @@ -17,8 +17,8 @@ class CVariant;

namespace PVR
{
class CPVRChannelGroup;
class CPVREpgInfoTag;
class CPVRChannelGroup;
class CPVREpgInfoTag;
}

namespace JSONRPC
Expand Down
4 changes: 2 additions & 2 deletions xbmc/interfaces/legacy/InfoTagRadioRDS.h
Expand Up @@ -14,8 +14,8 @@

namespace PVR
{
class CPVRChannel;
class CPVRRadioRDSInfoTag;
class CPVRChannel;
class CPVRRadioRDSInfoTag;
}

namespace XBMCAddon
Expand Down
1 change: 0 additions & 1 deletion xbmc/pvr/PVRItem.h
Expand Up @@ -8,7 +8,6 @@

#pragma once


#include <memory>

class CFileItem;
Expand Down
32 changes: 16 additions & 16 deletions xbmc/pvr/PVRManager.h
Expand Up @@ -556,27 +556,27 @@ namespace PVR

/** @name containers */
//@{
std::shared_ptr<CPVRChannelGroupsContainer> m_channelGroups; /*!< pointer to the channel groups container */
std::shared_ptr<CPVRRecordings> m_recordings; /*!< pointer to the recordings container */
std::shared_ptr<CPVRTimers> m_timers; /*!< pointer to the timers container */
std::shared_ptr<CPVRClients> m_addons; /*!< pointer to the pvr addon container */
std::unique_ptr<CPVRGUIInfo> m_guiInfo; /*!< pointer to the guiinfo data */
std::shared_ptr<CPVRGUIActions> m_guiActions; /*!< pointer to the pvr gui actions */
CPVREpgContainer m_epgContainer; /*!< the epg container */
std::shared_ptr<CPVRChannelGroupsContainer> m_channelGroups; /*!< pointer to the channel groups container */
std::shared_ptr<CPVRRecordings> m_recordings; /*!< pointer to the recordings container */
std::shared_ptr<CPVRTimers> m_timers; /*!< pointer to the timers container */
std::shared_ptr<CPVRClients> m_addons; /*!< pointer to the pvr addon container */
std::unique_ptr<CPVRGUIInfo> m_guiInfo; /*!< pointer to the guiinfo data */
std::shared_ptr<CPVRGUIActions> m_guiActions; /*!< pointer to the pvr gui actions */
CPVREpgContainer m_epgContainer; /*!< the epg container */
//@}

CPVRManagerJobQueue m_pendingUpdates; /*!< vector of pending pvr updates */
CPVRManagerJobQueue m_pendingUpdates; /*!< vector of pending pvr updates */

std::shared_ptr<CPVRDatabase> m_database; /*!< the database for all PVR related data */
mutable CCriticalSection m_critSection; /*!< critical section for all changes to this class, except for changes to triggers */
bool m_bFirstStart = true; /*!< true when the PVR manager was started first, false otherwise */
bool m_bEpgsCreated = false; /*!< true if epg data for channels has been created */
std::shared_ptr<CPVRDatabase> m_database; /*!< the database for all PVR related data */
mutable CCriticalSection m_critSection; /*!< critical section for all changes to this class, except for changes to triggers */
bool m_bFirstStart = true; /*!< true when the PVR manager was started first, false otherwise */
bool m_bEpgsCreated = false; /*!< true if epg data for channels has been created */

mutable CCriticalSection m_managerStateMutex;
ManagerState m_managerState = ManagerStateStopped;
std::unique_ptr<CStopWatch> m_parentalTimer;
mutable CCriticalSection m_managerStateMutex;
ManagerState m_managerState = ManagerStateStopped;
std::unique_ptr<CStopWatch> m_parentalTimer;

CCriticalSection m_startStopMutex; // mutex for protecting pvr manager's start/restart/stop sequence */
CCriticalSection m_startStopMutex; // mutex for protecting pvr manager's start/restart/stop sequence */

CEventSource<PVREvent> m_events;

Expand Down
2 changes: 1 addition & 1 deletion xbmc/pvr/PVRSettings.h
Expand Up @@ -27,7 +27,7 @@ namespace PVR
class CPVRSettings : private ISettingsHandler, private ISettingCallback
{
public:
explicit CPVRSettings(const std::set<std::string>& settingNames);
explicit CPVRSettings(const std::set<std::string>& settingNames);
~CPVRSettings() override;

// ISettingsHandler implementation
Expand Down
6 changes: 3 additions & 3 deletions xbmc/pvr/channels/PVRChannelGroups.h
Expand Up @@ -211,9 +211,9 @@ namespace PVR
*/
void RemoveFromAllGroups(const std::shared_ptr<CPVRChannel>& channel);

bool m_bRadio; /*!< true if this is a container for radio channels, false if it is for tv channels */
std::shared_ptr<CPVRChannelGroup> m_selectedGroup; /*!< the group that's currently selected in the UI */
std::vector<std::shared_ptr<CPVRChannelGroup>> m_groups; /*!< the groups in this container */
bool m_bRadio; /*!< true if this is a container for radio channels, false if it is for tv channels */
std::shared_ptr<CPVRChannelGroup> m_selectedGroup; /*!< the group that's currently selected in the UI */
std::vector<std::shared_ptr<CPVRChannelGroup>> m_groups; /*!< the groups in this container */
mutable CCriticalSection m_critSection;
std::vector<int> m_failedClientsForChannelGroups;
};
Expand Down
10 changes: 5 additions & 5 deletions xbmc/pvr/channels/PVRChannelGroupsContainer.h
Expand Up @@ -79,13 +79,13 @@ namespace PVR
* @brief Get the group containing all TV channels.
* @return The group containing all TV channels.
*/
std::shared_ptr<CPVRChannelGroup> GetGroupAllTV(void) const{ return GetGroupAll(false); }
std::shared_ptr<CPVRChannelGroup> GetGroupAllTV(void) const { return GetGroupAll(false); }

/*!
* @brief Get the group containing all radio channels.
* @return The group containing all radio channels.
*/
std::shared_ptr<CPVRChannelGroup> GetGroupAllRadio(void) const{ return GetGroupAll(true); }
std::shared_ptr<CPVRChannelGroup> GetGroupAllRadio(void) const { return GetGroupAll(true); }

/*!
* @brief Get the group containing all TV or radio channels.
Expand Down Expand Up @@ -178,9 +178,9 @@ namespace PVR
protected:
CPVRChannelGroups* m_groupsRadio; /*!< all radio channel groups */
CPVRChannelGroups* m_groupsTV; /*!< all TV channel groups */
CCriticalSection m_critSection;
bool m_bUpdateChannelsOnly = false;
bool m_bIsUpdating = false;
CCriticalSection m_critSection;
bool m_bUpdateChannelsOnly = false;
bool m_bIsUpdating = false;
std::shared_ptr<CPVRChannelGroup> m_lastPlayedGroups[2]; /*!< used to store the last played groups */

private :
Expand Down
26 changes: 13 additions & 13 deletions xbmc/pvr/epg/Epg.h
Expand Up @@ -303,19 +303,19 @@ namespace PVR
void Cleanup(int iPastDays);

std::map<CDateTime, std::shared_ptr<CPVREpgInfoTag>> m_tags;
std::map<int, std::shared_ptr<CPVREpgInfoTag>> m_changedTags;
std::map<int, std::shared_ptr<CPVREpgInfoTag>> m_deletedTags;
bool m_bChanged = false; /*!< true if anything changed that needs to be persisted, false otherwise */
bool m_bTagsChanged = false; /*!< true when any tags are changed and not persisted, false otherwise */
bool m_bLoaded = false; /*!< true when the initial entries have been loaded */
bool m_bUpdatePending = false; /*!< true if manual update is pending */
int m_iEpgID = 0; /*!< the database ID of this table */
std::string m_strName; /*!< the name of this table */
std::string m_strScraperName; /*!< the name of the scraper to use */
mutable CDateTime m_nowActiveStart; /*!< the start time of the tag that is currently active */
CDateTime m_lastScanTime; /*!< the last time the EPG has been updated */
mutable CCriticalSection m_critSection; /*!< critical section for changes in this table */
bool m_bUpdateLastScanTime = false;
std::map<int, std::shared_ptr<CPVREpgInfoTag>> m_changedTags;
std::map<int, std::shared_ptr<CPVREpgInfoTag>> m_deletedTags;
bool m_bChanged = false; /*!< true if anything changed that needs to be persisted, false otherwise */
bool m_bTagsChanged = false; /*!< true when any tags are changed and not persisted, false otherwise */
bool m_bLoaded = false; /*!< true when the initial entries have been loaded */
bool m_bUpdatePending = false; /*!< true if manual update is pending */
int m_iEpgID = 0; /*!< the database ID of this table */
std::string m_strName; /*!< the name of this table */
std::string m_strScraperName; /*!< the name of the scraper to use */
mutable CDateTime m_nowActiveStart; /*!< the start time of the tag that is currently active */
CDateTime m_lastScanTime; /*!< the last time the EPG has been updated */
mutable CCriticalSection m_critSection; /*!< critical section for changes in this table */
bool m_bUpdateLastScanTime = false;

std::shared_ptr<CPVREpgChannelData> m_channelData;

Expand Down
8 changes: 4 additions & 4 deletions xbmc/pvr/timers/PVRTimerInfoTag.h
Expand Up @@ -365,10 +365,10 @@ namespace PVR
static std::shared_ptr<CPVRTimerInfoTag> CreateFromDate(const std::shared_ptr<CPVRChannel>& channel, const CDateTime& start, int iDuration, bool bCreateReminder, bool bReadOnly);

mutable CCriticalSection m_critSection;
CDateTime m_StartTime; /*!< start time */
CDateTime m_StopTime; /*!< stop time */
CDateTime m_FirstDay; /*!< if it is a manual timer rule the first date it starts */
std::shared_ptr<CPVRTimerType> m_timerType; /*!< the type of this timer */
CDateTime m_StartTime; /*!< start time */
CDateTime m_StopTime; /*!< stop time */
CDateTime m_FirstDay; /*!< if it is a manual timer rule the first date it starts */
std::shared_ptr<CPVRTimerType> m_timerType; /*!< the type of this timer */

unsigned int m_iTVChildTimersActive = 0;
unsigned int m_iTVChildTimersConflictNOK = 0;
Expand Down
8 changes: 4 additions & 4 deletions xbmc/pvr/timers/PVRTimerType.cpp
Expand Up @@ -278,7 +278,7 @@ void CPVRTimerType::InitPriorityValues(const PVR_TIMER_TYPE& type)
}
}

void CPVRTimerType::GetPriorityValues(std::vector< std::pair<std::string, int>>& list) const
void CPVRTimerType::GetPriorityValues(std::vector<std::pair<std::string, int>>& list) const
{
for (const auto& prio : m_priorityValues)
list.push_back(prio);
Expand Down Expand Up @@ -318,7 +318,7 @@ void CPVRTimerType::InitLifetimeValues(const PVR_TIMER_TYPE& type)
}
}

void CPVRTimerType::GetLifetimeValues(std::vector< std::pair<std::string, int>>& list) const
void CPVRTimerType::GetLifetimeValues(std::vector<std::pair<std::string, int>>& list) const
{
for (const auto& lifetime : m_lifetimeValues)
list.push_back(lifetime);
Expand All @@ -343,7 +343,7 @@ void CPVRTimerType::InitMaxRecordingsValues(const PVR_TIMER_TYPE& type)
}
}

void CPVRTimerType::GetMaxRecordingsValues(std::vector< std::pair<std::string, int>>& list) const
void CPVRTimerType::GetMaxRecordingsValues(std::vector<std::pair<std::string, int>>& list) const
{
for (const auto& maxRecordings : m_maxRecordingsValues)
list.push_back(maxRecordings);
Expand Down Expand Up @@ -380,7 +380,7 @@ void CPVRTimerType::InitPreventDuplicateEpisodesValues(const PVR_TIMER_TYPE& typ
}
}

void CPVRTimerType::GetPreventDuplicateEpisodesValues(std::vector< std::pair<std::string, int>>& list) const
void CPVRTimerType::GetPreventDuplicateEpisodesValues(std::vector<std::pair<std::string, int>>& list) const
{
for (const auto& preventDupEpisodes : m_preventDupEpisodesValues)
list.push_back(preventDupEpisodes);
Expand Down
10 changes: 5 additions & 5 deletions xbmc/pvr/timers/PVRTimerType.h
Expand Up @@ -310,7 +310,7 @@ namespace PVR
* @brief Obtain a list with all possible values for the priority attribute.
* @param list out, the list with the values or an empty list, if priority is not supported by this type.
*/
void GetPriorityValues(std::vector< std::pair<std::string, int>>& list) const;
void GetPriorityValues(std::vector<std::pair<std::string, int>>& list) const;

/*!
* @brief Obtain the default value for the priority attribute.
Expand All @@ -322,7 +322,7 @@ namespace PVR
* @brief Obtain a list with all possible values for the lifetime attribute.
* @param list out, the list with the values or an empty list, if lifetime is not supported by this type.
*/
void GetLifetimeValues(std::vector< std::pair<std::string, int>>& list) const;
void GetLifetimeValues(std::vector<std::pair<std::string, int>>& list) const;

/*!
* @brief Obtain the default value for the lifetime attribute.
Expand All @@ -334,7 +334,7 @@ namespace PVR
* @brief Obtain a list with all possible values for the MaxRecordings attribute.
* @param list out, the list with the values or an empty list, if MaxRecordings is not supported by this type.
*/
void GetMaxRecordingsValues(std::vector< std::pair<std::string, int>>& list) const;
void GetMaxRecordingsValues(std::vector<std::pair<std::string, int>>& list) const;

/*!
* @brief Obtain the default value for the MaxRecordings attribute.
Expand All @@ -346,7 +346,7 @@ namespace PVR
* @brief Obtain a list with all possible values for the duplicate episode prevention attribute.
* @param list out, the list with the values or an empty list, if duplicate episode prevention is not supported by this type.
*/
void GetPreventDuplicateEpisodesValues(std::vector< std::pair<std::string, int>>& list) const;
void GetPreventDuplicateEpisodesValues(std::vector<std::pair<std::string, int>>& list) const;

/*!
* @brief Obtain the default value for the duplicate episode prevention attribute.
Expand All @@ -358,7 +358,7 @@ namespace PVR
* @brief Obtain a list with all possible values for the recording group attribute.
* @param list out, the list with the values or an empty list, if recording group is not supported by this type.
*/
void GetRecordingGroupValues(std::vector< std::pair<std::string, int>>& list) const;
void GetRecordingGroupValues(std::vector<std::pair<std::string, int>>& list) const;

/*!
* @brief Obtain the default value for the Recording Group attribute.
Expand Down
10 changes: 5 additions & 5 deletions xbmc/pvr/windows/GUIEPGGridContainer.cpp
Expand Up @@ -1793,12 +1793,12 @@ void CGUIEPGGridContainer::GoToBlock(int blockIndex)

void CGUIEPGGridContainer::UpdateLayout()
{
CGUIListItemLayout* oldFocusedChannelLayout = m_focusedChannelLayout;
CGUIListItemLayout* oldChannelLayout = m_channelLayout;
CGUIListItemLayout* oldFocusedChannelLayout = m_focusedChannelLayout;
CGUIListItemLayout* oldChannelLayout = m_channelLayout;
CGUIListItemLayout* oldFocusedProgrammeLayout = m_focusedProgrammeLayout;
CGUIListItemLayout* oldProgrammeLayout = m_programmeLayout;
CGUIListItemLayout* oldRulerLayout = m_rulerLayout;
CGUIListItemLayout* oldRulerDateLayout = m_rulerDateLayout;
CGUIListItemLayout* oldProgrammeLayout = m_programmeLayout;
CGUIListItemLayout* oldRulerLayout = m_rulerLayout;
CGUIListItemLayout* oldRulerDateLayout = m_rulerDateLayout;

GetCurrentLayouts();

Expand Down
2 changes: 1 addition & 1 deletion xbmc/pvr/windows/GUIEPGGridContainerModel.h
Expand Up @@ -60,7 +60,7 @@ namespace PVR

int GetBlockCount() const { return m_blocks; }
bool HasGridItems() const { return !m_gridIndex.empty(); }
GridItem* GetGridItemPtr(int iChannel, int iBlock) { return& m_gridIndex[iChannel][iBlock]; }
GridItem* GetGridItemPtr(int iChannel, int iBlock) { return &m_gridIndex[iChannel][iBlock]; }
std::shared_ptr<CFileItem> GetGridItem(int iChannel, int iBlock) const { return m_gridIndex[iChannel][iBlock].item; }
float GetGridItemWidth(int iChannel, int iBlock) const { return m_gridIndex[iChannel][iBlock].width; }
float GetGridItemOriginWidth(int iChannel, int iBlock) const { return m_gridIndex[iChannel][iBlock].originWidth; }
Expand Down

0 comments on commit 31c550b

Please sign in to comment.