RDK Documentation (Open Sourced RDK Components)
videoDeviceConfig.cpp
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 "videoDeviceConfig.hpp"
31 #include "dsVideoDeviceSettings.h"
32 #include "videoDevice.hpp"
33 #include "videoDFC.hpp"
34 #include <iostream>
35 #include "dslogger.h"
36 
37 
38 namespace device {
39 
40 VideoDeviceConfig::VideoDeviceConfig() {
41  // TODO Auto-generated constructor stub
42 
43 }
44 
45 VideoDeviceConfig::~VideoDeviceConfig() {
46  // TODO Auto-generated destructor stub
47 }
48 
49 VideoDeviceConfig & VideoDeviceConfig::getInstance() {
50  static VideoDeviceConfig _singleton;
51  return _singleton;
52 }
53 
54 List<VideoDevice> VideoDeviceConfig::getDevices()
55 {
56  List<VideoDevice> devices;
57  for (std::vector<VideoDevice>::const_iterator it = _vDevices.begin(); it != _vDevices.end(); it++) {
58  devices.push_back(*it);
59  }
60 
61  return devices;
62 }
63 
64 VideoDevice &VideoDeviceConfig::getDevice(int i)
65 {
66  return _vDevices.at(i);
67 }
68 
69 List<VideoDFC> VideoDeviceConfig::getDFCs()
70 {
71  List<VideoDFC> DFCs;
72  for (std::vector<VideoDFC>::iterator it = _vDFCs.begin(); it != _vDFCs.end(); it++) {
73  DFCs.push_back(*it);
74  }
75 
76  return DFCs;
77 }
78 
79 VideoDFC & VideoDeviceConfig::getDFC(int id)
80 {
81  return _vDFCs.at(id);
82 }
83 
84 VideoDFC & VideoDeviceConfig::getDefaultDFC()
85 {
86  return _vDFCs.back();
87 }
88 
89 void VideoDeviceConfig::load()
90 {
91  /*
92  * Load Constants First.
93  */
94  for (size_t i = 0; i < dsVIDEO_ZOOM_MAX; i++) {
95  _vDFCs.push_back(VideoDFC(i));
96  }
97 
98  /*
99  * Initialize Video Devices (supported DFCs etc.)
100  */
101  for (size_t i = 0; i < dsUTL_DIM(kConfigs); i++) {
102  _vDevices.push_back(VideoDevice(i));
103 
104  for (size_t j = 0; j < kConfigs[i].numSupportedDFCs; j++) {
105  _vDevices.at(i).addDFC(VideoDFC::getInstance(kConfigs[i].supportedDFCs[j]));
106  }
107  }
108 }
109 
110 void VideoDeviceConfig::release()
111 {
112  _vDFCs.clear();
113  _vDevices.clear();
114 }
115 
116 }
117 
118 
119 /** @} */
120 /** @} */
device::VideoDFC::getInstance
static const VideoDFC & getInstance(int id)
This function gets an instance of VideoDFC against the id specified, only if the id passed is valid.
Definition: videoDFC.cpp:95
videoDevice.hpp
It contains class referenced by videoDevice.cpp file.
dsUTL_DIM
#define dsUTL_DIM(arr)
Device Settings general Array dimension calculation inline definition.
Definition: dsUtl.h:85
dsVIDEO_ZOOM_MAX
@ dsVIDEO_ZOOM_MAX
Definition: dsTypes.h:591
videoDFC.hpp
This file defines VideoDFC class for managing video decoder format conversion types.