RDK Documentation (Open Sourced RDK Components)
dsVideoDevice.c
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 rpc
26 * @{
27 **/
28 
29 
30 #include "dsVideoDevice.h"
31 
32 #include <sys/types.h>
33 #include <stdint.h>
34 #include <iostream>
35 #include <string.h>
36 #include <pthread.h>
37 #include "dsError.h"
38 #include "dsUtl.h"
39 #include "dsTypes.h"
40 #include "pthread.h"
41 #include "libIARM.h"
42 #include "iarmUtil.h"
43 #include "libIBus.h"
44 #include "dsRpc.h"
45 #include "dsMgr.h"
46 #include "dsserverlogger.h"
47 #include "hostPersistence.hpp"
48 #include <dlfcn.h>
49 #ifdef HAS_HDMI_IN_SUPPORT
50 #include "dsHdmiIn.h"
51 #endif
52 
53 static int m_isInitialized = 0;
54 static int m_isPlatInitialized = 0;
55 static pthread_mutex_t dsLock = PTHREAD_MUTEX_INITIALIZER;
56 static dsVideoZoom_t srv_dfc = dsVIDEO_ZOOM_FULL;
57 static bool force_disable_hdr = true;
58 bool enableHDRDVStatus = false;
59 
60 #define IARM_BUS_Lock(lock) pthread_mutex_lock(&dsLock)
61 #define IARM_BUS_Unlock(lock) pthread_mutex_unlock(&dsLock)
62 
63 IARM_Result_t _dsVideoDeviceInit(void *arg);
64 IARM_Result_t _dsGetVideoDevice(void *arg);
65 IARM_Result_t _dsSetDFC(void *arg);
66 IARM_Result_t _dsGetDFC(void *arg);
67 IARM_Result_t _dsVideoDeviceTerm(void *arg);
68 IARM_Result_t _dsGetHDRCapabilities(void *arg);
69 IARM_Result_t _dsGetSupportedVideoCodingFormats(void *arg);
70 IARM_Result_t _dsGetVideoCodecInfo(void *arg);
71 IARM_Result_t _dsForceDisableHDR(void *arg);
72 
73 IARM_Result_t _dsSetFRFMode(void *arg);
74 IARM_Result_t _dsGetFRFMode(void *arg);
75 IARM_Result_t _dsGetCurrentDisframerate(void *arg);
76 IARM_Result_t _dsSetDisplayframerate(void *arg);
77 
78 void _dsFramerateStatusPostChangeCB(unsigned int inputStatus);
79 void _dsFramerateStatusPreChangeCB(unsigned int inputStatus);
80 static bool get_HDR_DV_RFC_config();
81 
82 IARM_Result_t dsVideoDeviceMgr_init()
83 {
84  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsVideoDeviceInit, _dsVideoDeviceInit);
85  IARM_BUS_Lock(lock);
86 
87  try
88  {
89  std::string _ZoomSettings("Full");
90  /* Get the Zoom from Persistence */
91  _ZoomSettings = device::HostPersistence::getInstance().getProperty("VideoDevice.DFC", _ZoomSettings);
92  if (_ZoomSettings.compare("None") == 0)
93  {
94  srv_dfc = dsVIDEO_ZOOM_NONE;
95  }
96 #ifdef HAS_HDMI_IN_SUPPORT
97  dsHdmiInSelectZoomMode(srv_dfc);
98 #endif
99  }
100  catch(...)
101  {
102  printf("Exception in Getting the Zoom settings on Startup..... \r\n");
103  }
104 
105  try
106  {
107  std::string _hdr_setting("false");
108  _hdr_setting = device::HostPersistence::getInstance().getProperty("VideoDevice.forceHDRDisabled", _hdr_setting);
109  if (_hdr_setting.compare("false") == 0)
110  {
111  force_disable_hdr = false;
112  }
113  else
114  {
115  force_disable_hdr = true;
116  printf("HDR support in disabled configuration.\n");
117  }
118  }
119  catch(...)
120  {
121  printf("Exception in getting force-disable-HDR setting at start up.\r\n");
122  }
123 
124  enableHDRDVStatus = get_HDR_DV_RFC_config();
125  printf("HDR DV support status is: %s.\n", (true == enableHDRDVStatus? "enabled" : "disabled"));
126 
127 
128  if (!m_isPlatInitialized) {
130  }
131  /*coverity[missing_lock] CID-19380 using Coverity Annotation to ignore error*/
132  m_isPlatInitialized++;
133  IARM_BUS_Unlock(lock); //CID:136385 - Data race condition
134 
135  return IARM_RESULT_SUCCESS;
136 }
137 
138 IARM_Result_t dsVideoDeviceMgr_term()
139 {
140  return IARM_RESULT_SUCCESS;
141 }
142 
143 IARM_Result_t _dsVideoDeviceInit(void *arg)
144 {
145  IARM_BUS_Lock(lock);
146 
147  if (!m_isInitialized) {
148 
149  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetVideoDevice,_dsGetVideoDevice);
150  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetDFC,_dsSetDFC);
151  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetDFC,_dsGetDFC);
152  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsVideoDeviceTerm,_dsVideoDeviceTerm);
153  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetHDRCapabilities,_dsGetHDRCapabilities);
154  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetSupportedVideoCodingFormats, _dsGetSupportedVideoCodingFormats);
155  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetVideoCodecInfo, _dsGetVideoCodecInfo);
156  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetForceDisableHDR, _dsForceDisableHDR);
157  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetFRFMode, _dsSetFRFMode);
158  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetFRFMode, _dsGetFRFMode);
159  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetCurrentDisframerate, _dsGetCurrentDisframerate);
160  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetDisplayframerate, _dsSetDisplayframerate);
161 
162  typedef dsError_t (*_dsFramerateStatusPreChangeCB_t)(dsRegisterFrameratePreChangeCB_t CBFunc);
163  static _dsFramerateStatusPreChangeCB_t frameratePreChangeCB = 0;
164  if (frameratePreChangeCB == 0) {
165  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
166  if (dllib) {
167  frameratePreChangeCB = (_dsFramerateStatusPreChangeCB_t) dlsym(dllib, "dsRegisterFrameratePreChangeCB");
168  if(frameratePreChangeCB == 0) {
169  printf("dsRegisterFrameratePreChangeCB(dsHdmiInStatusChangeCB_t) is not defined\r\n");
170  }
171  dlclose(dllib);
172  }
173  else {
174  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
175  }
176  }
177 
178  if(frameratePreChangeCB) {
179  frameratePreChangeCB(_dsFramerateStatusPreChangeCB);
180  }
181 
182  typedef dsError_t (*dsRegisterFrameratePostChangeCB_t)(dsRegisterFrameratePostChangeCB_t CBFunc);
183  static dsRegisterFrameratePostChangeCB_t frameratePostChangeCB = 0;
184  if (frameratePostChangeCB == 0) {
185  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
186  if (dllib) {
187  frameratePostChangeCB = (dsRegisterFrameratePostChangeCB_t) dlsym(dllib, "dsRegisterFrameratePostChangeCB");
188  if(frameratePostChangeCB == 0) {
189  printf("dsRegisterFrameratePostChangeCB(dsHdmiInStatusChangeCB_t) is not defined\r\n");
190  }
191  dlclose(dllib);
192  }
193  else {
194  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
195  }
196  }
197 
198  if(frameratePostChangeCB) {
199  frameratePostChangeCB(_dsFramerateStatusPostChangeCB);
200  }
201 
202  m_isInitialized = 1;
203  }
204 
205  if (!m_isPlatInitialized) {
207  }
208 
209  m_isPlatInitialized++;
210 
211  IARM_BUS_Unlock(lock);
212 
213  return IARM_RESULT_SUCCESS;
214 
215 }
216 
217 IARM_Result_t _dsGetVideoDevice(void *arg)
218 {
219  _DEBUG_ENTER();
220 
221  IARM_BUS_Lock(lock);
222 
224  dsGetVideoDevice(param->index, &param->handle);
225 
226 
227  IARM_BUS_Unlock(lock);
228 
229  return IARM_RESULT_SUCCESS;
230 }
231 
232 IARM_Result_t _dsSetDFC(void *arg)
233 {
234  _DEBUG_ENTER();
235 
236  IARM_BUS_Lock(lock);
237 
238  IARM_Bus_DSMgr_EventData_t eventData;
240 
241  if (param != NULL)
242  {
243  try
244  {
245  if(param->dfc == dsVIDEO_ZOOM_NONE)
246  {
247  printf("\n Call Zoom setting NONE\n");
248  dsSetDFC(param->handle,param->dfc);
249  eventData.data.dfc.zoomsettings = dsVIDEO_ZOOM_NONE;
250  srv_dfc = param->dfc;
251  IARM_Bus_BroadcastEvent(IARM_BUS_DSMGR_NAME,(IARM_EventId_t)IARM_BUS_DSMGR_EVENT_ZOOM_SETTINGS,(void *)&eventData, sizeof(eventData));
252  device::HostPersistence::getInstance().persistHostProperty("VideoDevice.DFC","None");
253  }
254  else if(param->dfc == dsVIDEO_ZOOM_FULL)
255  {
256  printf("\n Call Zoom setting FULL\n");
257  dsSetDFC(param->handle,param->dfc);
258  eventData.data.dfc.zoomsettings = dsVIDEO_ZOOM_FULL;
259  srv_dfc = param->dfc;
260  IARM_Bus_BroadcastEvent(IARM_BUS_DSMGR_NAME,(IARM_EventId_t)IARM_BUS_DSMGR_EVENT_ZOOM_SETTINGS,(void *)&eventData, sizeof(eventData));
261  device::HostPersistence::getInstance().persistHostProperty("VideoDevice.DFC","Full");
262 
263  }
264  else if(param->dfc == dsVIDEO_ZOOM_16_9_ZOOM)
265  {
266  printf("\n Call Zoom setting dsVIDEO_ZOOM_16_9_ZOOM\n");
267  dsSetDFC(param->handle,param->dfc);
268  eventData.data.dfc.zoomsettings = dsVIDEO_ZOOM_FULL;
269  srv_dfc = param->dfc;
270  IARM_Bus_BroadcastEvent(IARM_BUS_DSMGR_NAME,(IARM_EventId_t)IARM_BUS_DSMGR_EVENT_ZOOM_SETTINGS,(void *)&eventData, sizeof(eventData));
271  device::HostPersistence::getInstance().persistHostProperty("VideoDevice.DFC","Full");
272  }
273  else
274  {
275  printf("\n ERROR: unsupported Zoom setting %d\n", param->dfc);
276  }
277 
278 #ifdef HAS_HDMI_IN_SUPPORT
279  dsHdmiInSelectZoomMode(srv_dfc);
280 #endif
281  }
282  catch(...)
283  {
284  printf("Error in Setting the Video Resolution..... \r\n");
285  }
286 
287  }
288 
289  IARM_BUS_Unlock(lock);
290  return IARM_RESULT_SUCCESS;
291 }
292 
293 
294 
295 
296 IARM_Result_t _dsGetDFC(void *arg)
297 {
298  _DEBUG_ENTER();
299 
300  IARM_BUS_Lock(lock);
301 
303 
304  if (param != NULL)
305  {
306  param->dfc = srv_dfc;
307  INT_INFO("The Zoom Settings value is %d \r\n",param->dfc);
308  }
309 
310  IARM_BUS_Unlock(lock);
311 
312  return IARM_RESULT_SUCCESS;
313 }
314 
315 
316 IARM_Result_t _dsVideoDeviceTerm(void *arg)
317 {
318  _DEBUG_ENTER();
319 
320  IARM_BUS_Lock(lock);
321 
322  m_isPlatInitialized --;
323 
324  if (0 == m_isPlatInitialized)
325  {
327  }
328 
329  IARM_BUS_Unlock(lock);
330 
331  return IARM_RESULT_SUCCESS;
332 }
333 
334 IARM_Result_t _dsGetHDRCapabilities(void *arg)
335 {
336  _DEBUG_ENTER();
337 
338  IARM_BUS_Lock(lock);
339 
340  typedef dsError_t (*dsGetHDRCapabilitiesFunc_t)(intptr_t handle, int *capabilities);
341  static dsGetHDRCapabilitiesFunc_t func = 0;
342  if (func == 0) {
343  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
344  if (dllib) {
345  func = (dsGetHDRCapabilitiesFunc_t)dlsym(dllib, "dsGetHDRCapabilities");
346  if (func) {
347  printf("dsGetHDRCapabilities() is defined and loaded\r\n");
348  }
349  else {
350  printf("dsGetHDRCapabilities() is not defined\r\n");
351  }
352  dlclose(dllib);
353  }
354  else {
355  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
356  }
357  }
359  if((0 != func) && (false == force_disable_hdr)) {
360  param->result = func(param->handle, &param->capabilities);
361  if((param->capabilities & dsHDRSTANDARD_DolbyVision) && (enableHDRDVStatus == false))
362  {
363  param->capabilities &= ~dsHDRSTANDARD_DolbyVision;
364  printf("dsGetHDRCapabilities() DolbyVision Disabled param->capabilities:%x\r\n",param->capabilities);
365  }
366  }
367  else {
368  param->capabilities = dsHDRSTANDARD_NONE;
369  }
370 
371  IARM_BUS_Unlock(lock);
372  return IARM_RESULT_SUCCESS;
373 }
374 
375 IARM_Result_t _dsGetSupportedVideoCodingFormats(void *arg)
376 {
377  _DEBUG_ENTER();
378 
379  IARM_BUS_Lock(lock);
380 
381  typedef dsError_t (*dsGetSupportedVideoCodingFormatsFunc_t)(intptr_t handle, unsigned int *supported_formats);
382  static dsGetSupportedVideoCodingFormatsFunc_t func = 0;
383  if (func == 0) {
384  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
385  if (dllib) {
386  func = (dsGetSupportedVideoCodingFormatsFunc_t)dlsym(dllib, "dsGetSupportedVideoCodingFormats");
387  if (func) {
388  printf("dsGetSupportedVideoCodingFormats() is defined and loaded\r\n");
389  }
390  else {
391  printf("dsGetSupportedVideoCodingFormats() is not defined\r\n");
392  }
393  dlclose(dllib);
394  }
395  else {
396  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
397  }
398  }
400  if(0 != func) {
401  param->result = func(param->handle, &param->supported_formats);
402  }
403  else {
404  param->supported_formats = 0x0; //Safe default: no formats supported.
405  }
406 
407  IARM_BUS_Unlock(lock);
408  return IARM_RESULT_SUCCESS;
409 }
410 
411 IARM_Result_t _dsGetVideoCodecInfo(void *arg)
412 {
413  _DEBUG_ENTER();
414 
415  IARM_BUS_Lock(lock);
416 
417  typedef dsError_t (*dsGetVideoCodecInfoFunc_t)(intptr_t handle, dsVideoCodingFormat_t codec, dsVideoCodecInfo_t * info);
418  static dsGetVideoCodecInfoFunc_t func = 0;
419  if (func == 0) {
420  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
421  if (dllib) {
422  func = (dsGetVideoCodecInfoFunc_t)dlsym(dllib, "dsGetVideoCodecInfo");
423  if (func) {
424  printf("dsGetVideoCodecInfo() is defined and loaded\r\n");
425  }
426  else {
427  printf("dsGetVideoCodecInfo() is not defined\r\n");
428  }
429  dlclose(dllib);
430  }
431  else {
432  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
433  }
434  }
435 
437  if(0 != func) {
438  param->result = func(param->handle, param->format, &param->info);
439  }
440  else {
441  param->result = dsERR_OPERATION_NOT_SUPPORTED;
442  }
443 
444  IARM_BUS_Unlock(lock);
445  return IARM_RESULT_SUCCESS;
446 }
447 
448 IARM_Result_t _dsForceDisableHDR(void *arg)
449 {
450  _DEBUG_ENTER();
451 
452  IARM_BUS_Lock(lock);
453 
454  typedef dsError_t (*dsDisableHDRSupportFunc_t)(intptr_t handle, bool enable);
455  static dsDisableHDRSupportFunc_t func = 0;
456  if (func == 0) {
457  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
458  if (dllib) {
459  func = (dsDisableHDRSupportFunc_t)dlsym(dllib, "dsForceDisableHDRSupport");
460  if (func) {
461  printf("dsForceDisableHDRSupport() is defined and loaded\r\n");
462  }
463  else {
464  printf("dsForceDisableHDRSupport() is not defined\r\n");
465  }
466  dlclose(dllib);
467  }
468  else {
469  printf("dsForceDisableHDRSupport() Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
470  }
471  }
472 
474  param->result = dsERR_NONE;
475 
476  if(0 != func )
477  {
478  param->result = func(param->handle, param->disable);
479  printf("dsForceDisableHDRSupport() enable:%d \n",param->disable);
480  }
481  else {
482  param->disable = 0;
483  }
484 
485  force_disable_hdr = param->disable;
486  if(force_disable_hdr)
487  {
488  device::HostPersistence::getInstance().persistHostProperty("VideoDevice.forceHDRDisabled","true");
489  }
490  else
491  {
492  device::HostPersistence::getInstance().persistHostProperty("VideoDevice.forceHDRDisabled","false");
493  }
494 
495  IARM_BUS_Unlock(lock);
496  return IARM_RESULT_SUCCESS;
497 }
498 
499 #define RFC_BUFFER_SIZE 100
500 static bool get_HDR_DV_RFC_config()
501 {
502  bool is_enabled = false;
503  const char * cmd = "tr181Set -g Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.DolbyVision.Enable 2>&1 1>/dev/null";
504  /*Note: the above redirection is necessary because tr181 prints the value of parameter to stderr instead of stdout. */
505  printf("%s: getting RFC config using command \"%s\"\n", __FUNCTION__, cmd);
506  FILE * pipe = popen(cmd, "r");
507  if(pipe)
508  {
509  char buffer[RFC_BUFFER_SIZE];
510  if(NULL == fgets(buffer, RFC_BUFFER_SIZE, pipe))
511  {
512  printf("%s: could not parse output of command <%s>.\n", __FUNCTION__, cmd);
513  }
514  else
515  {
516  printf("%s: read output \"%s\"\n", __FUNCTION__, buffer);
517  if(0 == strncasecmp(buffer, "true", 4))
518  {
519  is_enabled = true;
520  }
521  }
522  pclose(pipe); //CID:154209 - Forward Null
523  }
524  printf("%s: the feature is %s.\n", __FUNCTION__, (true == is_enabled? "enabled" : "disabled"));
525  return is_enabled;
526 }
527 
528 IARM_Result_t _dsSetFRFMode(void *arg)
529 {
530  _DEBUG_ENTER();
531 
532  IARM_BUS_Lock(lock);
533 
534  typedef dsError_t (*dsSetFRFModeFunc_t)(intptr_t handle, int frfmode);
535  static dsSetFRFModeFunc_t func = 0;
536  if (func == 0) {
537  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
538  if (dllib) {
539  func = (dsSetFRFModeFunc_t)dlsym(dllib, "dsSetFRFMode");
540  if (func) {
541  printf("dsSetFRFMode is defined and loaded\r\n");
542  }
543  else {
544  printf("dsSetFRFMode is not defined\r\n");
545  }
546  dlclose(dllib);
547  }
548  else {
549  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
550  }
551  }
552  dsFRFParam_t *param = (dsFRFParam_t *)arg;
553  if(0 != func) {
554  func(param->handle, param->frfmode);
555  }
556  IARM_BUS_Unlock(lock);
557  return IARM_RESULT_SUCCESS;
558 }
559 
560 IARM_Result_t _dsGetFRFMode(void *arg)
561 {
562  _DEBUG_ENTER();
563 
564  IARM_BUS_Lock(lock);
565 
566  typedef dsError_t (*dsGetFRFModeFunc_t)(intptr_t handle, int *frfmode);
567  static dsGetFRFModeFunc_t func = 0;
568  if (func == 0) {
569  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
570  if (dllib) {
571  func = (dsGetFRFModeFunc_t)dlsym(dllib, "dsGetFRFMode");
572  if (func) {
573  printf("dsGetFRFMode() is defined and loaded\r\n");
574  }
575  else {
576  printf("dsGetFRFMode() is not defined\r\n");
577  }
578  dlclose(dllib);
579  }
580  else {
581  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
582  }
583  }
584  dsFRFParam_t *param = (dsFRFParam_t *)arg;
585  if(0 != func) {
586  func(param->handle, &param->frfmode);
587  }
588 
589  IARM_BUS_Unlock(lock);
590  return IARM_RESULT_SUCCESS;
591 }
592 
593 IARM_Result_t _dsGetCurrentDisframerate(void *arg)
594 {
595  _DEBUG_ENTER();
596 
597  IARM_BUS_Lock(lock);
598 
599  typedef dsError_t (*dsGetCurrentDisframerateFunc_t)(intptr_t handle, char *framerate);
600  static dsGetCurrentDisframerateFunc_t func = 0;
601  if (func == 0) {
602  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
603  if (dllib) {
604  func = (dsGetCurrentDisframerateFunc_t)dlsym(dllib, "dsGetCurrentDisplayframerate");
605  if (func) {
606  printf("dsGetCurrentDisframerate() is defined and loaded\r\n");
607  }
608  else {
609  printf("dsGetCurrentDisframerate() is not defined\r\n");
610  }
611  dlclose(dllib);
612  }
613  else {
614  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
615  }
616  }
617 
618  dsFramerateParam_t *param = (dsFramerateParam_t *)arg;
619  if(0 != func) {
620  func(param->handle, param->framerate);
621  }
622 
623  IARM_BUS_Unlock(lock);
624  return IARM_RESULT_SUCCESS;
625 }
626 
627 IARM_Result_t _dsSetDisplayframerate(void *arg)
628 {
629  _DEBUG_ENTER();
630 
631  IARM_BUS_Lock(lock);
632 
633  typedef dsError_t (*dsSetDisplayframerateFunc_t)(intptr_t handle, char *frfmode);
634  static dsSetDisplayframerateFunc_t func = 0;
635  if (func == 0) {
636  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
637  if (dllib) {
638  func = (dsSetDisplayframerateFunc_t)dlsym(dllib, "dsSetDisplayframerate");
639  if (func) {
640  printf("dsSetDisplayframerate() is defined and loaded\r\n");
641  }
642  else {
643  printf("dsSetDisplayframerate() is not defined\r\n");
644  }
645  dlclose(dllib);
646  }
647  else {
648  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
649  }
650  }
651 
652  dsFramerateParam_t *param = (dsFramerateParam_t *)arg;
653  if(0 != func) {
654  func(param->handle, param->framerate);
655  }
656 
657  IARM_BUS_Unlock(lock);
658  return IARM_RESULT_SUCCESS;
659 }
660 
661 void _dsFramerateStatusPreChangeCB(unsigned int inputStatus)
662 {
663  IARM_Bus_DSMgr_EventData_t _eventData;
664  __TIMESTAMP();
665  printf("%s:%d - Framerate status prechange update!!!!!! \r\n", __PRETTY_FUNCTION__,__LINE__);
666 
667  IARM_Bus_BroadcastEvent(IARM_BUS_DSMGR_NAME,
669  (void *)&_eventData,
670  sizeof(_eventData));
671 
672 }
673 
674 void _dsFramerateStatusPostChangeCB(unsigned int inputStatus)
675 {
676  IARM_Bus_DSMgr_EventData_t _eventData;
677  __TIMESTAMP();
678  printf("%s:%d - Framerate status changed update!!!!!! \r\n", __PRETTY_FUNCTION__,__LINE__);
679 
680  IARM_Bus_BroadcastEvent(IARM_BUS_DSMGR_NAME,
682  (void *)&_eventData,
683  sizeof(_eventData));
684 
685 }
686 
687 /** @} */
688 /** @} */
IARM_BUS_DSMGR_EVENT_DISPLAY_FRAMRATE_PRECHANGE
@ IARM_BUS_DSMGR_EVENT_DISPLAY_FRAMRATE_PRECHANGE
Definition: dsMgr.h:71
dsSetDFC
dsError_t dsSetDFC(intptr_t handle, dsVideoZoom_t dfc)
This function is used to set the screen zoom mode (decoder format conversion). This function sets the...
Definition: dsVideoDevice.c:89
dsVideoDeviceInit
dsError_t dsVideoDeviceInit()
This function initialize all the video devices in the system.
Definition: dsVideoDevice.c:46
dsHdmiInSelectZoomMode
dsError_t dsHdmiInSelectZoomMode(dsVideoZoom_t requestedZoomMode)
Select the HDMI Input zoom mode.
Definition: dsHdmiIn.c:202
dsGetVideoCodecInfoParam_t
Definition: dsRpc.h:822
dsGetSupportedVideoCodingFormatsParam_t
Definition: dsRpc.h:815
dsHDRSTANDARD_DolbyVision
@ dsHDRSTANDARD_DolbyVision
Definition: dsTypes.h:696
dsTypes.h
Device Settings HAL types.
_dsVideoDeviceGetHandleParam_t
Definition: dsRpc.h:581
dsVideoDeviceTerm
dsError_t dsVideoDeviceTerm(void)
This function deinitialize all the video devices in the system. It reset any data structures used wit...
Definition: dsVideoDevice.c:144
dsVIDEO_ZOOM_16_9_ZOOM
@ dsVIDEO_ZOOM_16_9_ZOOM
Definition: dsTypes.h:588
device::HostPersistence::persistHostProperty
void persistHostProperty(const std::string &key, const std::string &value)
Definition: hostPersistence.cpp:273
dsError.h
Device Settings HAL error codes.
IARM_Bus_RegisterCall
IARM_Result_t IARM_Bus_RegisterCall(const char *methodName, IARM_BusCall_t handler)
This API is used to register an RPC method that can be invoked by other applications.
dsVIDEO_ZOOM_NONE
@ dsVIDEO_ZOOM_NONE
Definition: dsTypes.h:579
dsUtl.h
Device Settings HAL utilities.
dsERR_NONE
@ dsERR_NONE
Definition: dsError.h:85
IARM_Bus_BroadcastEvent
IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *data, size_t len)
This API is used to publish an Asynchronous event to all IARM client registered for this perticular e...
_dsVideoDeviceSetDFCParam_t
Definition: dsRpc.h:586
libIBus.h
RDK IARM-Bus API Declarations.
dsVideoDevice.h
dsFRFParam_t
Definition: dsRpc.h:954
dsVideoZoom_t
enum _dsVideoZoom_t dsVideoZoom_t
_dsGetHDRCapabilitiesParam_t
Definition: dsRpc.h:774
dsHdmiIn.h
Device Settings HAL HDMI Input Public API. This API defines the HAL for the Device Settings HDMI Inpu...
dsHDRSTANDARD_NONE
@ dsHDRSTANDARD_NONE
Definition: dsTypes.h:693
dsForceDisableHDRParam_t
Definition: dsRpc.h:830
IARM_BUS_DSMGR_EVENT_ZOOM_SETTINGS
@ IARM_BUS_DSMGR_EVENT_ZOOM_SETTINGS
Definition: dsMgr.h:49
IARM_BUS_DSMGR_EVENT_DISPLAY_FRAMRATE_POSTCHANGE
@ IARM_BUS_DSMGR_EVENT_DISPLAY_FRAMRATE_POSTCHANGE
Definition: dsMgr.h:72
dsVideoCodecInfo_t
Definition: dsTypes.h:1111
dsERR_OPERATION_NOT_SUPPORTED
@ dsERR_OPERATION_NOT_SUPPORTED
Definition: dsError.h:89
dsVIDEO_ZOOM_FULL
@ dsVIDEO_ZOOM_FULL
Definition: dsTypes.h:580
dsGetVideoDevice
dsError_t dsGetVideoDevice(int index, intptr_t *handle)
This function gets the handle for the video device requested.
Definition: dsVideoDevice.c:64
dsFramerateParam_t
Definition: dsRpc.h:960
device::HostPersistence::getInstance
static HostPersistence & getInstance(void)
Definition: hostPersistence.cpp:122
dsError_t
dsError_t
Device Settings API Error return codes.
Definition: dsError.h:84
_DSMgr_EventData_t
Definition: dsMgr.h:81