RDK Documentation (Open Sourced RDK Components)
stereoScopicMode.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  * @file stereoScopicMode.cpp
22  * @brief This file contains implementation of StereoScopicMode class methods,
23  * support functions and variable assignments to manage the video stereoscopy
24  * types.
25  */
26 
27 
28 
29 /**
30 * @defgroup devicesettings
31 * @{
32 * @defgroup ds
33 * @{
34 **/
35 
36 
37 #include "stereoScopicMode.hpp"
38 #include "illegalArgumentException.hpp"
39 #include "videoOutputPortConfig.hpp"
40 #include "dsTypes.h"
41 #include "dsUtl.h"
42 #include "dslogger.h"
43 
44 namespace {
45  const char *_names[] = {
46  "UNKOWN",
47  "2D",
48  "SIDE_BY_SIDE",
49  "TOP_AND_BOTTOM"
50  };
51 
52  inline const bool isValid(int id) {
54  }
55 }
56 
57 
58 namespace device {
59 typedef int _SafetyCheck[(dsUTL_DIM(_names) == dsVIDEO_SSMODE_MAX) ? 1 : -1];
60 
66 
67 
68 /**
69  * @fn StereoScopicMode::getInstance(int id)
70  * @brief This function gets an instance of the StereoScopicMode against the specified id, only
71  * if the id passed is valid.
72  *
73  * @param[in] id Indicates the id of the StereoScopicMode instance required.
74  *
75  * @return Returns an instance of StereoScopicMode against the specified id only if the id is
76  * valid else throws an IllegalArgumentException.
77  */
79 {
80  if (::isValid(id)) {
81  return VideoOutputPortConfig::getInstance().getSSMode(id);
82  }
83  else {
85  }
86 }
87 
88 
89 /**
90  * @fn StereoScopicMode::StereoScopicMode(int id)
91  * @brief This function is a parameterised constructor of StereoScopicMode class. It initializes
92  * the instance with the specified id and the name corressponding to it. If the id passed
93  * is invalid then IllegalArgumentException is thrown.
94  *
95  * @param[in] id Indicates the id for the instance created which is used to identify the
96  * type of video Stereoscopy like 2D, 3D and so on.
97  *
98  * @return None
99  */
101 {
102  if (::isValid(id)) {
103  _id = id;
104  _name = std::string(_names[id]);
105  }
106  else {
107  throw IllegalArgumentException();
108  }
109 }
110 
111 
112 /**
113  * @fn StereoScopicMode::~StereoScopicMode()
114  * @brief This function is the default destructor for StereoScopicMode class.
115  *
116  * @return None
117  */
119 {
120 }
121 
122 }
123 
124 
125 /** @} */
126 /** @} */
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::StereoScopicMode::kMax
static const int kMax
Indicates the maximum number of supported stereoscopy types.
Definition: stereoScopicMode.hpp:57
device::StereoScopicMode::StereoScopicMode
StereoScopicMode(int id)
This function is a parameterised constructor of StereoScopicMode class. It initializes the instance w...
Definition: stereoScopicMode.cpp:100
dsVIDEO_SSMODE_MAX
@ dsVIDEO_SSMODE_MAX
Definition: dsTypes.h:566
dsVideoPortStereoScopicMode_isValid
#define dsVideoPortStereoScopicMode_isValid(t)
Definition: dsTypes.h:572
device::StereoScopicMode::kUnkown
static const int kUnkown
Indicates video stereoscopy of unknown type.
Definition: stereoScopicMode.hpp:53
dsTypes.h
Device Settings HAL types.
device::DSConstant::isValid
static bool isValid(int min, int max, int val)
This function checks if the given value lies between min and max values provided.
Definition: dsConstant.hpp:72
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
dsUtl.h
Device Settings HAL utilities.
device::StereoScopicMode::~StereoScopicMode
virtual ~StereoScopicMode()
This function is the default destructor for StereoScopicMode class.
Definition: stereoScopicMode.cpp:118
dsVIDEO_SSMODE_3D_TOP_AND_BOTTOM
@ dsVIDEO_SSMODE_3D_TOP_AND_BOTTOM
Definition: dsTypes.h:565
device::DSConstant::_name
std::string _name
Indicates the name string of the instance inheriting this class.
Definition: dsConstant.hpp:58
device::StereoScopicMode::k3DSidebySide
static const int k3DSidebySide
Indicates video stereoscopy of type 3D Side-by-Side.
Definition: stereoScopicMode.hpp:55
dsVIDEO_SSMODE_UNKNOWN
@ dsVIDEO_SSMODE_UNKNOWN
Definition: dsTypes.h:562
dsVIDEO_SSMODE_3D_SIDE_BY_SIDE
@ dsVIDEO_SSMODE_3D_SIDE_BY_SIDE
Definition: dsTypes.h:564
device::StereoScopicMode::k3dTopAndBottom
static const int k3dTopAndBottom
Indicates video stereoscopy of type 3D top and bottom.
Definition: stereoScopicMode.hpp:56
stereoScopicMode.hpp
This file defines StereoScopicMode class to manage the video stereoscopy types.
device::IllegalArgumentException
This class extends Exception class to manage the expections caused due to illegal arguments.
Definition: illegalArgumentException.hpp:51
dsUTL_DIM
#define dsUTL_DIM(arr)
Device Settings general Array dimension calculation inline definition.
Definition: dsUtl.h:85
device::StereoScopicMode::k2D
static const int k2D
Indicates video stereoscopy of type 2D.
Definition: stereoScopicMode.hpp:54
dsVIDEO_SSMODE_2D
@ dsVIDEO_SSMODE_2D
Definition: dsTypes.h:563