diff --git a/CMakeLists.txt b/CMakeLists.txt index 00266a6f..55d597d8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,6 @@ option(XRSR_HTTP "Enable XRSR_HTTP" OFF) option(XRSR_SDT "Enable XRSR_SDT" OFF) option(ENABLE_ASYNC_SRVR_MSG "Enable Asynchronous Server Messaging Feature" OFF) option(ENABLE_AVS_WITH_SDT "Enable SDT Based AVS Support" OFF) -option(USE_DEPRECATED_HDMI_INPUT_PLUGIN "Use deprecated HDMI Input plugin instead of AV Input plugin" OFF) # BUILD SYSTEM set(STAGING_BINDIR_NATIVE, "invalid" CACHE PATH "staging bin dir native") @@ -253,10 +252,6 @@ else() add_compile_definitions(SAFEC_DUMMY_API) endif() -if(USE_DEPRECATED_HDMI_INPUT_PLUGIN) - add_compile_definitions(USE_DEPRECATED_HDMI_INPUT_PLUGIN) -endif() - install(TARGETS controlMgr RUNTIME DESTINATION bin) install(FILES ${CMAKE_BINARY_DIR}/ctrlm_config.json DESTINATION ${CMAKE_INSTALL_SYSCONFDIR} COMPONENT config ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 93f3f745..99916598 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -198,7 +198,6 @@ if(THUNDER) thunder/plugins/ctrlm_thunder_plugin_display_settings.cpp thunder/plugins/ctrlm_thunder_plugin_device_info.cpp thunder/plugins/ctrlm_thunder_plugin_av_input.cpp - thunder/plugins/ctrlm_thunder_plugin_hdmi_input.cpp thunder/plugins/ctrlm_thunder_plugin_system.cpp ipc/ctrlm_rcp_ipc_iarm_thunder.cpp voice/ipc/ctrlm_voice_ipc_iarm_thunder.cpp diff --git a/src/irdb/ctrlm_irdb_interface.cpp b/src/irdb/ctrlm_irdb_interface.cpp index bab8f9a6..e9b5395e 100644 --- a/src/irdb/ctrlm_irdb_interface.cpp +++ b/src/irdb/ctrlm_irdb_interface.cpp @@ -32,11 +32,7 @@ #include "ctrlm_thunder_plugin_display_settings.h" #include "ctrlm_thunder_plugin_cec_source.h" // TV Platforms -#ifdef USE_DEPRECATED_HDMI_INPUT_PLUGIN -#include "ctrlm_thunder_plugin_hdmi_input.h" -#else #include "ctrlm_thunder_plugin_av_input.h" -#endif #include "ctrlm_thunder_plugin_cec_sink.h" #endif @@ -111,11 +107,7 @@ typedef struct { Thunder::DisplaySettings::ctrlm_thunder_plugin_display_settings_t *display_settings; Thunder::CEC::ctrlm_thunder_plugin_cec_source_t *cec_source; Thunder::CECSink::ctrlm_thunder_plugin_cec_sink_t *cec_sink; - #ifdef USE_DEPRECATED_HDMI_INPUT_PLUGIN - Thunder::HDMIInput::ctrlm_thunder_plugin_hdmi_input_t *av_input; - #else Thunder::AVInput::ctrlm_thunder_plugin_av_input_t *av_input; - #endif #endif } ctrlm_irdb_global_t; @@ -383,11 +375,7 @@ void ctrlm_irdb_interface_t::on_thunder_ready() { } } } else { - #ifdef USE_DEPRECATED_HDMI_INPUT_PLUGIN - g_irdb.av_input = Thunder::HDMIInput::ctrlm_thunder_plugin_hdmi_input_t::getInstance(); - #else g_irdb.av_input = Thunder::AVInput::ctrlm_thunder_plugin_av_input_t::getInstance(); - #endif g_irdb.cec_sink = Thunder::CECSink::ctrlm_thunder_plugin_cec_sink_t::getInstance(); } #endif diff --git a/src/thunder/plugins/ctrlm_thunder_plugin_hdmi_input.cpp b/src/thunder/plugins/ctrlm_thunder_plugin_hdmi_input.cpp deleted file mode 100644 index ed9f2a1e..00000000 --- a/src/thunder/plugins/ctrlm_thunder_plugin_hdmi_input.cpp +++ /dev/null @@ -1,242 +0,0 @@ -/* - * If not stated otherwise in this file or this component's license file the - * following copyright and licenses apply: - * - * Copyright 2015 RDK Management - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -#include "ctrlm_thunder_plugin_hdmi_input.h" -#include "ctrlm_log.h" -#include -#include -#include -#include - -using namespace Thunder; -using namespace HDMIInput; -using namespace WPEFramework; - -static int _on_hotplug_thread(void *data) { - auto params = (std::pair *)data; - if(params) { - if(params->first) { - params->first->check_device_list((void *)¶ms->second); - } else { - XLOGD_ERROR("Plugin NULL"); - } - delete params; - } else { - XLOGD_ERROR("Params NULL"); - } - return(0); -} - -static void _on_hotplug(ctrlm_thunder_plugin_hdmi_input_t *plugin, JsonObject params) { - g_idle_add(_on_hotplug_thread, new std::pair(plugin, params)); -} - -static int _on_device_status_change_thread(void *data) { - auto params = (std::pair *)data; - if(params) { - if(params->first) { - if(params->second.HasLabel("id") && params->second.HasLabel("status")) { - params->first->on_device_status_change(params->second["id"].Number(), params->second["status"].String() == "started"); - } else { - std::string response_str; - params->second.ToString(response_str); - XLOGD_ERROR("HDMIInput device status changemalformed: <%s>", response_str.c_str()); - } - } else { - XLOGD_ERROR("Plugin NULL"); - } - delete params; - } else { - XLOGD_ERROR("Params NULL"); - } - return(0); -} - -static void _on_device_status_change(ctrlm_thunder_plugin_hdmi_input_t *plugin, JsonObject params) { - g_idle_add(_on_device_status_change_thread, new std::pair(plugin, params)); -} - -ctrlm_thunder_plugin_hdmi_input_t::ctrlm_thunder_plugin_hdmi_input_t() : ctrlm_thunder_plugin_t("HdmiInput", "org.rdk.HdmiInput", 2) { - sem_init(&this->semaphore, 0, 1); - this->registered_events = false; -} - -ctrlm_thunder_plugin_hdmi_input_t::~ctrlm_thunder_plugin_hdmi_input_t() { - -} - -ctrlm_thunder_plugin_hdmi_input_t *ctrlm_thunder_plugin_hdmi_input_t::getInstance() { - XLOGD_INFO("HDMI Input Plugin"); - static ctrlm_thunder_plugin_hdmi_input_t instance; - return &instance; -} - -void ctrlm_thunder_plugin_hdmi_input_t::get_infoframes(std::map > &infoframes) { - // Lock sempahore as we are touching infoframe cache - sem_wait(&this->semaphore); - infoframes = this->infoframes; - // Unlock semaphore as we are done touching the infoframe cache - sem_post(&this->semaphore); -} - -bool ctrlm_thunder_plugin_hdmi_input_t::_get_infoframe(int port) { - bool ret = false; - JsonObject params, response; - - XLOGD_INFO("Calling HDMIInput for infoframe data for port %d", port); - - params["portId"] = port; - // Lock sempahore as we are touching infoframe cache - sem_wait(&this->semaphore); - this->infoframes[port].clear(); - - if(this->call_plugin("getRawHDMISPD", (void *)¶ms, (void *)&response)) { - if(response.HasLabel("HDMISPD")) { - std::string infoframe_str = response["HDMISPD"].String(); - if(!infoframe_str.empty()) { - uint8_t *infoframe_buf = NULL; - size_t infoframe_size = 0; - - // Base64 decode the string - infoframe_buf = g_base64_decode(infoframe_str.c_str(), &infoframe_size); - if(infoframe_buf && infoframe_size > 0) { - for(size_t i = 0; i < infoframe_size; i++) { - this->infoframes[port].push_back(infoframe_buf[i]); // This checksum byte is not part of the HDMI spec, not sure why dsMgr/TvServer adds it within the infoframe - } -#define REMOVE_RSD_BYTE -#ifdef REMOVE_RSD_BYTE - this->infoframes[port].erase(this->infoframes[port].begin() + 3); -#endif - if(this->infoframes[port].size() < 29) { - XLOGD_INFO("Padding infoframe to complete 29 bytes"); - for(size_t i = this->infoframes[port].size(); i < 29; i++) { - this->infoframes[port].push_back(0x00); - } - } else if(this->infoframes[port].size() > 29) { - XLOGD_INFO("Removing padding from infoframe to 29 bytes"); - for(size_t i = this->infoframes[port].size(); i > 29; i--) { - this->infoframes[port].pop_back(); - } - } - ret = true; - } else { - XLOGD_ERROR("Failed to decode Infoframe base64!"); - } - g_free(infoframe_buf); - } else { - XLOGD_ERROR("Infoframe string is empty!"); - } - } else { - std::string response_str; - response.ToString(response_str); - XLOGD_ERROR("HDMIInput readINFOFRAME response malformed: <%s>", response_str.c_str()); - } - } else { - XLOGD_ERROR("HDMIInput readINFOFRAME call failed!"); - } - - // Unlock semaphore as we are done touching the infoframe cache - sem_post(&this->semaphore); - return(ret); -} - -void ctrlm_thunder_plugin_hdmi_input_t::_clear_infoframe(int port) { - XLOGD_INFO("Clearing infoframe data from cache for port %d", port); - // Lock sempahore as we are touching infoframe cache - sem_wait(&this->semaphore); - this->infoframes[port].clear(); - // Unlock semaphore as we are done touching the infoframe cache - sem_post(&this->semaphore); -} - -void ctrlm_thunder_plugin_hdmi_input_t::on_device_status_change(int port, bool active) { - XLOGD_INFO("Device status changed <%s>", (active ? "STARTED" : "STOPPED")); - if(active) { - XLOGD_INFO("Acquiring new infoframe data"); - this->_get_infoframe(port); - } else { - XLOGD_INFO("Purposely doing nothing when status is stopped"); - } -} - -bool ctrlm_thunder_plugin_hdmi_input_t::register_events() { - bool ret = this->registered_events; - if(ret == false) { - auto clientObject = (JSONRPC::LinkType*)this->plugin_client; - if(clientObject) { - ret = true; - uint32_t thunderRet = clientObject->Subscribe(CALL_TIMEOUT, _T("onDevicesChanged"), &_on_hotplug, this); - if(thunderRet != Core::ERROR_NONE) { - XLOGD_ERROR("Thunder subscribe failed "); - ret = false; - } - thunderRet = clientObject->Subscribe(CALL_TIMEOUT, _T("onInputStatusChanged"), &_on_device_status_change, this); - if(thunderRet != Core::ERROR_NONE) { - XLOGD_ERROR("Thunder subscribe failed "); - ret = false; - } - if(ret) { - this->registered_events = true; - } - } - } - Thunder::Plugin::ctrlm_thunder_plugin_t::register_events(); - return(ret); -} - -void ctrlm_thunder_plugin_hdmi_input_t::on_initial_activation() { - // Get initial INFOFRAME info - JsonObject params, response; - if(this->call_plugin("getHDMIInputDevices", (void *)¶ms, (void *)&response)) { - this->check_device_list((void *)&response); - } - - Thunder::Plugin::ctrlm_thunder_plugin_t::on_initial_activation(); -} - -void ctrlm_thunder_plugin_hdmi_input_t::check_device_list(void *params) { - JsonObject *root = (JsonObject *)params; - if(root) { - std::string response_st; - root->ToString(response_st); - XLOGD_INFO("%s", response_st.c_str()); - if(root->HasLabel("devices")) { - JsonArray devices = (*root)["devices"].Array(); - for(int i = 0; i < devices.Length(); i++) { - JsonObject device = devices[i].Object(); - if(device.HasLabel("id") && device.HasLabel("connected")) { - if(device["connected"].String() == "true") { - this->_get_infoframe(device["id"].Number()); - } else { - this->_clear_infoframe(device["id"].Number()); - } - } else { - std::string response_str; - device.ToString(response_str); - XLOGD_WARN("Malformed device object <%s>", response_str.c_str()); - } - } - } else { - std::string response_str; - root->ToString(response_str); - XLOGD_WARN("Missing device list! <%s>", response_str.c_str()); - } - } else { - XLOGD_WARN("JsonObject is NULL"); - } -} diff --git a/src/thunder/plugins/ctrlm_thunder_plugin_hdmi_input.h b/src/thunder/plugins/ctrlm_thunder_plugin_hdmi_input.h deleted file mode 100644 index 0a858186..00000000 --- a/src/thunder/plugins/ctrlm_thunder_plugin_hdmi_input.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * If not stated otherwise in this file or this component's license file the - * following copyright and licenses apply: - * - * Copyright 2014 RDK Management - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ -#ifndef __CTRLM_THUNDER_PLUGIN_HDMI_INPUT_H__ -#define __CTRLM_THUNDER_PLUGIN_HDMI_INPUT_H__ -#include "ctrlm_thunder_plugin.h" -#include -#include - -namespace Thunder { -namespace HDMIInput { - -/** - * This class is used within ControlMgr to interact with the HDMIInput Thunder Plugin. - */ -class ctrlm_thunder_plugin_hdmi_input_t : public Thunder::Plugin::ctrlm_thunder_plugin_t { -public: - /** - * This function is used to get the Thunder HDMI Input instance, as it is a Singleton. - * @return The instance of the Thunder HDMI Input, or NULL on error. - */ - static ctrlm_thunder_plugin_hdmi_input_t *getInstance(); - - /** - * HDMIInput Thunder Plugin Destructor - */ - virtual ~ctrlm_thunder_plugin_hdmi_input_t(); - - /** - * This function is used to get the HDMI Infoframe data from cache. - * @param infoframe The vector that the resulting Infoframe data will be placed. - */ - void get_infoframes(std::map > &infoframes); - -public: - /** - * This function is technically used internally but from static function. This is used to handle device status events. - * @param port The HDMI port of the input device which has changed status. - * @param active The boolean that states whether the source is active or not. - */ - void on_device_status_change(int port, bool active); - - /** - * This function is technically used internally but from static function. This function is used to parse device list from HdmiInput calls/events - */ - void check_device_list(void *params); - -protected: - /** - * HDMIInput Thunder Plugin Default Constructor - */ - ctrlm_thunder_plugin_hdmi_input_t(); - - /** - * This function is called when registering for Thunder events. - * @return True if the events were registered for successfully otherwise False. - */ - virtual bool register_events(); - - /** - * This function is called when the initial activation of the plugin occurs. - */ - virtual void on_initial_activation(); - - /** - * This function actually calls the HDMI Input Thunder Plugin to get the Infoframe data. - * @return True if the call was successful and there is data available, otherwise False. - */ - bool _get_infoframe(int port); - - /** - * This function clears the current infoframe cache. - */ - void _clear_infoframe(int port); - -private: - std::map > infoframes; - sem_t semaphore; - bool registered_events; - -}; -}; -}; -#endif