[pvr] fix unnecessary creation of new CPVRChannel instances
authorAlwinEsch <alwin.esch@web.de>
Wed, 8 Oct 2014 14:13:01 +0000 (16:13 +0200)
committerAlwinEsch <alwin.esch@web.de>
Thu, 9 Oct 2014 13:55:36 +0000 (15:55 +0200)
xbmc/GUIInfoManager.cpp

index dcb31e7..2bca784 100644 (file)
@@ -3723,37 +3723,31 @@ CStdString CGUIInfoManager::GetMusicTagLabel(int info, const CFileItem *item)
     return GetItemLabel(item, LISTITEM_DURATION);
   case MUSICPLAYER_CHANNEL_NAME:
     {
-      CPVRChannel* channeltag = m_currentFile->GetPVRChannelInfoTag();
-      if (channeltag)
-        return channeltag->ChannelName();
+      if (m_currentFile->HasPVRChannelInfoTag())
+        return m_currentFile->GetPVRChannelInfoTag()->ChannelName();
     }
     break;
   case MUSICPLAYER_CHANNEL_NUMBER:
     {
-      CPVRChannel* channeltag = m_currentFile->GetPVRChannelInfoTag();
-      if (channeltag)
-      {
-        return StringUtils::Format("%i", channeltag->ChannelNumber());
-      }
+      if (m_currentFile->HasPVRChannelInfoTag())
+        return StringUtils::Format("%i", m_currentFile->GetPVRChannelInfoTag()->ChannelNumber());
     }
     break;
   case MUSICPLAYER_SUB_CHANNEL_NUMBER:
     {
-      CPVRChannel* channel = m_currentFile->GetPVRChannelInfoTag();
-      if (channel)
-        return StringUtils::Format("%i", channel->SubChannelNumber());
+      if (m_currentFile->HasPVRChannelInfoTag())
+        return StringUtils::Format("%i", m_currentFile->GetPVRChannelInfoTag()->SubChannelNumber());
     }
     break;
   case MUSICPLAYER_CHANNEL_NUMBER_LBL:
     {
-      CPVRChannel* channel = m_currentFile->GetPVRChannelInfoTag();
-      return channel ? channel->FormattedChannelNumber() : "";
+      if (m_currentFile->HasPVRChannelInfoTag())
+        return m_currentFile->GetPVRChannelInfoTag()->FormattedChannelNumber();
     }
     break;
   case MUSICPLAYER_CHANNEL_GROUP:
     {
-      CPVRChannel* channeltag = m_currentFile->GetPVRChannelInfoTag();
-      if (channeltag && channeltag->IsRadio())
+      if (m_currentFile->HasPVRChannelInfoTag() && m_currentFile->GetPVRChannelInfoTag()->IsRadio())
         return g_PVRManager.GetPlayingGroup(true)->GroupName();
     }
     break;