36 #define BASE_NAME "Device.Services.STBService.1.Components.VideoDecoder"
37 #define UPDATE_FORMAT_STRING "%s.%d.%s"
39 #define STATUS_STRING "Status"
40 #define CONTENT_AR_STRING "ContentAspectRatio"
41 #define COMCAST_STANDBY_STRING "X_COMCAST-COM_Standby"
42 #define HEVC_STRING "X_RDKCENTRAL-COM_MPEGHPart2"
43 #define HEVC_PROFILE_PATH ".Capabilities.VideoDecoder.X_RDKCENTRAL-COM_MPEGHPart2.ProfileLevel.1"
44 #define NAME_STRING "Name"
46 #define ENABLE_STRING "Enable"
47 #define ENABLED_STRING "Enabled"
48 #define DISABLED_STRING "Disabled"
49 #define ERROR_STRING "Error"
51 GHashTable * hostIf_STBServiceVideoDecoder::ifHash = NULL;
52 GMutex * hostIf_STBServiceVideoDecoder::m_mutex = NULL;
64 ifHash = g_hash_table_new(NULL,NULL);
73 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"Caught exception, not able create STB service Video Interface instance..\n");
75 g_hash_table_insert(ifHash, (gpointer)dev_id, pRet);
80 GList* hostIf_STBServiceVideoDecoder::getAllInstances()
83 return g_hash_table_get_keys(ifHash);
91 g_hash_table_remove(ifHash, (gconstpointer)pDev->dev_id);
96 void hostIf_STBServiceVideoDecoder::closeAllInstances()
100 GList* tmp_list = g_hash_table_get_values (ifHash);
105 tmp_list = tmp_list->next;
111 void hostIf_STBServiceVideoDecoder::getLock()
115 m_mutex = g_mutex_new();
117 g_mutex_lock(m_mutex);
120 void hostIf_STBServiceVideoDecoder::releaseLock()
122 g_mutex_unlock(m_mutex);
136 strcpy(backupContentAspectRatio,
" ");
137 backupStandby =
false;
138 strcpy(backupVideoDecoderStatus,
" ");
140 bCalledContentAspectRatio =
false;
141 bCalledStandby =
false;
142 bCalledVideoDecoderStatus =
false;
161 int ret = NOT_HANDLED;
162 if (strcasecmp(pSetting, COMCAST_STANDBY_STRING) == 0)
164 ret = setX_COMCAST_COM_Standby(stMsgData);
184 int ret = NOT_HANDLED;
185 if(strcasecmp(paramName, COMCAST_STANDBY_STRING) == 0)
187 ret = getX_COMCAST_COM_Standby(stMsgData);
189 else if(strcasecmp(paramName, ENABLE_STRING) == 0)
192 stMsgData->
paramtype = hostIf_BooleanType;
196 else if(strcasecmp(paramName, STATUS_STRING) == 0)
198 ret = getStatus(stMsgData);
200 else if(strcasecmp(paramName, NAME_STRING) == 0)
202 strncpy(stMsgData->
paramValue,
"VideoDecoderHDMI0", strlen(
"VideoDecoderHDMI0")+1);
203 stMsgData->
paramtype = hostIf_StringType;
207 else if(strcasecmp(paramName, CONTENT_AR_STRING) == 0)
209 ret = getContentAspectRatio(stMsgData);
211 else if(strcasecmp(paramName, HEVC_STRING) == 0)
213 strncpy(stMsgData->
paramValue, HEVC_PROFILE_PATH, strlen(HEVC_PROFILE_PATH)+1);
214 stMsgData->
paramtype = hostIf_StringType;
232 char tmp_buff[PARAM_LEN];
234 memset(&msgData,0,
sizeof(msgData));
235 memset(tmp_buff,0,PARAM_LEN);
238 getX_COMCAST_COM_Standby(&msgData,&bChanged);
241 snprintf(tmp_buff, PARAM_LEN, UPDATE_FORMAT_STRING, BASE_NAME, dev_id, COMCAST_STANDBY_STRING);
247 memset(&msgData,0,
sizeof(msgData));
248 memset(tmp_buff,0,PARAM_LEN);
251 getStatus(&msgData,&bChanged);
254 snprintf(tmp_buff, PARAM_LEN, UPDATE_FORMAT_STRING, BASE_NAME, dev_id, STATUS_STRING);
260 memset(&msgData,0,
sizeof(msgData));
261 memset(tmp_buff,0,PARAM_LEN);
264 getContentAspectRatio(&msgData,&bChanged);
267 snprintf(tmp_buff, PARAM_LEN, UPDATE_FORMAT_STRING, BASE_NAME, dev_id, CONTENT_AR_STRING);
292 int hostIf_STBServiceVideoDecoder::getContentAspectRatio(
HOSTIF_MsgData_t *stMsgData,
bool *pChanged)
296 std::string videoPortName = strVideoPort.substr(0, strVideoPort.size()-1);
303 const std::string str = aspect_ratio.getName();
304 strncpy(stMsgData->
paramValue, str.c_str(),str.length());
308 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s] %s Display is NOT connected, vPort.isDisplayConnected() %d \r\n",__FUNCTION__,
"HDMI", vPort.
isDisplayConnected());
311 stMsgData->
paramtype = hostIf_StringType;
313 if(bCalledContentAspectRatio && pChanged && strcmp(backupContentAspectRatio,stMsgData->
paramValue))
317 bCalledContentAspectRatio =
true;
318 strncpy(backupContentAspectRatio,stMsgData->
paramValue,_BUF_LEN_16-1);
319 backupContentAspectRatio[_BUF_LEN_16-1] =
'\0';
320 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s] In getVideoDecoderContentAspectRatio(): Value: %s \n",__FUNCTION__, stMsgData->
paramValue);
322 catch (
const std::exception e) {
323 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s] Exception\r\n",__FUNCTION__);
342 int hostIf_STBServiceVideoDecoder::getX_COMCAST_COM_Standby(
HOSTIF_MsgData_t *stMsgData,
bool *pChanged)
356 if(bCalledStandby && pChanged && (backupStandby != get_boolean(stMsgData->
paramValue)))
360 bCalledStandby =
true;
361 backupStandby = get_boolean(stMsgData->
paramValue);
362 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s()] PowerMode: [%d , %s] \n", __FUNCTION__, iPowerMode, stMsgData->
paramValue);
364 catch (
const std::exception e) {
365 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s] Exception\r\n",__FUNCTION__);
382 int hostIf_STBServiceVideoDecoder::getStatus(
HOSTIF_MsgData_t *stMsgData,
bool *pChanged)
389 strncpy(stMsgData->
paramValue, ENABLED_STRING, strlen(ENABLED_STRING)+1);
392 strncpy(stMsgData->
paramValue, COMCAST_STANDBY_STRING, strlen(COMCAST_STANDBY_STRING)+1);
395 strncpy(stMsgData->
paramValue, DISABLED_STRING, strlen(DISABLED_STRING)+1);
398 strncpy(stMsgData->
paramValue, ERROR_STRING, strlen(ERROR_STRING)+1);
401 stMsgData->
paramtype = hostIf_StringType;
403 if(bCalledVideoDecoderStatus && pChanged && strcmp(backupVideoDecoderStatus, stMsgData->
paramValue))
407 bCalledVideoDecoderStatus =
true;
408 strncpy(backupVideoDecoderStatus,stMsgData->
paramValue,_BUF_LEN_32-1);
409 backupVideoDecoderStatus[_BUF_LEN_32-1] =
'\0';
410 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s()] PowerMode: [%d , %s] \n", __FUNCTION__, iPowerMode, stMsgData->
paramValue);
412 catch (
const std::exception e) {
413 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s] Exception\r\n",__FUNCTION__);
430 int hostIf_STBServiceVideoDecoder::setX_COMCAST_COM_Standby(
const HOSTIF_MsgData_t *stMsgData)
435 bool val = get_boolean(stMsgData->
paramValue);
445 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s] Failed to set [%s] due to Invalid input value [%d]\r\n",__FUNCTION__, stMsgData->
paramName, val);
448 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%s] Get value as \'%d\' and Set as: \'%d\' \n", __FILE__, __FUNCTION__, get_boolean(stMsgData->
paramValue), iPowerMode);
451 catch (
const std::exception e) {
452 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s] Exception\r\n",__FUNCTION__);