2 * Copyright (C) 2010-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "DVDVideoCodec.h"
22 #include "windowing/WindowingFactory.h"
23 #include "settings/Settings.h"
25 bool CDVDVideoCodec::IsSettingVisible(const std::string &condition, const std::string &value, const std::string &settingId)
27 if (settingId.empty() || value.empty())
30 // check if we are running on nvidia hardware
31 std::string gpuvendor = g_Windowing.GetRenderVendor();
32 std::transform(gpuvendor.begin(), gpuvendor.end(), gpuvendor.begin(), ::tolower);
33 bool isNvidia = (gpuvendor.compare(0, 6, "nvidia") == 0);
34 bool isIntel = (gpuvendor.compare(0, 5, "intel") == 0);
36 // nvidia does only need mpeg-4 setting
39 if (settingId == "videoplayer.usevdpaumpeg4")
42 return false; //will also hide intel settings on nvidia hardware
44 else if (isIntel) // intel needs vc1, mpeg-2 and mpeg4 setting
46 if (settingId == "videoplayer.usevaapimpeg4")
48 if (settingId == "videoplayer.usevaapivc1")
50 if (settingId == "videoplayer.usevaapimpeg2")
53 return false; //this will also hide nvidia settings on intel hardware
55 // if we don't know the hardware we are running on e.g. amd oss vdpau
56 // or fglrx with xvba-driver we show everything
60 bool CDVDVideoCodec::IsCodecDisabled(DVDCodecAvailableType* map, unsigned int size, AVCodecID id)
63 for (unsigned int i = 0; i < size; ++i)
65 if(map[i].codec == id)
72 return (!CSettings::Get().GetBool(map[index].setting) || !CDVDVideoCodec::IsSettingVisible("unused", "unused", map[index].setting));
74 return false; //don't disable what we don't have