RDK Documentation (Open Sourced RDK Components)
AampRDKCCManager.cpp
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2018 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 AampRDKCCManager.cpp
22  *
23  * @brief Impl of RDK ClosedCaption integration layer
24  *
25  */
26 
27 #include "AampRDKCCManager.h"
28 
29 #include "ccDataReader.h"
30 #include "vlCCConstants.h"
31 #include "cc_util.h"
32 #include "vlGfxScreen.h"
33 
34 #define CHAR_CODE_1 49
35 #define CHAR_CODE_6 54
36 
37 /**
38  * @brief Release CC resources
39  */
41  {
42  Stop();
43  if (mCCHandle != NULL)
44  {
45  media_closeCaptionStop();
46  mCCHandle = NULL;
47  }
48  mTrickplayStarted = false;
49  mParentalCtrlLocked = false;
50  }
51 
52 /**
53  * @brief To start CC rendering
54  */
56  {
57  ccSetCCState(CCStatus_ON, 1);
58  }
59 
60 /**
61  * @brief To stop CC rendering
62  */
64  {
65  ccSetCCState(CCStatus_OFF, 1);
66  }
67 
68 /**
69  * @brief Impl specific initialization code called once in Init() function
70  */
71 int AampRDKCCManager::Initialize(void * handle)
72  {
73  static bool initStatus = false;
74 
75  int ret = -1;
76  if (!initStatus)
77  {
78  vlGfxInit(0);
79  ret = vlMpeosCCManagerInit();
80  if (ret != 0)
81  {
82  return ret;
83  }
84  initStatus = true;
85  }
86 
87  if (handle == NULL)
88  {
89  return -1;
90  }
91 
92  mCCHandle = handle;
93  media_closeCaptionStart((void *)mCCHandle);
94 
95  return 0;
96  }
97 
98 /**
99  * @brief set digital channel with specified id
100  */
102  {
103  return ccSetDigitalChannel(id);
104  }
105 
106 /**
107  * @brief set analog channel with specified id
108  */
110  {
111  return ccSetAnalogChannel(id);
112  }
AampCCManagerBase::mTrickplayStarted
bool mTrickplayStarted
Definition: AampCCManager.h:250
AampCCManagerBase::mParentalCtrlLocked
bool mParentalCtrlLocked
Definition: AampCCManager.h:251
AampRDKCCManager::SetAnalogChannel
int SetAnalogChannel(unsigned int id) override
set analog channel with specified id
Definition: AampRDKCCManager.cpp:109
AampRDKCCManager::StopRendering
void StopRendering() override
To stop CC rendering.
Definition: AampRDKCCManager.cpp:63
AampRDKCCManager::Release
void Release(int iID) override
Release CC resources.
Definition: AampRDKCCManager.cpp:40
AampRDKCCManager::StartRendering
void StartRendering() override
To start CC rendering.
Definition: AampRDKCCManager.cpp:55
AampRDKCCManager::SetDigitalChannel
int SetDigitalChannel(unsigned int id) override
set digital channel with specified id
Definition: AampRDKCCManager.cpp:101
CCStatus_OFF
@ CCStatus_OFF
Definition: SubtecConnector.h:366
AampRDKCCManager.h
Integration layer of RDK ClosedCaption in AAMP.
CCStatus_ON
@ CCStatus_ON
Definition: SubtecConnector.h:368
AampRDKCCManager::mCCHandle
void * mCCHandle
Definition: AampRDKCCManager.h:105
AampRDKCCManager::Initialize
int Initialize(void *handle) override
Impl specific initialization code called once in Init() function.
Definition: AampRDKCCManager.cpp:71
AampCCManagerBase::Stop
void Stop()
To stop CC rendering.
Definition: AampCCManager.cpp:558