RDK Documentation (Open Sourced RDK Components)
videoResolution.cpp
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 
22 /**
23 * @defgroup devicesettings
24 * @{
25 * @defgroup ds
26 * @{
27 **/
28 
29 
30 #include "videoResolution.hpp"
31 #include "pixelResolution.hpp"
32 #include "videoOutputPortConfig.hpp"
33 #include "illegalArgumentException.hpp"
34 #include <string>
35 #include "dslogger.h"
36 
37 /**
38  * @file videoResolution.cpp
39  * @brief This file defines the videoResolution objects by the device settings module upon intialization.
40  *
41  */
42 namespace device {
43 
44 
45 /**
46  * @addtogroup dssettingsvidresolutionapi
47  * @{
48  */
49 /**
50  * @fn const VideoResolution & VideoResolution::getInstance(int id)
51  * @brief This API is used to get the instance of the video resolution port based on the port id returned by the getsupported video resolution .
52  *
53  * @param[in] id port id
54  * @return Reference to the instance of the port id.
55  */
57 {
58  return VideoOutputPortConfig::getInstance().getVideoResolution(id);
59 }
60 
61 
62 /**
63  * @fn const VideoResolution & VideoResolution::getInstance(const std::string &name, bool isIgnoreEdid)
64  * @brief This API is used to get the instance of the video resolution port with the name as passed parameter and comparing name with the
65  * supported resolution . If matched, it returns the supported resolution.
66  *
67  * @param[in] name Name of the port
68  * @param[in] isIgnoreEdid request to ignore Edid Check.
69  * @return Reference to the instance of the name of the port
70  */
71 const VideoResolution & VideoResolution::getInstance(const std::string &name, bool isIgnoreEdid)
72 {
73  const List<VideoResolution> supportedResollutions = VideoOutputPortConfig::getInstance().getSupportedResolutions(isIgnoreEdid);
74 
75  for (size_t i = 0; i < supportedResollutions.size(); i++) {
76  if (name.compare(std::string(supportedResollutions.at(i).getName())) == 0) {
77  return supportedResollutions.at(i);
78  }
79  }
81 }
82 
83 
84 /**
85  * @fn VideoResolution::VideoResolution(const int id, const std::string &name,int pixelResolutionId, int ratioId,
86  * int ssModeId,int frameRateId, bool interlaced, bool enabled)
87  * @brief This function is a default constructor for videoResolution. It initialises the data members
88  * of video Resolution instance with the parameters passed.
89  *
90  * @param[in] type Type of video Resolution.
91  * @param[in] name Name of the video Resolution port.
92  * @param[in] pixelResolutionId Pixel resolution[720x480,720x480,..] id.
93  * @param[in] frameRateId Frame rate[24,25, 59.94,.... frames per second] id.
94  * @param[in] ratioId Aspect ratio[4:3, 16:9,...] id.
95  * @param[in] ssModeId Stereoscopic mode[2D, 3D,...] id.
96  * @param[in] interlaced Scan mode type . True if interlaced or False.
97  * @param[in] enabled True if video port is enabled. Else, false.
98  *
99  * @return None
100  */
101 VideoResolution::VideoResolution(const int id, const std::string &name,
102  int pixelResolutionId, int ratioId, int ssModeId,
103  int frameRateId, bool interlaced, bool enabled) :
104  DSConstant(id, name),
105  _pixelResolutionId(pixelResolutionId),
106  _aspectRatioId(ratioId),
107  _stereoScopicModeId(ssModeId),
108  _frameRateId(frameRateId),
109  _interlaced(interlaced),
110  _enabled(enabled)
111 {
112  _id = id;
113  _name = name;
114 }
115 
116 
117 /**
118  * @fn VideoResolution::~VideoResolution()
119  * @brief This is a default destructor of class VideoResolution.
120  *
121  * @return None.
122  */
124 {
125 }
126 
127 
128 /**
129  * @fn VideoResolution::getPixelResolution() const
130  * @brief This API is used to get the pixel format of the given video output port.
131  *
132  * @return A list of pixel resolution instance
133  */
135 {
137 }
138 
139 
140 /**
141  * @fn AspectRatio & VideoResolution::getAspectRatio() const
142  * @brief This API is used to get the current Aspect Ratio setting of the Display Device (i.e. TV) that is connected to the port.
143  * Its value is independent to the current zoom settings (which includes the Aspect Ratio of the output format) on the Video Output Port.
144  * IllegalStateException will be thrown if the display is not connected.
145  * UnsupportedOperationException will be thrown if the Display's Aspect Ratio setting is not available.
146  *
147  * @return Aspect ratio instance
148  */
150 {
152 }
153 
154 
155 /**
156  * @fn VideoResolution::getStereoscopicMode() const
157  * @brief This API is used to get the stereoscopic mode of the given video output port.
158  *
159  * @return Reference to the stereoscopicemode instance
160  */
163 }
164 
165 
166 /**
167  * @fn VideoResolution::getFrameRate() const
168  * @brief This API is used to get the frame rate of the given video output port.
169  *
170  * @return Reference to the frame rate instance id
171  */
173  return FrameRate::getInstance(_frameRateId);
174 }
175 
176 
177 /**
178  * @fn VideoResolution::isInterlaced() const
179  * @brief This API is used to check the video is interlaced or not.
180  *
181  * @return True or False
182  * @retval True If video is interlaced
183  * @retval False If video is not interlaced
184  */
186  return _interlaced;
187 }
188 
189 
190 /**
191  * @fn VideoResolution::isEnabled() const
192  * @brief This API is used to check whether the current resolution is enabled or not.
193  *
194  * @return True or False
195  * @retval True If current resolution is enabled
196  * @retval False If current resolution is disabled
197  */
199  return _enabled;
200 }
201 
202 
203 }
204 
205 /** @} */ //End of Doxygen tag
206 
207 /** @} */
208 /** @} */
device::DSConstant::_id
int _id
Indicates the id of the instance inheriting this class.
Definition: dsConstant.hpp:57
device::StereoScopicMode
This class extentds DSConstant to implement StereoScopicMode. It manages the stereoscopic mode of the...
Definition: stereoScopicMode.hpp:50
device::VideoResolution::_enabled
bool _enabled
TRUE indicates this video resolution is enabled otherwise disabled.
Definition: videoResolution.hpp:65
device::List
This class is implemented using templates and it is used to maintain a container with the list of sup...
Definition: list.hpp:51
device::VideoResolution::getFrameRate
const FrameRate & getFrameRate() const
This API is used to get the frame rate of the given video output port.
Definition: videoResolution.cpp:172
device::VideoResolution
Class extending DSConstant to implement the videoResolution interface.
Definition: videoResolution.hpp:57
device::PixelResolution
This class extends DSConstant to manages the pixel resolution of the video.
Definition: pixelResolution.hpp:51
device::FrameRate
This class extends DSConstant to handle the video frame rate.
Definition: frameRate.hpp:49
device::VideoResolution::VideoResolution
VideoResolution(const int id, const std::string &name, int resolutionId, int ratioid, int ssModeId, int frameRateId, bool interlacedId, bool enabled=true)
This function is a default constructor for videoResolution. It initialises the data members of video ...
Definition: videoResolution.cpp:101
device::VideoResolution::_stereoScopicModeId
int _stereoScopicModeId
Indicates the stereoscopic mode of the video.
Definition: videoResolution.hpp:61
device::PixelResolution::getInstance
static const PixelResolution & getInstance(int id)
This function gets the instance of PixelResolution against the specified id, only if the id passed is...
Definition: pixelResolution.cpp:85
device::DSConstant
This class is used to store and manage the names and id's. It is derived by many classes like VideoRe...
Definition: dsConstant.hpp:52
device::VideoResolution::getStereoscopicMode
const StereoScopicMode & getStereoscopicMode() const
This API is used to get the stereoscopic mode of the given video output port.
Definition: videoResolution.cpp:161
device::List::size
size_t size()
This function gets the size of the container.
Definition: list.hpp:118
device::StereoScopicMode::getInstance
static const StereoScopicMode & getInstance(int id)
This function gets an instance of the StereoScopicMode against the specified id, only if the id passe...
Definition: stereoScopicMode.cpp:78
device::VideoResolution::isInterlaced
bool isInterlaced() const
This API is used to check the video is interlaced or not.
Definition: videoResolution.cpp:185
device::VideoResolution::_frameRateId
int _frameRateId
Indicates frame rate of the video.
Definition: videoResolution.hpp:62
videoResolution.hpp
It contains class and structure refrenced by the videoResolution.cpp file.
device::VideoResolution::getInstance
static const VideoResolution & getInstance(int id)
This API is used to get the instance of the video resolution port based on the port id returned by th...
Definition: videoResolution.cpp:56
device::AspectRatio::getInstance
static const AspectRatio & getInstance(int id)
This function gets the instance of the AspectRatio against the id specified, only if the id passed is...
Definition: aspectRatio.cpp:74
device::DSConstant::_name
std::string _name
Indicates the name string of the instance inheriting this class.
Definition: dsConstant.hpp:58
device::VideoResolution::getPixelResolution
const PixelResolution & getPixelResolution() const
This API is used to get the pixel format of the given video output port.
Definition: videoResolution.cpp:134
device::VideoResolution::~VideoResolution
virtual ~VideoResolution()
This is a default destructor of class VideoResolution.
Definition: videoResolution.cpp:123
device::AspectRatio
This class extends DSConstant to implement AspectRatio. It manages the aspect ratios of the videos.
Definition: aspectRatio.hpp:50
device::VideoResolution::_aspectRatioId
int _aspectRatioId
Indicates aspect ratio type of the video.
Definition: videoResolution.hpp:60
device::IllegalArgumentException
This class extends Exception class to manage the expections caused due to illegal arguments.
Definition: illegalArgumentException.hpp:51
device::VideoResolution::getAspectRatio
const AspectRatio & getAspectRatio() const
This API is used to get the current Aspect Ratio setting of the Display Device (i....
Definition: videoResolution.cpp:149
device::VideoResolution::isEnabled
bool isEnabled() const
This API is used to check whether the current resolution is enabled or not.
Definition: videoResolution.cpp:198
pixelResolution.hpp
This file defines PixelResolution class for managing video resolution types.
device::VideoResolution::_pixelResolutionId
int _pixelResolutionId
Indicates the video resolution.
Definition: videoResolution.hpp:59
device::VideoResolution::_interlaced
bool _interlaced
TRUE indicates interlaced scan and FALSE indicates progressive scan.
Definition: videoResolution.hpp:64