diff --git a/DeviceInfo/DeviceInfoImplementation.cpp b/DeviceInfo/DeviceInfoImplementation.cpp index 4bf234ad..e3c016f8 100644 --- a/DeviceInfo/DeviceInfoImplementation.cpp +++ b/DeviceInfo/DeviceInfoImplementation.cpp @@ -74,8 +74,9 @@ namespace Plugin { uint32_t DeviceInfoImplementation::AudioOutputs(Exchange::IDeviceAudioCapabilities::IAudioOutputIterator*& audioOutputs) const { AudioOutputList audioOutputList; + audioOutputList.reserve(_audioOutputMap.size()); - std::transform(_audioOutputMap.begin(), _audioOutputMap.end(), std::front_inserter(audioOutputList), + std::transform(_audioOutputMap.begin(), _audioOutputMap.end(), std::back_inserter(audioOutputList), [](decltype(_audioOutputMap)::value_type const &pair) { return pair.first; }); @@ -114,6 +115,7 @@ namespace Plugin { uint32_t DeviceInfoImplementation::VideoOutputs(Exchange::IDeviceVideoCapabilities::IVideoOutputIterator*& videoOutputs) const { VideoOutputList videoOutputList; + videoOutputList.reserve(_videoOutputMap.size()); std::transform(_videoOutputMap.begin(), _videoOutputMap.end(), std::back_inserter(videoOutputList), [](decltype(_videoOutputMap)::value_type const &pair) { diff --git a/DeviceInfo/DeviceInfoImplementation.h b/DeviceInfo/DeviceInfoImplementation.h index a1de13f3..6c10b664 100644 --- a/DeviceInfo/DeviceInfoImplementation.h +++ b/DeviceInfo/DeviceInfoImplementation.h @@ -151,7 +151,7 @@ namespace Plugin { std::list MS12Profiles; }; using AudioOutputMap = std::map; - using AudioOutputList = std::list; + using AudioOutputList = std::vector; using AudioOutputIteratorImplementation = RPC::IteratorType; struct VideoOutputCapability { @@ -160,7 +160,7 @@ namespace Plugin { IDeviceVideoCapabilities::CopyProtection CopyProtection; }; using VideoOutputMap = std::map; - using VideoOutputList = std::list; + using VideoOutputList = std::vector; using VideoOutputIteratorImplementation = RPC::IteratorType; public: diff --git a/DisplayInfo/DeviceSettings/PlatformImplementation.cpp b/DisplayInfo/DeviceSettings/PlatformImplementation.cpp index eebe80c6..c775ffd6 100644 --- a/DisplayInfo/DeviceSettings/PlatformImplementation.cpp +++ b/DisplayInfo/DeviceSettings/PlatformImplementation.cpp @@ -584,7 +584,9 @@ class DisplayInfoImplementation : uint32_t Colorimetry(IColorimetryIterator*& colorimetry /* @out */) const override { - std::list colorimetryCaps; + std::vector colorimetryCaps; + colorimetryCaps.reserve(8); + vector edidVec; uint32_t ret = GetEdidBytes(edidVec); if (ret == Core::ERROR_NONE) @@ -665,7 +667,8 @@ class DisplayInfoImplementation : // @return HDRType: array of HDR formats uint32_t TVCapabilities(IHDRIterator*& type /* out */) const override { - std::list hdrCapabilities; + std::vector hdrCapabilities; + hdrCapabilities.reserve(4); int capabilities = static_cast(dsHDRSTANDARD_NONE); try @@ -699,7 +702,8 @@ class DisplayInfoImplementation : // @return HDRType: array of HDR formats uint32_t STBCapabilities(IHDRIterator*& type /* out */) const override { - std::list hdrCapabilities; + std::vector hdrCapabilities; + hdrCapabilities.reserve(4); int capabilities = static_cast(dsHDRSTANDARD_NONE); try diff --git a/MessageControl/MessageControl.h b/MessageControl/MessageControl.h index 2e33ad44..1d081e5b 100644 --- a/MessageControl/MessageControl.h +++ b/MessageControl/MessageControl.h @@ -432,7 +432,7 @@ namespace Plugin { Core::hresult Controls(const string& module, Exchange::IMessageControl::IControlIterator*& controls) const override { - std::list list; + std::vector list; Messaging::MessageUnit::Iterator index; _client.Controls(index, module); diff --git a/PlayerInfo/DeviceSettings/PlatformImplementation.cpp b/PlayerInfo/DeviceSettings/PlatformImplementation.cpp index 72993d95..10b796ec 100644 --- a/PlayerInfo/DeviceSettings/PlatformImplementation.cpp +++ b/PlayerInfo/DeviceSettings/PlatformImplementation.cpp @@ -459,6 +459,8 @@ class PlayerInfoImplementation : public Exchange::IPlayerProperties, public Exch {"audio/x-vorbis", Exchange::IPlayerProperties::AUDIO_VORBIS_OGG}, {"audio/x-wav", Exchange::IPlayerProperties::AUDIO_WAV}, }; + _audioCodecs.reserve(audioCaps.size()); + if (GstUtils::GstRegistryCheckElementsForMediaTypes(audioCaps, _audioCodecs) != true) { TRACE(Trace::Warning, (_T("There is no Audio Codec support available"))); } @@ -477,14 +479,16 @@ class PlayerInfoImplementation : public Exchange::IPlayerProperties, public Exch {"video/x-vp9", Exchange::IPlayerProperties::VideoCodec::VIDEO_VP9}, {"video/x-vp10", Exchange::IPlayerProperties::VideoCodec::VIDEO_VP10} }; + _videoCodecs.reserve(videoCaps.size()); + if (GstUtils::GstRegistryCheckElementsForMediaTypes(videoCaps, _videoCodecs) != true) { TRACE(Trace::Warning, (_T("There is no Video Codec support available"))); } } private: - std::list _audioCodecs; - std::list _videoCodecs; + std::vector _audioCodecs; + std::vector _videoCodecs; std::map _resolutions = { {"480i24", RESOLUTION_480I24}, diff --git a/PlayerInfo/GStreamer/PlatformImplementation.cpp b/PlayerInfo/GStreamer/PlatformImplementation.cpp index 3794ad17..31bf769b 100644 --- a/PlayerInfo/GStreamer/PlatformImplementation.cpp +++ b/PlayerInfo/GStreamer/PlatformImplementation.cpp @@ -170,6 +170,8 @@ class PlayerInfoImplementation : public Exchange::IPlayerProperties { {"audio/x-vorbis", Exchange::IPlayerProperties::AudioCodec::AUDIO_VORBIS_OGG}, {"audio/x-wav", Exchange::IPlayerProperties::AudioCodec::AUDIO_WAV}, }; + _audioCodecs.reserve(audioCaps.size()); + if (GstUtils::GstRegistryCheckElementsForMediaTypes(audioCaps, _audioCodecs) != true) { TRACE(Trace::Warning, (_T("There is no Audio Codec support available"))); } @@ -185,14 +187,16 @@ class PlayerInfoImplementation : public Exchange::IPlayerProperties { {"video/x-vp9", Exchange::IPlayerProperties::VideoCodec::VIDEO_VP9}, {"video/x-vp10", Exchange::IPlayerProperties::VideoCodec::VIDEO_VP10} }; + _videoCodecs.reserve(videoCaps.size()); + if (GstUtils::GstRegistryCheckElementsForMediaTypes(videoCaps, _videoCodecs) != true) { TRACE(Trace::Warning, (_T("There is no Video Codec support available"))); } } private: - std::list _audioCodecs; - std::list _videoCodecs; + std::vector _audioCodecs; + std::vector _videoCodecs; #if DOLBY_SUPPORT Exchange::Dolby::IOutput* _dolbyOut; #endif diff --git a/WebKitBrowser/WebKitBrowser.cpp b/WebKitBrowser/WebKitBrowser.cpp index 2c94191c..2e6e7757 100644 --- a/WebKitBrowser/WebKitBrowser.cpp +++ b/WebKitBrowser/WebKitBrowser.cpp @@ -331,7 +331,8 @@ namespace Plugin { Core::JSON::ArrayType array; array.FromString(languagesList); - std::list list; + std::vector list; + list.reserve(array.Length()); auto iterator = array.Elements(); while (iterator.Next() == true) {