RDK Documentation (Open Sourced RDK Components)
Components_AudioOutput.h
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 Components_AudioOutput.h
22  * @brief The header file provides capabilities audio output information APIs.
23  */
24 
25 /**
26  * @defgroup TR69_HOSTIF_STBSERVICES TR-069 Object (Device.STBServices.{i})
27  * STBService defines as the container associated with the remote management of
28  * objects for STB devices. The STBService object is a service object.
29  *
30  * As such, individual CPE devices can contain one or more of these objects
31  * within their Services object alongside the generic data objects. The presence of
32  * more than one STBService object would be appropriate primarily where a CPE device serves as a
33  * management proxy for other non TR-069 capable STBService devices.
34  *
35  * @par For example,
36  * An Internet Gateway Device might serve as a management proxy for one or more non TR-069 capable STBs.
37  *
38  * @par Components
39  * The STB data model contains a Components object that describes the devices functional blocks.
40  * It contains the following components:
41  * - Display Devices
42  * - HDMI
43  * - AudioDecoder
44  * - VideoDecoder
45  * - AudioOutput
46  * - VideoOutput etc..
47  *
48  * each of which can be multi-instance.
49  *
50  * @ingroup TR69_HOSTIF_PROFILE
51  * @defgroup TR69_HOSTIF_STBSERVICES_AUDIOOUTPUT TR-069 Object (Device.STBServices.{i}.Capabilities.AudioOutput)
52  * AudioOutput objects describe the functional blocks in charge of audio rendering.
53  * An Audio Output receives uncompressed audio streams from one or more Audio Decoders and
54  * performs format adaptations as required by the relevant presentation standard e.g., analog mono
55  * or stereo audio as needed for speakers or headphones, S/PDIF or HDMI/HDCP as needed by
56  * specific digital devices.
57  * - Adaptation of the audio to the specified output format can include digital-to-analog conversion
58  * or other analog or digital processing, including encryption.
59  * - Each Audio Output is mapped to one or more physical output connectors. Where an Audio
60  * Output is mapped directly to a SCART connector, this is indicated in the data model via a
61  * reference from the Audio Output to the corresponding SCART instance other types of physical
62  * connector are not modelled.
63  *
64  * @ingroup TR69_HOSTIF_STBSERVICES
65  *
66  * @defgroup TR69_HOSTIF_STBSERVICES_AUDIOOUTPUT_API TR-069 Object (Device.STBServices.{i}.Capabilities.AudioOutput) Public APIs
67  * Describe the details about RDK TR069 capabilities audio output APIs specifications.
68  * @ingroup TR69_HOSTIF_STBSERVICES_AUDIOOUTPUT
69  *
70  * @defgroup TR69_HOSTIF_STBSERVICES_AUDIOOUTPUT_CLASSES TR-069 Object (Device.STBServices.{i}.Capabilities.AudioOutput) Public Classes
71  * Describe the details about classes used in TR069 capabilities audio output.
72  * @ingroup TR69_HOSTIF_STBSERVICES_AUDIOOUTPUT
73  */
74 
75 
76 /**
77 * @defgroup tr69hostif
78 * @{
79 * @defgroup hostif
80 * @{
81 **/
82 
83 
84 #ifndef DEVSET_COMP_AUDIOOUTPUT_HPP__
85 #define DEVSET_COMP_AUDIOOUTPUT_HPP__
86 
87 #include <iostream>
88 #include "host.hpp"
89 #include "videoDevice.hpp"
90 #include "videoDFC.hpp"
91 #include "manager.hpp"
92 #include "dsUtl.h"
93 #include "dsError.h"
94 #include "list.hpp"
95 #include <exception>
96 #include <string.h>
97 #include <stdlib.h>
98 #include "hostIf_utils.h"
99 #include "hostIf_tr69ReqHandler.h"
100 #include "hostIf_updateHandler.h"
101 #include "hostIf_main.h"
102 #include "audioOutputPort.hpp"
103 
104 #ifndef PARAM_LEN
105 #define PARAM_LEN TR69HOSTIFMGR_MAX_PARAM_LEN
106 #endif
107 
108 /**
109  * @brief This class provides the TR069 components audio output information.
110  * @ingroup TR69_HOSTIF_STBSERVICES_AUDIOOUTPUT_CLASSES
111  */
113 {
114  static GHashTable *ifHash;
117  static GMutex *m_mutex;
118  int dev_id;
120 
121  char backupStatus[_BUF_LEN_16];
122  bool backupCancelMute;
123  char backupAudioStereoMode[_BUF_LEN_16];
124  unsigned int backupAudioLevel;
125  char backupAudioDB[_BUF_LEN_16];
126  char backupAudioLoopThru[_BUF_LEN_16];
127  unsigned int backupAudioCompression;
128  char backupAudioEncoding[_BUF_LEN_16];
129  char backupAudioGain[_BUF_LEN_16];
130  char backupMinAudioDB[_BUF_LEN_16];
131  char backupMaxAudioDB[_BUF_LEN_16];
132  char backupAudioOptimalLevel[_BUF_LEN_16];
133  unsigned int backupDialogEnhancement;
134 
135  bool bCalledStatus;
136  bool bCalledCancelMute;
137  bool bCalledAudioStereoMode;
138  bool bCalledAudioLevel;
139  bool bCalledAudioDB;
140  bool bCalledAudioLoopThru;
141  bool bCalledAudioCompression;
142  bool bCalledAudioEncoding;
143  bool bCalledAudioGain;
144  bool bCalledMinAudioDB;
145  bool bCalledMaxAudioDB;
146  bool bCalledAudioOptimalLevel;
147  bool bCalledDialogEnhancement;
148 
149 private:
150  int getStatus(HOSTIF_MsgData_t *,bool *pChanged = NULL);
151 
152  int setCancelMute(const HOSTIF_MsgData_t *);
153  int getCancelMute(HOSTIF_MsgData_t *,bool *pChanged = NULL);
154 
155  int getEnable(HOSTIF_MsgData_t *);
156  int getName(HOSTIF_MsgData_t *);
157 
158  int setX_COMCAST_COM_AudioStereoMode(const HOSTIF_MsgData_t *);
159  int getX_COMCAST_COM_AudioStereoMode(HOSTIF_MsgData_t *,bool *pChanged = NULL);
160 
161  int setAudioLevel(const HOSTIF_MsgData_t *);
162  int getAudioLevel(HOSTIF_MsgData_t *,bool *pChanged = NULL);
163 
164  int setX_COMCAST_COM_AudioDB(const HOSTIF_MsgData_t *);
165  int getX_COMCAST_COM_AudioDB(HOSTIF_MsgData_t *,bool *pChanged = NULL);
166 
167  int setX_COMCAST_COM_AudioLoopThru(const HOSTIF_MsgData_t *);
168  int getX_COMCAST_COM_AudioLoopThru(HOSTIF_MsgData_t *,bool *pChanged = NULL);
169 
170  /* X_COMCAST_COM_AudioCompression */
171  int setX_COMCAST_COM_AudioCompression(const HOSTIF_MsgData_t *);
172  int getX_COMCAST_COM_AudioCompression(HOSTIF_MsgData_t *,bool *pChanged = NULL);
173 
174  /* X_COMCAST_COM_AudioFormat - Read Only Data as per TR 135*/
175  int getX_COMCAST_COM_AudioFormat(HOSTIF_MsgData_t *);
176 
177  /* X_COMCAST_COM_AudioEncoding */
178  int setAudioEncoding(const HOSTIF_MsgData_t *);
179  int getX_COMCAST_COM_AudioEncoding(HOSTIF_MsgData_t *,bool *pChanged = NULL);
180 
181  /* X_COMCAST_COM_AudioGain */
182  /* int setAudioGain(HOSTIF_MsgData_t *,bool *pChanged = NULL); */ // Not supported???
183  int getX_COMCAST_COM_AudioGain(HOSTIF_MsgData_t *,bool *pChanged = NULL);
184 
185  int getX_COMCAST_COM_MinAudioDB(HOSTIF_MsgData_t *stMsgData,bool *pChanged = NULL);
186  int getX_COMCAST_COM_MaxAudioDB(HOSTIF_MsgData_t *stMsgData,bool *pChanged = NULL);
187  int getX_COMCAST_COM_AudioOptimalLevel(HOSTIF_MsgData_t *stMsgData,bool *pChanged = NULL);
188 
189  /* X_COMCAST_COM_DialogEnhancement */
190  int setX_COMCAST_COM_DialogEnhancement(const HOSTIF_MsgData_t *);
191  int getX_COMCAST_COM_DialogEnhancement(HOSTIF_MsgData_t *stMsgData,bool *pChanged = NULL);
192 
193 
194 public:
195  static hostIf_STBServiceAudioInterface *getInstance(int dev_id);
196  static void closeInstance(hostIf_STBServiceAudioInterface *);
197  static GList* getAllInstances();
198  static void closeAllInstances();
199  static void getLock();
200  static void releaseLock();
201  static int getNumberOfInstances(HOSTIF_MsgData_t *stMsgData);
202  void doUpdates(updateCallback mUpdateCallback);
203  int handleSetMsg(const char *paramName, HOSTIF_MsgData_t *stMsgData);
204  int handleGetMsg(const char *paramName, HOSTIF_MsgData_t *stMsgData);
205 
206 };
207 #endif /* DEVSET_COMP_AUDIOOUTPUT_HPP_ */
208 
209 
210 /** @} */
211 /** @} */
hostIf_STBServiceAudioInterface::handleSetMsg
int handleSetMsg(const char *paramName, HOSTIF_MsgData_t *stMsgData)
This function set the audio interface such as mute status, audio encoding, audio level,...
Definition: Components_AudioOutput.cpp:243
manager.hpp
It contains class referenced by manager.cpp file.
_HostIf_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
dsError.h
Device Settings HAL error codes.
hostIf_main.h
hostIf_main API.
dsUtl.h
Device Settings HAL utilities.
device::AudioOutputPort
Class extending Enumerable to implement the audiooutputport interface.
Definition: audioOutputPort.hpp:60
hostIf_STBServiceAudioInterface::handleGetMsg
int handleGetMsg(const char *paramName, HOSTIF_MsgData_t *stMsgData)
This function get the audio interface attribute values such as mute status, audio encoding,...
Definition: Components_AudioOutput.cpp:295
videoDevice.hpp
It contains class referenced by videoDevice.cpp file.
hostIf_STBServiceAudioInterface
This class provides the TR069 components audio output information.
Definition: Components_AudioOutput.h:112
hostIf_STBServiceAudioInterface::hostIf_STBServiceAudioInterface
hostIf_STBServiceAudioInterface(int dev_id, device::AudioOutputPort &port)
Class Constructor of the class hostIf_STBServiceAudioInterface.
Definition: Components_AudioOutput.cpp:163
hostIf_STBServiceAudioInterface::doUpdates
void doUpdates(updateCallback mUpdateCallback)
This function updates the audio interface such as mute status, audio encoding, audio level,...
Definition: Components_AudioOutput.cpp:373
audioOutputPort.hpp
It contain variables,stuctures,class and functions referenced by audiooutputport code.
videoDFC.hpp
This file defines VideoDFC class for managing video decoder format conversion types.